public class AssetReference extends java.lang.Object implements FieldValue, java.lang.AutoCloseable
GUID.UID_REC_ASSET_REFERENCE
or GUID.UID_REC_CHECKOUT_LOCATION
. Use Item.getAssetReferenceValue(com.canto.cumulus.GUID)
to get this wrapper class object. You can
then use Item.setAssetReferenceValue(com.canto.cumulus.GUID, AssetReference)
to set the field value back into the item.Constructor and Description |
---|
AssetReference(CumulusSession session,
java.lang.String pathNameOrXML,
java.lang.String assetHandlingSet)
Create a new asset reference object from the given data.
|
Modifier and Type | Method and Description |
---|---|
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. |
void |
close()
Releases all native resources associated with this instance.
|
int |
countLevels()
Return the number of levels of this asset reference.
|
int |
countParts()
Get the number of asset reference parts that this asset reference consists of.
|
boolean |
equals(java.lang.Object o) |
Asset |
getAsset(boolean allowProxyAsset)
Resolves the asset reference data and returns the asset object, using the default asset handling set.
|
java.lang.String |
getAsXML()
Returns the asset references in XML format.
|
CumulusSession |
getCumulusSession()
Get the Cumulus session that belongs to this asset reference.
|
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.
|
AssetReferencePart |
getPart(GUID classID)
Returns an asset reference by the class ID of the
AssetStorage module that created it. |
AssetReferencePart |
getPart(int index)
Get a part of this reference by index.
|
java.util.Set<GUID> |
getPartClassIDs(int level)
Returns the set of class IDs that are available for the specified level.
|
int |
hashCode() |
boolean |
hasValue()
Return whether this field has a value.
|
void |
setFromDisplayString(java.util.Locale locale,
java.lang.String value)
This method is not supported for asset reference values.
|
void |
setFromDisplayString(java.lang.String value)
This method is not supported for asset reference values.
|
boolean |
supportsVersioning()
Return whether this asset reference supports versioning, meaning that is allows (after resolving it to an
Asset object to check
it out and check a new version back in. |
public AssetReference(CumulusSession session, java.lang.String pathNameOrXML, java.lang.String assetHandlingSet)
session
- The Cumulus session to use.pathNameOrXML
- Either a patch name for a native file or a URL or the XML representation of an asset reference field value.assetHandlingSet
- The name of the asset handling set to use.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 CumulusSession getCumulusSession()
public boolean supportsVersioning()
Asset
object to check
it out and check a new version back in.true
if this asset reference supports versioning.public int countLevels()
public int countParts()
public AssetReferencePart getPart(int index)
index
- Zero-based index into the parts.public AssetReferencePart getPart(GUID classID)
AssetStorage
module that created it. classID
- the class ID of the AssetStorage
module that created the asset reference part.CumulusException
- if the specified part cannot be found.getPart(int)
public java.util.Set<GUID> getPartClassIDs(int level)
level
- level to get the class IDs forpublic java.lang.String getAsXML()
AssetReference(com.canto.cumulus.CumulusSession, String, String)
public Asset getAsset(boolean allowProxyAsset) throws UnresolvableAssetReferenceException, CumulusException
allowProxyAsset
- if true
then Cumulus may return a proxy asset instead of the real one. A proxy asset is created if the client can not
access the real asset but a server has access. If the user has the permission to transfer assets, Cumulus creates a proxy asset
that allows to access the properties of an asset (including the data streams) but will not provide a container asset and access to
sub-assets.Asset
object for accessing the asset.UnresolvableAssetReferenceException
- in case the asset reference cannot be resolvedCumulusException
- in case of any unknown errorpublic void close()
close
in interface java.lang.AutoCloseable
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
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.