Search in sources :

Example 16 with BusinessGroupRef

use of org.olat.group.BusinessGroupRef in project OpenOLAT by OpenOLAT.

the class BusinessGroupMembershipProcessor method processIdentityRemoved.

private void processIdentityRemoved(Long groupKey, Long identityKey) {
    IdentityRef identityRef = new IdentityRefImpl(identityKey);
    BusinessGroupRef groupRef = new BusinessGroupRefImpl(groupKey);
    if (!businessGroupRelationDao.hasAnyRole(identityRef, groupRef)) {
        infoMessageManager.updateInfoMessagesOfIdentity(groupRef, identityRef);
        notificationsManager.unsubscribeAllForIdentityAndResId(identityRef, groupRef.getKey());
        List<BGRepositoryEntryRelation> relations = businessGroupRelationDao.findRelationToRepositoryEntries(Collections.singletonList(groupKey), 0, -1);
        for (BGRepositoryEntryRelation relation : relations) {
            Long repositoryEntryKey = relation.getRepositoryEntryKey();
            RepositoryEntryRef entryRef = new RepositoryEntryRefImpl(repositoryEntryKey);
            List<String> remaingRoles = repositoryEntryRelationDao.getRoles(identityRef, entryRef);
            if (remaingRoles.isEmpty()) {
                OLATResource resource = repositoryManager.lookupRepositoryEntryResource(entryRef.getKey());
                notificationsManager.unsubscribeAllForIdentityAndResId(identityRef, resource.getResourceableId());
            }
        }
    }
}
Also used : IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) BusinessGroupRef(org.olat.group.BusinessGroupRef) IdentityRef(org.olat.basesecurity.IdentityRef) RepositoryEntryRefImpl(org.olat.repository.model.RepositoryEntryRefImpl) OLATResource(org.olat.resource.OLATResource) BusinessGroupRefImpl(org.olat.group.model.BusinessGroupRefImpl) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef) BGRepositoryEntryRelation(org.olat.group.model.BGRepositoryEntryRelation)

Example 17 with BusinessGroupRef

use of org.olat.group.BusinessGroupRef in project OpenOLAT by OpenOLAT.

the class BusinessGroupRelationDAO method getRoles.

public List<String> getRoles(IdentityRef identity, List<? extends BusinessGroupRef> groups) {
    if (groups == null || groups.isEmpty())
        return Collections.emptyList();
    StringBuilder sb = new StringBuilder();
    sb.append("select membership.role from businessgroup as bgroup ").append(" inner join bgroup.baseGroup as baseGroup").append(" inner join baseGroup.members as membership").append(" where bgroup.key in (:businessGroupKeys) and membership.identity.key=:identityKey");
    List<Long> groupKeys = new ArrayList<>(groups.size());
    for (BusinessGroupRef group : groups) {
        groupKeys.add(group.getKey());
    }
    return dbInstance.getCurrentEntityManager().createQuery(sb.toString(), String.class).setParameter("businessGroupKeys", groupKeys).setParameter("identityKey", identity.getKey()).getResultList();
}
Also used : BusinessGroupRef(org.olat.group.BusinessGroupRef) ArrayList(java.util.ArrayList)

Example 18 with BusinessGroupRef

use of org.olat.group.BusinessGroupRef in project openolat by klemens.

the class BusinessGroupRoleRuleSPI method evaluate.

@Override
public List<Identity> evaluate(RepositoryEntry entry, ReminderRule rule) {
    List<Identity> identities = null;
    if (rule instanceof ReminderRuleImpl) {
        ReminderRuleImpl r = (ReminderRuleImpl) rule;
        String groupKey = r.getRightOperand();
        if (StringHelper.isLong(groupKey)) {
            Long key = Long.parseLong(groupKey);
            BusinessGroupRef groupRef = new BusinessGroupRefImpl(key);
            identities = businessGroupRelationDao.getMembers(groupRef, GroupRoles.coach.name(), GroupRoles.participant.name());
        }
    }
    return identities == null ? Collections.<Identity>emptyList() : identities;
}
Also used : BusinessGroupRef(org.olat.group.BusinessGroupRef) ReminderRuleImpl(org.olat.modules.reminder.model.ReminderRuleImpl) BusinessGroupRefImpl(org.olat.group.model.BusinessGroupRefImpl) Identity(org.olat.core.id.Identity)

Example 19 with BusinessGroupRef

use of org.olat.group.BusinessGroupRef in project openolat by klemens.

the class GTAManagerImpl method getMembership.

