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 protected
SynchronizationContext()
Creates a new instance of aSynchronizationContext
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 externalizableMap<String,Object>
getExternalizableDataContext()
Retrieves the contextMap
that is used to determine if a data is externalizableExternalizableDataProvider.ExternalizableDataStatus
getStatusToSynchronize()
Determines which values (locals or externals) have to be synchronizedstatic SynchronizationContext
newInstance()
Creates a new instance of aSynchronizationContext
boolean
useDefaultFromModel()
Checks if synchronization has to use the default value from the modelSynchronizationContext
withDefaultFromModel(boolean useDefaultFromModel)
Set totrue
to use the default value from the model (default tofalse
)SynchronizationContext
withExternalizableDataContextEntry(String entryKey, Object entryValue)
Add an entry in the contextMap
that is used to determine if a data is externalizableSynchronizationContext
withStatus(ExternalizableDataProvider.ExternalizableDataStatus externalizableDataStatus)
Sets the status to determine which values (locals or externals) have to be synchronized (default to local)SynchronizationContext
withStatusForcedIfNotPresent(boolean forceStatusIfNotPresent)
Set tofalse
if 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:
true
to use the default value from the model,false
otherwise
-
withDefaultFromModel
public SynchronizationContext withDefaultFromModel(boolean useDefaultFromModel)
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
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 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
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:
true
if the status has to be forced,false
otherwise
-
withStatusForcedIfNotPresent
public SynchronizationContext withStatusForcedIfNotPresent(boolean forceStatusIfNotPresent)
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
-
-