Search in sources :

Example 1 with EfficiencyStatementEvent

use of org.olat.course.assessment.EfficiencyStatementEvent in project openolat by klemens.

the class UpdateEfficiencyStatementsWorker method run.

/**
 * @see java.lang.Runnable#run()
 */
public void run() {
    boolean success = false;
    try {
        RepositoryManager rm = CoreSpringFactory.getImpl(RepositoryManager.class);
        EfficiencyStatementManager esm = CoreSpringFactory.getImpl(EfficiencyStatementManager.class);
        RepositoryEntry re = rm.lookupRepositoryEntry(ores, false);
        List<Identity> identities = esm.findIdentitiesWithEfficiencyStatements(re.getKey());
        esm.updateEfficiencyStatements(re, identities);
        // close db session in this thread
        DBFactory.getInstance().commitAndCloseSession();
        success = true;
        EfficiencyStatementEvent finishedEvent = new EfficiencyStatementEvent(EfficiencyStatementEvent.CMD_FINISHED, ores.getResourceableId());
        CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(finishedEvent, ores);
    } catch (Exception ex) {
        log.error("Unexpected exception updating the efficiency statements of " + ores, ex);
    } finally {
        // close db session in this thread
        if (!success) {
            DBFactory.getInstance().rollbackAndCloseSession();
        }
    }
}
Also used : EfficiencyStatementEvent(org.olat.course.assessment.EfficiencyStatementEvent) RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity)

Example 2 with EfficiencyStatementEvent

use of org.olat.course.assessment.EfficiencyStatementEvent in project OpenOLAT by OpenOLAT.

the class UpdateEfficiencyStatementsWorker method run.

/**
 * @see java.lang.Runnable#run()
 */
public void run() {
    boolean success = false;
    try {
        RepositoryManager rm = CoreSpringFactory.getImpl(RepositoryManager.class);
        EfficiencyStatementManager esm = CoreSpringFactory.getImpl(EfficiencyStatementManager.class);
        RepositoryEntry re = rm.lookupRepositoryEntry(ores, false);
        List<Identity> identities = esm.findIdentitiesWithEfficiencyStatements(re.getKey());
        esm.updateEfficiencyStatements(re, identities);
        // close db session in this thread
        DBFactory.getInstance().commitAndCloseSession();
        success = true;
        EfficiencyStatementEvent finishedEvent = new EfficiencyStatementEvent(EfficiencyStatementEvent.CMD_FINISHED, ores.getResourceableId());
        CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(finishedEvent, ores);
    } catch (Exception ex) {
        log.error("Unexpected exception updating the efficiency statements of " + ores, ex);
    } finally {
        // close db session in this thread
        if (!success) {
            DBFactory.getInstance().rollbackAndCloseSession();
        }
    }
}
Also used : EfficiencyStatementEvent(org.olat.course.assessment.EfficiencyStatementEvent) RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity)

Aggregations

Identity (org.olat.core.id.Identity)2 EfficiencyStatementEvent (org.olat.course.assessment.EfficiencyStatementEvent)2 RepositoryEntry (org.olat.repository.RepositoryEntry)2 RepositoryManager (org.olat.repository.RepositoryManager)2