Class SynchronizationContext
- java.lang.Object
-
- org.ametys.plugins.repository.data.holder.values.SynchronizationContext
-
- Direct Known Subclasses:
ContentSynchronizationContext
public class SynchronizationContext extends Object
Object that gives some context for values synchronization
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSynchronizationContext()Creates a new instance of aSynchronizationContext
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanforceStatusIfNotPresent()Determines if the status has to be forced if there is no status yet This case can happen if a data is newly externalizableMap<String,Object>getExternalizableDataContext()Retrieves the contextMapthat is used to determine if a data is externalizableExternalizableDataProvider.ExternalizableDataStatusgetStatusToSynchronize()Determines which values (locals or externals) have to be synchronizedstatic SynchronizationContextnewInstance()Creates a new instance of aSynchronizationContextbooleanuseDefaultFromModel()Checks if synchronization has to use the default value from the modelSynchronizationContextwithDefaultFromModel(boolean useDefaultFromModel)Set totrueto use the default value from the model (default tofalse)SynchronizationContextwithExternalizableDataContextEntry(String entryKey, Object entryValue)Add an entry in the contextMapthat is used to determine if a data is externalizableSynchronizationContextwithStatus(ExternalizableDataProvider.ExternalizableDataStatus externalizableDataStatus)Sets the status to determine which values (locals or externals) have to be synchronized (default to local)SynchronizationContextwithStatusForcedIfNotPresent(boolean forceStatusIfNotPresent)Set tofalseif the status has not to be forced (default totrue)
-
-
-
Constructor Detail
-
SynchronizationContext
protected SynchronizationContext()
Creates a new instance of aSynchronizationContext
-
-
Method Detail
-
newInstance
public static SynchronizationContext newInstance()
Creates a new instance of aSynchronizationContext- Returns:
- the created instance
-
useDefaultFromModel
public boolean useDefaultFromModel()
Checks if synchronization has to use the default value from the model- Returns:
trueto use the default value from the model,falseotherwise
-
withDefaultFromModel
public SynchronizationContext withDefaultFromModel(boolean useDefaultFromModel)
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
public ExternalizableDataProvider.ExternalizableDataStatus 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
public Map<String,Object> 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
public boolean 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
public SynchronizationContext withStatusForcedIfNotPresent(boolean forceStatusIfNotPresent)
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
-
-