@Override
public Membership getMembership(IdentityRef identity, RepositoryEntryRef entry, GTACourseNode cNode) {
    List<String> roles;
    ModuleConfiguration config = cNode.getModuleConfiguration();
    if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
        List<Long> groupKeys = config.getList(GTACourseNode.GTASK_GROUPS, Long.class);
        List<Long> areaKeys = config.getList(GTACourseNode.GTASK_AREAS, Long.class);
        List<Long> consolidatedGroupKeys = new ArrayList<>();
        if (groupKeys != null && groupKeys.size() > 0) {
            consolidatedGroupKeys.addAll(groupKeys);
        }
        consolidatedGroupKeys.addAll(areaManager.findBusinessGroupKeysOfAreaKeys(areaKeys));
        List<BusinessGroupRef> businessGroups = BusinessGroupRefImpl.toRefs(consolidatedGroupKeys);
        roles = businessGroupRelationDao.getRoles(identity, businessGroups);
    } else {
        roles = repositoryEntryRelationDao.getRoles(identity, entry);
    }
    boolean coach = roles.contains(GroupRoles.coach.name()) || roles.contains(GroupRoles.owner.name());
    boolean participant = roles.contains(GroupRoles.participant.name());
    return new Membership(coach, participant);
}
Also used : BusinessGroupRef(org.olat.group.BusinessGroupRef) ModuleConfiguration(org.olat.modules.ModuleConfiguration) ArrayList(java.util.ArrayList) Membership(org.olat.course.nodes.gta.model.Membership)

Example 20 with BusinessGroupRef

use of org.olat.group.BusinessGroupRef in project openolat by klemens.

the class CourseRuntimeController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (layoutLink == source) {
        doLayout(ureq);
    } else if (optionsLink == source) {
        doOptions(ureq);
    } else if (assessmentModeLink == source) {
        doAssessmentMode(ureq);
    } else if (certificatesOptionsLink == source) {
        doCertificatesOptions(ureq);
    } else if (lifeCycleChangeLink == source) {
        doLifeCycleChange(ureq);
    } else if (reminderLink == source) {
        doReminders(ureq);
    } else if (lecturesAdminLink == source) {
        doLecturesAdmin(ureq);
    } else if (lecturesLink == source) {
        doLectures(ureq);
    } else if (archiverLink == source) {
        doArchive(ureq);
    } else if (folderLink == source) {
        doCourseFolder(ureq);
    } else if (areaLink == source) {
        doCourseAreas(ureq);
    } else if (dbLink == source) {
        doDatabases(ureq);
    } else if (courseStatisticLink == source) {
        doCourseStatistics(ureq);
    } else if (testStatisticLink == source) {
        doAssessmentTestStatistics(ureq);
    } else if (surveyStatisticLink == source) {
        doAssessmentSurveyStatistics(ureq);
    } else if (assessmentLink == source) {
        doAssessmentTool(ureq);
    } else if (calendarLink == source) {
        launchCalendar(ureq);
    } else if (chatLink == source) {
        launchChat(ureq);
    } else if (searchLink == source) {
        launchCourseSearch(ureq);
    } else if (efficiencyStatementsLink == source) {
        doEfficiencyStatements(ureq);
    } else if (noteLink == source) {
        launchPersonalNotes(ureq);
    } else if (openGlossaryLink == source) {
        launchGlossary(ureq);
    } else if (leaveLink == source) {
        doConfirmLeave(ureq);
    } else if (source instanceof Link && "group".equals(((Link) source).getCommand())) {
        BusinessGroupRef ref = (BusinessGroupRef) ((Link) source).getUserObject();
        launchGroup(ureq, ref.getKey());
    } else if (source == toolbarPanel) {
        if (event instanceof VetoPopEvent) {
            delayedClose = Delayed.pop;
        } else if (event instanceof PopEvent) {
            processPopEvent(ureq, (PopEvent) event);
        }
    } else if (enableGlossaryLink == source) {
        toggleGlossary(ureq);
    }
    // Update window title
    if (source instanceof Link) {
        Link link = (Link) source;
        ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
        String newTitle = course.getCourseTitle() + " - " + link.getI18n();
        getWindowControl().getWindowBackOffice().getWindow().setTitle(getTranslator(), newTitle);
    }
    super.event(ureq, source, event);
}
Also used : BusinessGroupRef(org.olat.group.BusinessGroupRef) VetoPopEvent(org.olat.core.gui.components.stack.VetoPopEvent) PopEvent(org.olat.core.gui.components.stack.PopEvent) ICourse(org.olat.course.ICourse) VetoPopEvent(org.olat.core.gui.components.stack.VetoPopEvent) Link(org.olat.core.gui.components.link.Link)

Aggregations

BusinessGroupRef (org.olat.group.BusinessGroupRef)22 ArrayList (java.util.ArrayList)12 IdentityRef (org.olat.basesecurity.IdentityRef)8 IdentityRefImpl (org.olat.basesecurity.model.IdentityRefImpl)6 BusinessGroupRefImpl (org.olat.group.model.BusinessGroupRefImpl)6 BusinessGroup (org.olat.group.BusinessGroup)4 BGConfigBusinessGroup (org.olat.group.ui.wizard.BGConfigBusinessGroup)4 BGCopyBusinessGroup (org.olat.group.ui.wizard.BGCopyBusinessGroup)4 ModuleConfiguration (org.olat.modules.ModuleConfiguration)4 RepositoryEntryRef (org.olat.repository.RepositoryEntryRef)4 RepositoryEntryRefImpl (org.olat.repository.model.RepositoryEntryRefImpl)4 OLATResource (org.olat.resource.OLATResource)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 Link (org.olat.core.gui.components.link.Link)2 PopEvent (org.olat.core.gui.components.stack.PopEvent)2 VetoPopEvent (org.olat.core.gui.components.stack.VetoPopEvent)2 Identity (org.olat.core.id.Identity)2 ICourse (org.olat.course.ICourse)2