com.fatwire.assetapi.data
Class AssetDataManagerImpl

java.lang.Object
  extended by com.fatwire.assetapi.data.AssetDataManagerImpl
All Implemented Interfaces:
AssetDataManager

public class AssetDataManagerImpl
extends java.lang.Object
implements AssetDataManager

AssetDataManager implementation class The class has two variant of read methods: 1. read with a set of attribute names to retrieve specified - in this case, attribute names are specified either directly in the method signature, for example readAttributes (AssetId id, List attributeNames) or in the query read(Query query). We consider the user is intending to read only the attribute specified (immediateonly) and do not want to retrieve the inherited data from parent 2. read with only id specified but no attribute names - in this case, we assume that user wants all the attributes with inherited values


Constructor Summary
AssetDataManagerImpl(ICS ics)
           
 
Method Summary
protected  java.lang.Iterable _getAssets(Query query)
          Get a list of asset data, this method is common for both readonly load and mutuable load of assets In this case, we only return a Iterable and cast the returned data according to the usage
 void delete(java.util.List<AssetId> data)
          Deletes a given Iterator of AssetIds from database.
 void insert(java.util.List<AssetData> data)
          if there is guareentee that all the data are from the same asset type, we would potentially use Asset.Save( ics, assettype, IAsset[] ) however there is no guareentee of that, we would have to save asset one by one
 AssetData newAssetData(java.lang.String assetTypeName, AssetData example)
          NOTE: This method is not implemented yet.
 AttributeData newAttribiteData(java.lang.String attributeName, java.lang.String assetTypeName, java.lang.String subtype)
          NOTE: This method is not implemented yet.
 java.lang.Iterable<AssetData> read(java.util.List<AssetId> ids)
          Reads asset data for all given AssetIds.
 java.lang.Iterable<AssetData> read(Query query)
          read a list of Asset Data that satisfy the query.
 AssetData readAttributes(AssetId id, java.util.List<java.lang.String> attributeNames)
          Reads given set attribute data and returns an AssetData instance containing them.
 java.lang.Iterable<MutableAssetData> readForUpdate(java.util.List<AssetId> ids)
          read a list of asset data to update
 java.lang.Iterable<MutableAssetData> readForUpdate(Query query)
          NOTE: This method is not implemented yet.
 void update(java.util.List<AssetData> data)
          NOTE: This method is not implemented yet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssetDataManagerImpl

public AssetDataManagerImpl(ICS ics)
Method Detail

read

public java.lang.Iterable<AssetData> read(Query query)
                                   throws AssetAccessException
read a list of Asset Data that satisfy the query. The query against flex assets is considered to only to retrieve immediately only attributes it will not retrieve the parent inherited attributes

Specified by:
read in interface AssetDataManager
Parameters:
query - the Query object
Returns:
list of asset data
Throws:
AssetAccessException

_getAssets

protected java.lang.Iterable _getAssets(Query query)
                                 throws AssetAccessException
Get a list of asset data, this method is common for both readonly load and mutuable load of assets In this case, we only return a Iterable and cast the returned data according to the usage

Parameters:
query - - the query passed in
Returns:
the list of returned assets
Throws:
AssetAccessException - - in case of errros, exception is thrown

readForUpdate

public java.lang.Iterable<MutableAssetData> readForUpdate(Query query)
                                                   throws AssetAccessException
Description copied from interface: AssetDataManager
NOTE: This method is not implemented yet. Reads all asset data that satisfies a given Query and results in mutable results.

Specified by:
readForUpdate in interface AssetDataManager
Parameters:
query - Query to be satisfied.
Returns:
Iterator of MutableAssetData instances.
Throws:
AssetAccessException - is the layer specific failures and wraps other internal exceptions.

read

public java.lang.Iterable<AssetData> read(java.util.List<AssetId> ids)
                                   throws AssetAccessException
Description copied from interface: AssetDataManager
Reads asset data for all given AssetIds.

Specified by:
read in interface AssetDataManager
Parameters:
ids - the list of asset ids to read
Returns:
list of asset data
Throws:
AssetAccessException - rethrown excetpion

readForUpdate

public java.lang.Iterable<MutableAssetData> readForUpdate(java.util.List<AssetId> ids)
                                                   throws AssetAccessException
read a list of asset data to update

Specified by:
readForUpdate in interface AssetDataManager
Parameters:
ids - the list of asset ids to read
Returns:
list of asset data
Throws:
AssetAccessException

readAttributes

public AssetData readAttributes(AssetId id,
                                java.util.List<java.lang.String> attributeNames)
                         throws AssetAccessException
Description copied from interface: AssetDataManager
Reads given set attribute data and returns an AssetData instance containing them.

Specified by:
readAttributes in interface AssetDataManager
Parameters:
id - AssetId to read attributes for
attributeNames - names of the attributes
Returns:
AssetData containing values for requested attributes.
Throws:
AssetAccessException - if thrown if the AssetId does not exist or attrbute names passed are incorrect for the asset. AssetAccessException also wraps any AssetExcptions thrown by the internal implementation.

insert

public void insert(java.util.List<AssetData> data)
            throws AssetAccessException
if there is guareentee that all the data are from the same asset type, we would potentially use Asset.Save( ics, assettype, IAsset[] ) however there is no guareentee of that, we would have to save asset one by one

Specified by:
insert in interface AssetDataManager
Parameters:
data -
Throws:
AssetAccessException

update

public void update(java.util.List<AssetData> data)
            throws AssetAccessException
Description copied from interface: AssetDataManager
NOTE: This method is not implemented yet. Updates a given Iterator of AssetData in the database.

Specified by:
update in interface AssetDataManager
Parameters:
data - AssetData to be updated.
Throws:
AssetAccessException - captures layer specific failures and wraps other internal exceptions.

delete

public void delete(java.util.List<AssetId> data)
            throws AssetAccessException
Description copied from interface: AssetDataManager
Deletes a given Iterator of AssetIds from database.

Specified by:
delete in interface AssetDataManager
Parameters:
data - AssetIds to be deleted.
Throws:
AssetAccessException - captures layer specific failures and wraps other internal exceptions.

newAttribiteData

public AttributeData newAttribiteData(java.lang.String attributeName,
                                      java.lang.String assetTypeName,
                                      java.lang.String subtype)
Description copied from interface: AssetDataManager
NOTE: This method is not implemented yet. Creates an empty instance of AttributeData (of appropriate type and default)

Specified by:
newAttribiteData in interface AssetDataManager
Parameters:
attributeName - name of the attribute
assetTypeName - name of asset type
subtype - subtype of asset type.
Returns:
empty AttributeData for a given attribute name and attribute type.

newAssetData

public AssetData newAssetData(java.lang.String assetTypeName,
                              AssetData example)
Description copied from interface: AssetDataManager
NOTE: This method is not implemented yet. Creates an empty instance of AssetData (with empty instances of AttributeData)

Specified by:
newAssetData in interface AssetDataManager
Parameters:
assetTypeName - name of the asset type
example - optional example AsetData the returned will be based on.
Returns:
empty instance of AssetData