Skip to content
Snippets Groups Projects
Commit f2d3390d authored by srosse's avatar srosse
Browse files

FXOLAT-424: reduce the number of output in log files from the...

FXOLAT-424: reduce the number of output in log files from the UserActivityLogging (especially in QTI and EffiencyStatment)
parent ff114d35
No related branches found
No related tags found
No related merge requests found
Showing
with 117 additions and 34 deletions
...@@ -71,10 +71,11 @@ import org.olat.core.id.context.StateEntry; ...@@ -71,10 +71,11 @@ import org.olat.core.id.context.StateEntry;
import org.olat.core.logging.AssertException; import org.olat.core.logging.AssertException;
import org.olat.core.logging.OLog; import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing; import org.olat.core.logging.Tracing;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.util.coordinate.CoordinatorManager; import org.olat.core.util.coordinate.CoordinatorManager;
import org.olat.core.util.coordinate.LockResult; import org.olat.core.util.coordinate.LockResult;
import org.olat.core.util.nodes.INode;
import org.olat.core.util.resource.OresHelper; import org.olat.core.util.resource.OresHelper;
import org.olat.util.logging.activity.LoggingResourceable;
/** /**
* <pre> * <pre>
...@@ -123,6 +124,7 @@ public class UserAdminMainController extends MainLayoutBasicController implement ...@@ -123,6 +124,7 @@ public class UserAdminMainController extends MainLayoutBasicController implement
// we always start with a search controller // we always start with a search controller
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
OLATResourceable ores = OresHelper.createOLATResourceableInstance(firstNode.getUserObject().toString(), 0l); OLATResourceable ores = OresHelper.createOLATResourceableInstance(firstNode.getUserObject().toString(), 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = addToHistory(ureq, ores, null); WindowControl bwControl = addToHistory(ureq, ores, null);
contentCtr = new UsermanagerUserSearchController(ureq, bwControl); contentCtr = new UsermanagerUserSearchController(ureq, bwControl);
listenTo(contentCtr); // auto dispose later listenTo(contentCtr); // auto dispose later
...@@ -168,6 +170,8 @@ public class UserAdminMainController extends MainLayoutBasicController implement ...@@ -168,6 +170,8 @@ public class UserAdminMainController extends MainLayoutBasicController implement
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
OLATResourceable ores = OresHelper.createOLATResourceableInstance(Identity.class, identity.getKey()); OLATResourceable ores = OresHelper.createOLATResourceableInstance(Identity.class, identity.getKey());
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl; WindowControl bwControl;
if(contentCtr instanceof UsermanagerUserSearchController) { if(contentCtr instanceof UsermanagerUserSearchController) {
UsermanagerUserSearchController ctrl = (UsermanagerUserSearchController)contentCtr; UsermanagerUserSearchController ctrl = (UsermanagerUserSearchController)contentCtr;
......
...@@ -41,8 +41,10 @@ import org.olat.core.gui.translator.Translator; ...@@ -41,8 +41,10 @@ import org.olat.core.gui.translator.Translator;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.id.context.BusinessControlFactory; import org.olat.core.id.context.BusinessControlFactory;
import org.olat.core.id.context.StateSite; import org.olat.core.id.context.StateSite;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.resource.OresHelper; import org.olat.core.util.resource.OresHelper;
import org.olat.util.logging.activity.LoggingResourceable;
/** /**
* Initial Date: Jan 16, 2006 * Initial Date: Jan 16, 2006
* @author Florian Gnaegi * @author Florian Gnaegi
...@@ -78,6 +80,7 @@ public class UserAdminSite implements SiteInstance { ...@@ -78,6 +80,7 @@ public class UserAdminSite implements SiteInstance {
public MainLayoutController createController(UserRequest ureq, WindowControl wControl) { public MainLayoutController createController(UserRequest ureq, WindowControl wControl) {
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
OLATResourceable ores = OresHelper.createOLATResourceableInstance(UserAdminSite.class, 0l); OLATResourceable ores = OresHelper.createOLATResourceableInstance(UserAdminSite.class, 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
MainLayoutController c = ControllerFactory.createLaunchController(ORES_OLATUSERADMINS, null, ureq, bwControl, true); MainLayoutController c = ControllerFactory.createLaunchController(ORES_OLATUSERADMINS, null, ureq, bwControl, true);
return c; return c;
......
...@@ -82,6 +82,7 @@ import org.olat.core.id.context.ContextEntry; ...@@ -82,6 +82,7 @@ import org.olat.core.id.context.ContextEntry;
import org.olat.core.id.context.StateEntry; import org.olat.core.id.context.StateEntry;
import org.olat.core.id.context.StateMapped; import org.olat.core.id.context.StateMapped;
import org.olat.core.logging.AssertException; import org.olat.core.logging.AssertException;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.servlets.WebDAVManager; import org.olat.core.servlets.WebDAVManager;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.Util; import org.olat.core.util.Util;
...@@ -95,6 +96,7 @@ import org.olat.modules.co.ContactFormController; ...@@ -95,6 +96,7 @@ import org.olat.modules.co.ContactFormController;
import org.olat.user.UserInfoMainController; import org.olat.user.UserInfoMainController;
import org.olat.user.UserManager; import org.olat.user.UserManager;
import org.olat.user.propertyhandlers.UserPropertyHandler; import org.olat.user.propertyhandlers.UserPropertyHandler;
import org.olat.util.logging.activity.LoggingResourceable;
/** /**
* Initial Date: Jan 31, 2006 * Initial Date: Jan 31, 2006
...@@ -310,6 +312,7 @@ public class UsermanagerUserSearchController extends BasicController implements ...@@ -310,6 +312,7 @@ public class UsermanagerUserSearchController extends BasicController implements
removeAsListenerAndDispose(tableCtr); removeAsListenerAndDispose(tableCtr);
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
OLATResourceable ores = OresHelper.createOLATResourceableInstance("table", 0l); OLATResourceable ores = OresHelper.createOLATResourceableInstance("table", 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = addToHistory(ureq, ores, null); WindowControl bwControl = addToHistory(ureq, ores, null);
tableCtr = ExtendedIdentitiesTableControllerFactory.createController(tdm, ureq, bwControl, actionEnabled); tableCtr = ExtendedIdentitiesTableControllerFactory.createController(tdm, ureq, bwControl, actionEnabled);
listenTo(tableCtr); listenTo(tableCtr);
......
...@@ -49,9 +49,11 @@ import org.olat.core.id.OLATResourceable; ...@@ -49,9 +49,11 @@ import org.olat.core.id.OLATResourceable;
import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.ContextEntry;
import org.olat.core.id.context.StateEntry; import org.olat.core.id.context.StateEntry;
import org.olat.core.logging.AssertException; import org.olat.core.logging.AssertException;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.util.CodeHelper; import org.olat.core.util.CodeHelper;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.resource.OresHelper; import org.olat.core.util.resource.OresHelper;
import org.olat.util.logging.activity.LoggingResourceable;
/** /**
* Description:<br> * Description:<br>
...@@ -351,6 +353,7 @@ public abstract class GenericMainController extends MainLayoutBasicController { ...@@ -351,6 +353,7 @@ public abstract class GenericMainController extends MainLayoutBasicController {
} else { } else {
ores = OresHelper.createOLATResourceableInstance(GMCMT, CodeHelper.getUniqueIDFromString(nE.getUniqueExtensionID())); ores = OresHelper.createOLATResourceableInstance(GMCMT, CodeHelper.getUniqueIDFromString(nE.getUniqueExtensionID()));
} }
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
bwControl = addToHistory(ureq, ores, null); bwControl = addToHistory(ureq, ores, null);
} }
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
package org.olat.core.logging.activity; package org.olat.core.logging.activity;
import org.olat.core.commons.persistence.PersistentObject;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.ContextEntry;
...@@ -97,6 +96,8 @@ public class CoreLoggingResourceable implements ILoggingResourceable { ...@@ -97,6 +96,8 @@ public class CoreLoggingResourceable implements ILoggingResourceable {
/** the OlatResourceable if we have one - null otherwise. Used for equals() and the businessPath check mainly **/ /** the OlatResourceable if we have one - null otherwise. Used for equals() and the businessPath check mainly **/
private final OLATResourceable resourceable_; private final OLATResourceable resourceable_;
private final boolean ignorable_;
/** /**
* Internal constructor to create a LoggingResourceable object with the given mandatory * Internal constructor to create a LoggingResourceable object with the given mandatory
* parameters initialized. * parameters initialized.
...@@ -110,7 +111,7 @@ public class CoreLoggingResourceable implements ILoggingResourceable { ...@@ -110,7 +111,7 @@ public class CoreLoggingResourceable implements ILoggingResourceable {
* @param id the id to be stored to the database * @param id the id to be stored to the database
* @param name the name to be stored to the database * @param name the name to be stored to the database
*/ */
private CoreLoggingResourceable(OLATResourceable resourceable, ILoggingResourceableType resourceableType, String type, String id, String name) { private CoreLoggingResourceable(OLATResourceable resourceable, ILoggingResourceableType resourceableType, String type, String id, String name, boolean ignorable) {
if (type!=null && type.length()>32) { if (type!=null && type.length()>32) {
log_.error("<init> type too long. Allowed 32, actual: "+type.length()+", type="+type); log_.error("<init> type too long. Allowed 32, actual: "+type.length()+", type="+type);
type = type.substring(0, 32); type = type.substring(0, 32);
...@@ -128,6 +129,7 @@ public class CoreLoggingResourceable implements ILoggingResourceable { ...@@ -128,6 +129,7 @@ public class CoreLoggingResourceable implements ILoggingResourceable {
type_ = type; type_ = type;
id_ = id; id_ = id;
name_ = name; name_ = name;
ignorable_ = ignorable;
} }
// //
...@@ -153,7 +155,7 @@ public class CoreLoggingResourceable implements ILoggingResourceable { ...@@ -153,7 +155,7 @@ public class CoreLoggingResourceable implements ILoggingResourceable {
*/ */
public static CoreLoggingResourceable wrapNonOlatResource(StringResourceableType type, String idForDB, String nameForDB) { public static CoreLoggingResourceable wrapNonOlatResource(StringResourceableType type, String idForDB, String nameForDB) {
return new CoreLoggingResourceable(null, type, return new CoreLoggingResourceable(null, type,
type.name(), idForDB, nameForDB); type.name(), idForDB, nameForDB, false);
} }
/** /**
...@@ -220,7 +222,7 @@ public class CoreLoggingResourceable implements ILoggingResourceable { ...@@ -220,7 +222,7 @@ public class CoreLoggingResourceable implements ILoggingResourceable {
*/ */
public static CoreLoggingResourceable wrap(OLATResourceable olatResourceable, ILoggingResourceableType type) { public static CoreLoggingResourceable wrap(OLATResourceable olatResourceable, ILoggingResourceableType type) {
return new CoreLoggingResourceable(olatResourceable, type, olatResourceable.getResourceableTypeName(), return new CoreLoggingResourceable(olatResourceable, type, olatResourceable.getResourceableTypeName(),
String.valueOf(olatResourceable.getResourceableId()), ""); String.valueOf(olatResourceable.getResourceableId()), "", false);
} }
/** /**
...@@ -275,6 +277,11 @@ public class CoreLoggingResourceable implements ILoggingResourceable { ...@@ -275,6 +277,11 @@ public class CoreLoggingResourceable implements ILoggingResourceable {
return resourceableType_; return resourceableType_;
} }
@Override
public boolean isIgnorable() {
return ignorable_;
}
@Override @Override
public int hashCode() { public int hashCode() {
return type_.hashCode()+id_.hashCode()+(resourceable_!=null ? resourceable_.getResourceableTypeName().hashCode()+(int)resourceable_.getResourceableId().longValue() : 0) + (resourceableType_!=null ? resourceableType_.hashCode() : 0); return type_.hashCode()+id_.hashCode()+(resourceable_!=null ? resourceable_.getResourceableTypeName().hashCode()+(int)resourceable_.getResourceableId().longValue() : 0) + (resourceableType_!=null ? resourceableType_.hashCode() : 0);
......
...@@ -93,6 +93,7 @@ public class CourseLoggingAction extends BaseLoggingAction { ...@@ -93,6 +93,7 @@ public class CourseLoggingAction extends BaseLoggingAction {
public static final ILoggingAction COURSE_LEAVING = public static final ILoggingAction COURSE_LEAVING =
new CourseLoggingAction(ActionType.statistic, CrudAction.exit, ActionVerb.exit, ActionObject.course).setTypeList( new CourseLoggingAction(ActionType.statistic, CrudAction.exit, ActionVerb.exit, ActionObject.course).setTypeList(
new ResourceableTypeList().addMandatory(OlatResourceableType.course). new ResourceableTypeList().addMandatory(OlatResourceableType.course).
or().addMandatory(OlatResourceableType.course).addOptional(OlatResourceableType.node).
or().addMandatory(OlatResourceableType.course, OlatResourceableType.genRepoEntry).addOptional(OlatResourceableType.businessGroup). or().addMandatory(OlatResourceableType.course, OlatResourceableType.genRepoEntry).addOptional(OlatResourceableType.businessGroup).
or().addMandatory(OlatResourceableType.genRepoEntry, StringResourceableType.targetIdentity).addOptional(OlatResourceableType.businessGroup).addOptional(OlatResourceableType.sharedFolder).addOptional(OlatResourceableType.course). or().addMandatory(OlatResourceableType.genRepoEntry, StringResourceableType.targetIdentity).addOptional(OlatResourceableType.businessGroup).addOptional(OlatResourceableType.sharedFolder).addOptional(OlatResourceableType.course).
or().addMandatory(OlatResourceableType.course, StringResourceableType.targetIdentity)); or().addMandatory(OlatResourceableType.course, StringResourceableType.targetIdentity));
......
...@@ -66,4 +66,11 @@ public interface ILoggingResourceable { ...@@ -66,4 +66,11 @@ public interface ILoggingResourceable {
* @return the ILoggingResourceableType of this LoggingResourceable * @return the ILoggingResourceableType of this LoggingResourceable
*/ */
public ILoggingResourceableType getResourceableType(); public ILoggingResourceableType getResourceableType();
/**
* Some components of a list of context entries are used to recreate the
* controllers hierarchy by back button and haven't any meaning for logging.
* @return
*/
public boolean isIgnorable();
} }
...@@ -59,6 +59,8 @@ public class LearningResourceLoggingAction extends BaseLoggingAction { ...@@ -59,6 +59,8 @@ public class LearningResourceLoggingAction extends BaseLoggingAction {
or().addMandatory(OlatResourceableType.course, OlatResourceableType.node, OlatResourceableType.wiki). or().addMandatory(OlatResourceableType.course, OlatResourceableType.node, OlatResourceableType.wiki).
// this is the case when you open a scorm resource as a course node // this is the case when you open a scorm resource as a course node
or().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.scormResource). or().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.scormResource).
// this is the case when you open a QTI resource as a course node
or().addMandatory(OlatResourceableType.course, OlatResourceableType.node, OlatResourceableType.iq).
// this is another case of closing a resource // this is another case of closing a resource
or().addMandatory(OlatResourceableType.course, OlatResourceableType.node); or().addMandatory(OlatResourceableType.course, OlatResourceableType.node);
public static final ILoggingAction LEARNING_RESOURCE_OPEN = public static final ILoggingAction LEARNING_RESOURCE_OPEN =
......
...@@ -78,5 +78,8 @@ public enum OlatResourceableType implements ILoggingResourceableType { ...@@ -78,5 +78,8 @@ public enum OlatResourceableType implements ILoggingResourceableType {
calendar, calendar,
/** reprensents a portfolio map **/ /** reprensents a portfolio map **/
portfolio; portfolio,
/** business path component **/
businessPath
} }
\ No newline at end of file
...@@ -267,6 +267,14 @@ public class ResourceableTypeList { ...@@ -267,6 +267,14 @@ public class ResourceableTypeList {
} }
List<ILoggingResourceable> resourceInfosCopy = new LinkedList<ILoggingResourceable>(resourceInfos); List<ILoggingResourceable> resourceInfosCopy = new LinkedList<ILoggingResourceable>(resourceInfos);
for (Iterator<ILoggingResourceable> it = resourceInfosCopy.iterator(); it.hasNext();) {
if(it.next().isIgnorable()) {
it.remove();
}
}
List<ILoggingResourceableType> mandatory = getMandatory(); List<ILoggingResourceableType> mandatory = getMandatory();
for (Iterator<ILoggingResourceableType> it = mandatory.iterator(); it.hasNext();) { for (Iterator<ILoggingResourceableType> it = mandatory.iterator(); it.hasNext();) {
ILoggingResourceableType type = it.next(); ILoggingResourceableType type = it.next();
......
...@@ -92,7 +92,9 @@ public class ThreadLocalUserActivityLogger { ...@@ -92,7 +92,9 @@ public class ThreadLocalUserActivityLogger {
static IUserActivityLogger getUserActivityLogger() { static IUserActivityLogger getUserActivityLogger() {
IUserActivityLogger logger = userActivityLogger_.get(); IUserActivityLogger logger = userActivityLogger_.get();
if (logger==null) { if (logger==null) {
log_.warn("No UserActivityLogger set! Reinitializing now.", new Exception("stacktrace")); if(log_.isDebug()) {//only generate this exception in debug
log_.warn("No UserActivityLogger set! Reinitializing now.", new Exception("stacktrace"));
}
return new UserActivityLoggerImpl(); return new UserActivityLoggerImpl();
} }
return logger; return logger;
......
...@@ -32,7 +32,6 @@ import java.io.UnsupportedEncodingException; ...@@ -32,7 +32,6 @@ import java.io.UnsupportedEncodingException;
import java.io.Writer; import java.io.Writer;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
...@@ -41,10 +40,8 @@ import java.util.Set; ...@@ -41,10 +40,8 @@ import java.util.Set;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.hibernate.FlushMode;
import org.olat.core.commons.persistence.DB; import org.olat.core.commons.persistence.DB;
import org.olat.core.commons.persistence.DBFactory; import org.olat.core.commons.persistence.DBFactory;
import org.olat.core.commons.persistence.DBQuery;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
...@@ -509,7 +506,8 @@ public class UserActivityLoggerImpl implements IUserActivityLogger { ...@@ -509,7 +506,8 @@ public class UserActivityLoggerImpl implements IUserActivityLogger {
} }
if (!foundIt) { if (!foundIt) {
String oresourceableOres = "n/a (null)"; String oresourceableOres = "n/a (null)";
if (ce !=null && ce.getOLATResourceable() !=null) { // SR: why generate exception for unuseable information???
if (log_.isDebug() && ce !=null && ce.getOLATResourceable() !=null) {
try { try {
java.lang.reflect.Method getOlatResource = ce.getOLATResourceable().getClass().getDeclaredMethod("getOlatResource"); java.lang.reflect.Method getOlatResource = ce.getOLATResourceable().getClass().getDeclaredMethod("getOlatResource");
if (getOlatResource!=null) { if (getOlatResource!=null) {
...@@ -532,8 +530,12 @@ public class UserActivityLoggerImpl implements IUserActivityLogger { ...@@ -532,8 +530,12 @@ public class UserActivityLoggerImpl implements IUserActivityLogger {
ILoggingResourceable resourceInfo = it2.next(); ILoggingResourceable resourceInfo = it2.next();
log_.info("id: "+resourceInfo.getId()+", name="+resourceInfo.getName()+", type="+resourceInfo.getType()+", toString: "+resourceInfo.toString()); log_.info("id: "+resourceInfo.getId()+", name="+resourceInfo.getName()+", type="+resourceInfo.getType()+", toString: "+resourceInfo.toString());
} }
log_.warn("Could not find any LoggingResourceable corresponding to this ContextEntry: "+ce.toString(), if(log_.isDebug()) {//only generate the stacktrace in debug mode
new Exception("UserActivityLoggerImpl.getCombinedOrderedLoggingResourceables()")); log_.warn("Could not find any LoggingResourceable corresponding to this ContextEntry: "+ce.toString(),
new Exception("UserActivityLoggerImpl.getCombinedOrderedLoggingResourceables()"));
} else {
log_.warn("Could not find any LoggingResourceable corresponding to this ContextEntry: "+ce.toString(), null);
}
} }
} }
} }
...@@ -727,6 +729,12 @@ public class UserActivityLoggerImpl implements IUserActivityLogger { ...@@ -727,6 +729,12 @@ public class UserActivityLoggerImpl implements IUserActivityLogger {
// alongside the log message // alongside the log message
// check if we have more than 4 - if we do, issue a log and remove the middle ones // check if we have more than 4 - if we do, issue a log and remove the middle ones
for(Iterator<ILoggingResourceable> riIterator=resourceInfos.iterator(); riIterator.hasNext(); ) {
if(riIterator.next().isIgnorable()) {
riIterator.remove();
}
}
if (resourceInfos.size()>4) { if (resourceInfos.size()>4) {
log_.warn("More than 4 resource infos set on a user activity log. Can only have 4. Having: "+resourceInfos.size()); log_.warn("More than 4 resource infos set on a user activity log. Can only have 4. Having: "+resourceInfos.size());
int diff = resourceInfos.size()-4; int diff = resourceInfos.size()-4;
......
...@@ -61,21 +61,21 @@ import org.olat.core.logging.activity.StringResourceableType; ...@@ -61,21 +61,21 @@ import org.olat.core.logging.activity.StringResourceableType;
// the stickyactiontype to admin // the stickyactiontype to admin
public static final ILoggingAction ASSESSMENT_ATTEMPTS_UPDATED = public static final ILoggingAction ASSESSMENT_ATTEMPTS_UPDATED =
new AssessmentLoggingAction(ActionType.statistic, CrudAction.update, ActionVerb.edit, ActionObject.testattempts).setTypeList( new AssessmentLoggingAction(ActionType.statistic, CrudAction.update, ActionVerb.edit, ActionObject.testattempts).setTypeList(
new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiAttempts, StringResourceableType.targetIdentity)); new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiAttempts).addOptional(StringResourceableType.targetIdentity));
public static final ILoggingAction ASSESSMENT_SCORE_UPDATED = public static final ILoggingAction ASSESSMENT_SCORE_UPDATED =
new AssessmentLoggingAction(ActionType.statistic, CrudAction.update, ActionVerb.edit, ActionObject.testscore).setTypeList( new AssessmentLoggingAction(ActionType.statistic, CrudAction.update, ActionVerb.edit, ActionObject.testscore).setTypeList(
new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiScore, StringResourceableType.targetIdentity)); new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiScore).addOptional(StringResourceableType.targetIdentity));
public static final ILoggingAction ASSESSMENT_PASSED_UPDATED = public static final ILoggingAction ASSESSMENT_PASSED_UPDATED =
new AssessmentLoggingAction(ActionType.statistic, CrudAction.update, ActionVerb.edit, ActionObject.testsuccess).setTypeList( new AssessmentLoggingAction(ActionType.statistic, CrudAction.update, ActionVerb.edit, ActionObject.testsuccess).setTypeList(
new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiPassed, StringResourceableType.targetIdentity)); new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiPassed).addOptional(StringResourceableType.targetIdentity));
// note that comments can only be set via a tutor, hence the following two are strict admin actions // note that comments can only be set via a tutor, hence the following two are strict admin actions
public static final ILoggingAction ASSESSMENT_USERCOMMENT_UPDATED = public static final ILoggingAction ASSESSMENT_USERCOMMENT_UPDATED =
new AssessmentLoggingAction(ActionType.admin, CrudAction.update, ActionVerb.edit, ActionObject.testcomment).setTypeList( new AssessmentLoggingAction(ActionType.admin, CrudAction.update, ActionVerb.edit, ActionObject.testcomment).setTypeList(
new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiUserComment, StringResourceableType.targetIdentity)); new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiUserComment).addOptional(StringResourceableType.targetIdentity));
public static final ILoggingAction ASSESSMENT_COACHCOMMENT_UPDATED = public static final ILoggingAction ASSESSMENT_COACHCOMMENT_UPDATED =
new AssessmentLoggingAction(ActionType.admin, CrudAction.update, ActionVerb.edit, ActionObject.testcomment).setTypeList( new AssessmentLoggingAction(ActionType.admin, CrudAction.update, ActionVerb.edit, ActionObject.testcomment).setTypeList(
new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiCoachComment, StringResourceableType.targetIdentity)); new ResourceableTypeList().addMandatory(OlatResourceableType.course, OlatResourceableType.node, StringResourceableType.qtiCoachComment).addOptional(StringResourceableType.targetIdentity));
/** /**
......
...@@ -52,6 +52,7 @@ import org.olat.core.id.context.ContextEntry; ...@@ -52,6 +52,7 @@ import org.olat.core.id.context.ContextEntry;
import org.olat.core.id.context.StateEntry; import org.olat.core.id.context.StateEntry;
import org.olat.core.logging.AssertException; import org.olat.core.logging.AssertException;
import org.olat.core.logging.OLATRuntimeException; import org.olat.core.logging.OLATRuntimeException;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.util.Formatter; import org.olat.core.util.Formatter;
import org.olat.core.util.UserSession; import org.olat.core.util.UserSession;
import org.olat.core.util.event.EventBus; import org.olat.core.util.event.EventBus;
...@@ -381,6 +382,7 @@ public class IQRunController extends BasicController implements GenericEventList ...@@ -381,6 +382,7 @@ public class IQRunController extends BasicController implements GenericEventList
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
OLATResourceable ores = OresHelper.createOLATResourceableTypeWithoutCheck("test"); OLATResourceable ores = OresHelper.createOLATResourceableTypeWithoutCheck("test");
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = addToHistory(ureq, ores, null); WindowControl bwControl = addToHistory(ureq, ores, null);
Controller returnController = IQManager.getInstance().createIQDisplayController(modConfig, secCallback, ureq, bwControl, callingResId, callingResDetail); Controller returnController = IQManager.getInstance().createIQDisplayController(modConfig, secCallback, ureq, bwControl, callingResId, callingResDetail);
/* /*
...@@ -457,7 +459,6 @@ public class IQRunController extends BasicController implements GenericEventList ...@@ -457,7 +459,6 @@ public class IQRunController extends BasicController implements GenericEventList
IQSubmittedEvent se = (IQSubmittedEvent) event; IQSubmittedEvent se = (IQSubmittedEvent) event;
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager(); AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
// Save results in case of test // Save results in case of test
if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) { if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
// update scoring overview for the user in the current course // update scoring overview for the user in the current course
......
...@@ -40,9 +40,11 @@ import org.olat.core.gui.translator.Translator; ...@@ -40,9 +40,11 @@ import org.olat.core.gui.translator.Translator;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.id.context.BusinessControlFactory; import org.olat.core.id.context.BusinessControlFactory;
import org.olat.core.id.context.StateSite; import org.olat.core.id.context.StateSite;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.resource.OresHelper; import org.olat.core.util.resource.OresHelper;
import org.olat.group.ui.context.BGContextManagementController; import org.olat.group.ui.context.BGContextManagementController;
import org.olat.util.logging.activity.LoggingResourceable;
/** /**
* Description:<br> * Description:<br>
...@@ -83,6 +85,7 @@ public class GroupsManagementSite implements SiteInstance { ...@@ -83,6 +85,7 @@ public class GroupsManagementSite implements SiteInstance {
public MainLayoutController createController(UserRequest ureq, WindowControl wControl) { public MainLayoutController createController(UserRequest ureq, WindowControl wControl) {
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
OLATResourceable ores = OresHelper.createOLATResourceableInstance(GroupsManagementSite.class, 0l); OLATResourceable ores = OresHelper.createOLATResourceableInstance(GroupsManagementSite.class, 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
MainLayoutController c = ControllerFactory.createLaunchController(ORES_GROUPSMANAGEMENT, null, ureq, bwControl, true); MainLayoutController c = ControllerFactory.createLaunchController(ORES_GROUPSMANAGEMENT, null, ureq, bwControl, true);
return c; return c;
......
...@@ -713,6 +713,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im ...@@ -713,6 +713,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im
WindowControl bwControl = getWindowControl(); WindowControl bwControl = getWindowControl();
// calculate the new businesscontext for the forum clicked // calculate the new businesscontext for the forum clicked
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLCAL); ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLCAL);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable()));
bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl); bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl);
collabToolCtr = collabTools.createCalendarController(ureq, bwControl, this.businessGroup, isAdmin); collabToolCtr = collabTools.createCalendarController(ureq, bwControl, this.businessGroup, isAdmin);
...@@ -721,6 +722,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im ...@@ -721,6 +722,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im
} else if (ACTIVITY_MENUSELECT_INFORMATION.equals(cmd)) { } else if (ACTIVITY_MENUSELECT_INFORMATION.equals(cmd)) {
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLMSG); ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLMSG);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable()));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
collabToolCtr = collabTools.createNewsController(ureq, bwControl); collabToolCtr = collabTools.createNewsController(ureq, bwControl);
listenTo(collabToolCtr); listenTo(collabToolCtr);
...@@ -733,6 +735,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im ...@@ -733,6 +735,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im
WindowControl bwControl = getWindowControl(); WindowControl bwControl = getWindowControl();
// calculate the new businesscontext for the forum clicked // calculate the new businesscontext for the forum clicked
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLFOLDER); ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLFOLDER);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable()));
bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl); bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl);
//fxdiff VCRP-8: collaboration tools folder access control //fxdiff VCRP-8: collaboration tools folder access control
collabToolCtr = collabTools.createFolderController(ureq, bwControl, businessGroup, isAdmin, sc); collabToolCtr = collabTools.createFolderController(ureq, bwControl, businessGroup, isAdmin, sc);
...@@ -777,6 +780,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im ...@@ -777,6 +780,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im
private void doAdministration(UserRequest ureq) { private void doAdministration(UserRequest ureq) {
removeAsListenerAndDispose(bgEditCntrllr); removeAsListenerAndDispose(bgEditCntrllr);
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ORES_TOOLADMIN));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ORES_TOOLADMIN, null, getWindowControl()); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ORES_TOOLADMIN, null, getWindowControl());
collabToolCtr = bgEditCntrllr = BGControllerFactory.getInstance().createEditControllerFor(ureq, bwControl, businessGroup); collabToolCtr = bgEditCntrllr = BGControllerFactory.getInstance().createEditControllerFor(ureq, bwControl, businessGroup);
listenTo(bgEditCntrllr); listenTo(bgEditCntrllr);
......
...@@ -30,8 +30,10 @@ import org.olat.core.gui.translator.Translator; ...@@ -30,8 +30,10 @@ import org.olat.core.gui.translator.Translator;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.id.context.BusinessControlFactory; import org.olat.core.id.context.BusinessControlFactory;
import org.olat.core.id.context.StateSite; import org.olat.core.id.context.StateSite;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.resource.OresHelper; import org.olat.core.util.resource.OresHelper;
import org.olat.util.logging.activity.LoggingResourceable;
/** /**
* <h3>Description:</h3> Instantiates the genericmainctrl for a minimal home * <h3>Description:</h3> Instantiates the genericmainctrl for a minimal home
...@@ -62,6 +64,7 @@ public class HomeSite implements SiteInstance { ...@@ -62,6 +64,7 @@ public class HomeSite implements SiteInstance {
@Override @Override
public MainLayoutController createController(UserRequest ureq, WindowControl wControl) { public MainLayoutController createController(UserRequest ureq, WindowControl wControl) {
OLATResourceable ores = OresHelper.createOLATResourceableInstance(HomeSite.class, ureq.getIdentity().getKey()); OLATResourceable ores = OresHelper.createOLATResourceableInstance(HomeSite.class, ureq.getIdentity().getKey());
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
MainLayoutController c = new HomeMainController(ureq, bwControl); MainLayoutController c = new HomeMainController(ureq, bwControl);
return c; return c;
......
...@@ -40,9 +40,11 @@ import org.olat.core.gui.translator.Translator; ...@@ -40,9 +40,11 @@ import org.olat.core.gui.translator.Translator;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.id.context.BusinessControlFactory; import org.olat.core.id.context.BusinessControlFactory;
import org.olat.core.id.context.StateSite; import org.olat.core.id.context.StateSite;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.resource.OresHelper; import org.olat.core.util.resource.OresHelper;
import org.olat.repository.controllers.RepositoryMainController; import org.olat.repository.controllers.RepositoryMainController;
import org.olat.util.logging.activity.LoggingResourceable;
/** /**
* Description:<br> * Description:<br>
* TODO: Felix Jost Class Description for HomeSite * TODO: Felix Jost Class Description for HomeSite
...@@ -85,6 +87,7 @@ public class RepositorySite implements SiteInstance { ...@@ -85,6 +87,7 @@ public class RepositorySite implements SiteInstance {
// for existing controller which are part of the main olat -> use the controllerfactory // for existing controller which are part of the main olat -> use the controllerfactory
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
OLATResourceable ores = OresHelper.createOLATResourceableInstance(RepositorySite.class, 0l); OLATResourceable ores = OresHelper.createOLATResourceableInstance(RepositorySite.class, 0l);
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, new StateSite(this), wControl, true);
MainLayoutController c = ControllerFactory.createLaunchController(ORES_REPO, null, ureq, bwControl, true); MainLayoutController c = ControllerFactory.createLaunchController(ORES_REPO, null, ureq, bwControl, true);
return c; return c;
......
...@@ -127,6 +127,9 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -127,6 +127,9 @@ public class LoggingResourceable implements ILoggingResourceable {
/** the OlatResourceable if we have one - null otherwise. Used for equals() and the businessPath check mainly **/ /** the OlatResourceable if we have one - null otherwise. Used for equals() and the businessPath check mainly **/
private final OLATResourceable resourceable_; private final OLATResourceable resourceable_;
private final boolean ignorable;
/** /**
* Restrict the given argument to the given number of bytes using UTF-8 encoding. * Restrict the given argument to the given number of bytes using UTF-8 encoding.
* <p> * <p>
...@@ -193,12 +196,22 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -193,12 +196,22 @@ public class LoggingResourceable implements ILoggingResourceable {
* @param id the id to be stored to the database * @param id the id to be stored to the database
* @param name the name to be stored to the database * @param name the name to be stored to the database
*/ */
private LoggingResourceable(OLATResourceable resourceable, ILoggingResourceableType resourceableType, String type, String id, String name) { private LoggingResourceable(OLATResourceable resourceable, ILoggingResourceableType resourceableType, String type, String id, String name, boolean ignorable) {
type_ = restrictStringLength(type, MAX_TYPE_LEN, "type", true); type_ = restrictStringLength(type, MAX_TYPE_LEN, "type", true);
id_ = restrictStringLength(id, MAX_ID_LEN, "id", true); id_ = restrictStringLength(id, MAX_ID_LEN, "id", true);
name_ = restrictStringLength(name, MAX_NAME_LEN, "name", true); name_ = restrictStringLength(name, MAX_NAME_LEN, "name", true);
resourceable_ = resourceable; resourceable_ = resourceable;
resourceableType_ = resourceableType; resourceableType_ = resourceableType;
this.ignorable = ignorable;
}
/**
* These are ignored from the logging.
* @param olatResourceable
* @return
*/
public static LoggingResourceable wrapBusinessPath(OLATResourceable olatResourceable) {
return new LoggingResourceable(olatResourceable, OlatResourceableType.businessPath, "businessPath", "0", "", true);
} }
// //
...@@ -223,7 +236,7 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -223,7 +236,7 @@ public class LoggingResourceable implements ILoggingResourceable {
throw new IllegalArgumentException("olatResourceable must not be null"); throw new IllegalArgumentException("olatResourceable must not be null");
} }
if (olatResourceable.equals(BusinessGroupMainRunController.ORES_TOOLWIKI)) { if (olatResourceable.equals(BusinessGroupMainRunController.ORES_TOOLWIKI)) {
return new LoggingResourceable(olatResourceable, OlatResourceableType.wiki, "wiki", "0", ""); return new LoggingResourceable(olatResourceable, OlatResourceableType.wiki, "wiki", "0", "", false);
} else { } else {
return wrap(olatResourceable, OlatResourceableType.wiki); return wrap(olatResourceable, OlatResourceableType.wiki);
} }
...@@ -239,7 +252,7 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -239,7 +252,7 @@ public class LoggingResourceable implements ILoggingResourceable {
throw new IllegalArgumentException("olatResourceable must not be null"); throw new IllegalArgumentException("olatResourceable must not be null");
} }
if (olatResourceable.equals(BusinessGroupMainRunController.ORES_TOOLPORTFOLIO)) { if (olatResourceable.equals(BusinessGroupMainRunController.ORES_TOOLPORTFOLIO)) {
return new LoggingResourceable(olatResourceable, OlatResourceableType.portfolio, "portfolio", "0", ""); return new LoggingResourceable(olatResourceable, OlatResourceableType.portfolio, "portfolio", "0", "", false);
} else { } else {
return wrap(olatResourceable, OlatResourceableType.portfolio); return wrap(olatResourceable, OlatResourceableType.portfolio);
} }
...@@ -262,14 +275,14 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -262,14 +275,14 @@ public class LoggingResourceable implements ILoggingResourceable {
} }
if (repoEntry!=null) { if (repoEntry!=null) {
return new LoggingResourceable(repoEntry, type, repoEntry.getOlatResource().getResourceableTypeName(), return new LoggingResourceable(repoEntry, type, repoEntry.getOlatResource().getResourceableTypeName(),
String.valueOf(repoEntry.getOlatResource().getResourceableId()), repoEntry.getDisplayname()); String.valueOf(repoEntry.getOlatResource().getResourceableId()), repoEntry.getDisplayname(), false);
} else if (olatResourceable instanceof OLATResource) { } else if (olatResourceable instanceof OLATResource) {
OLATResource olatResource = (OLATResource) olatResourceable; OLATResource olatResource = (OLATResource) olatResourceable;
return new LoggingResourceable(olatResource, type, olatResource.getResourceableTypeName(), return new LoggingResourceable(olatResource, type, olatResource.getResourceableTypeName(),
String.valueOf(olatResource.getResourceableId()), String.valueOf(olatResource.getKey())); String.valueOf(olatResource.getResourceableId()), String.valueOf(olatResource.getKey()), false);
} else { } else {
return new LoggingResourceable(olatResourceable, type, olatResourceable.getResourceableTypeName(), return new LoggingResourceable(olatResourceable, type, olatResourceable.getResourceableTypeName(),
String.valueOf(olatResourceable.getResourceableId()), ""); String.valueOf(olatResourceable.getResourceableId()), "", false);
} }
} }
...@@ -291,7 +304,7 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -291,7 +304,7 @@ public class LoggingResourceable implements ILoggingResourceable {
*/ */
public static LoggingResourceable wrapNonOlatResource(StringResourceableType type, String idForDB, String nameForDB) { public static LoggingResourceable wrapNonOlatResource(StringResourceableType type, String idForDB, String nameForDB) {
return new LoggingResourceable(null, type, return new LoggingResourceable(null, type,
type.name(), idForDB, nameForDB); type.name(), idForDB, nameForDB, false);
} }
/** /**
...@@ -371,7 +384,7 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -371,7 +384,7 @@ public class LoggingResourceable implements ILoggingResourceable {
name = forumMessages.get(0).getTitle(); name = forumMessages.get(0).getTitle();
} }
return new LoggingResourceable(forum, OlatResourceableType.forum, forum.getResourceableTypeName(), return new LoggingResourceable(forum, OlatResourceableType.forum, forum.getResourceableTypeName(),
String.valueOf(forum.getResourceableId()), name); String.valueOf(forum.getResourceableId()), name, false);
} }
/** /**
...@@ -381,7 +394,7 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -381,7 +394,7 @@ public class LoggingResourceable implements ILoggingResourceable {
*/ */
public static LoggingResourceable wrap(Message forumMessage) { public static LoggingResourceable wrap(Message forumMessage) {
return new LoggingResourceable(OresHelper.createOLATResourceableInstance(Message.class, forumMessage.getKey()), OlatResourceableType.forumMessage, OlatResourceableType.forumMessage.name(), return new LoggingResourceable(OresHelper.createOLATResourceableInstance(Message.class, forumMessage.getKey()), OlatResourceableType.forumMessage, OlatResourceableType.forumMessage.name(),
String.valueOf(forumMessage.getKey()), forumMessage.getTitle()); String.valueOf(forumMessage.getKey()), forumMessage.getTitle(), false);
} }
/** /**
...@@ -394,7 +407,7 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -394,7 +407,7 @@ public class LoggingResourceable implements ILoggingResourceable {
// truncate title after 230 chars // truncate title after 230 chars
if (title.length() > 230) title = title.substring(0, 229); if (title.length() > 230) title = title.substring(0, 229);
return new LoggingResourceable(feed, OlatResourceableType.feed, feed.getResourceableTypeName(), return new LoggingResourceable(feed, OlatResourceableType.feed, feed.getResourceableTypeName(),
String.valueOf(feed.getResourceableId()), title); String.valueOf(feed.getResourceableId()), title, false);
} }
/** /**
...@@ -428,7 +441,7 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -428,7 +441,7 @@ public class LoggingResourceable implements ILoggingResourceable {
name = DEFAULT_COURSE_GROUP_CONTEXT_NAME; name = DEFAULT_COURSE_GROUP_CONTEXT_NAME;
} }
return new LoggingResourceable(bgContext, OlatResourceableType.bgContext, bgContext.getGroupType(), return new LoggingResourceable(bgContext, OlatResourceableType.bgContext, bgContext.getGroupType(),
String.valueOf(bgContext.getResourceableId()), name); String.valueOf(bgContext.getResourceableId()), name, false);
} }
/** /**
...@@ -438,7 +451,7 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -438,7 +451,7 @@ public class LoggingResourceable implements ILoggingResourceable {
*/ */
public static LoggingResourceable wrap(BusinessGroup group) { public static LoggingResourceable wrap(BusinessGroup group) {
return new LoggingResourceable(group, OlatResourceableType.businessGroup, group.getResourceableTypeName(), return new LoggingResourceable(group, OlatResourceableType.businessGroup, group.getResourceableTypeName(),
String.valueOf(group.getKey()), group.getName()); String.valueOf(group.getKey()), group.getName(), false);
} }
/** /**
...@@ -448,7 +461,7 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -448,7 +461,7 @@ public class LoggingResourceable implements ILoggingResourceable {
*/ */
public static LoggingResourceable wrap(ICourse course) { public static LoggingResourceable wrap(ICourse course) {
return new LoggingResourceable(course, OlatResourceableType.course, course.getResourceableTypeName(), return new LoggingResourceable(course, OlatResourceableType.course, course.getResourceableTypeName(),
String.valueOf(course.getResourceableId()), course.getCourseTitle()); String.valueOf(course.getResourceableId()), course.getCourseTitle(), false);
} }
/** /**
...@@ -465,10 +478,10 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -465,10 +478,10 @@ public class LoggingResourceable implements ILoggingResourceable {
Long id = Long.parseLong(ident); Long id = Long.parseLong(ident);
return new LoggingResourceable(OresHelper.createOLATResourceableInstance("CourseNode", id), OlatResourceableType.node, typeForLogging, return new LoggingResourceable(OresHelper.createOLATResourceableInstance("CourseNode", id), OlatResourceableType.node, typeForLogging,
node.getIdent(), name); node.getIdent(), name, false);
} catch(NumberFormatException nfe) { } catch(NumberFormatException nfe) {
return new LoggingResourceable(null, OlatResourceableType.node, typeForLogging, return new LoggingResourceable(null, OlatResourceableType.node, typeForLogging,
node.getIdent(), name); node.getIdent(), name, false);
} }
} }
...@@ -533,6 +546,11 @@ public class LoggingResourceable implements ILoggingResourceable { ...@@ -533,6 +546,11 @@ public class LoggingResourceable implements ILoggingResourceable {
return resourceableType_; return resourceableType_;
} }
@Override
public boolean isIgnorable() {
return ignorable;
}
@Override @Override
public int hashCode() { public int hashCode() {
return type_.hashCode()+(id_!=null ? id_.hashCode() : 1)+(resourceable_!=null ? resourceable_.getResourceableTypeName().hashCode()+(int)resourceable_.getResourceableId().longValue() : 0) + (resourceableType_!=null ? resourceableType_.hashCode() : 0); return type_.hashCode()+(id_!=null ? id_.hashCode() : 1)+(resourceable_!=null ? resourceable_.getResourceableTypeName().hashCode()+(int)resourceable_.getResourceableId().longValue() : 0) + (resourceableType_!=null ? resourceableType_.hashCode() : 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment