Search in sources :

Example 21 with RepositoryEntryRef

use of org.olat.repository.RepositoryEntryRef in project openolat by klemens.

the class BusinessGroupMembershipProcessor method processResourceRemoved.

private void processResourceRemoved(Long groupKey, Long repoKey) {
    BusinessGroupRef groupRef = new BusinessGroupRefImpl(groupKey);
    RepositoryEntryRef entryRef = new RepositoryEntryRefImpl(repoKey);
    OLATResource resource = repositoryManager.lookupRepositoryEntryResource(entryRef.getKey());
    List<Long> memberKeys = businessGroupRelationDao.getMemberKeys(Collections.singletonList(groupRef), GroupRoles.coach.name(), GroupRoles.participant.name());
    for (Long memberKey : memberKeys) {
        IdentityRef member = new IdentityRefImpl(memberKey);
        List<String> remaingRoles = repositoryEntryRelationDao.getRoles(member, entryRef);
        if (remaingRoles.isEmpty()) {
            notificationsManager.unsubscribeAllForIdentityAndResId(member, resource.getResourceableId());
        }
    }
}
Also used : BusinessGroupRef(org.olat.group.BusinessGroupRef) IdentityRefImpl(org.olat.basesecurity.model.IdentityRefImpl) RepositoryEntryRefImpl(org.olat.repository.model.RepositoryEntryRefImpl) IdentityRef(org.olat.basesecurity.IdentityRef) OLATResource(org.olat.resource.OLATResource) BusinessGroupRefImpl(org.olat.group.model.BusinessGroupRefImpl) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef)

Example 22 with RepositoryEntryRef

use of org.olat.repository.RepositoryEntryRef in project openolat by klemens.

the class AuditLogFormatter method log.

protected static void log(CandidateEvent candidateEvent, Map<Identifier, AssessmentResponse> candidateResponseMap, Writer writer) throws IOException {
    writer.append("QTI21 audit [");
    AssessmentTestSession testSession = candidateEvent.getCandidateSession();
    if (testSession != null) {
        RepositoryEntryRef testEntry = candidateEvent.getTestEntry();
        RepositoryEntryRef courseEntry = candidateEvent.getRepositoryEntry();
        if (courseEntry != null && !testEntry.getKey().equals(courseEntry.getKey())) {
            writer.write(courseEntry.getKey().toString());
            writer.write(":");
            if (testSession.getSubIdent() == null) {
                writer.write("NULL:");
            } else {
                writer.write(testSession.getSubIdent());
                writer.write(":");
            }
        }
        if (testEntry != null) {
            writer.write(testEntry.getKey().toString());
        }
    }
    writer.write("] ");
    if (candidateEvent.getTestEventType() != null) {
        writer.append("TestEvent:");
        writer.append(candidateEvent.getTestEventType().toString());
        writer.write(" ");
    }
    if (candidateEvent.getItemEventType() != null) {
        writer.append("ItemEvent:");
        writer.append(candidateEvent.getItemEventType().toString());
        writer.write(" ");
    }
    if (candidateEvent.getTestItemKey() != null) {
        writer.append("TestItemKey[");
        writer.append(candidateEvent.getTestItemKey());
        writer.write("] ");
    }
    if (candidateResponseMap != null) {
        writer.write("params=");
        for (Map.Entry<Identifier, AssessmentResponse> responseEntry : candidateResponseMap.entrySet()) {
            Identifier identifier = responseEntry.getKey();
            AssessmentResponse response = responseEntry.getValue();
            writer.append("|");
            writer.append(identifier.toString());
            writer.append("=");
            String stringuifiedResponse = response.getStringuifiedResponse();
            if (stringuifiedResponse == null) {
                writer.append("NULL");
            } else {
                writer.append(stringuifiedResponse);
            }
        }
    }
}
Also used : AssessmentTestSession(org.olat.ims.qti21.AssessmentTestSession) Identifier(uk.ac.ed.ph.jqtiplus.types.Identifier) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef) Map(java.util.Map) AssessmentResponse(org.olat.ims.qti21.AssessmentResponse)

Aggregations

RepositoryEntryRef (org.olat.repository.RepositoryEntryRef)22 RepositoryEntryRefImpl (org.olat.repository.model.RepositoryEntryRefImpl)12 OLATResource (org.olat.resource.OLATResource)10 IdentityRef (org.olat.basesecurity.IdentityRef)6 IdentityRefImpl (org.olat.basesecurity.model.IdentityRefImpl)6 UserEfficiencyStatement (org.olat.course.assessment.UserEfficiencyStatement)6 ArrayList (java.util.ArrayList)4 EfficiencyStatementManager (org.olat.course.assessment.manager.EfficiencyStatementManager)4 ArgumentParseException (org.olat.course.condition.interpreter.ArgumentParseException)4 CourseEditorEnv (org.olat.course.editor.CourseEditorEnv)4 BusinessGroup (org.olat.group.BusinessGroup)4 BusinessGroupRef (org.olat.group.BusinessGroupRef)4 BusinessGroupRefImpl (org.olat.group.model.BusinessGroupRefImpl)4 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Identity (org.olat.core.id.Identity)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 BGRepositoryEntryRelation (org.olat.group.model.BGRepositoryEntryRelation)2 BusinessGroupMembershipViewImpl (org.olat.group.model.BusinessGroupMembershipViewImpl)2 BusinessGroupModifiedEvent (org.olat.group.ui.edit.BusinessGroupModifiedEvent)2