• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java User类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中blackboard.data.user.User的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



User类属于blackboard.data.user包,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: start

import blackboard.data.user.User; //导入依赖的package包/类
/**
    * Starts preview lesson on LAMS server. Launches it.
    */
   private void start(HttpServletRequest request, HttpServletResponse response, Context ctx) throws IOException, ServletException, PersistenceException, ParseException, ValidationException, ParserConfigurationException, SAXException {

   	BbPersistenceManager bbPm = PersistenceServiceFactory.getInstance().getDbPersistenceManager();

//store newly created LAMS lesson
User user = ctx.getUser();
BlackboardUtil.storeBlackboardContent(request, response, user);

// constuct strReturnUrl
String courseIdStr = request.getParameter("course_id");
String contentIdStr = request.getParameter("content_id");
// internal Blackboard IDs for the course and parent content item
Id courseId = bbPm.generateId(Course.DATA_TYPE, courseIdStr);
Id folderId = bbPm.generateId(CourseDocument.DATA_TYPE, contentIdStr);
String returnUrl = PlugInUtil.getEditableContentReturnURL(folderId, courseId);
request.setAttribute("returnUrl", returnUrl);

request.getRequestDispatcher("/modules/startLessonSuccess.jsp").forward(request, response);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:LessonManagerServlet.java


示例2: getCourseTeacher

import blackboard.data.user.User; //导入依赖的package包/类
/**
    * Returns one random teacher from the specified course.
    * 
    * @param courseId
    *            BB course id
    * @return teacher
    * @throws PersistenceException
    */
   public static User getCourseTeacher(PkId courseId) throws PersistenceException {
// find the main teacher
CourseMembershipDbLoader courseMemLoader = CourseMembershipDbLoader.Default.getInstance();
List<CourseMembership> monitorCourseMemberships = courseMemLoader.loadByCourseIdAndRole(courseId,
	CourseMembership.Role.INSTRUCTOR, null, true);
if (monitorCourseMemberships.isEmpty()) {
    List<CourseMembership> teachingAssistantCourseMemberships = courseMemLoader
	    .loadByCourseIdAndRole(courseId, CourseMembership.Role.TEACHING_ASSISTANT, null, true);
    monitorCourseMemberships.addAll(teachingAssistantCourseMemberships);
    if (monitorCourseMemberships.isEmpty()) {
	List<CourseMembership> courseBuilderCourseMemberships = courseMemLoader
		.loadByCourseIdAndRole(courseId, CourseMembership.Role.COURSE_BUILDER, null, true);
	monitorCourseMemberships.addAll(courseBuilderCourseMemberships);
    }
}
// validate teacher existence
if (monitorCourseMemberships.isEmpty()) {
    throw new RuntimeException("There are no monitors in the course courseId=" + courseId);
}
User teacher = monitorCourseMemberships.get(0).getUser();

return teacher;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:BlackboardUtil.java


示例3: getMyCourses

import blackboard.data.user.User; //导入依赖的package包/类
private Iterable<Command> getMyCourses( User user )
{
  try
  {
    List<Course> courses = CourseDbLoader.Default.getInstance().loadByUserId( user.getId() );
    Set<Command> commands = Sets.newTreeSet();
    for ( Course course : courses )
    {
      String url = String.format( My_COURSE_URL_TEMPLATE, course.getId().toExternalString() );
      url = FramesetUtil.getTabGroupUrl(blackboard.data.navigation.Tab.TabType.courses, url);
      SimpleCommand command = new SimpleCommand( course.getTitle(), url, Category.COURSE );
      commands.add( command );
    }
    return commands;
  }
  catch ( PersistenceException e )
  {
    throw new PersistenceRuntimeException( e );
  }
}
 
开发者ID:blackboard,项目名称:hayabusa,代码行数:21,代码来源:CourseProvider.java


示例4: getLTIUserId

import blackboard.data.user.User; //导入依赖的package包/类
public static String getLTIUserId(String userIdType, User user) {

    String userId;
    if (userIdType.equals(Constants.DATA_USERNAME)) {
      userId = user.getUserName();
    } else if (userIdType.equals(Constants.DATA_PRIMARYKEY)) {
      userId = user.getId().toExternalString();
    } else if (userIdType.equals(Constants.DATA_STUDENTID)) {
      userId = user.getStudentId();
    } else if (userIdType.equals(Constants.DATA_UUID) && B2Context.getIsVersion(9, 1, 13)) {
      userId = user.getUuid();
    } else {
      userId = user.getBatchUid();
    }

    return userId;

}
 
开发者ID:ubc,项目名称:enhanced-basiclti-b2,代码行数:19,代码来源:Utils.java


示例5: getObservedUsers

import blackboard.data.user.User; //导入依赖的package包/类
public static List<User> getObservedUsers(Id userId, Id courseId) {

    List<User> users;
    try {
      UserDbLoader userLoader = UserDbLoader.Default.getInstance();
      users = userLoader.loadObservedByObserverId(userId);
      if (!users.isEmpty() && (courseId != null)) {
        List<User> enrolled = userLoader.loadByCourseId(courseId);
        User user;
        for (Iterator<User> iter = users.iterator(); iter.hasNext();) {
          user = iter.next();
          if (!enrolled.contains(user)) {
            iter.remove();
          }
        }
      }
    } catch (PersistenceException e) {
      users = new ArrayList<User>();
    }

    return users;

  }
 
开发者ID:ubc,项目名称:enhanced-basiclti-b2,代码行数:24,代码来源:Utils.java


示例6: userRead

import blackboard.data.user.User; //导入依赖的package包/类
public static BBUser userRead(BBUser user, BBUserVerbosity verbosity) throws WebServiceException
{
    String error = "";
    try
    {
        if(user.getUserName()!=null && !user.getUserName().equalsIgnoreCase(""))
        {
            return ObjectConverter.getUser(UserDbLoader.Default.getInstance().loadByUserName(user.getUserName()),verbosity);
        }
        else if(user.getBbId()!=null && !user.getBbId().equalsIgnoreCase(""))
        {
            return ObjectConverter.getUser(UserDbLoader.Default.getInstance().loadById(PersistenceServiceFactory.getInstance().getDbPersistenceManager().generateId(User.DATA_TYPE, user.getBbId())),verbosity);
        }
        error = "You must specify either userId or userBBId";
    }
    catch(KeyNotFoundException knfe)
    {
        error = "No matching user";
    }
    catch(Exception e)
    {
        error = "Error whilst finding user: "+e.toString();
    }
    throw new WebServiceException(error);
}
 
开发者ID:andmar8,项目名称:Blackboard-Java-WebservicesBBHelper,代码行数:26,代码来源:UserHelper.java


示例7: BbPerson

import blackboard.data.user.User; //导入依赖的package包/类
public BbPerson(User user, String role) {
    //standard info
    if(user != null){
        this.id = user.getId().getExternalString();
        this.given_name = user.getGivenName();
        this.family_name = user.getFamilyName();
        this.username = user.getUserName();
        this.email = user.getEmailAddress();
        this.role = role;

        //bb info
        this.department = user.getDepartment();
        this.address = user.getStreet1() + " " + user.getStreet2() + ", " + user.getCity() + ", " + user.getState() + " " + user.getZipCode();
        this.phone = user.getMobilePhone();
        this.uniqueId = user.getStudentId();
    }

}
 
开发者ID:pfgray,项目名称:lmsrest,代码行数:19,代码来源:BbPerson.java


示例8: openPreview

import blackboard.data.user.User; //导入依赖的package包/类
/**
    * Starts preview lesson on LAMS server. Launches it.
    */
   private void openPreview(HttpServletRequest request, HttpServletResponse response, Context ctx)
    throws InitializationException, BbServiceException, PersistenceException, IOException {
// Authorize current user for Course Control Panel (automatic redirect)
try {
    if (!PlugInUtil.authorizeForCourseControlPanel(request, response))
	return;
} catch (PlugInException e) {
    throw new RuntimeException(e);
}

// Get the form parameters and convert into correct data types
String strTitle = request.getParameter("title").trim();
String strLdId = request.getParameter("ldId").trim();
long ldId = Long.parseLong(strLdId);

// start lesson-preview in LAMS and get back the lesson ID
User user = ctx.getUser();
Long lsId = LamsSecurityUtil.startLesson(user, "Previews", ldId, strTitle, "", true);
// error checking
if (lsId == -1) {
    response.sendRedirect("lamsServerDown.jsp");
    System.exit(1);
}

// redirect to preview lesson
String previewUrl = LamsSecurityUtil.generateRequestURL(ctx, "learnerStrictAuth", "" + lsId);
response.sendRedirect(previewUrl);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:OpenLamsPageServlet.java


示例9: buildUserId

import blackboard.data.user.User; //导入依赖的package包/类
/**
 * Constructs a Learn user ID based on the given string. This is provided as
 * a method so that it can be overriden for unit testing.
 * 
 * @param id the string to convert to a user ID.
 * @return a user ID. Returns null if input is null.
 */
public Id buildUserId(final String id) throws PersistenceException {
    if (null == id) {
        return null;
    }
    
    return Id.generateId(User.DATA_TYPE, id);
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:15,代码来源:BlackboardService.java


示例10: addUser

import blackboard.data.user.User; //导入依赖的package包/类
/**
 * Add a user to the mock loader.
 * 
 * @param user user to be stored ready for loading.
 */
protected void addUser(final User user) {
    assert null != user;
    assert null != user.getId();
    assert null != user.getUserName();
    
    this.userById.put(user.getId(), user);
    this.userByUsername.put(user.getUserName(), user);
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:14,代码来源:UserMockLoader.java


示例11: removeUserById

import blackboard.data.user.User; //导入依赖的package包/类
protected void removeUserById(Id id) {
    final User user = this.userById.get(id);
    
    if (null == user) {
        return;
    }
    
    this.userById.remove(id);
    this.userByUsername.remove(user.getUserName());
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:11,代码来源:UserMockLoader.java


示例12: loadById

import blackboard.data.user.User; //导入依赖的package包/类
@Override
public User loadById(Id id) throws KeyNotFoundException, PersistenceException {
    final User user = this.userById.get(id);
    
    if (null == user) {
        throw new KeyNotFoundException("Could not find user \""
            + id.getExternalString() + "\".");
    } else {
        return user;
    }
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:12,代码来源:UserMockLoader.java


示例13: loadByUserName

import blackboard.data.user.User; //导入依赖的package包/类
@Override
public User loadByUserName(final String username, Connection cnctn) throws KeyNotFoundException, PersistenceException {
    final User user = this.userByUsername.get(username);
    
    if (null == user) {
        throw new KeyNotFoundException("Could not find user \""
            + username + "\".");
    } else {
        return user;
    }
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:12,代码来源:UserMockLoader.java


示例14: getCommands

import blackboard.data.user.User; //导入依赖的package包/类
@Override
public Iterable<Command> getCommands()
{
  User currentUser = ContextManagerFactory.getInstance().getContext().getUser();
  if ( currentUser.getSystemRole().getIdentifier().equals( SystemRole.Ident.SystemAdmin.getIdentifier() ) )
  {
    return getAdminCourses();
  }
  else
  {
    return getMyCourses( currentUser );
  }
}
 
开发者ID:blackboard,项目名称:hayabusa,代码行数:14,代码来源:CourseProvider.java


示例15: addAdminRole

import blackboard.data.user.User; //导入依赖的package包/类
public static String addAdminRole(String roles, User user) {

    if (user.getSystemRole().equals(User.SystemRole.SYSTEM_ADMIN)) {
      if (roles.length() > 0) {
        roles += ",";
      }
      roles += Constants.ROLE_ADMINISTRATOR + "," + Constants.ROLE_SYSTEM_ADMINISTRATOR;
    }

    return roles;

  }
 
开发者ID:ubc,项目名称:enhanced-basiclti-b2,代码行数:13,代码来源:Utils.java


示例16: addPreviewRole

import blackboard.data.user.User; //导入依赖的package包/类
public static String addPreviewRole(String roles, User user) {

    if (isPreviewUser(user)) {
      if (roles.length() > 0) {
        roles += ",";
      }
      roles += Constants.ROLE_TRANSIENT;
    }

    return roles;

  }
 
开发者ID:ubc,项目名称:enhanced-basiclti-b2,代码行数:13,代码来源:Utils.java


示例17: getInstitutionRoles

import blackboard.data.user.User; //导入依赖的package包/类
public static List<PortalRole> getInstitutionRoles(boolean systemRolesOnly, User user) {

    List<PortalRole> roles;
    try {
      BbPersistenceManager pm = PersistenceServiceFactory.getInstance().getDbPersistenceManager();
      PortalRoleDbLoader prLoader = (PortalRoleDbLoader)pm.getLoader("PortalRoleDbLoader");
      List<PortalRole> allRoles;
      if (user == null) {
        allRoles = prLoader.loadAll();
      } else {
        allRoles = prLoader.loadAllByUserId(user.getId());
      }
      if (systemRolesOnly) {
        roles = new ArrayList<PortalRole>();
        for (Iterator<PortalRole> iter = allRoles.listIterator(); iter.hasNext();) {
          PortalRole role = iter.next();
          if (!role.isRemovable()) {
            roles.add(role);
          }
        }
      } else {
        roles = new ArrayList<PortalRole>(allRoles);
      }
    } catch (PersistenceException e) {
      roles = new ArrayList<PortalRole>();
    }
    java.util.Collections.sort(roles, getSortByName());

    return roles;

  }
 
开发者ID:ubc,项目名称:enhanced-basiclti-b2,代码行数:32,代码来源:Utils.java


示例18: getPrimaryNode

import blackboard.data.user.User; //导入依赖的package包/类
public static String getPrimaryNode(Id id, boolean isCourse) {

    String primary = "";
    if (B2Context.getIsVersion(9, 1, 8)) {
      NodeAssociationManager nodeAssociationManager = NodeManagerFactory.getAssociationManager();
      NodeManager nodeManager = NodeManagerFactory.getHierarchyManager();
      try {
        Id nodeId = null;
        if (B2Context.getIsVersion(9, 1, 10)) {
          ObjectType type;
          if (isCourse) {
            type = ObjectType.Course;
          } else {
            type = ObjectType.User;
          }
          nodeId = nodeAssociationManager.loadPrimaryNodeId(id, type);
        } else if (isCourse) {
          nodeId = nodeAssociationManager.loadCoursePrimaryNodeId(id);
        }
        if (nodeId != null) {
          Node node = nodeManager.loadNodeById(nodeId);
          primary = node.getName();
        }
      } catch (PersistenceException ex) {
        Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex);
      }
    }

    return primary;

  }
 
开发者ID:ubc,项目名称:enhanced-basiclti-b2,代码行数:32,代码来源:Utils.java


示例19: UserWrapper

import blackboard.data.user.User; //导入依赖的package包/类
public UserWrapper(User user, Encryption encryptor, boolean isEncrypt) {
    this.user = user;
    this.encryptor = encryptor;
    this.isEncrypt = isEncrypt;
    // use user ID external string as initialization vector
    this.encryptor.setIv(user.getId().getExternalString());
}
 
开发者ID:ubc,项目名称:enhanced-basiclti-b2,代码行数:8,代码来源:UserWrapper.java


示例20: userDelete

import blackboard.data.user.User; //导入依赖的package包/类
public static boolean userDelete(BBUser user)
{
    String error = "";
    try
    {
        if(Util.checkParam(user.getUserName()))
        {
            UserDbPersister.Default.getInstance().deleteById(UserDbLoader.Default.getInstance().loadByUserName(user.getUserName()).getId());
            return true;
        }
        else if(Util.checkParam(user.getBbId()))
        {
            UserDbPersister.Default.getInstance().deleteById(UserDbLoader.Default.getInstance().loadById(PersistenceServiceFactory.getInstance().getDbPersistenceManager().generateId(User.DATA_TYPE,user.getBbId())).getId());
            return true;
        }
        error = "You must specify either userId or userBBId";
    }
    catch(KeyNotFoundException knfe)
    {
        error = "No matching user";
    }
    catch(Exception e)
    {
        error = "Error whilst deleting user: "+e.toString();
    }
    throw new WebServiceException(error);
}
 
开发者ID:andmar8,项目名称:Blackboard-Java-WebservicesBBHelper,代码行数:28,代码来源:UserHelper.java



注:本文中的blackboard.data.user.User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AlipayTradeFastpayRefundQueryResponse类代码示例发布时间:2022-05-22
下一篇:
Java FindModel类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap