com.fatwire.gst.foundation.facade.assetapi.asset
Class TemplateAsset

java.lang.Object
  extended by com.fatwire.gst.foundation.facade.assetapi.asset.TemplateAsset

public class TemplateAsset
extends Object

This class provides easy access to AssetData, to be used in rendering code in read-only mode. Is is called TemplateAsset because the intent is that it is to be used in Templates.

It has casting accessors for values of the different attribute types.

It must be noted that naming conflicts between flex attribute names and meta attribute names are resolved by giving the meta attribute preference.

 TemplateAsset asset = ...;
 String name = asset.asString("name");
 
 

Author:
Dolf Dijkstra

Constructor Summary
TemplateAsset(com.fatwire.assetapi.data.AssetData delegate)
           
 
Method Summary
 com.fatwire.assetapi.data.AssetId asAssetId(String name)
           
 com.fatwire.assetapi.data.BlobObject asBlob(String name)
           
 com.fatwire.assetapi.data.BlobObject.BlobAddress asBlobAddress(String name)
           
 Date asDate(String name)
           
 Double asDouble(String name)
           
 Float asFloat(String name)
           
 Integer asInt(String name)
           
 List<?> asList(String name)
           
 Long asLong(String name)
           
 String asString(String name)
           
 boolean equals(Object obj)
           
 com.fatwire.assetapi.data.AssetId getAssetId()
           
 com.fatwire.assetapi.def.AssetTypeDef getAssetTypeDef()
           
 com.fatwire.assetapi.data.AssetId getAssociatedAsset(String name)
           
 List<com.fatwire.assetapi.data.AssetId> getAssociatedAssets(String name)
           
 Object getAttribute(String name)
           
 com.fatwire.assetapi.data.AttributeData getAttributeData(String name, boolean meta)
           
 List<String> getAttributeNames()
          Get all the attribute names.
 com.fatwire.assetapi.data.AssetData getDelegate()
           
 List<com.fatwire.assetapi.data.AssetId> getImmediateParents(String name)
           
 com.fatwire.mda.Dimension getLocale()
           
 Object getMetaAttribute(String name)
           
 List<String> getMetaAttributeNames()
          Gets all the names of the meta attributes.
 List<com.fatwire.assetapi.data.AssetId> getParents()
           
 String getSubtype()
           
 com.fatwire.assetapi.def.AttributeTypeEnum getType(String name)
          Get the type of the attribute.
 int hashCode()
           
 boolean isAttribute(String name)
          Checks if the asset has an attribute by the provided name.
 boolean isSingleValued(String name)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TemplateAsset

public TemplateAsset(com.fatwire.assetapi.data.AssetData delegate)
Parameters:
delegate -
Method Detail

getDelegate

public com.fatwire.assetapi.data.AssetData getDelegate()

getAssetId

public com.fatwire.assetapi.data.AssetId getAssetId()
Returns:
the assetid
See Also:
AssetData.getAssetId()

getSubtype

public String getSubtype()
Returns:
the asset subtype.

getAssetTypeDef

public com.fatwire.assetapi.def.AssetTypeDef getAssetTypeDef()
Returns:
the asset type definition
See Also:
AssetData.getAssetTypeDef()

getAssociatedAssets

public List<com.fatwire.assetapi.data.AssetId> getAssociatedAssets(String name)
Parameters:
name - name of the association
Returns:
list of assetids
See Also:
AssetData.getAssociatedAssets(java.lang.String)

getAssociatedAsset

public com.fatwire.assetapi.data.AssetId getAssociatedAsset(String name)
Parameters:
name - name of the association
Returns:
the single associated asset.
See Also:
AssetData.getAssociatedAssets(java.lang.String)

getAttribute

public Object getAttribute(String name)
Parameters:
name -
Returns:
the attribute value
See Also:
AssetData.getAttributeData(java.lang.String, boolean)

getMetaAttribute

public Object getMetaAttribute(String name)
Parameters:
name - the name of the attribute.
Returns:
the meta attribute value.
See Also:
AssetData.getAttributeData(java.lang.String, boolean)

isSingleValued

public boolean isSingleValued(String name)
Parameters:
name -
Returns:
true is the attribute is defined as single valued.

asList

public List<?> asList(String name)
Parameters:
name -
Returns:
attribute as a List

asInt

public Integer asInt(String name)
Parameters:
name -
Returns:
attribute value as a Integer, can be null; please be careful with autoboxing.

asDate

public Date asDate(String name)
Parameters:
name -
Returns:
attribute value as a Date.

asBlob

public com.fatwire.assetapi.data.BlobObject asBlob(String name)
Parameters:
name -
Returns:
attribute value as a BlobObject.

asFloat

public Float asFloat(String name)
Parameters:
name -
Returns:
attribute value as a Float, can be null; please be careful with autoboxing.

asDouble

public Double asDouble(String name)
Parameters:
name -
Returns:
attribute value as a Double, can be null; please be careful with autoboxing.

asLong

public Long asLong(String name)
Parameters:
name -
Returns:
attribute value as a Long, can be null; please be careful with autoboxing.

asAssetId

public com.fatwire.assetapi.data.AssetId asAssetId(String name)
Parameters:
name -
Returns:
attribute value as a AssetId.

asString

public String asString(String name)
Parameters:
name -
Returns:
attribute value as a String.

asBlobAddress

public com.fatwire.assetapi.data.BlobObject.BlobAddress asBlobAddress(String name)
Parameters:
name -
Returns:
attribute value as a BlobAddress.

getAttributeNames

public List<String> getAttributeNames()
Get all the attribute names.

Returns:
the name of all the attributes of the asset
See Also:
AssetData.getAttributeNames()

getType

public com.fatwire.assetapi.def.AttributeTypeEnum getType(String name)
Get the type of the attribute.

Parameters:
name - the name of the attribute
Returns:
the attribute type

isAttribute

public boolean isAttribute(String name)
Checks if the asset has an attribute by the provided name.

Parameters:
name - the name of trhe attributes.
Returns:
true if the asset has an attribute by this name.

getMetaAttributeNames

public List<String> getMetaAttributeNames()
Gets all the names of the meta attributes.

Returns:
the name of all the attributes of the asset
See Also:
AssetData.getAttributeNames()

getImmediateParents

public List<com.fatwire.assetapi.data.AssetId> getImmediateParents(String name)
                                                            throws com.fatwire.assetapi.common.AssetAccessException
Parameters:
name -
Returns:
list of assetids
Throws:
com.fatwire.assetapi.common.AssetAccessException
See Also:
AssetData.getImmediateParents(java.lang.String)

getParents

public List<com.fatwire.assetapi.data.AssetId> getParents()
                                                   throws com.fatwire.assetapi.common.AssetAccessException
Returns:
the parents of the asset
Throws:
com.fatwire.assetapi.common.AssetAccessException
See Also:
AssetData.getParents()

getAttributeData

public com.fatwire.assetapi.data.AttributeData getAttributeData(String name,
                                                                boolean meta)
Parameters:
name -
meta - the asset attributes
Returns:
asset attributes
See Also:
AssetData.getAttributeData(java.lang.String, boolean)

getLocale

public com.fatwire.mda.Dimension getLocale()
Returns:
the Dimension holding the locale

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2010-2013 Oracle Corporation. All Rights Reserved.