public class JCRCompositeMetadata extends Object implements ModifiableCompositeMetadata, CommentableCompositeMetadata
CompositeMetadata.MetadataType
Modifier and Type | Field and Description |
---|---|
private static Pattern |
__metadataNamePattern |
private boolean |
_lockAlreadyChecked |
private Node |
_node |
private AmetysObjectResolver |
_resolver |
static String |
METADATA_COMMENTS_SUFFIX
Comments metadata suffix
|
static String |
METADATA_PREFIX
Prefix for jcr properties and nodes names
|
static String |
OBJECT_COLLECTION_METADATA_NODETYPE
The JCR nodetype of object collection metadatas.
|
Constructor and Description |
---|
JCRCompositeMetadata(Node metadataNode,
AmetysObjectResolver resolver)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private void |
_checkLock() |
protected void |
_checkMetadataName(String metadataName)
Check if the metadata name is valid.
|
private void |
_copyDataFolder(ModifiableFolder srcDataFolder,
ModifiableFolder targetDataFolder) |
private void |
_copyFile(ModifiableFile srcFile,
ModifiableFolder targetDataFolder) |
private boolean |
_getBoolean(String metadataName,
Boolean defaultValue,
boolean failIfNotExist) |
private boolean[] |
_getBooleanArray(String metadataName,
boolean[] defaultValues,
boolean failIfNotExist) |
private Date |
_getDate(String metadataName,
Date defaultValue,
boolean failIfNotExist) |
private Date[] |
_getDateArray(String metadataName,
Date[] defaultValues,
boolean failIfNotExist) |
private double |
_getDouble(String metadataName,
Double defaultValue,
boolean failIfNotExist) |
private double[] |
_getDoubleArray(String metadataName,
double[] defaultValues,
boolean failIfNotExist) |
private long |
_getLong(String metadataName,
Long defaultValue,
boolean failIfNotExist) |
private long[] |
_getLongArray(String metadataName,
long[] defaultValues,
boolean failIfNotExist) |
protected static Pattern |
_getMetadataNamePattern()
Get the metadata name pattern to test validity.
|
private String |
_getString(String metadataName,
String defaultValue,
boolean failIfNotExist) |
private String[] |
_getStringArray(String metadataName,
String[] defaultValues,
boolean failIfNotExist) |
private UserIdentity |
_getUser(String metadataName,
UserIdentity defaultValue,
boolean failIfNotExist) |
private UserIdentity[] |
_getUserArray(String metadataName,
UserIdentity[] defaultValues,
boolean failIfNotExist) |
void |
addComment(String metadataName,
String text,
String author,
Date date)
Add a metadata comment.
|
void |
copyTo(ModifiableCompositeMetadata metadata)
Copy the current
CompositeMetadata to the given composite metadata. |
void |
deleteComment(String metadataName,
int index)
Delete a metadata comment.
|
void |
editComment(String metadataName,
int index,
String text,
String author,
Date date)
Edit the text of a metadata comment.
|
ModifiableBinaryMetadata |
getBinaryMetadata(String metadataName)
Returns the named metadata's value as
BinaryMetadata .If the metadata does not exist, an UnknownMetadataException is thrown. |
ModifiableBinaryMetadata |
getBinaryMetadata(String metadataName,
boolean createNew)
Returns the named metadata's value as
BinaryMetadata .If the metadata does not exist and createNew is false , an UnknownMetadataException is thrown. |
boolean |
getBoolean(String metadataName)
Returns the named metadata's value as boolean.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, an UnknownMetadataException is thrown. |
boolean |
getBoolean(String metadataName,
boolean defaultValue)
Returns the named metadata's value as boolean.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, the default value is returned. |
boolean[] |
getBooleanArray(String metadataName)
Returns the named metadata's value as boolean array.
|
boolean[] |
getBooleanArray(String metadataName,
boolean[] defaultValues)
Returns the named metadata's value as boolean array.
If the metadata does not exist, the default values are returned. |
List<MetadataComment> |
getComments(String metadataName)
Retrieves the comments of a metadata
|
ModifiableCompositeMetadata |
getCompositeMetadata(String metadataName)
Returns the named metadata's value as
CompositeMetadata .If the metadata is multi-valued, one of the value is returned. If the metadata does not exist an UnknownMetadataException is thrown. |
ModifiableCompositeMetadata |
getCompositeMetadata(String metadataName,
boolean createNew)
Returns the named metadata's value as
CompositeMetadata .If the metadata is multi-valued, one of the value is returned. If the metadata does not exist and createNew is false , an UnknownMetadataException is thrown. |
Date |
getDate(String metadataName)
Returns the named metadata's value as Date.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, an UnknownMetadataException is thrown. |
Date |
getDate(String metadataName,
Date defaultValue)
Returns the named metadata's value as Date.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, the default value is returned. |
Date[] |
getDateArray(String metadataName)
Returns the named metadata's value as Date array.
|
Date[] |
getDateArray(String metadataName,
Date[] defaultValues)
Returns the named metadata's value as Date array.
If the metadata does not exist, the default values are returned. |
double |
getDouble(String metadataName)
Returns the named metadata's value as double.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, an UnknownMetadataException is thrown. |
double |
getDouble(String metadataName,
double defaultValue)
Returns the named metadata's value as double.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, the default value is returned. |
double[] |
getDoubleArray(String metadataName)
Returns the named metadata's value as double array.
|
double[] |
getDoubleArray(String metadataName,
double[] defaultValues)
Returns the named metadata's value as double array.
If the metadata does not exist, the default values are returned. |
long |
getLong(String metadataName)
Returns the named metadata's value as long.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, an UnknownMetadataException is thrown. |
long |
getLong(String metadataName,
long defaultValue)
Returns the named metadata's value as long.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, the default value is returned. |
long[] |
getLongArray(String metadataName)
Returns the named metadata's value as long array.
|
long[] |
getLongArray(String metadataName,
long[] defaultValues)
Returns the named metadata's value as long array.
If the metadata does not exist, the default values are returned. |
String[] |
getMetadataNames()
Returns an array containing metadata names.
|
Node |
getNode()
Retrieves the underlying node.
|
ModifiableTraversableAmetysObject |
getObjectCollection(String metadataName)
Returns an object collection metadata as a
TraversableAmetysObject . |
ModifiableTraversableAmetysObject |
getObjectCollection(String metadataName,
boolean createNew)
Returns an object collection metadata as a
TraversableAmetysObject . |
ModifiableRichText |
getRichText(String metadataName)
Returns the named metadata's value as
RichText .If the metadata does not exist, an UnknownMetadataException is thrown. |
ModifiableRichText |
getRichText(String metadataName,
boolean createNew)
Returns the named metadata's value as
RichText .If the metadata does not exist and createNew is false , an UnknownMetadataException is thrown. |
String |
getString(String metadataName)
Returns the named metadata's value as String.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, an UnknownMetadataException is thrown. |
String |
getString(String metadataName,
String defaultValue)
Returns the named metadata's value as String.
If the metadata is multi-valued, one of the value is returned. If the metadata does not exist, the default value is returned. |
String[] |
getStringArray(String metadataName)
Returns the named metadata's value as String array.
|
String[] |
getStringArray(String metadataName,
String[] defaultValues)
Returns the named metadata's value as String array.
If the metadata does not exist, the default values are returned. |
CompositeMetadata.MetadataType |
getType(String metadataName)
Returns the type of the given metadata.
|
UserIdentity |
getUser(String metadataName)
Returns the named metadata's value as
UserIdentity .If the metadata does not exist, an UnknownMetadataException is thrown. |
UserIdentity |
getUser(String metadataName,
UserIdentity defaultValue)
Returns the named metadata's value as
UserIdentity .If the metadata does not exist, the default value is returned. |
UserIdentity[] |
getUserArray(String metadataName)
Returns the named metadata's value as
UserIdentity array. |
UserIdentity[] |
getUserArray(String metadataName,
UserIdentity[] defaultValues)
Returns the named metadata's value as
UserIdentity array.If the metadata does not exist, the default values are returned. |
boolean |
hasComment(String metadataName,
int index)
Indicates if a metadata has a comment
|
boolean |
hasComments(String metadataName)
Indicates if a metadata has any comments
|
boolean |
hasMetadata(String metadataName)
Tests if a metadata with a given name exists.
|
boolean |
isMultiple(String metadataName)
Test if the given metadata is multiple.
|
void |
removeMetadata(String metadataName)
Removes the given metadata.
|
void |
rename(String newName)
Rename the current metadata
|
void |
setMetadata(String metadataName,
boolean value)
Set a boolean metadata.
|
void |
setMetadata(String metadataName,
boolean[] values)
Set a multi-valued boolean metadata.
|
void |
setMetadata(String metadataName,
Date value)
Set a date metadata.
|
void |
setMetadata(String metadataName,
Date[] values)
Set a multi-valued date metadata.
|
void |
setMetadata(String metadataName,
double value)
Set a double metadata.
|
void |
setMetadata(String metadataName,
double[] values)
Set a multi-valued double metadata.
|
void |
setMetadata(String metadataName,
long value)
Set a long metadata.
|
void |
setMetadata(String metadataName,
long[] values)
Set a multi-valued long metadata.
|
void |
setMetadata(String metadataName,
String value)
Set a string metadata.
|
void |
setMetadata(String metadataName,
String[] value)
Set a multi-valued string metadata.
|
void |
setMetadata(String metadataName,
UserIdentity value)
Set a
UserIdentity metadata. |
void |
setMetadata(String metadataName,
UserIdentity[] values)
Set a multi-valued
UserIdentity metadata. |
public static final String METADATA_PREFIX
public static final String METADATA_COMMENTS_SUFFIX
public static final String OBJECT_COLLECTION_METADATA_NODETYPE
private static Pattern __metadataNamePattern
private boolean _lockAlreadyChecked
private AmetysObjectResolver _resolver
public JCRCompositeMetadata(Node metadataNode, AmetysObjectResolver resolver)
metadataNode
- the Node supporting this composite metadataresolver
- The resolver, used to resolve object collections.public boolean hasMetadata(String metadataName) throws AmetysRepositoryException
CompositeMetadata
hasMetadata
in interface CompositeMetadata
metadataName
- the metadataName to test.true
if the given metadata exists, false
otherwise.AmetysRepositoryException
- if an error occurs.public void rename(String newName) throws AmetysRepositoryException
ModifiableCompositeMetadata
rename
in interface ModifiableCompositeMetadata
newName
- the new nameAmetysRepositoryException
- if an error occurs.public void removeMetadata(String metadataName) throws AmetysRepositoryException
ModifiableCompositeMetadata
removeMetadata
in interface ModifiableCompositeMetadata
metadataName
- metadata name.UnknownMetadataException
- if the metadata does not exist.AmetysRepositoryException
- if an error occurs.public void copyTo(ModifiableCompositeMetadata metadata) throws AmetysRepositoryException
CompositeMetadata
CompositeMetadata
to the given composite metadata.copyTo
in interface CompositeMetadata
metadata
- The parent composite metadata. Can not be null.AmetysRepositoryException
- if an error occurs.private void _copyDataFolder(ModifiableFolder srcDataFolder, ModifiableFolder targetDataFolder)
private void _copyFile(ModifiableFile srcFile, ModifiableFolder targetDataFolder)
public CompositeMetadata.MetadataType getType(String metadataName) throws AmetysRepositoryException
CompositeMetadata
getType
in interface CompositeMetadata
metadataName
- metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public String getString(String metadataName)
CompositeMetadata
UnknownMetadataException
is thrown.getString
in interface CompositeMetadata
metadataName
- the metadata name.public String getString(String metadataName, String defaultValue)
CompositeMetadata
getString
in interface CompositeMetadata
metadataName
- the metadata name.defaultValue
- the default value.private String _getString(String metadataName, String defaultValue, boolean failIfNotExist)
public String[] getStringArray(String metadataName) throws AmetysRepositoryException
CompositeMetadata
getStringArray
in interface CompositeMetadata
metadataName
- metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public String[] getStringArray(String metadataName, String[] defaultValues)
CompositeMetadata
getStringArray
in interface CompositeMetadata
metadataName
- metadata name.defaultValues
- the default values.private String[] _getStringArray(String metadataName, String[] defaultValues, boolean failIfNotExist)
public boolean getBoolean(String metadataName) throws UnknownMetadataException, AmetysRepositoryException
CompositeMetadata
UnknownMetadataException
is thrown.getBoolean
in interface CompositeMetadata
metadataName
- the metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public boolean getBoolean(String metadataName, boolean defaultValue) throws AmetysRepositoryException
CompositeMetadata
getBoolean
in interface CompositeMetadata
metadataName
- the metadata name.defaultValue
- the default value.AmetysRepositoryException
- if an error occurs.private boolean _getBoolean(String metadataName, Boolean defaultValue, boolean failIfNotExist)
public boolean[] getBooleanArray(String metadataName) throws AmetysRepositoryException
CompositeMetadata
getBooleanArray
in interface CompositeMetadata
metadataName
- metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public boolean[] getBooleanArray(String metadataName, boolean[] defaultValues)
CompositeMetadata
getBooleanArray
in interface CompositeMetadata
metadataName
- metadata name.defaultValues
- the default values.private boolean[] _getBooleanArray(String metadataName, boolean[] defaultValues, boolean failIfNotExist)
public Date getDate(String metadataName) throws AmetysRepositoryException
CompositeMetadata
UnknownMetadataException
is thrown.getDate
in interface CompositeMetadata
metadataName
- the metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public Date getDate(String metadataName, Date defaultValue) throws AmetysRepositoryException
CompositeMetadata
getDate
in interface CompositeMetadata
metadataName
- the metadata name.defaultValue
- the default value.AmetysRepositoryException
- if an error occurs.public Date[] getDateArray(String metadataName) throws AmetysRepositoryException
CompositeMetadata
getDateArray
in interface CompositeMetadata
metadataName
- metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public Date[] getDateArray(String metadataName, Date[] defaultValues)
CompositeMetadata
getDateArray
in interface CompositeMetadata
metadataName
- metadata name.defaultValues
- the default values.private Date[] _getDateArray(String metadataName, Date[] defaultValues, boolean failIfNotExist)
public long getLong(String metadataName) throws AmetysRepositoryException
CompositeMetadata
UnknownMetadataException
is thrown.getLong
in interface CompositeMetadata
metadataName
- the metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public long getLong(String metadataName, long defaultValue) throws AmetysRepositoryException
CompositeMetadata
getLong
in interface CompositeMetadata
metadataName
- the metadata name.defaultValue
- the default value.AmetysRepositoryException
- if an error occurs.public long[] getLongArray(String metadataName) throws AmetysRepositoryException
CompositeMetadata
getLongArray
in interface CompositeMetadata
metadataName
- metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public long[] getLongArray(String metadataName, long[] defaultValues)
CompositeMetadata
getLongArray
in interface CompositeMetadata
metadataName
- metadata name.defaultValues
- the default values.private long[] _getLongArray(String metadataName, long[] defaultValues, boolean failIfNotExist)
public double getDouble(String metadataName) throws AmetysRepositoryException
CompositeMetadata
UnknownMetadataException
is thrown.getDouble
in interface CompositeMetadata
metadataName
- the metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public double getDouble(String metadataName, double defaultValue) throws AmetysRepositoryException
CompositeMetadata
getDouble
in interface CompositeMetadata
metadataName
- the metadata name.defaultValue
- the default value.AmetysRepositoryException
- if an error occurs.private double _getDouble(String metadataName, Double defaultValue, boolean failIfNotExist)
public double[] getDoubleArray(String metadataName) throws AmetysRepositoryException
CompositeMetadata
getDoubleArray
in interface CompositeMetadata
metadataName
- metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public double[] getDoubleArray(String metadataName, double[] defaultValues)
CompositeMetadata
getDoubleArray
in interface CompositeMetadata
metadataName
- metadata name.defaultValues
- the default values.private double[] _getDoubleArray(String metadataName, double[] defaultValues, boolean failIfNotExist)
public UserIdentity getUser(String metadataName) throws AmetysRepositoryException
CompositeMetadata
UserIdentity
.UnknownMetadataException
is thrown.getUser
in interface CompositeMetadata
metadataName
- the metadata name.AmetysRepositoryException
- if an error occurs.public UserIdentity getUser(String metadataName, UserIdentity defaultValue) throws AmetysRepositoryException
CompositeMetadata
UserIdentity
.getUser
in interface CompositeMetadata
metadataName
- the metadata name.defaultValue
- the default value.AmetysRepositoryException
- if an error occurs.private UserIdentity _getUser(String metadataName, UserIdentity defaultValue, boolean failIfNotExist) throws AmetysRepositoryException
AmetysRepositoryException
public UserIdentity[] getUserArray(String metadataName) throws AmetysRepositoryException
CompositeMetadata
UserIdentity
array.getUserArray
in interface CompositeMetadata
metadataName
- the metadata name.AmetysRepositoryException
- if an error occurs.public UserIdentity[] getUserArray(String metadataName, UserIdentity[] defaultValues) throws AmetysRepositoryException
CompositeMetadata
UserIdentity
array.getUserArray
in interface CompositeMetadata
metadataName
- the metadata name.defaultValues
- the default values.AmetysRepositoryException
- if an error occurs.private UserIdentity[] _getUserArray(String metadataName, UserIdentity[] defaultValues, boolean failIfNotExist) throws AmetysRepositoryException
AmetysRepositoryException
public void setMetadata(String metadataName, String value) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.value
- the String value of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, String[] value) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.value
- the String array containing values of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, Date value) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.value
- the Date value of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, Date[] values) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.values
- the Date array containing values of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, long value) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.value
- the integer value of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, double value) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.value
- the integer value of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, long[] values) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.values
- the integer array containing values of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, double[] values) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.values
- the integer array containing values of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, boolean value) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.value
- the boolean value of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, boolean[] values) throws AmetysRepositoryException
ModifiableCompositeMetadata
setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.values
- the boolean array containing values of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, UserIdentity value) throws AmetysRepositoryException
ModifiableCompositeMetadata
UserIdentity
metadata.setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.value
- the UserIdentity
value of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public void setMetadata(String metadataName, UserIdentity[] values) throws AmetysRepositoryException
ModifiableCompositeMetadata
UserIdentity
metadata.setMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.values
- the UserIdentity
array containing values of this metadata.AmetysRepositoryException
- if the metadata cannot be set.public String[] getMetadataNames() throws AmetysRepositoryException
CompositeMetadata
getMetadataNames
in interface CompositeMetadata
AmetysRepositoryException
- if an error occurs.public boolean isMultiple(String metadataName) throws AmetysRepositoryException
CompositeMetadata
isMultiple
in interface CompositeMetadata
metadataName
- the metadata name.true
if the given metadata is multiple,
false
otherwise.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.protected void _checkMetadataName(String metadataName) throws AmetysRepositoryException
metadataName
- The metadata name to check.AmetysRepositoryException
- If the metadata name is invalid.protected static Pattern _getMetadataNamePattern()
public ModifiableBinaryMetadata getBinaryMetadata(String metadataName) throws AmetysRepositoryException
CompositeMetadata
BinaryMetadata
.UnknownMetadataException
is thrown.getBinaryMetadata
in interface CompositeMetadata
getBinaryMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public ModifiableBinaryMetadata getBinaryMetadata(String metadataName, boolean createNew) throws AmetysRepositoryException
ModifiableCompositeMetadata
BinaryMetadata
.false
, an UnknownMetadataException
is thrown.
Otherwise, the metadata is automatically created.getBinaryMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.createNew
- true
to create automatically the BinaryMetadata
when missing.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public ModifiableCompositeMetadata getCompositeMetadata(String metadataName) throws AmetysRepositoryException
CompositeMetadata
CompositeMetadata
.UnknownMetadataException
is thrown.getCompositeMetadata
in interface CompositeMetadata
getCompositeMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.CompositeMetadata
.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public ModifiableCompositeMetadata getCompositeMetadata(String metadataName, boolean createNew) throws AmetysRepositoryException
ModifiableCompositeMetadata
CompositeMetadata
.false
, an UnknownMetadataException
is thrown. Otherwise, the metadata is automatically created.getCompositeMetadata
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.createNew
- true
to create automatically the CompositeMetadata
when missing.CompositeMetadata
.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public ModifiableRichText getRichText(String metadataName) throws UnknownMetadataException, AmetysRepositoryException
CompositeMetadata
RichText
.UnknownMetadataException
is thrown.getRichText
in interface CompositeMetadata
getRichText
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public ModifiableRichText getRichText(String metadataName, boolean createNew) throws UnknownMetadataException, AmetysRepositoryException
ModifiableCompositeMetadata
RichText
.false
, an UnknownMetadataException
is thrown.
Otherwise, the metadata is automatically created.getRichText
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.createNew
- true
to create automatically the BinaryMetadata
when missing.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public ModifiableTraversableAmetysObject getObjectCollection(String metadataName) throws AmetysRepositoryException
CompositeMetadata
TraversableAmetysObject
getObjectCollection
in interface CompositeMetadata
getObjectCollection
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.TraversableAmetysObject
.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public ModifiableTraversableAmetysObject getObjectCollection(String metadataName, boolean createNew) throws AmetysRepositoryException
ModifiableCompositeMetadata
TraversableAmetysObject
false
, an UnknownMetadataException
is thrown. Otherwise, the metadata is automatically created.getObjectCollection
in interface ModifiableCompositeMetadata
metadataName
- the metadata name.createNew
- true
to create automatically the CompositeMetadata
when missing.TraversableAmetysObject
.UnknownMetadataException
- if the named metadata does not exist.AmetysRepositoryException
- if an error occurs.public List<MetadataComment> getComments(String metadataName)
CommentableCompositeMetadata
getComments
in interface CommentableCompositeMetadata
metadataName
- The metadata nameMetadataComment
public boolean hasComments(String metadataName)
CommentableCompositeMetadata
hasComments
in interface CommentableCompositeMetadata
metadataName
- The metadata namepublic boolean hasComment(String metadataName, int index)
CommentableCompositeMetadata
hasComment
in interface CommentableCompositeMetadata
metadataName
- The metadata nameindex
- The comment indexpublic void addComment(String metadataName, String text, String author, Date date)
CommentableCompositeMetadata
addComment
in interface CommentableCompositeMetadata
metadataName
- The metadata nametext
- The text of the commentauthor
- The comment authordate
- The date of the comment (null to use the current date)public void editComment(String metadataName, int index, String text, String author, Date date)
CommentableCompositeMetadata
editComment
in interface CommentableCompositeMetadata
metadataName
- The metadata nameindex
- The comment indextext
- The new text for the commentauthor
- The comment authordate
- The date of the comment (null to use the current date)public void deleteComment(String metadataName, int index)
CommentableCompositeMetadata
deleteComment
in interface CommentableCompositeMetadata
metadataName
- The metadata nameindex
- The comment indexprivate void _checkLock() throws RepositoryException
RepositoryException