public class AssetXRefFieldValue extends java.lang.Object implements FieldValue
GUID.UID_REC_RELATED_SUB_ASSETS
or GUID.UID_REC_RELATED_MASTER_ASSETS
.
An asset cross reference field contains a list of references to other items of the same catalog. Each reference consists of a relation ID, a name and the item ID.
The relation ID is one of the following:
GUID.UID_ASSET_RELATION_CONTAINS
GUID.UID_ASSET_RELATION_REFERENCES
GUID.UID_ASSET_RELATION_IS_ALTERNATE
GUID.UID_ASSET_RELATION_IS_VARIATION
Item.getAssetXRefValue(com.canto.cumulus.GUID)
to get this wrapper class object. You can then use Item.setAssetXRefValue(com.canto.cumulus.GUID, AssetXRefFieldValue)
to set the field value back into the item.Constructor and Description |
---|
AssetXRefFieldValue(byte[] coreValue)
Create a new asset cross reference field value wrapper from the binary data contents of the corresponding field.
|
Modifier and Type | Method and Description |
---|---|
void |
addReference(GUID relationID,
int itemID,
java.lang.String itemName)
Add a new reference to this asset cross reference field value.
|
void |
clearValue()
You need to set the field value of an item using this field value wrapper and then call
Item.save() to save this change back to the catalog. |
boolean |
containsReference(GUID relationID,
int itemID)
Return whether this asset cross reference field value contains a reference of a specific relation to a given item.
|
java.lang.String |
getDisplayString()
Return the field's value as a string that can be displayed to the user.
|
java.lang.String |
getDisplayString(java.util.Locale locale)
Return the field's value as a string that can be displayed to the user.
|
java.util.Map<java.lang.Integer,java.lang.String> |
getReferencedItemNames(java.util.Set<java.lang.Integer> itemIDs)
Get a map of item IDs to item names contained in this asset cross reference field value.
|
java.util.Set<java.lang.Integer> |
getReferences(GUID relationID)
Get all references to other items for a given relation.
|
java.util.Set<GUID> |
getRelations()
Get all relations used in this asset cross reference field value.
|
boolean |
hasValue()
Return whether this field has a value.
|
void |
removeAllReferences(GUID relationID)
Remove all reference for a given relation.
|
void |
removeReference(GUID relationID,
int itemID)
Remove the reference to another item.
|
void |
setFromDisplayString(java.util.Locale locale,
java.lang.String value)
This method is not supported for asset cross reference values.
|
void |
setFromDisplayString(java.lang.String value)
This method is not supported for asset cross reference values.
|
java.lang.String |
toString()
Return a string representation of this asset cross reference field value.
|
public AssetXRefFieldValue(byte[] coreValue)
Item.getAssetXRefValue(com.canto.cumulus.GUID)
to the asset cross reference field wrapper.coreValue
- The binary field value from the item field to initialize this field value wrapper.public boolean hasValue()
hasValue
in interface FieldValue
true
if the field has a value, false
otherwise.public void clearValue()
Item.save()
to save this change back to the catalog.clearValue
in interface FieldValue
public java.lang.String getDisplayString()
getDisplayString
in interface FieldValue
public java.lang.String getDisplayString(java.util.Locale locale)
getDisplayString
in interface FieldValue
locale
- Unused parameter.public void setFromDisplayString(java.lang.String value) throws InvalidArgumentException
setFromDisplayString
in interface FieldValue
value
- The display string to set the value from.InvalidArgumentException
- if the display string is not of the right format.public void setFromDisplayString(java.util.Locale locale, java.lang.String value) throws InvalidArgumentException
setFromDisplayString
in interface FieldValue
locale
- The locale to use for formatting and language selection.value
- The display string to set the value from.InvalidArgumentException
- if the display string is not of the right format.public java.util.Set<GUID> getRelations()
public java.util.Set<java.lang.Integer> getReferences(GUID relationID)
relationID
- The relation, one of the following:
public boolean containsReference(GUID relationID, int itemID)
relationID
- The relation, one of the following:
itemID
- The ID of the item of the same catalog to check.true
if this field value contains a reference to the given item, false
otherwise.public java.util.Map<java.lang.Integer,java.lang.String> getReferencedItemNames(java.util.Set<java.lang.Integer> itemIDs)
getReferences(com.canto.cumulus.GUID)
.itemIDs
- The IDs of all items that you want to be mapped.public void addReference(GUID relationID, int itemID, java.lang.String itemName)
Item.save()
to save this change back to the catalog.
When saving a changed field value to the catalog Cumulus automatically updates the back-reference from the other item to this value's item.relationID
- The relation to the other item, one of the following:
itemID
- The ID of the item to be referenced.itemName
- A name to be used for displaying the item reference.public void removeReference(GUID relationID, int itemID)
Item.save()
to save this change back to the catalog.
When saving a changed field value to the catalog Cumulus automatically updates the back-reference from the other item to this value's item.relationID
- The relation to the other item, one of the following:
itemID
- The ID of the item referenced.public void removeAllReferences(GUID relationID)
Item.save()
to save this change back to the catalog.
When saving a changed field value to the catalog Cumulus automatically updates the back-reference from other items to this value's item.relationID
- The relation to the other item, one of the following:
public java.lang.String toString()
toString
in class java.lang.Object
getDisplayString()
www.canto.com
Canto, the Canto logo, the Cumulus logo, and Cumulus are registered trademarks of Canto GmbH, registered in the U.S. and other countries.