@Exported
public interface AssetReader
A reader that allows user to read asset information in a simplified way
AssetReader provides the ability for a user to retrieve an Asset information in a
unified way for all asset types. The reader allows user retrieving asset information by
specifying an AssetId or an AssetType/name pair. It further allows user to retrieve nested
asset information using grammar or another AssetReader
The results returned from AssetReader.read()
method is a Map, which contains the requested asset information
in a Map format.
Sample code snippet:
Map data = new AssetReaderImpl(new AssetFacadeImpl(ics)) .forAsset( assetId ) .select( "name, description, AssociatedAssetOne.(name, description, body)" ) .levelOfChildren(2) .selectImmediateOnlyParents(true) .useAssetReader( "Content_P", null, new AssetReaderImpl(new AssetFacadeImpl(ics)).selectAll(true) ) .includeLinks(true) .includeBlobLinks(true) .includeFeatures(true) .forLocale("en_US") .read();
Modifier and Type | Method and Description |
---|---|
AssetReader |
addAssetLinkInfo(LinkInfo linkInfo)
Adds a LinkInfo object for building a link for the read asset
|
AssetReader |
addAssetLinkInfos(List<LinkInfo> linkInfos)
Adds a list of LinkInfo objects for building a link for the read asset
|
AssetReader |
addBlobLinkInfo(BlobLinkInfo blobLinkMaker)
Adds a default BlobLinkInfo object for building blob links contained in the asset for all fields without a specific BlobLinkInfo
object specified.
|
AssetReader |
addBlobLinkInfo(String field,
BlobLinkInfo blobLinkMaker)
Adds a BlobLinkInfo object for building blob links contained in the asset for given field
|
AssetReader |
filterForDate(Date date)
Filter the assets by date; This is used together with the startdate and enddate in the asset.
|
AssetReader |
forAsset(AssetId assetId)
Specify the asset by an AssetId
|
AssetReader |
forAsset(String assettype,
Long assetid)
Specify the asset type, id of the interested asset
|
AssetReader |
forAssetName(String assetType,
String assetName)
Specify the asset by name; There is always chance that several assets with same name exists in Sites.
|
AssetReader |
forLocale(String locale)
Specify interested Locale for the asset.
|
AssetReader |
forLocale(String locale,
String dimensionSet)
Specify interested Locale for the asset and a DimensionSet filter to obtain asset translation.
|
AssetReader |
forSite(String siteName)
Specify the sitename the AssetReader is working upon.
|
AssetReader |
immediateOnlyAttributes(boolean immediateOnlyAttributes)
Specifies whether or not to retrieve immediate-only attributes for flex assets/parents.
|
AssetReader |
includeFeatures(boolean includeFeatures)
Specify whether to include the Asset features like AssetType, subtype, dimensions and such in the
asset map.
|
AssetReader |
includeLinks(boolean includeLink)
indicate whether to include a Link in the returned Object; when set yes, the AssetReader will retrieve the
Webreference (Vanity Urls) defined in the asset and return the first one in the list as _link_ in the returned
Object.
|
AssetReader |
includeLinksForBlobs(boolean includeBlobLinks)
indicate whether to include a Link in the returned Object; when set yes, the AssetReader will retrieve the
Webreference (Vanity Urls) defined in the Blob and return the first one in the list as [BlobAttributeName]_link_
in the returned Object.
|
AssetReader |
levelOfChildren(int level)
Specify the level of flex children to bring back in the children list if the asset is an flex parent
|
Map |
read()
Read the asset bean with information specified.
|
AssetReader |
select(String attributes)
Specify a list of attributes to retrieve
|
AssetReader |
selectAll(boolean all)
Indicates whether all the attributes are needed.
|
AssetReader |
selectImmediateOnlyParents(boolean immediateOnly)
Indicates whether parents will be selected and what attributes will be selected.
|
AssetReader |
selectParents(String parentDefName)
Indicates to select a parent of certain definition.
|
AssetReader |
useAssetReader(String assettype,
String subtype,
AssetReader assetReader)
Specify an AssetReader to use for flex children, flex parent of specified assettype and subtype.
|
AssetReader |
useWrapper(String wrapper)
If the target uses an uncached wrapper page, supply this argument with the name of that SiteCatalog page.
|
AssetReader forAsset(String assettype, Long assetid)
assettype
- the asset typeassetid
- the asset idAssetReader forAsset(AssetId assetId)
assetId
- the asset idAssetReader forAssetName(String assetType, String assetName)
assetType
- the asset typeassetName
- the asset nameAssetReader levelOfChildren(int level)
level
- int number of children to bring backAssetReader useAssetReader(String assettype, String subtype, AssetReader assetReader)
assettype
- the asset typesubtype
- the asset subtypeassetReader
- the assetReaderAssetReader forSite(String siteName)
siteName
- the String sitenameAssetReader select(String attributes)
attributes
- list of asset attributesAssetReader forLocale(String locale)
forLocale(locale, dimensionSet)
.locale
- The name of the Locale, which is the Dimension asset name you defined for Locale DimensionSet.AssetReader forLocale(String locale, String dimensionSet)
forLocale(locale)
. If dimensionSet is
null the call is same as forLocale(locale)
locale
- the name of the Locale, which is the Dimension asset name you defined for Locale DimensionSetdimensionSet
- name of the DimensionSet to be usedAssetReader filterForDate(Date date)
date
- the date on which the asset is interested in; null means filter is not neededAssetReader selectAll(boolean all)
all
- true indicate all attributes will be retrieved; false otherwiseAssetReader addAssetLinkInfo(LinkInfo linkInfo)
linkInfo
- a LinkInfoAssetReader addAssetLinkInfos(List<LinkInfo> linkInfos)
linkInfos
- LinkInfoAssetReader addBlobLinkInfo(String field, BlobLinkInfo blobLinkMaker)
field
- the field to use this BlobLinkInfoblobLinkMaker
- a BlobLinkInfoAssetReader addBlobLinkInfo(BlobLinkInfo blobLinkMaker)
blobLinkMaker
- a BlobLinkInfoAssetReader includeLinks(boolean includeLink)
includeLink
- boolean to indicate whether to include the default link from Webreference; default is falseAssetReader includeLinksForBlobs(boolean includeBlobLinks)
includeBlobLinks
- boolean to indicate whether to include the default links from Webreference for
the Blob attributes; default is falseAssetReader selectImmediateOnlyParents(boolean immediateOnly)
immediateOnly
- Indicates whether to select immediate parents only or all the parents.AssetReader selectParents(String parentDefName)
parentDefName
- The parent definition name to select.AssetReader includeFeatures(boolean includeFeatures)
includeFeatures
- True indicates that features will be included in asset map, false otherwise.AssetReader immediateOnlyAttributes(boolean immediateOnlyAttributes)
immediateOnlyAttributes
- True indicate only immediate attributes will be retrieved, false otherwise.AssetReader useWrapper(String wrapper)
wrapper
- The wrapper page name.Map read() throws AssetAccessException
AssetAccessException
- an AssetAccessException