Package ch.tocco.nice2.businessunit.api
Class BusinessUnitChange
java.lang.Object
ch.tocco.nice2.businessunit.api.BusinessUnitChange
Describes changing the business unit. The business unit is changed using
BusinessUnitManager.withBusinessUnit(BusinessUnitChange)
. The code
executed by the invoker is running in the given business unit. By default,
the principal is logged into the new business unit since now the policy may
have changed. If the code is known to be executed in privileged mode, this
is not necessary and can be skipped (the policy of the current user does not
matter when running privileged). This is possible to specify using noLogin()
.
If this is used with persistence related code, consider using PersistTask
s,
see TaskModes.BUSINESS_UNIT
which detects automatically when in privileged mode
and uses the invoker accordingly.-
Method Summary
Modifier and TypeMethodDescriptionallows the setting and removal of business unit relations with typeBusinessUnitType.SINGLE
orBusinessUnitType.OPTIONAL
boolean
forbids the setting and removal of business unit relations with typeBusinessUnitType.SINGLE
orBusinessUnitType.OPTIONAL
int
hashCode()
boolean
boolean
noLogin()
The principal is **not** logged into the new business unit, leaving the policy corresponding to the old business unit in place.static BusinessUnitChange
to
(BusinessUnit unit) static BusinessUnitChange
static BusinessUnitChange
-
Method Details
-
to
-
to
-
toNullBusinessUnit
-
noLogin
The principal is **not** logged into the new business unit, leaving the policy corresponding to the old business unit in place. Use this only, if the whole code is known to run in privileged mode.- Returns:
- a new
BusinessUnitChange
-
getBusinessUnit
-
isReloginPrincipal
public boolean isReloginPrincipal() -
allowResetting
allows the setting and removal of business unit relations with typeBusinessUnitType.SINGLE
orBusinessUnitType.OPTIONAL
- Returns:
- copy of this with resettingAllowed set to true
-
forbidResetting
forbids the setting and removal of business unit relations with typeBusinessUnitType.SINGLE
orBusinessUnitType.OPTIONAL
- Returns:
- copy of this with resettingAllowed set to false
-
isResettingAllowed
public boolean isResettingAllowed()- Returns:
- whether the setting and removal of business unit relations with type
BusinessUnitType.SINGLE
orBusinessUnitType.OPTIONAL
should be allowed
-
equals
-
hashCode
public int hashCode()
-