public class CSMetaData extends CSItem
Meta data is generally used to categorise individual items of content by defining the properties of that item. All
metadata consists of two parts: a Property (see CSMetaDataProperty
) such as 'Colour' and a Value such as
'Blue'. Meta data values can be associated with articles to facilitate searching and personalisation.
The CSMetaData
class includes methods for the retrieval, update, and removal of a particular metadata
value. It also provides a method that checks for the existence of a metadata value. All such methods require that
certain database and key information (metadata value ID, for example) be specified via the set
methods
provided, prior to their invocation.
Typically, metadata values are specified via the METADATA section of iCM.
All database access/connectivity is handled internally by the CSMetaData
class.
ACCESS_GRANTED, DOES_NOT_EXIST, EMPTY, EXISTS, SECURE_ACCESS_DENIED, SECURE_ACCESS_GRANTED, UPDATE_ACTION_INSERTED, UPDATE_ACTION_UPDATED
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSMetaData()
Creates an empty
CSMetaData object. |
CSMetaData(java.lang.String strPropertyFile)
Creates an empty
CSMetaData object, specifying a property file that contains all of the database
connection details. |
CSMetaData(java.lang.String strPropertyFile,
boolean bExternalDataAvailable,
boolean bSynonymDataAvailable)
Creates an empty
CSMetaData object, specifying a property file that contains all of the database
connection details and whether or not external schema and synonym data are available. |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Removes a metadata value from the database.
|
boolean |
exist()
Checks to see whether a metadata value exists on the database.
|
void |
get()
Retrieves the details of a metadata value from the database.
|
java.lang.String |
getDescription()
Gets the description of the metadata value.
|
java.lang.String |
getExternalSchemaID()
Gets the ID within the external schema that the metadata value is mapped to.
|
java.lang.String |
getExternalSchemaName()
Gets the name of the external schema that the metadata value is mapped to.
|
int |
getGroupID()
Gets the ID that identifies the group, 'Display' for example, with which this metadata value is associated.
|
java.lang.String |
getGroupName()
Gets the group name of the metadata group e.g.
|
java.lang.String |
getGroupSearchField()
Gets the metadata group search field.
|
java.lang.String |
getKnownTerms()
Gets the known terms (synonyms) for the metadata value.
|
java.lang.String |
getLocalTerms()
Gets the local terms (synonyms) for the metadata value.
|
java.lang.String |
getPropertyDescription()
Gets the description of the metadata property.
|
int |
getPropertyID()
Gets the ID that identifies the property, 'Colour' for example, with which this metadata value is associated.
|
java.lang.String |
getPropertyName()
Gets the property name of the metadata property e.g.
|
java.lang.String |
getPropertySearchField()
Gets the metadata property search field.
|
java.lang.Object |
getRelatedByKey()
Returns the state of the relationship direction after fetching related metadata using the
CSMetaDataMultiple.setRelatedBothWays(boolean) method that matched this metadata. |
java.lang.String |
getRelatedMetaDataOptionalIDs()
Gets the list of metadata value IDs specified via the
CSMetaDataMultiple.setRelatedMetaDataOptionalIDs(String) method that matched for this metadata. |
java.lang.String |
getRootMetadataIDs()
Gets the IDs of Root Metadata Groups.
|
java.lang.String |
getRootMetaDataIDs()
Gets the IDs of Root Metadata Groups.
|
java.lang.String |
getValue()
Gets the value of the metadata value, 'Red' for example.
|
int |
getValueID()
Gets the ID of the metadata value.
|
void |
setDescription(java.lang.String strDescription)
Sets the description of the metadata value.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setExternalSchemaID(java.lang.String strValue)
Sets the ID within the external schema that the metadata value is mapped to.
|
void |
setExternalSchemaName(java.lang.String strValue)
Sets the name of the external schema that the metadata value is mapped to.
|
void |
setGroupID(int nGroupID)
Sets the ID that identifies the group, 'Display' for example, with which this metadata value is associated.
|
void |
setGroupName(java.lang.String strGroupName)
Sets the group name to be used as key information.
|
void |
setGroupSearchField(java.lang.String strSearchField)
Sets the metadata group search field.
|
void |
setKnownTerms(java.lang.String strKnownTerms)
Sets the known terms (synonyms) for the metadata value.
|
void |
setLocalTerms(java.lang.String strLocalTerms)
Sets the local terms (synonyms) for the metadata value.
|
void |
setPropertyDescription(java.lang.String strPropertyDesc)
Sets the description of the metadata property.
|
void |
setPropertyID(int nPropertyID)
Sets the ID that identifies the property, 'Colour' for example, with which this metadata value is associated.
|
void |
setPropertyName(java.lang.String strPropertyName)
Sets the property name to be used as key information.
|
void |
setPropertySearchField(java.lang.String strSearchField)
Sets the metadata property search field.
|
void |
setRelatedByKey(java.lang.Object bRelatedByKey)
Sets the state of the relationship direction after fetching related metadata using the
CSMetaDataMultiple.setRelatedBothWays(boolean) method that matched this metadata. |
void |
setRootMetadataIDs(java.lang.String strRootMetaDataIDs)
Sets the IDs of Root Metadata Groups.
|
void |
setRootMetaDataIDs(java.lang.String strRootMetaDataIDs)
Sets the IDs of Root Metadata Groups.
|
void |
setValue(java.lang.String strValue)
Sets the metadata value, 'Red' for example.
|
void |
setValueID(int nValueID)
Sets the ID of the metadata value.
|
void |
update()
Updates a metadata value on the database.
|
equals, getID, getStatus, hashCode, jsonString, serialiseWithTypes, setID, setStatus, toString, unset
clearRecordedGatewayMessages, clone, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public CSMetaData()
CSMetaData
object.
Use the various set methods provided to initialise the CSMetaData
object prior to invoking any of
its query methods.
public CSMetaData(java.lang.String strPropertyFile)
CSMetaData
object, specifying a property file that contains all of the database
connection details.
Use the various set methods provided to initialise the CSMetaData
object prior to invoking any of
its query methods.
strPropertyFile
- the name of the property file from which the database connection details are to be read.public CSMetaData(java.lang.String strPropertyFile, boolean bExternalDataAvailable, boolean bSynonymDataAvailable)
CSMetaData
object, specifying a property file that contains all of the database
connection details and whether or not external schema and synonym data are available. This constructor should
only be called from a CSMetaDataMultiple object that has previously determined the required states of the two
boolean parameters.
Use the various set methods provided to initialise the CSMetaData
object prior to invoking any of
its query methods.
strPropertyFile
- the name of the property file from which the database connection details are to be read.bExternalDataAvailable
- Whether the current database supports External Schema information (iCM version 5.4.0.0 or later)bSynonymDataAvailable
- Whether the current database supports synonym data (iCM 6.0.0.0 or later)public void setDetailLevel(int nDetailLevel) throws CSParameterException
get
method.
Valid detail levels for a metadata value are :
LEVEL_ALL - all details are processed.
setDetailLevel
in class CSDatabaseItem
nDetailLevel
- the detail level to be used.CSParameterException
- if an invalid detail level is specified.public void setGroupName(java.lang.String strGroupName)
Use setGroupName
or setGroupID
in conjunction with
setPropertyID
or setPropertyName
and then
setValueID
or setValue
to restrict the scope of the
exist
, get
, update
and delete
operations.
If no group name/ID or property name/ID is specified, these operations will be performed on the metadata values
as a whole. If property name/ID is specified, however, these operations will only be performed on the values
defined for the specified property. If a group name/ID and a property name/ID is specified, however, these
operations will only be performed on the values defined for the specified group and property.
For example, specifying a group name 'Display', a property name 'Colour' and a value of 'Red' followed by a call
to the exist
method will determine whether there is a metadata value of 'Red' defined on the
database for the 'Colour' property within the 'Display' group. Without the group and property names being
specified, this would check for the existence of the value 'Red' for any property.
strGroupName
- the name of the group.public java.lang.String getGroupName()
public void setGroupID(int nGroupID)
Use setGroupID
or setGroupName
in conjunction with
setPropertyID
or setPropertyName
and then
setValueID
or setValue
to restrict the scope of the
exist
, get
, update
and delete
operations.
If no group name/ID or property name/ID is specified, these operations will be performed on the metadata values
as a whole. If property name/ID is specified, however, these operations will only be performed on the values
defined for the specified property. If a group name/ID and a property name/ID is specified, however, these
operations will only be performed on the values defined for the specified group and property.
nGroupID
- the metadata group ID.public int getGroupID()
public void setGroupSearchField(java.lang.String strSearchField)
This property is effectively read only; it does not provide a way to update the group search field in the database.
strSearchField
- the metadata group search field.public java.lang.String getGroupSearchField()
public void setPropertyName(java.lang.String strPropertyName)
Use setPropertyName
or setPropertyID
in conjunction with
setValueID
or setValue
to restrict the scope of the
exist
, get
, update
and delete
operations.
If no property name/ID is specified, these operations will be performed on the metadata values as a whole. If
property name/ID is specified, however, these operations will only be performed on the values defined for the
specified property.
For example, specifying a property name 'Colour' and a value of 'Red' followed by a call to the
exist
method will determine whether there is a metadata value of 'Red' defined on the database
for the 'Colour' property. Without the property name being specified, this would check for the existence of the
value 'Red' for any property.
strPropertyName
- the name of the property.public java.lang.String getPropertyName()
public void setPropertyDescription(java.lang.String strPropertyDesc)
strPropertyDesc
- the description of the property.public void setPropertySearchField(java.lang.String strSearchField)
strSearchField
- the metadata property search field.public java.lang.String getPropertySearchField()
public java.lang.String getPropertyDescription()
public void setValueID(int nValueID)
setValueID
followed by a call to exist
will determine whether a metadata value
with that ID exists on the database.
setValueID
followed by a call to get
will populate this CSMetaData
object with that metadata value's details.
If a metadata value ID is specified, the update
method will update, using the contents of this
CSMetaData
object, the metadata value on the database whose ID matches.
setValueID
followed by a call to delete
will remove the metadata value with that
ID from the database.
Use the setPropertyID
or setPropertyName
method in
conjunction with the setValueID
method in order to restrict the scope of the
exist
, get
, update
and delete
operations.
If no property name/ID is specified, these operations will be performed on the metadata values as a whole. If
property name/ID is specified, however, these operations will only be performed on the values defined for the
specified property.
nValueID
- the numeric identifier of the metadata value.public int getValueID()
public void setValue(java.lang.String strValue)
setValue
followed by a call to exist
will determine whether that metadata value
exists on the database. If the metadata value ID is known, it will be used in preference to the value.
setValue
followed by a call to get
will populate this CSMetaData
object with details of the metadata value specified. If the metadata value ID is known, it will be used in
preference to the value.
If no metadata value ID is specified, the update
method will use the metadata value to update,
using the contents of this CSMetaData
object, the metadata value on the database. If none exists,
a new one will be created.
setValue
followed by a call to delete
will remove the metadata value from the
database. If the metadata value ID is known, it will be used as a key in preference to the value.
Use the setPropertyID
or setPropertyName
method in
conjunction with the setValue
method in order to restrict the scope of the exist
,
get
, update
and delete
operations. If no property name/ID is
specified, these operations will be performed on the metadata values as a whole. If property name/ID is
specified, however, these operations will only be performed on the values defined for the specified property.
strValue
- the metadata value.public java.lang.String getValue()
public void setDescription(java.lang.String strDescription)
strDescription
- the metadata description to assign.public java.lang.String getDescription()
public void setExternalSchemaName(java.lang.String strValue)
strValue
- Stringpublic java.lang.String getExternalSchemaName()
public void setExternalSchemaID(java.lang.String strValue)
strValue
- Stringpublic java.lang.String getExternalSchemaID()
public void setKnownTerms(java.lang.String strKnownTerms)
strKnownTerms
- the known terms to assign.public java.lang.String getKnownTerms()
public void setLocalTerms(java.lang.String strLocalTerms)
strLocalTerms
- the local terms to assign.public java.lang.String getLocalTerms()
public void setPropertyID(int nPropertyID)
Use setPropertyID
or setPropertyName
in conjunction with
setValueID
or setValue
to restrict the scope of the
exist
, get
, update
and delete
operations.
If no property name/ID is specified, these operations will be performed on the metadata values as a whole. If
property name/ID is specified, however, these operations will only be performed on the values defined for the
specified property.
nPropertyID
- the metadata property ID.public int getPropertyID()
public void setRootMetadataIDs(java.lang.String strRootMetaDataIDs)
setRootMetaDataIDs(String)
method.
This parameter is useful to restrict metadata queries to one particular subsite.
strRootMetaDataIDs
- A comma seperated list of metadata group IDs.public void setRootMetaDataIDs(java.lang.String strRootMetaDataIDs)
This parameter is useful to restrict metadata queries to one particular subsite.
strRootMetaDataIDs
- A comma seperated list of metadata group IDs.public java.lang.String getRootMetadataIDs()
getRootMetaDataIDs()
method.
public java.lang.String getRootMetaDataIDs()
public java.lang.String getRelatedMetaDataOptionalIDs()
CSMetaDataMultiple.setRelatedMetaDataOptionalIDs(String)
method that matched for this metadata. This list
will only be populated when the setRelatedMetaDataOptionalIDs
method is specified as key
information.
public void setRelatedByKey(java.lang.Object bRelatedByKey)
CSMetaDataMultiple.setRelatedBothWays(boolean)
method that matched this metadata. This should only be set
when the CSMetaDataMultiple.get()
method uses an ArticleID, MediaID, EventID or MetadataID value as a key
and should only be set Boolean.FALSE
when this metadata value relates the MetadataID used as key
information.
The flag state has the following meanings: Boolean.True => this value was related by the supplied key item, Boolean.FALSE => this value relates the supplied key item
bRelatedByKey
- the Boolean value or null if the use of this flag is inappropriate for the supplied key information.public java.lang.Object getRelatedByKey()
CSMetaDataMultiple.setRelatedBothWays(boolean)
method that matched this metadata. This will only be
populated when the CSMetaDataMultiple.get()
method uses an ArticleID, MediaID, EventID or MetadataID
value as a key and will only be set Boolean.FALSE
when this metadata value relates the MetadataID
used as key information.
public boolean exist() throws CSException
Use setValueID
followed by exist
to determine whether a metadata value
with the specified ID exists on the database.
Use setValue
followed by exist
to determine whether that metadata value
exists on the database.
To restrict the scope of this operation to values defined for a particular property, use the
setPropertyID
or setPropertyName
methods in
conjunction with one of the above.
exist
in class CSItem
true
if the metadata value exists on the database.CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSException
- the base class for exceptions thrown by this method.public void get() throws CSException
Use setValueID
followed by get
to populate this CSMetaData
object with the details of the metadata value identified by the specified ID.
Use setValue
followed by get
to populate this CSMetaData
object with the details of that metadata value.
To restrict the scope of this operation to values defined for a particular property, use the
setPropertyID
or setPropertyName
methods in
conjunction with one of the above.
get
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified metadata value cannot be found on the database.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.public void update() throws CSException
Use update
to store the current contents of this CSMetaData
object to the database.
If the metadata value already exists on the database, its details will be updated. Otherwise, a new metadata
value will be created.
update
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified metadata value cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
Use setValueID
followed by delete
to remove the metadata value with that
ID from the database.
Use setValue
followed by delete
to remove the metadata value from the
database.
To restrict the scope of this operation to values defined for a particular property, use the
setPropertyID
or setPropertyName
methods in
conjunction with one of the above.
To restrict the scope of this operation to values defined for a particular group, use the
setGroupID
or setGroupName
methods in conjunction with one
of the above. In addition the scope can be restricted further by additionally using
setPropertyID
or setPropertyName
methods.
delete
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified metadata value cannot be found on the database.CSException
- the base class for exceptions thrown by this method.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.