Package org.ametys.cms.data.type.impl
Class UserRepositoryElementType
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.model.type.AbstractModelItemType
-
- org.ametys.core.model.type.AbstractElementType<UserIdentity>
-
- org.ametys.cms.data.type.AbstractUserElementType
-
- org.ametys.cms.data.type.impl.UserRepositoryElementType
-
- All Implemented Interfaces:
ComplexRepositoryElementType<UserIdentity>
,RepositoryElementType<UserIdentity>
,RepositoryModelItemType
,ElementType<UserIdentity>
,ModelItemType
,LogEnabled
,PluginAware
,Component
,Serviceable
public class UserRepositoryElementType extends AbstractUserElementType implements ComplexRepositoryElementType<UserIdentity>
Class for user type of elements stored in the repository
-
-
Field Summary
-
Fields inherited from class org.ametys.cms.data.type.AbstractUserElementType
_helper, _userManager
-
Fields inherited from class org.ametys.core.model.type.AbstractElementType
_jsonUtils
-
Fields inherited from interface org.ametys.plugins.repository.data.type.ComplexRepositoryElementType
TYPE_ID_DATA_NAME
-
Fields inherited from interface org.ametys.plugins.repository.data.type.RepositoryModelItemType
EMPTY_METADATA_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description UserRepositoryElementType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private String
_getStringValue(RepositoryData userData, String name)
private boolean
_isMultipleButSetViaOldAPI(RepositoryData parentData, String name)
private boolean
_isStringValueEmpty(RepositoryData userData, String name)
void
emptySingleValue(ModifiableRepositoryData parentData, String name)
Empties the single value into the given repositoryData This method is called by theComplexRepositoryElementType.write(ModifiableRepositoryData, String, Object)
method, when the given value isnull
String
getRepositoryDataType()
Retrieves the type of repository data used for this typeboolean
isMultiple(RepositoryData parentData, String name)
Checks if the value in the given repository data is multipleboolean
isSingleValueEmpty(RepositoryData userData)
Checks if the single value is emptyObject
read(RepositoryData parentData, String name)
Read the value in the given repository dataUserIdentity
readSingleValue(RepositoryData userData)
Read the single value in the given repository datavoid
writeSingleValue(ModifiableRepositoryData parentData, String name, UserIdentity value)
Write the single value into the given repository data This method is called by theComplexRepositoryElementType.write(ModifiableRepositoryData, String, Object)
method, once for each value if the value is an array-
Methods inherited from class org.ametys.cms.data.type.AbstractUserElementType
_singleValueFromXML, _singleValueToJSON, _singleValueToSAX, _useJSONForEdition, convertValue, fromJSONForClient, isSimple, service, toString
-
Methods inherited from class org.ametys.core.model.type.AbstractElementType
_compareMultipleValues, _compareSingleValues, _getValueAttributes, _isValueFromXMLMultiple, _valueToSAX, _valueToSAX, _valueToSAXForEdition, castValue, compareValues, getManagedClass, getManagedClassArray, isCompatible, parseConfiguration, valueFromXML, valueToJSONForClient, valueToSAX, valueToSAXForEdition
-
Methods inherited from class org.ametys.core.model.type.AbstractModelItemType
_getContextAttributes, getId, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.repository.data.type.ComplexRepositoryElementType
hasNonEmptyValue, isCompatible, removeValueBeforeWritingIt, write
-
Methods inherited from interface org.ametys.runtime.model.type.ElementType
castValue, compareValues, fromJSONForClient, getManagedClass, getManagedClassArray, isCompatible, isSimple, parseConfiguration, toString, valueFromXML, valueToJSONForClient
-
Methods inherited from interface org.ametys.runtime.model.type.ModelItemType
getId, valueToSAX, valueToSAX, valueToSAXForEdition
-
Methods inherited from interface org.ametys.runtime.plugin.component.PluginAware
setPluginInfo
-
Methods inherited from interface org.ametys.plugins.repository.data.type.RepositoryElementType
externalizableValueToSAX
-
Methods inherited from interface org.ametys.plugins.repository.data.type.RepositoryModelItemType
hasValue, remove
-
-
-
-
Constructor Detail
-
UserRepositoryElementType
public UserRepositoryElementType()
-
-
Method Detail
-
read
public Object read(RepositoryData parentData, String name) throws BadItemTypeException
Description copied from interface:RepositoryElementType
Read the value in the given repository data- Specified by:
read
in interfaceComplexRepositoryElementType<UserIdentity>
- Specified by:
read
in interfaceRepositoryElementType<UserIdentity>
- Parameters:
parentData
- repository data containing the valuename
- the name of the element to read- Returns:
- the value. Can return a T or a T[]. That's why the return type is Object
- Throws:
BadItemTypeException
- if the reading value doesn't match this element type
-
isSingleValueEmpty
public boolean isSingleValueEmpty(RepositoryData userData)
Description copied from interface:ComplexRepositoryElementType
Checks if the single value is empty- Specified by:
isSingleValueEmpty
in interfaceComplexRepositoryElementType<UserIdentity>
- Parameters:
userData
- repository data containing the value to check- Returns:
true
if the value is empty,false
otherwise
-
_isStringValueEmpty
private boolean _isStringValueEmpty(RepositoryData userData, String name)
-
readSingleValue
public UserIdentity readSingleValue(RepositoryData userData)
Description copied from interface:ComplexRepositoryElementType
Read the single value in the given repository data- Specified by:
readSingleValue
in interfaceComplexRepositoryElementType<UserIdentity>
- Parameters:
userData
- repository data containing the value- Returns:
- the value. Can return null if the given data does not contain the necessary elements
-
_getStringValue
private String _getStringValue(RepositoryData userData, String name)
-
emptySingleValue
public void emptySingleValue(ModifiableRepositoryData parentData, String name)
Description copied from interface:ComplexRepositoryElementType
Empties the single value into the given repositoryData This method is called by theComplexRepositoryElementType.write(ModifiableRepositoryData, String, Object)
method, when the given value isnull
- Specified by:
emptySingleValue
in interfaceComplexRepositoryElementType<UserIdentity>
- Parameters:
parentData
- repository where to empty the single value.name
- the name of the element to empty
-
writeSingleValue
public void writeSingleValue(ModifiableRepositoryData parentData, String name, UserIdentity value)
Description copied from interface:ComplexRepositoryElementType
Write the single value into the given repository data This method is called by theComplexRepositoryElementType.write(ModifiableRepositoryData, String, Object)
method, once for each value if the value is an array- Specified by:
writeSingleValue
in interfaceComplexRepositoryElementType<UserIdentity>
- Parameters:
parentData
- repository where to store the single value.name
- the name of the element to writevalue
- the single value to write. Can be null. In this case, an empty data must be created
-
isMultiple
public boolean isMultiple(RepositoryData parentData, String name) throws UnknownDataException
Description copied from interface:RepositoryModelItemType
Checks if the value in the given repository data is multiple- Specified by:
isMultiple
in interfaceRepositoryModelItemType
- Parameters:
parentData
- repository data containing the data to checkname
- the name of the data to check- Returns:
true
if the stored data is multiple,false
otherwise- Throws:
UnknownDataException
- if there is no data in the parent repository data with this name
-
_isMultipleButSetViaOldAPI
private boolean _isMultipleButSetViaOldAPI(RepositoryData parentData, String name)
-
getRepositoryDataType
public String getRepositoryDataType()
Description copied from interface:RepositoryModelItemType
Retrieves the type of repository data used for this type- Specified by:
getRepositoryDataType
in interfaceRepositoryModelItemType
- Returns:
- the type of repository data used for this type
-
-