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 Entity
Entity.State -
Field Summary
Fields inherited from class AbstractEntityWrapper
entity -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class AbstractEntityWrapper
getAutoFieldsDisabled, getChangedFields, getContext, getFieldModel, getKey, getLogger, getManager, getModel, getOldValue, getRelatedEntity, getRelatedEntityOrNull, getState, getTouchedRelations, getValue, getValue, getValue, getValue, getValue, getValue, getValueMap, isFieldChanged, resolve, setAutoFieldsDisabled, unwrap, validateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Entity
getBool, getDate, getDateTime, getDecimal, getDouble, getFloat, getInt, getLong, getShort, getString, getTime, hasKey, requireBool, requireDate, requireDateTime, requireDecimal, requireDouble, requireFloat, requireInt, requireKey, requireLong, requireOldValue, requireShort, requireString, requireTime, requireValue, requireValue, requireValue, requireValue, requireValue, requireValue, validate
-
Constructor Details
-
UnmodifiableEntityWrapper
-
-
Method Details
-
setValue
Description copied from interface:EntitySet 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.Convertercontributed. 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:
setValuein interfaceEntity- Overrides:
setValuein 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.UnauthorizedExceptionIf the user does not have the permission to set/change the value.
-
delete
public final void delete()Description copied from interface:EntityDelete the entity.- Specified by:
deletein interfaceEntity- Overrides:
deletein classAbstractEntityWrapper
-
joinTx
public final void joinTx()Description copied from interface:EntityJoins the current transaction.- Specified by:
joinTxin interfaceEntity- Overrides:
joinTxin classAbstractEntityWrapper
-
isUpdatable
public final boolean isUpdatable()Description copied from interface:EntityDetermine whether the entity is updatable.- Specified by:
isUpdatablein interfaceEntity- Overrides:
isUpdatablein classAbstractEntityWrapper- Returns:
true, if the entity is updatable,false, if it's read-only.
-