Search in sources :

Example 6 with RepositoryEntryRefImpl

use of org.olat.repository.model.RepositoryEntryRefImpl in project openolat by klemens.

the class RepositoryEntryMembershipProcessor method processIdentityRemoved.

private void processIdentityRemoved(Long repoKey, Long identityKey) {
    IdentityRef identity = new IdentityRefImpl(identityKey);
    RepositoryEntryRef re = new RepositoryEntryRefImpl(repoKey);
    List<String> remainingRoles = repositoryEntryRelationDao.getRoles(identity, re);
    if (remainingRoles.isEmpty()) {
        OLATResource resource = repositoryManager.lookupRepositoryEntryResource(repoKey);
        notificationsManager.unsubscribeAllForIdentityAndResId(identity, resource.getResourceableId());
    }
}
Also used : IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) IdentityRef(org.olat.basesecurity.IdentityRef) RepositoryEntryRefImpl(org.olat.repository.model.RepositoryEntryRefImpl) OLATResource(org.olat.resource.OLATResource) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef)

Example 7 with RepositoryEntryRefImpl

use of org.olat.repository.model.RepositoryEntryRefImpl in project openolat by klemens.

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 8 with RepositoryEntryRefImpl

use of org.olat.repository.model.RepositoryEntryRefImpl in project OpenOLAT by OpenOLAT.

the class RepositoryEntryMembershipProcessor method processIdentityRemoved.

private void processIdentityRemoved(Long repoKey, Long identityKey) {
    IdentityRef identity = new IdentityRefImpl(identityKey);
    RepositoryEntryRef re = new RepositoryEntryRefImpl(repoKey);
    List<String> remainingRoles = repositoryEntryRelationDao.getRoles(identity, re);
    if (remainingRoles.isEmpty()) {
        OLATResource resource = repositoryManager.lookupRepositoryEntryResource(repoKey);
        notificationsManager.unsubscribeAllForIdentityAndResId(identity, resource.getResourceableId());
    }
}
Also used : IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) IdentityRef(org.olat.basesecurity.IdentityRef) RepositoryEntryRefImpl(org.olat.repository.model.RepositoryEntryRefImpl) OLATResource(org.olat.resource.OLATResource) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef)

Example 9 with RepositoryEntryRefImpl

use of org.olat.repository.model.RepositoryEntryRefImpl 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 10 with RepositoryEntryRefImpl

use of org.olat.repository.model.RepositoryEntryRefImpl in project openolat by klemens.

the class EfficiencyStatementManager method deleteEfficiencyStatement.

/**
 * Delete the given efficiency statement for this person
 * @param identity
 * @param efficiencyStatement
 */
protected void deleteEfficiencyStatement(Identity identity, EfficiencyStatement efficiencyStatement) {
    RepositoryEntryRef ref = new RepositoryEntryRefImpl(efficiencyStatement.getCourseRepoEntryKey());
    UserEfficiencyStatement s = getUserEfficiencyStatementLightByRepositoryEntry(ref, identity);
    if (s != null) {
        dbInstance.getCurrentEntityManager().remove(s);
    }
}
Also used : UserEfficiencyStatement(org.olat.course.assessment.UserEfficiencyStatement) RepositoryEntryRefImpl(org.olat.repository.model.RepositoryEntryRefImpl) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef)

Aggregations

RepositoryEntryRef (org.olat.repository.RepositoryEntryRef)12 RepositoryEntryRefImpl (org.olat.repository.model.RepositoryEntryRefImpl)12 IdentityRef (org.olat.basesecurity.IdentityRef)6 IdentityRefImpl (org.olat.basesecurity.model.IdentityRefImpl)6 UserEfficiencyStatement (org.olat.course.assessment.UserEfficiencyStatement)6 OLATResource (org.olat.resource.OLATResource)6 EfficiencyStatementManager (org.olat.course.assessment.manager.EfficiencyStatementManager)4 ArgumentParseException (org.olat.course.condition.interpreter.ArgumentParseException)4 CourseEditorEnv (org.olat.course.editor.CourseEditorEnv)4 BusinessGroupRef (org.olat.group.BusinessGroupRef)4 BusinessGroupRefImpl (org.olat.group.model.BusinessGroupRefImpl)4 BGRepositoryEntryRelation (org.olat.group.model.BGRepositoryEntryRelation)2