Class UnmodifiableEntityWrapper
java.lang.Object
ch.tocco.nice2.persist.core.api.entity.entitywrappers.AbstractEntityWrapper
ch.tocco.nice2.persist.core.api.entity.entitywrappers.UnmodifiableEntityWrapper
- All Implemented Interfaces:
EntityReference
,Entity
Wrapper for making an entity unmodifiable.
All modifying methods throw an UnsupportedOperationException.
Note that relations are still modifiable.
Use Entities.unmodifiableEntity(myEntity)
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.persist.core.api.entity.Entity
Entity.State
-
Field Summary
Fields inherited from class ch.tocco.nice2.persist.core.api.entity.entitywrappers.AbstractEntityWrapper
entity
-
Constructor Summary
-
Method Summary
Methods inherited from class ch.tocco.nice2.persist.core.api.entity.entitywrappers.AbstractEntityWrapper
getAutoFieldsDisabled, getChangedFields, getContext, getFieldModel, getKey, getLogger, getManager, getModel, getOldValue, getRelatedEntity, getRelatedEntityOrNull, getState, getTouchedFields, getTouchedRelations, getValue, getValue, getValue, getValue, getValue, getValue, getValueMap, isFieldChanged, isFieldTouched, resolve, setAutoFieldsDisabled, unwrap, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.persist.core.api.entity.Entity
getBool, getDate, getDateTime, getDecimal, getDouble, getFloat, getInt, getLong, getShort, getString, getTime, hasKey, requireBool, requireDate, requireDateTime, requireDecimal, requireDouble, requireFloat, requireInt, requireKey, requireLong, requireShort, requireString, requireTime, requireValue, requireValue, requireValue, requireValue, requireValue, requireValue, validate
-
Constructor Details
-
UnmodifiableEntityWrapper
-
-
Method Details
-
setValue
Description copied from interface:Entity
Set the value of a field.In the current implementation no content validation is made on this method call - other than null on a non-nullable field. Validation happens when storing, when all values have been set.
The value must either be in the correct data type, or convertible. To be convertible there must be a
ch.tocco.nice2.types.spi.Converter
contributed. Note that not all kinds of conversions that seem obvious at first are registered, for example there is no string to integer converter and thus a value like "" won't work and set 0 on an int field. Setting an int 0 on a long field works though because there is an int to long type converter.- Specified by:
setValue
in interfaceEntity
- Overrides:
setValue
in classAbstractEntityWrapper
- Parameters:
field
- The name of the field.value
- The new value in the expected data type, or in a conversible type of it. Throwsch.tocco.nice2.security.UnauthorizedException
If the user does not have the permission to set/change the value.
-
delete
public final void delete()Description copied from interface:Entity
Delete the entity.- Specified by:
delete
in interfaceEntity
- Overrides:
delete
in classAbstractEntityWrapper
-
joinTx
public final void joinTx()Description copied from interface:Entity
Joins the current transaction.- Specified by:
joinTx
in interfaceEntity
- Overrides:
joinTx
in classAbstractEntityWrapper
-
isUpdatable
public final boolean isUpdatable()Description copied from interface:Entity
Determine whether the entity is updatable.- Specified by:
isUpdatable
in interfaceEntity
- Overrides:
isUpdatable
in classAbstractEntityWrapper
- Returns:
true
, if the entity is updatable,false
, if it's read-only.
-