public class AssetAccessTemplate extends Object
AssetDataManager
use in a simplified
way in delivery ContentServer templates.
This class is inspired by springframework data access template classes like
org.springframework.jdbc.core.JdbcTemplate.
This class is not thread safe and should not be shared between threads.Constructor and Description |
---|
AssetAccessTemplate(COM.FutureTense.Interfaces.ICS ics)
Constructor that accepts ICS as an argument.
|
AssetAccessTemplate(com.fatwire.system.Session session) |
Modifier and Type | Method and Description |
---|---|
com.fatwire.assetapi.data.AssetId |
createAssetId(String c,
long cid)
Helper method to create an AssetId from c and cid as string values.
|
com.fatwire.assetapi.data.AssetId |
createAssetId(String c,
String cid)
Helper method to create an AssetId from c and cid as string values.
|
com.fatwire.assetapi.query.SimpleQuery |
createNameQuery(String assetType,
String assetName)
Creates a Query to retrieve the asset by it's name.
|
com.fatwire.assetapi.data.AssetId |
findByName(COM.FutureTense.Interfaces.ICS ics,
String assetType,
String name)
Finds the assetid by the name of the asset.
|
com.fatwire.assetapi.data.AssetId |
findByName(COM.FutureTense.Interfaces.ICS ics,
String assetType,
String name,
long siteid)
Finds the assetid by the name of the asset in a particular site.
|
protected com.fatwire.assetapi.data.AssetDataManager |
getAssetDataManager() |
<T> Iterable<T> |
query(String assetType,
String subType,
String query,
AssetMapper<T> mapper)
Queries for a list of objects as mapped by the AssetMapper.
|
<T> Iterable<T> |
query(String assetType,
String subType,
String query,
AssetMapper<T> mapper,
String... attributes)
Queries for a list of objects as mapped by the AssetMapper.
|
com.fatwire.assetapi.data.AssetData |
readAsset(com.fatwire.assetapi.data.AssetId id) |
void |
readAsset(com.fatwire.assetapi.data.AssetId id,
AssetClosure closure)
Method to read an asset and pass the results to the closure for further
handling.
|
void |
readAsset(com.fatwire.assetapi.data.AssetId id,
AssetClosure closure,
String... attributes)
Method to read an asset and provide the AssetClosure with the AssetData.
|
<T> T |
readAsset(com.fatwire.assetapi.data.AssetId id,
AssetMapper<T> mapper)
Method to read an asset and use the AssetMapper to transform the
AssetData into another object as specified by the AssetMapper.
|
<T> T |
readAsset(com.fatwire.assetapi.data.AssetId id,
AssetMapper<T> mapper,
String... attributes)
Method to read an asset and use the AssetMapper to transform the
AssetData into another object as specified by the AssetMapper.
|
com.fatwire.assetapi.data.AssetData |
readAsset(com.fatwire.assetapi.data.AssetId id,
String... attributes)
Reads an asset based on the listed attribute names
TODO: do we need to load the attribute values and prevent access to
non-listed attributes (prevent lazy loading)
|
void |
readAsset(Iterable<com.fatwire.assetapi.data.AssetId> ids,
AssetClosure closure,
String... attributes)
Method to read an asset and pass the results to the closure for further
handling.
|
void |
readAsset(List<com.fatwire.assetapi.data.AssetId> ids,
AssetClosure closure)
Method to read an asset and pass the results to the closure for further
handling.
|
<T> T |
readAsset(String c,
long cid,
AssetMapper<T> mapper)
Method to read an asset and use the AssetMapper to transform the
AssetData into another object as specified by the AssetMapper.
|
<T> T |
readAsset(String c,
String cid,
AssetMapper<T> mapper)
Method to read an asset and use the AssetMapper to transform the
AssetData into another object as specified by the AssetMapper interface..
|
Iterable<com.fatwire.assetapi.data.AssetData> |
readAssets(com.fatwire.assetapi.query.Query query) |
void |
readAssets(com.fatwire.assetapi.query.Query query,
AssetClosure closure)
Invokes the work(asset) method on the provided Closure for assets
returned by the Query.
|
<T> Iterable<T> |
readAssets(com.fatwire.assetapi.query.Query query,
AssetMapper<T> mapper)
Reading assets with the Query and using the mapper to transform the
AssetData into another object, as specified by T.
|
Collection<com.fatwire.assetapi.data.AssetId> |
readAssociatedAssetIds(com.fatwire.assetapi.data.AssetId id,
String associationType)
Reads the associated assets of the asset and returns the AssetIds.
|
void |
readAssociatedAssets(com.fatwire.assetapi.data.AssetId id,
String associationType,
AssetClosure closure,
String... attributes)
Reads the associated assets of an asset and returns them as a
ScatteredAsset.
|
com.fatwire.assetapi.site.Site |
readSite(String name)
Finds the Site object by the given name.
|
com.fatwire.assetapi.site.SiteInfo |
readSiteInfo(String name) |
public AssetAccessTemplate(com.fatwire.system.Session session)
session
- public AssetAccessTemplate(COM.FutureTense.Interfaces.ICS ics)
ics
- public com.fatwire.assetapi.data.AssetId createAssetId(String c, String cid)
c
- cid
- public com.fatwire.assetapi.data.AssetId createAssetId(String c, long cid)
c
- cid
- public <T> T readAsset(com.fatwire.assetapi.data.AssetId id, AssetMapper<T> mapper)
T
- id
- mapper
- public <T> T readAsset(String c, String cid, AssetMapper<T> mapper)
T
- c
- the assetTypecid
- the asset idmapper
- public <T> T readAsset(String c, long cid, AssetMapper<T> mapper)
T
- c
- the assetTypecid
- the asset idmapper
- public <T> T readAsset(com.fatwire.assetapi.data.AssetId id, AssetMapper<T> mapper, String... attributes)
T
- id
- mapper
- attributes
- public void readAsset(com.fatwire.assetapi.data.AssetId id, AssetClosure closure, String... attributes)
id
- closure
- attributes
- public void readAsset(com.fatwire.assetapi.data.AssetId id, AssetClosure closure)
id
- the assetid to readclosure
- the closurepublic void readAsset(List<com.fatwire.assetapi.data.AssetId> ids, AssetClosure closure)
ids
- a list of AssetIdsclosure
- the closurepublic void readAsset(Iterable<com.fatwire.assetapi.data.AssetId> ids, AssetClosure closure, String... attributes)
ids
- a list of AssetIdsclosure
- the closurepublic com.fatwire.assetapi.data.AssetData readAsset(com.fatwire.assetapi.data.AssetId id, String... attributes)
id
- the assetidattributes
- the list of attributes to returnprotected com.fatwire.assetapi.data.AssetDataManager getAssetDataManager()
public com.fatwire.assetapi.data.AssetData readAsset(com.fatwire.assetapi.data.AssetId id)
id
- the assetid to readpublic Iterable<com.fatwire.assetapi.data.AssetData> readAssets(com.fatwire.assetapi.query.Query query)
query
- public void readAssets(com.fatwire.assetapi.query.Query query, AssetClosure closure)
query
- the queryclosure
- the closurepublic <T> Iterable<T> readAssets(com.fatwire.assetapi.query.Query query, AssetMapper<T> mapper)
T
- query
- mapper
- public com.fatwire.assetapi.data.AssetId findByName(COM.FutureTense.Interfaces.ICS ics, String assetType, String name, long siteid)
ics
- assetType
- the type of the asset.name
- the name of the asset.siteid
- the Site id.public com.fatwire.assetapi.data.AssetId findByName(COM.FutureTense.Interfaces.ICS ics, String assetType, String name)
ics
- assetType
- the type of the asset.name
- the name of the asset.public com.fatwire.assetapi.query.SimpleQuery createNameQuery(String assetType, String assetName)
assetType
- assetName
- public com.fatwire.assetapi.site.Site readSite(String name)
name
- the name of the site.public com.fatwire.assetapi.site.SiteInfo readSiteInfo(String name)
name
- public Collection<com.fatwire.assetapi.data.AssetId> readAssociatedAssetIds(com.fatwire.assetapi.data.AssetId id, String associationType)
id
- associationType
- public void readAssociatedAssets(com.fatwire.assetapi.data.AssetId id, String associationType, AssetClosure closure, String... attributes)
id
- the parent assetassociationType
- the name of the association or '-' for an unnamed
associationclosure
- the AssetClosure to work on.attributes
- the list of attributes to loadpublic <T> Iterable<T> query(String assetType, String subType, String query, AssetMapper<T> mapper, String... attributes)
T
- assetType
- subType
- query
- mapper
- attributes
- query(String, String, String, AssetMapper,
String...)
public <T> Iterable<T> query(String assetType, String subType, String query, AssetMapper<T> mapper)
T
- assetType
- subType
- query
- mapper
- Copyright © 2010-2016 Oracle Corporation. All Rights Reserved.