use of org.olat.util.logging.activity.LoggingResourceable in project OpenOLAT by OpenOLAT.
the class NewBGController method event.
/* (non-Javadoc)
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == groupCreateController) {
if (event == Event.DONE_EVENT) {
String bgDesc = groupCreateController.getGroupDescription();
Integer bgMax = groupCreateController.getGroupMax();
Integer bgMin = groupCreateController.getGroupMin();
boolean enableWaitingList = groupCreateController.isWaitingListEnabled();
boolean enableAutoCloseRanks = groupCreateController.isAutoCloseRanksEnabled();
UserSession usess = ureq.getUserSession();
Object wildcard = usess.removeEntry("wild_card_new");
newGroups = new ArrayList<BusinessGroup>();
if (bulkMode) {
for (String bgName : groupCreateController.getGroupNames()) {
BusinessGroup group = businessGroupService.createBusinessGroup(getIdentity(), bgName, bgDesc, bgMin, bgMax, enableWaitingList, enableAutoCloseRanks, re);
newGroups.add(group);
}
} else {
String bgName = groupCreateController.getGroupName();
BusinessGroup group = businessGroupService.createBusinessGroup(getIdentity(), bgName, bgDesc, bgMin, bgMax, enableWaitingList, enableAutoCloseRanks, re);
newGroups.add(group);
if (wildcard != null && Boolean.TRUE.equals(wildcard)) {
usess.putEntry("wild_card_" + group.getKey(), Boolean.TRUE);
}
}
if (newGroups != null) {
for (BusinessGroup bg : newGroups) {
LoggingResourceable resourceInfo = LoggingResourceable.wrap(bg);
ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_CREATED, getClass(), resourceInfo);
}
// workflow successfully finished
// so far no events on the systembus to inform about new groups in BGContext
fireEvent(ureq, Event.DONE_EVENT);
}
} else if (event == Event.CANCELLED_EVENT) {
// workflow cancelled
fireEvent(ureq, Event.CANCELLED_EVENT);
}
}
}
use of org.olat.util.logging.activity.LoggingResourceable in project OpenOLAT by OpenOLAT.
the class BulkAssessmentTask method process.
public List<BulkAssessmentFeedback> process() {
List<BulkAssessmentFeedback> feedbacks = new ArrayList<>();
try {
LoggingResourceable infos = LoggingResourceable.wrap(getCourseNode());
ThreadLocalUserActivityLogger.addLoggingResourceInfo(infos);
doProcess(feedbacks);
cleanup();
} catch (Exception e) {
log.error("", e);
feedbacks.add(new BulkAssessmentFeedback("", "bulk.assessment.error"));
} finally {
cleanupUnzip();
}
return feedbacks;
}
use of org.olat.util.logging.activity.LoggingResourceable in project OpenOLAT by OpenOLAT.
the class BulkAssessmentTask method run.
/**
* Used by to task executor, without any GUI
*/
@Override
public void run() {
final List<BulkAssessmentFeedback> feedbacks = new ArrayList<>();
try {
log.audit("Start process bulk assessment");
LoggingResourceable[] infos = new LoggingResourceable[2];
if (task != null && task.getCreator() != null) {
UserSession session = new UserSession();
session.setIdentity(task.getCreator());
session.setSessionInfo(new SessionInfo(task.getCreator().getKey(), task.getCreator().getName()));
ThreadLocalUserActivityLoggerInstaller.initUserActivityLogger(session);
infos[0] = LoggingResourceable.wrap(courseRes, OlatResourceableType.course);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(infos[0]);
infos[1] = LoggingResourceable.wrap(getCourseNode());
ThreadLocalUserActivityLogger.addLoggingResourceInfo(infos[1]);
}
doProcess(feedbacks);
log.audit("End process bulk assessment");
cleanup();
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_BULK, getClass(), infos);
} catch (Exception e) {
log.error("", e);
feedbacks.add(new BulkAssessmentFeedback("", "bulk.assessment.error"));
throw e;
} finally {
cleanupUnzip();
sendFeedback(feedbacks);
}
}
use of org.olat.util.logging.activity.LoggingResourceable in project openolat by klemens.
the class BulkAssessmentTask method run.
/**
* Used by to task executor, without any GUI
*/
@Override
public void run() {
final List<BulkAssessmentFeedback> feedbacks = new ArrayList<>();
try {
log.audit("Start process bulk assessment");
LoggingResourceable[] infos = new LoggingResourceable[2];
if (task != null && task.getCreator() != null) {
UserSession session = new UserSession();
session.setIdentity(task.getCreator());
session.setSessionInfo(new SessionInfo(task.getCreator().getKey(), task.getCreator().getName()));
ThreadLocalUserActivityLoggerInstaller.initUserActivityLogger(session);
infos[0] = LoggingResourceable.wrap(courseRes, OlatResourceableType.course);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(infos[0]);
infos[1] = LoggingResourceable.wrap(getCourseNode());
ThreadLocalUserActivityLogger.addLoggingResourceInfo(infos[1]);
}
doProcess(feedbacks);
log.audit("End process bulk assessment");
cleanup();
ThreadLocalUserActivityLogger.log(AssessmentLoggingAction.ASSESSMENT_BULK, getClass(), infos);
} catch (Exception e) {
log.error("", e);
feedbacks.add(new BulkAssessmentFeedback("", "bulk.assessment.error"));
throw e;
} finally {
cleanupUnzip();
sendFeedback(feedbacks);
}
}
use of org.olat.util.logging.activity.LoggingResourceable in project openolat by klemens.
the class NewBGController method event.
/* (non-Javadoc)
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == groupCreateController) {
if (event == Event.DONE_EVENT) {
String bgDesc = groupCreateController.getGroupDescription();
Integer bgMax = groupCreateController.getGroupMax();
Integer bgMin = groupCreateController.getGroupMin();
boolean enableWaitingList = groupCreateController.isWaitingListEnabled();
boolean enableAutoCloseRanks = groupCreateController.isAutoCloseRanksEnabled();
UserSession usess = ureq.getUserSession();
Object wildcard = usess.removeEntry("wild_card_new");
newGroups = new ArrayList<BusinessGroup>();
if (bulkMode) {
for (String bgName : groupCreateController.getGroupNames()) {
BusinessGroup group = businessGroupService.createBusinessGroup(getIdentity(), bgName, bgDesc, bgMin, bgMax, enableWaitingList, enableAutoCloseRanks, re);
newGroups.add(group);
}
} else {
String bgName = groupCreateController.getGroupName();
BusinessGroup group = businessGroupService.createBusinessGroup(getIdentity(), bgName, bgDesc, bgMin, bgMax, enableWaitingList, enableAutoCloseRanks, re);
newGroups.add(group);
if (wildcard != null && Boolean.TRUE.equals(wildcard)) {
usess.putEntry("wild_card_" + group.getKey(), Boolean.TRUE);
}
}
if (newGroups != null) {
for (BusinessGroup bg : newGroups) {
LoggingResourceable resourceInfo = LoggingResourceable.wrap(bg);
ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_CREATED, getClass(), resourceInfo);
}
// workflow successfully finished
// so far no events on the systembus to inform about new groups in BGContext
fireEvent(ureq, Event.DONE_EVENT);
}
} else if (event == Event.CANCELLED_EVENT) {
// workflow cancelled
fireEvent(ureq, Event.CANCELLED_EVENT);
}
}
}
Aggregations