Class SynchronizationContext
java.lang.Object
org.ametys.plugins.repository.data.holder.values.SynchronizationContext
- Direct Known Subclasses:
ContentSynchronizationContext
Object that gives some context for values synchronization
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if the status has to be forced if there is no status yet This case can happen if a data is newly externalizableRetrieves the contextMapthat is used to determine if a data is externalizableDetermines which values (locals or externals) have to be synchronizedbooleanDetermines if values that are incompatible with their data type (defined in model) have to be ignored Iffalse(default behavior), aBadItemTypeExceptionis thrown if a value to synchronize is incompatible with its type Iftrue, such values are ignored.static SynchronizationContextCreates a new instance of aSynchronizationContextbooleanChecks if synchronization has to use the default value from the modelwithDefaultFromModel(boolean useDefaultFromModel) Set totrueto use the default value from the model (default tofalse)withExternalizableDataContextEntry(String entryKey, Object entryValue) Add an entry in the contextMapthat is used to determine if a data is externalizablewithIncompatibleValuesIgnored(boolean ignoreIncompatibleValues) Set totrueto ignore values that are incompatible with their data type (defined in model) (default tofalsewithStatus(ExternalizableDataProvider.ExternalizableDataStatus externalizableDataStatus) Sets the status to determine which values (locals or externals) have to be synchronized (default to local)withStatusForcedIfNotPresent(boolean forceStatusIfNotPresent) Set tofalseif the status has not to be forced (default totrue)
-
Constructor Details
-
SynchronizationContext
protected SynchronizationContext()Creates a new instance of aSynchronizationContext
-
-
Method Details
-
newInstance
Creates a new instance of aSynchronizationContext- Returns:
- the created instance
-
useDefaultFromModel
Checks if synchronization has to use the default value from the model- Returns:
trueto use the default value from the model,falseotherwise
-
withDefaultFromModel
Set totrueto use the default value from the model (default tofalse)- Parameters:
useDefaultFromModel-trueto use the default value from the model,falseotherwise- Returns:
- the current
SynchronizationContext
-
getStatusToSynchronize
Determines which values (locals or externals) have to be synchronized- Returns:
- the status of the value to synchronize
-
withStatus
public SynchronizationContext withStatus(ExternalizableDataProvider.ExternalizableDataStatus externalizableDataStatus) Sets the status to determine which values (locals or externals) have to be synchronized (default to local)- Parameters:
externalizableDataStatus- the status to determine which values have to be synchronized- Returns:
- the current
SynchronizationContext
-
getExternalizableDataContext
Retrieves the contextMapthat is used to determine if a data is externalizable- Returns:
- the context
Map
-
withExternalizableDataContextEntry
public SynchronizationContext withExternalizableDataContextEntry(String entryKey, Object entryValue) Add an entry in the contextMapthat is used to determine if a data is externalizable- Parameters:
entryKey- the key of the entryentryValue- the value of the entry- Returns:
- the current
SynchronizationContext
-
forceStatusIfNotPresent
Determines if the status has to be forced if there is no status yet This case can happen if a data is newly externalizable- Returns:
trueif the status has to be forced,falseotherwise
-
withStatusForcedIfNotPresent
Set tofalseif the status has not to be forced (default totrue)- Parameters:
forceStatusIfNotPresent-trueto force the status if it is not yet present,falseotherwise- Returns:
- the current
SynchronizationContext
-
ignoreIncompatibleValues
Determines if values that are incompatible with their data type (defined in model) have to be ignored Iffalse(default behavior), aBadItemTypeExceptionis thrown if a value to synchronize is incompatible with its type Iftrue, such values are ignored. No exception is thrown- Returns:
trueif incompatible values have to be ignored,falseotherwise
-
withIncompatibleValuesIgnored
Set totrueto ignore values that are incompatible with their data type (defined in model) (default tofalse- Parameters:
ignoreIncompatibleValues-trueto ignore incompatible values,falseotherwise- Returns:
- the current
SynchronizationContext
-