Package mc.core.domain.base.aspect
Class AspectState<T extends ComplexEntity>
java.lang.Object
mc.core.system.base.BaseBean
mc.core.domain.base.dobj.AbstractAspect<T>
mc.core.domain.base.aspect.AspectState<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoStateTransition(IStateManaged entity, StateTransitionType stateTransitionType, Locale locale, String message) executes the transition and changes the state of the object.filterByEditAllowed(List<T> entityListToCheck) Deprecated.filterByEditAllowed(List<T> entityListToCheck, User user, Locale locale) IMPORTANT CHANGES V13 - no fallback to getContentLocale more!
filter list by edit allowed state pro object
seeisEditAllowed(IStateManaged, User, Locale)filterByEditAllowed(List<T> entityListToCheck, Locale locale) getAllowedStateTransitionTypes(T entity, StateGroupType stateGroupType, Locale locale) returns all stateTransitionTypes for the current User, the specified stateGroup and the localemc.core.system.util.misc.Pair<List<State>,List<StateGroupType>> getStatesPreventingEdit(IStateManaged entity, User user, Locale locale, boolean failFast) IMPORTANT CHANGES V13 - no fallback to getContentLocale more!insertDefaultState(IStateManaged entity, StateGroupType stateGroupType, Locale locale) if a stateGroup has been added to complexEntityType when already complex entities exist insert the default state for these entitiesvoidinsertLocaleState(IStateManaged entity, Locale locale) sets insert state for each configured stateGroupType in given locale.booleanisEditAllowed(IStateManaged entity, User user, Locale locale) IMPORTANT CHANGES V13 - no fallback to getContentLocale more!
checks if object is in edit state for session user for all state groups that require an edit state.
If state group is language dependent checks on given locale.setState(IStateManaged entity, StateType stateType, boolean recursive, Locale locale) sets given state for given entity.
-
Constructor Details
-
AspectState
public AspectState()
-
-
Method Details
-
filterByEditAllowed
Deprecated.IMPORTANT CHANGES V13 - no fallback to getContentLocale more!
use better filterByEditAllowed(ListentityListToCheck, Locale locale) - Parameters:
entityListToCheck-- Returns:
-
filterByEditAllowed
-
filterByEditAllowed
IMPORTANT CHANGES V13 - no fallback to getContentLocale more!
filter list by edit allowed state pro object
seeisEditAllowed(IStateManaged, User, Locale) -
isEditAllowed
IMPORTANT CHANGES V13 - no fallback to getContentLocale more!
checks if object is in edit state for session user for all state groups that require an edit state.
If state group is language dependent checks on given locale.- Parameters:
locale- optional, if null -> check edit structure and edit state in ALL locales not in content locale only!
-
getStatesPreventingEdit
public mc.core.system.util.misc.Pair<List<State>,List<StateGroupType>> getStatesPreventingEdit(IStateManaged entity, User user, Locale locale, boolean failFast) IMPORTANT CHANGES V13 - no fallback to getContentLocale more!- Parameters:
entity- mandatoryuser- mandatorylocale- optional IMPORTANT CHANGES V13(#15828) changed logic !!! ->
no fallback to content locale more if null -> check all language dependent states instead.- Returns:
- returns null if entity is editable by current user. Otherwise returns pair: left contains list of states that prevent current user from editing given entity, or a empty list. Right contains StateGroupTypes for which entity has no state, thus also preventing editing, or empty list.
-
insertDefaultState
public State insertDefaultState(IStateManaged entity, StateGroupType stateGroupType, Locale locale) throws ApplicationException if a stateGroup has been added to complexEntityType when already complex entities exist insert the default state for these entities- Parameters:
entity- mandatorystateGroupType- mandatorylocale- optional, default is content locale- Returns:
- inserted state entity
- Throws:
ApplicationException
-
insertLocaleState
sets insert state for each configured stateGroupType in given locale. Also inserts first version for given locale- Parameters:
entity- mandatorylocale- optional, default is content locale- Throws:
ApplicationException
-
setState
public State setState(IStateManaged entity, StateType stateType, boolean recursive, Locale locale) throws ApplicationException sets given state for given entity. Overwrites old state for same stateGroup. handles setting of locale regarding the language dependency of stateGroup. Is stateGroup is language dependent and no locale is specified uses content locale.- Parameters:
entity- mandatorystateType- mandatoryrecursive- boolean: if entity is hierarchical entity also sets this state for all children.locale- optional, default is content locale, or undefinedLocale for locale independent states- Returns:
- state set
- Throws:
ApplicationException- the application exception
-
doStateTransition
public void doStateTransition(IStateManaged entity, StateTransitionType stateTransitionType, Locale locale, String message) throws ApplicationException executes the transition and changes the state of the object. Calls on StateTransitionHandler before and after transition, if a handler is configured- Parameters:
entity- mandatorystateTransitionType- mandatorylocale- optional, default is contentLocale or undefined locale for locale independent statesmessage- optional- Throws:
ApplicationException
-
getAllowedStateTransitionTypes
public List<StateTransitionType> getAllowedStateTransitionTypes(T entity, StateGroupType stateGroupType, Locale locale) throws ApplicationException returns all stateTransitionTypes for the current User, the specified stateGroup and the locale- Parameters:
entity- mandatorystateGroupType- mandatorylocale- optional- Returns:
- stateTransitionType list, never null
- Throws:
ApplicationException
-