Search in sources :

Example 6 with RepositoryEntryMembershipModifiedEvent

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

the class RepositoryManager method removeParticipants.

/**
 * remove list of identities as participant of given repository entry.
 * @param ureqIdentity
 * @param removeIdentities
 * @param re
 * @param logger
 */
public void removeParticipants(Identity ureqIdentity, List<Identity> removeIdentities, RepositoryEntry re, MailPackage mailing, boolean sendMail) {
    List<RepositoryEntryMembershipModifiedEvent> deferredEvents = new ArrayList<>();
    for (Identity identity : removeIdentities) {
        removeParticipant(ureqIdentity, identity, re, mailing, sendMail);
        deferredEvents.add(RepositoryEntryMembershipModifiedEvent.removed(identity, re));
    }
    dbInstance.commit();
    sendDeferredEvents(deferredEvents, re);
}
Also used : RepositoryEntryMembershipModifiedEvent(org.olat.repository.model.RepositoryEntryMembershipModifiedEvent) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity)

Example 7 with RepositoryEntryMembershipModifiedEvent

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

the class RepositoryManager method updateRepositoryEntryMemberships.

public void updateRepositoryEntryMemberships(Identity ureqIdentity, Roles ureqRoles, RepositoryEntry re, List<RepositoryEntryPermissionChangeEvent> changes, MailPackage mailing) {
    int count = 0;
    List<RepositoryEntryMembershipModifiedEvent> deferredEvents = new ArrayList<>();
    for (RepositoryEntryPermissionChangeEvent e : changes) {
        updateRepositoryEntryMembership(ureqIdentity, ureqRoles, re, e, mailing, deferredEvents);
        if (++count % 100 == 0) {
            dbInstance.commitAndCloseSession();
        }
    }
    dbInstance.commitAndCloseSession();
    sendDeferredEvents(deferredEvents, re);
}
Also used : RepositoryEntryMembershipModifiedEvent(org.olat.repository.model.RepositoryEntryMembershipModifiedEvent) ArrayList(java.util.ArrayList) RepositoryEntryPermissionChangeEvent(org.olat.repository.model.RepositoryEntryPermissionChangeEvent)

Example 8 with RepositoryEntryMembershipModifiedEvent

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

the class RepositoryManager method removeTutors.

/**
 * remove list of identities as tutor of given repository entry.
 * @param ureqIdentity
 * @param removeIdentities
 * @param re
 * @param logger
 */
public void removeTutors(Identity ureqIdentity, List<Identity> removeIdentities, RepositoryEntry re, MailPackage mailing) {
    List<RepositoryEntryMembershipModifiedEvent> deferredEvents = new ArrayList<>();
    for (Identity identity : removeIdentities) {
        removeTutor(ureqIdentity, identity, re, mailing);
        deferredEvents.add(RepositoryEntryMembershipModifiedEvent.removed(identity, re));
    }
    dbInstance.commit();
    sendDeferredEvents(deferredEvents, re);
}
Also used : RepositoryEntryMembershipModifiedEvent(org.olat.repository.model.RepositoryEntryMembershipModifiedEvent) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity)

Example 9 with RepositoryEntryMembershipModifiedEvent

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

the class RepositoryManager method removeParticipants.

/**
 * remove list of identities as participant of given repository entry.
 * @param ureqIdentity
 * @param removeIdentities
 * @param re
 * @param logger
 */
public void removeParticipants(Identity ureqIdentity, List<Identity> removeIdentities, RepositoryEntry re, MailPackage mailing, boolean sendMail) {
    List<RepositoryEntryMembershipModifiedEvent> deferredEvents = new ArrayList<>();
    for (Identity identity : removeIdentities) {
        removeParticipant(ureqIdentity, identity, re, mailing, sendMail);
        deferredEvents.add(RepositoryEntryMembershipModifiedEvent.removed(identity, re));
    }
    dbInstance.commit();
    sendDeferredEvents(deferredEvents, re);
}
Also used : RepositoryEntryMembershipModifiedEvent(org.olat.repository.model.RepositoryEntryMembershipModifiedEvent) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity)

Example 10 with RepositoryEntryMembershipModifiedEvent

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

the class RepositoryManager method updateRepositoryEntryMemberships.

public void updateRepositoryEntryMemberships(Identity ureqIdentity, Roles ureqRoles, RepositoryEntry re, List<RepositoryEntryPermissionChangeEvent> changes, MailPackage mailing) {
    int count = 0;
    List<RepositoryEntryMembershipModifiedEvent> deferredEvents = new ArrayList<>();
    for (RepositoryEntryPermissionChangeEvent e : changes) {
        updateRepositoryEntryMembership(ureqIdentity, ureqRoles, re, e, mailing, deferredEvents);
        if (++count % 100 == 0) {
            dbInstance.commitAndCloseSession();
        }
    }
    dbInstance.commitAndCloseSession();
    sendDeferredEvents(deferredEvents, re);
}
Also used : RepositoryEntryMembershipModifiedEvent(org.olat.repository.model.RepositoryEntryMembershipModifiedEvent) ArrayList(java.util.ArrayList) RepositoryEntryPermissionChangeEvent(org.olat.repository.model.RepositoryEntryPermissionChangeEvent)

Aggregations

ArrayList (java.util.ArrayList)10 RepositoryEntryMembershipModifiedEvent (org.olat.repository.model.RepositoryEntryMembershipModifiedEvent)10 Identity (org.olat.core.id.Identity)8 ActionType (org.olat.core.logging.activity.ActionType)2 RepositoryEntryPermissionChangeEvent (org.olat.repository.model.RepositoryEntryPermissionChangeEvent)2 ResourceReservation (org.olat.resource.accesscontrol.ResourceReservation)2