当前位置: 首页>>代码示例>>Java>>正文


Java GroupMembership类代码示例

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


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

示例1: emailMemberships

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
public List<MailException> emailMemberships()
    throws PersistenceException {
    if (this.unsafeMemberships.isEmpty()) {
        return Collections.EMPTY_LIST;
    }
    
    final List<MailException> mailErrors = new ArrayList<MailException>();        
    
    for (Course course: this.unsafeMemberships.keySet()) {
        final Collection<GroupMembership> memberships = this.unsafeMemberships.get(course);
        final SimpleMailMessage message = this.buildMessage(course, memberships);
        
        if (null != message) {
            try {
                this.mailSender.send(message);
            } catch(MailException e) {
                mailErrors.add(e);
            }
        }
    }
    
    return mailErrors;
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:24,代码来源:UnsafeGroupMembershipManager.java

示例2: addGroupMembership

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
protected void addGroupMembership(final GroupMembership membership) throws PersistenceException {
    this.groupMembershipsById.put(membership.getId(), membership);
    
    final CourseMembership courseMembership = this.persistenceManager
            .getCourseMembershipLoader()
            .loadById(membership.getCourseMembershipId());
    
    List<GroupMembership> groupMemberships = this.groupMembershipsByCourseId.get(courseMembership.getCourseId());
    if (null == groupMemberships) {
        groupMemberships = new ArrayList<GroupMembership>();
        this.groupMembershipsByCourseId.put(courseMembership.getCourseId(), groupMemberships);
    }
    
    groupMemberships.add(membership);
    
    groupMemberships = this.groupMembershipsByGroupId.get(membership.getGroupId());
    if (null == groupMemberships) {
        groupMemberships = new ArrayList<GroupMembership>();
        this.groupMembershipsByGroupId.put(membership.getGroupId(), groupMemberships);
    }
    
    groupMemberships.add(membership);
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:24,代码来源:GroupMembershipMockLoader.java

示例3: groupMembershipCreateByUserIdAndGroupId

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
public static boolean groupMembershipCreateByUserIdAndGroupId(BBUser user, BBGroup group) throws WebServiceException
{
    try
    {
        Group g = GroupDbLoader.Default.getInstance().loadById(PersistenceServiceFactory.getInstance().getDbPersistenceManager().generateId(Group.DATA_TYPE,group.getGroupBbId()));
        GroupMembership gm = new GroupMembership();
        gm.setCourseMembershipId(CourseMembershipDbLoader.Default.getInstance().loadByCourseAndUserId(g.getCourseId(),UserDbLoader.Default.getInstance().loadByUserName(user.getBbId()).getId()).getId());
        gm.setGroupId(g.getId());
        GroupMembershipDbPersister.Default.getInstance().persist(gm);
    }
    catch(PersistenceException pe)
    {
        throw new WebServiceException("Error: Is user already part of this group?");
    }
    catch(Exception e)
    {
        throw new WebServiceException("Error while trying to add user to group: "+e.toString());
    }
    return true;
}
 
开发者ID:andmar8,项目名称:Blackboard-Java-WebservicesBBHelper,代码行数:21,代码来源:GroupHelper.java

示例4: getBBObject

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
public static Object getBBObject(Object o, String type) throws Exception
{
    switch(BBObjectsWithoutVerbosity.valueOfSafe(type))
    {
        case Announcement: return ObjectConverter.getAnnouncement((Announcement)o);
        case CalendarEntry: return ObjectConverter.getCalendarEntry((CalendarEntry)o);
        case Enrollment: return ObjectConverter.getEnrollment((Enrollment)o);
        case GradableItem: return ObjectConverter.getGradableItem((GradableItem)o);
        case GradeDetail: return ObjectConverter.getGradeDetail((GradeDetail)o);
        case GradingSchema: return ObjectConverter.getGradingSchema((GradingSchema)o);
        case Group: return ObjectConverter.getGroup((Group)o);
        case GroupMembership: return ObjectConverter.getGroupMembership((GroupMembership)o);
        case Outcome: return ObjectConverter.getOutcome((Outcome)o);
        case OutcomeDefinition: return ObjectConverter.getOutcomeDefinition((OutcomeDefinition)o);
        default: throw new Exception("Type '"+type+"' not found");
    }
}
 
开发者ID:andmar8,项目名称:Blackboard-Java-WebservicesBBHelper,代码行数:18,代码来源:BBObjectFactory.java

示例5: addMembership

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
public void addMembership(final Course course, final GroupMembership membership) {
    Collection<GroupMembership> memberships = this.unsafeMemberships.get(course);
    
    if (null == memberships) {
        memberships = new ArrayList<GroupMembership>();
        this.unsafeMemberships.put(course, memberships);
    }
    
    memberships.add(membership);
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:11,代码来源:UnsafeGroupMembershipManager.java

示例6: buildGroupMembership

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
/**
 * Constructs a user's membership on a group and returns it.
 *
 * @param courseMembership the membership of the student onto the course the
 * group belongs to.
 * @param groupId the ID of the group to enrol the student onto.
 * @return the group membership.
 */
public GroupMembership buildGroupMembership(final CourseMembership courseMembership,
        final Id groupId) {
    assert null != courseMembership;
    assert null != groupId;
    
    final GroupMembership groupMembership = new GroupMembership();

    groupMembership.setCourseMembershipId(courseMembership.getId());
    groupMembership.setGroupId(groupId);
    // groupMembership.setGroupRoleIdentifier(CourseMembership.Role.STUDENT.getIdentifier());

    return groupMembership;
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:22,代码来源:BlackboardService.java

示例7: loadById

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

示例8: loadByCourseId

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
@Override
public BbList<GroupMembership> loadByCourseId(final Id courseId) throws KeyNotFoundException, PersistenceException {
    final List<GroupMembership> memberships = this.groupMembershipsByCourseId.get(courseId);
    
    if (null == memberships) {
        this.persistenceManager.getCourseLoader().loadById(courseId);
        return new BbList<GroupMembership>();
    } else {
        return new BbList<GroupMembership>(memberships);
    }
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:12,代码来源:GroupMembershipMockLoader.java

示例9: loadByGroupId

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
@Override
public BbList<GroupMembership> loadByGroupId(final Id groupId) throws KeyNotFoundException, PersistenceException {
    final List<GroupMembership> memberships = this.groupMembershipsByGroupId.get(groupId);
    
    if (null == memberships) {
        this.persistenceManager.getGroupLoader().loadById(groupId);
        return new BbList<GroupMembership>();
    } else {
        return new BbList<GroupMembership>(memberships);
    }
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:12,代码来源:GroupMembershipMockLoader.java

示例10: testIsGroupMembershipRemovalUnsafe

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
/**
 * Validate code for testing if a student can safely be removed from a group
 * without risk of loss of data.
 */
@Test
public void testIsGroupMembershipRemovalUnsafe()
    throws Exception {
    final BlackboardService service = this.getService();
    final Group availableGroup = new Group();
    final MockGroup unavailableGroup = new MockGroup();
    final GroupMembership groupMembership = new GroupMembership();
    
    availableGroup.setIsAvailable(true);
    unavailableGroup.setIsAvailable(false);
    
    unavailableGroup.setHasGroupToolWithGradeableItem(false);
    unavailableGroup.setIsDiscussionBoardAvailable(false);
    
    assertFalse(service.isGroupMembershipRemovalUnsafe(unavailableGroup, groupMembership));
    assertTrue(service.isGroupMembershipRemovalUnsafe(availableGroup, groupMembership));
    
    unavailableGroup.setHasGroupToolWithGradeableItem(true);
    assertTrue(service.isGroupMembershipRemovalUnsafe(unavailableGroup, groupMembership));
    
    unavailableGroup.setIsDiscussionBoardAvailable(true);
    assertTrue(service.isGroupMembershipRemovalUnsafe(unavailableGroup, groupMembership));
    
    unavailableGroup.setHasGroupToolWithGradeableItem(false);
    assertTrue(service.isGroupMembershipRemovalUnsafe(unavailableGroup, groupMembership));
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:31,代码来源:BlackboardServiceTest.java

示例11: buildMessage

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
protected SimpleMailMessage buildMessage(final Course course, final Collection<GroupMembership> memberships)
        throws KeyNotFoundException, PersistenceException {
    final Collection<String> to = getInstructorAddresses(course);
    
    if (to.isEmpty()) {
        return null;
    }
    final StringBuilder body = new StringBuilder();
    
    body.append("Students on ").append(course.getCourseId())
        .append(" have moved groups within the Timetabling system. ")
        .append("These students have been added to their new groups in Learn, but have not ")
        .append("been removed from their existing groups because group tools have been ")
        .append("enabled and there may be important content that would be lost if they ")
        .append("were removed automatically. A list of affected students is provided below:\r\n\r\n");

    for (GroupMembership membership: memberships) {
        final CourseMembership courseMembership = this.courseMembershipLoader.loadById(membership.getCourseMembershipId());
        final User student = this.userLoader.loadById(courseMembership.getUserId());
        
        body.append(student.getGivenName()).append(" ")
                .append(student.getFamilyName()).append(" (")
                .append(student.getUserName()).append(")\r\n");
    }
    
    body.append("\r\n")
        .append("You can also review the list of students affected by logging into Learn ")
        .append("and selecting Timetabling Sync from the Course Tools menu.\r\n");
    
    body.append("You can then choose whether to remove the student from their existing ")
        .append("groups or not, and whether any information needs to be copied before ")
        .append("this happens.\r\n\r\n")
        .append(EMAIL_SIGNATURE);
    
    final SimpleMailMessage message = new SimpleMailMessage(this.messageTemplate);
    
    log.debug("Instructors: "
        + to.toString());
    if (null != this.getMailToOverride()) {
        message.setTo(this.getMailToOverride());
    } else {
        message.setTo(to.toArray(new String[to.size()]));
    }
    message.setSubject("Student groups on Learn Course "
        + course.getCourseId() + " - Instructor action required");
    message.setText(body.toString());
    
    return message;
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:50,代码来源:UnsafeGroupMembershipManager.java

示例12: loadByGroupAndUserId

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
@Override
public GroupMembership loadByGroupAndUserId(final Id groupId, final Id userId) throws KeyNotFoundException, PersistenceException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:5,代码来源:GroupMembershipMockLoader.java

示例13: loadByGroupAndRole

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
@Override
public List<GroupMembership> loadByGroupAndRole(final Id groupId, Role role) throws KeyNotFoundException, PersistenceException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:5,代码来源:GroupMembershipMockLoader.java

示例14: persist

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
@Override
public void persist(final GroupMembership groupMembership) throws ValidationException, PersistenceException {
    this.persistenceManager.getGroupMembershipLoader().addGroupMembership(groupMembership);
}
 
开发者ID:rnicoll,项目名称:learn_syllabus_plus_sync,代码行数:5,代码来源:GroupMembershipMockPersister.java

示例15: getGroupMembership

import blackboard.data.course.GroupMembership; //导入依赖的package包/类
public static BBGroupMembership getGroupMembership(GroupMembership gm) throws Exception
{
    BBGroupMembership bbgm = new BBGroupMembership();
    bbgm.setUserId(CourseMembershipDbLoader.Default.getInstance().loadById(gm.getCourseMembershipId(),null,true).getUser().getUserName());
    return bbgm;
}
 
开发者ID:andmar8,项目名称:Blackboard-Java-WebservicesBBHelper,代码行数:7,代码来源:ObjectConverter.java


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