com.fatwire.assetapi.data
Class BasicAssetDataWriteStrategy

java.lang.Object
  extended by com.fatwire.assetapi.data.BasicAssetDataWriteStrategy
All Implemented Interfaces:
AssetDataWriteStrategy
Direct Known Subclasses:
AbstractSpecialAssetTypeWriteStrategy

public class BasicAssetDataWriteStrategy
extends java.lang.Object
implements AssetDataWriteStrategy

BasicAssetDataWriteStrategy is used to handle the write operation for basic asset types in Content Server through Asset API


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.fatwire.assetapi.data.AssetDataWriteStrategy
AssetDataWriteStrategy.AssetActionType
 
Field Summary
protected  ICS _ics
           
protected static org.apache.commons.logging.Log _logger
           
 
Method Summary
protected  AssetTypeDef _getAssetTypeDef(java.lang.String assettype, java.lang.String subtype)
          returnt the AssetTypeDef given asset type and subtype
protected  void _save(java.util.List<IAsset> instances, boolean insert)
          Saves a list of asset instances to Content Server
 void delete(java.util.List<AssetId> data)
          Delete a given list of assts from Content Server
protected  IAsset getInstance(AssetData data, AssetDataWriteStrategy.AssetActionType type, java.util.List<java.lang.String> ignoreAttributes, boolean insert)
          Gets an IAsset instance with the given asset data
protected  java.util.List<IAsset> getInstances(java.util.List<AssetData> data, AssetDataWriteStrategy.AssetActionType type, java.util.List<java.lang.String> ignoreAttributes, boolean insert)
          Gets a list of IAsset instances given a list of asset data
 void populateInstance(IAsset asset, AssetData data)
           
 void populateInstance(IAsset asset, AssetData data, boolean filterNoSetAttributes, boolean verifyReferences)
           
 void write(java.util.List<AssetData> data, AssetDataWriteStrategy.AssetActionType type)
          Inserts a given Iterator of AssetData instances in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logger

protected static final org.apache.commons.logging.Log _logger

_ics

protected ICS _ics
Method Detail

delete

public void delete(java.util.List<AssetId> data)
            throws AssetAccessException
Description copied from interface: AssetDataWriteStrategy
Delete a given list of assts from Content Server

Specified by:
delete in interface AssetDataWriteStrategy
Parameters:
data - the list of AssetIds to delete
Throws:
AssetAccessException - AssetAccessException captures layer specific failures and wraps other internal exceptions.

write

public void write(java.util.List<AssetData> data,
                  AssetDataWriteStrategy.AssetActionType type)
           throws AssetAccessException
Description copied from interface: AssetDataWriteStrategy
Inserts a given Iterator of AssetData instances in the database.

Specified by:
write in interface AssetDataWriteStrategy
Parameters:
data - AssetData to be inserted.
type - the type of operation for the list of assets
Throws:
AssetAccessException - captures layer specific failures and wraps other internal exceptions.

_save

protected void _save(java.util.List<IAsset> instances,
                     boolean insert)
              throws AssetAccessException
Saves a list of asset instances to Content Server

Parameters:
instances - the assets to save
insert - whether the assets will be saved as new; true indicates they are new assets; false indicates not
Throws:
AssetAccessException - throws the exception if error met in saving

getInstances

protected java.util.List<IAsset> getInstances(java.util.List<AssetData> data,
                                              AssetDataWriteStrategy.AssetActionType type,
                                              java.util.List<java.lang.String> ignoreAttributes,
                                              boolean insert)
                                       throws AssetAccessException
Gets a list of IAsset instances given a list of asset data

Parameters:
data - data the asset datas used to construct the IAssets
type - the action type AssetActionType.NEW or AssetActionType.UPDATE
ignoreAttributes - the list of attributes that will be ignored from the asset datas
insert - whether it is an insert
Returns:
the IAssets created from the asset datas
Throws:
AssetAccessException - throws this exception if error met

populateInstance

public void populateInstance(IAsset asset,
                             AssetData data)
                      throws AssetAccessException
Specified by:
populateInstance in interface AssetDataWriteStrategy
Throws:
AssetAccessException

populateInstance

public void populateInstance(IAsset asset,
                             AssetData data,
                             boolean filterNoSetAttributes,
                             boolean verifyReferences)
                      throws AssetAccessException
Specified by:
populateInstance in interface AssetDataWriteStrategy
Throws:
AssetAccessException

getInstance

protected IAsset getInstance(AssetData data,
                             AssetDataWriteStrategy.AssetActionType type,
                             java.util.List<java.lang.String> ignoreAttributes,
                             boolean insert)
                      throws AssetAccessException
Gets an IAsset instance with the given asset data

Parameters:
data - the asset data used to construct the IAsset
type - the action type AssetActionType.NEW or AssetActionType.UPDATE
ignoreAttributes - the list of attributes that will be ignored from the asset data
insert - whether it is an insert
Returns:
the IAsset created from the asset data
Throws:
AssetAccessException - throws this exception if error met

_getAssetTypeDef

protected AssetTypeDef _getAssetTypeDef(java.lang.String assettype,
                                        java.lang.String subtype)
                                 throws AssetAccessException
returnt the AssetTypeDef given asset type and subtype

Parameters:
assettype - the type of the asset
subtype - the subtype of the asset
Returns:
AssetTypeDef the asset type defintion of the given asset type and subtype
Throws:
AssetAccessException - exception will be thrown from AssetTypeDefManager.findByName(assettype, subtype)


Copyright (c) 2003 - 2011 FatWire Corporation All Rights Reserved.