Package org.nuxeo.ecm.localconf
Class SimpleConfigurationAdapter
- java.lang.Object
-
- org.nuxeo.ecm.core.api.localconfiguration.AbstractLocalConfiguration<SimpleConfiguration>
-
- org.nuxeo.ecm.localconf.SimpleConfigurationAdapter
-
- All Implemented Interfaces:
DetachedAdapter
,LocalConfiguration<SimpleConfiguration>
,SimpleConfiguration
- Direct Known Subclasses:
SimpleUserPreferences
public class SimpleConfigurationAdapter extends AbstractLocalConfiguration<SimpleConfiguration> implements SimpleConfiguration
Default implementation ofSimpleConfiguration
.- Since:
- 5.5
- Author:
- Thomas Roger
- See Also:
SimpleConfiguration
-
-
Field Summary
Fields Modifier and Type Field Description protected DocumentModel
detachedDocument
protected Map<String,String>
parameters
-
Fields inherited from interface org.nuxeo.ecm.localconf.SimpleConfiguration
SIMPLE_CONFIGURATION_FACET, SIMPLE_CONFIGURATION_PARAMETER_KEY, SIMPLE_CONFIGURATION_PARAMETER_VALUE, SIMPLE_CONFIGURATION_PARAMETERS_PROPERTY, SIMPLE_CONFIGURATION_SCHEMA
-
-
Constructor Summary
Constructors Constructor Description SimpleConfigurationAdapter(DocumentModel doc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canMerge()
Returnstrue
if thisLocalConfiguration
accepted to be merged with a parent configuration,false
otherwise.protected List<Map<String,String>>
computeParametersForDocument(Map<String,String> parameters)
protected Map<String,String>
computeParametersFromDocument(DocumentModel doc)
String
get(String key)
Returns the value to which the specifiedkey
is mapped, ornull
if there is no mapping for thekey
.String
get(String key, String defaultValue)
Returns the value to which the specified key is mapped, or the given default value if there is no mapping for the key.DocumentRef
getDocumentRef()
Returns the relatedDocumentRef
of this local configuration.protected void
loadFromDocument(DocumentModel doc)
SimpleConfiguration
merge(SimpleConfiguration other)
Merge thisLocalConfiguration
with another one.String
put(String key, String value)
Associates the specified value with the specified key.void
putAll(Map<String,String> parameters)
Copies all of the parameters from the specified map to this Simple configurationvoid
save(CoreSession session)
Save this LocalConfiguration.
-
-
-
Field Detail
-
detachedDocument
protected DocumentModel detachedDocument
-
-
Constructor Detail
-
SimpleConfigurationAdapter
public SimpleConfigurationAdapter(DocumentModel doc)
-
-
Method Detail
-
loadFromDocument
protected void loadFromDocument(DocumentModel doc)
-
computeParametersFromDocument
protected Map<String,String> computeParametersFromDocument(DocumentModel doc)
-
get
public String get(String key)
Description copied from interface:SimpleConfiguration
Returns the value to which the specifiedkey
is mapped, ornull
if there is no mapping for thekey
.- Specified by:
get
in interfaceSimpleConfiguration
- Parameters:
key
- the key whose associated value is to be returned
-
get
public String get(String key, String defaultValue)
Description copied from interface:SimpleConfiguration
Returns the value to which the specified key is mapped, or the given default value if there is no mapping for the key.- Specified by:
get
in interfaceSimpleConfiguration
- Parameters:
key
- the key whose associated value is to be returneddefaultValue
- the value returned if there is no mapping for the key
-
put
public String put(String key, String value)
Description copied from interface:SimpleConfiguration
Associates the specified value with the specified key.If the map previously contained a mapping for the key, the old value is replaced by the specified value.
- Specified by:
put
in interfaceSimpleConfiguration
- Parameters:
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key- Returns:
- the previous value associated with
key
, ornull
if there was no mapping forkey
.
-
putAll
public void putAll(Map<String,String> parameters)
Description copied from interface:SimpleConfiguration
Copies all of the parameters from the specified map to this Simple configuration- Specified by:
putAll
in interfaceSimpleConfiguration
- Parameters:
parameters
- parameters to be stored in this Simple configuration
-
getDocumentRef
public DocumentRef getDocumentRef()
Description copied from interface:LocalConfiguration
Returns the relatedDocumentRef
of this local configuration.- Specified by:
getDocumentRef
in interfaceLocalConfiguration<SimpleConfiguration>
-
canMerge
public boolean canMerge()
Description copied from interface:LocalConfiguration
Returnstrue
if thisLocalConfiguration
accepted to be merged with a parent configuration,false
otherwise.- Specified by:
canMerge
in interfaceLocalConfiguration<SimpleConfiguration>
- Overrides:
canMerge
in classAbstractLocalConfiguration<SimpleConfiguration>
-
merge
public SimpleConfiguration merge(SimpleConfiguration other)
Description copied from interface:LocalConfiguration
Merge thisLocalConfiguration
with another one.- Specified by:
merge
in interfaceLocalConfiguration<SimpleConfiguration>
- Overrides:
merge
in classAbstractLocalConfiguration<SimpleConfiguration>
-
save
public void save(CoreSession session)
Description copied from interface:LocalConfiguration
Save this LocalConfiguration.- Specified by:
save
in interfaceLocalConfiguration<SimpleConfiguration>
- Overrides:
save
in classAbstractLocalConfiguration<SimpleConfiguration>
-
-