|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.olat.core.logging.activity.CoreLoggingResourceable
public class CoreLoggingResourceable
Core implementation for LoggingResourceable - i.e. contains those LoggingResourceables that are known in the olatcore.
A LoggingResourceable is the least common denominator between an OlatResourceable, an OlatResource, a RepositoryEntry and simple Strings - all of which want to be used as (greatGrandParent,grandParent,parent,target) resources in the logging table.
The idea of this class is to have one class containing the three fields
Besides the above (container for the triple type/id/name) it serves the purpose of doing checks between the businessPath/contextEntries and the ThreadLocalUserActivityLogger's LoggingResourceables which have been collected all the way from the initial request creating a particular Controller to the actual event handling method calling into IUserActivityLogger.log() - optionally passing additional LoggingResourceables.
The above check is done as a testing means to assure the data we're logging matches what we expect it to contain.
This way we avoid difficult if not unrealistic testing of the use of this IUserActivityLogging framework.
If a comparison with the businessPath fails, a simple (technical) log.WARN is issued. This should then be noticed by the system administrator hence feeding back into a patch or a fix for the next release.
Initial Date: 20.10.2009
| Method Summary | |
|---|---|
boolean |
correspondsTo(ContextEntry ce)
Checks whether this LoggingResourceable represents the same resource as the given ContextEntry. |
boolean |
equals(java.lang.Object obj)
|
java.lang.String |
getId()
Returns the id of this LoggingResourceable - the id varies depending on the type of this LoggingResourceable - but usually it is the olatresourceable id or the olatresource id. |
java.lang.String |
getName()
Returns the name of this LoggingResourceable - the name varies depending on the type of this LoggingResource - e.g. |
ILoggingResourceableType |
getResourceableType()
Returns the ILoggingResourceableType of this LoggingResourceable - used for businessPath checking |
java.lang.String |
getType()
Returns the type of this LoggingResourceable - this is the OlatResourceable's type (in case this LoggingResource represents a OlatResourceable) - or the StringResourceableType's enum name() otherwise |
int |
hashCode()
|
java.lang.String |
toString()
|
static CoreLoggingResourceable |
wrap(Identity identity)
Wraps an Identity as type StringResourceableType.targetIdentity into a LoggingResourceable |
static CoreLoggingResourceable |
wrap(OLATResourceable olatResourceable,
ILoggingResourceableType type)
General wrapper for an OlatResourceable - as it's not obvious of what type that OlatResourceable is (in terms of being able to later compare it against the businessPath etc) an ILoggingResourceableType needs to be passed to this method as well. |
static CoreLoggingResourceable |
wrapBCFile(java.lang.String bcFileName)
Wraps a filename as type StringResourceableType.bcFile into a LoggingResourceable |
static CoreLoggingResourceable |
wrapBGRight(java.lang.String right)
Wraps a businessgroup right as type StringResourceableType.bgRight into a LoggingResourceable |
static CoreLoggingResourceable |
wrapCpNode(java.lang.String cpNodeName)
Wraps a cpNodeName as type StringResourceableType.cpNode into a LoggingResourceable |
static CoreLoggingResourceable |
wrapNonOlatResource(StringResourceableType type,
java.lang.String idForDB,
java.lang.String nameForDB)
General wrapper for non OlatResourceable types - i.e. |
static CoreLoggingResourceable |
wrapSpUri(java.lang.String spUri)
Wraps a single page uri as type StringResourceableType.spUri into a LoggingResourceable |
static CoreLoggingResourceable |
wrapUploadFile(java.lang.String uploadFileName)
Wraps a filename as type StringResourceableType.uploadFile into a LoggingResourceable |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static CoreLoggingResourceable wrapNonOlatResource(StringResourceableType type,
java.lang.String idForDB,
java.lang.String nameForDB)
The LoggingResourceable always needs to have an ILoggingResourceableType - therefore it needs to be passed to this method.
Note that the typeForDB (so to speak) is set to ILoggingResourceableType.name().
Also note that there are a few further specialized wrapXXX(String) methods for selected StringResourceableTypes.
type - the ILoggingResourceableType which corresponds the given id/name informationidForDB - the id - to be stored to the databasenameForDB - the name - to be stored to the database
public static CoreLoggingResourceable wrapUploadFile(java.lang.String uploadFileName)
uploadFileName - the filename - to be stored to the database in the name field
public static CoreLoggingResourceable wrapBCFile(java.lang.String bcFileName)
bcFileName - the filename - to be stored to the database in the name field
public static CoreLoggingResourceable wrapCpNode(java.lang.String cpNodeName)
cpNodeName - the node name - to be stored to the database in the name field
public static CoreLoggingResourceable wrapSpUri(java.lang.String spUri)
spUri - the single page uri - to be stored to the database in the name field
public static CoreLoggingResourceable wrapBGRight(java.lang.String right)
right - the name of the businessgroup right - to be stored to the database in the name field
public static CoreLoggingResourceable wrap(Identity identity)
identity - the identity - to be stored to the database in the name field
public static CoreLoggingResourceable wrap(OLATResourceable olatResourceable,
ILoggingResourceableType type)
olatResourceable - a general OlatResourceabletype - the type of the olatResourceable
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getType()
getType in interface ILoggingResourceablepublic java.lang.String getId()
getId in interface ILoggingResourceablepublic java.lang.String getName()
getName in interface ILoggingResourceablepublic ILoggingResourceableType getResourceableType()
getResourceableType in interface ILoggingResourceablepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic boolean correspondsTo(ContextEntry ce)
This is used during the businessPath check.
correspondsTo in interface ILoggingResourceablece -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||