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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Determines if the status has to be forced if there is no status yet This case can happen if a data is newly externalizableRetrieves the contextMap
that is used to determine if a data is externalizableDetermines which values (locals or externals) have to be synchronizedstatic SynchronizationContext
Creates a new instance of aSynchronizationContext
boolean
Checks if synchronization has to use the default value from the modelwithDefaultFromModel
(boolean useDefaultFromModel) Set totrue
to use the default value from the model (default tofalse
)withExternalizableDataContextEntry
(String entryKey, Object entryValue) Add an entry in the contextMap
that is used to determine if a data is externalizablewithStatus
(ExternalizableDataProvider.ExternalizableDataStatus externalizableDataStatus) Sets the status to determine which values (locals or externals) have to be synchronized (default to local)withStatusForcedIfNotPresent
(boolean forceStatusIfNotPresent) Set tofalse
if 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:
true
to use the default value from the model,false
otherwise
-
withDefaultFromModel
Set totrue
to use the default value from the model (default tofalse
)- Parameters:
useDefaultFromModel
-true
to use the default value from the model,false
otherwise- 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 contextMap
that 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 contextMap
that 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:
true
if the status has to be forced,false
otherwise
-
withStatusForcedIfNotPresent
Set tofalse
if the status has not to be forced (default totrue
)- Parameters:
forceStatusIfNotPresent
-true
to force the status if it is not yet present,false
otherwise- Returns:
- the current
SynchronizationContext
-