Skip navigation links


com.fatwire.services
Interface AssetService

All Superinterfaces:
Service

public interface AssetService
extends Service

The Asset Service is the interface providing asset and asset type related services.


Method Summary
 AssetSaveStatusBean copy(AssetId source, java.lang.String targetName, MessageCollectors.SaveAssetsMessageCollector collector)
           Copies an asset and returns a new asset with the specified name by copying fields from the source asset and mutating field values as governed by the dimension object.
 boolean delete(AssetId assetId, MessageCollectors.DeleteAssetsMessageCollector collector)
          Deletes an asset.
 java.util.List<AssetId> delete(java.util.List<AssetId> assetIds, MessageCollectors.DeleteAssetsMessageCollector collector)
          Deletes a list of assets identified by the asset identifiers in assetsToDelete.
 boolean exists(AssetId assetId)
           Returns true if an asset exists.
 boolean existsInSite(AssetId assetId, long siteId)
           Returns true if an asset exists in the given site.
 java.util.List<SiteBean> getCommonEnabledSites(java.util.List<AssetId> assetIds)
          Returns the list of sites in which intersection of all the assets enabled sites.
 java.util.List<SiteBean> getCommonSharedSites(java.util.List<AssetId> assetIds)
          Returns the list of sites in which intersection of all the assets shared sites.
 AssetTypeDef getDefinition(java.lang.String type, java.lang.String subType)
           Returns the asset type definition object for a specified asset type.
 java.util.List<AssetId> getReferences(AssetId assetId)
          Returns a list of asset identifiers for all assets which reference a given asset.
 java.util.List<SiteBean> getSitesInWhichEnabled(java.lang.String assetType)
          Returns the list of sites for which the given asset type is enabled.
 java.util.List<SiteBean> getSitesInWhichShared(AssetId assetId)
          Returns the list of sites in which an asset is shared.
 java.util.List<java.lang.String> getSubtypes(java.lang.String assetType, java.lang.Long site)
           Returns the List of subtypes for the given flex asset type and site.
 AssetData newAsset(java.lang.String type, java.lang.String subtype, StartMenuBean startMenu)
           Returns an empty asset data instance for a given asset type.
 AssetData read(AssetId assetId)
           Returns data associated with asset.
 AssetData read(AssetId assetId, java.util.List<java.lang.String> fields)
           Returns a subset of the data associated with asset, retrieving only a subset of the available fields.
 java.util.List<AssetData> read(java.util.List<AssetId> assetIds)
           Returns data associated with asset.
 java.util.List<AssetId> removeReferences(AssetId assetId, java.util.List<AssetId> references, MessageCollectors.RemoveReferenceMessageCollector collector)
          Removes the references of an asset.
 AssetSaveStatusBean save(AssetData assetData, MessageCollectors.SaveAssetsMessageCollector collector)
          Saves the data associated with an asset.
 java.lang.Boolean share(AssetId assetId, java.util.List<java.lang.Long> sites)
          Shares an asset with all the sites in the specified list.
 AssetSaveStatusBean translate(AssetId assetid, java.lang.String targetName, DimensionBean dimension, MessageCollectors.SaveAssetsMessageCollector collector)
           Translates an asset and returns a new asset as governed by the specified dimension object.

 

Methods inherited from interface com.fatwire.services.Service
getManager, getResponse, setManager

 

Method Detail

getDefinition

AssetTypeDef getDefinition(java.lang.String type,
                           java.lang.String subType)
                           throws ServiceException

Returns the asset type definition object for a specified asset type.

The asset type argument has the optional sub-type attribute which is optional for Assetmaker asset types and mandatory for Flex asset types.
Parameters:
type, - String the asset type for which the type definition is to be retrieved.
subType, - String the asset sub type for which the type definition is to be retrieved.
Returns:
the asset type definition associated with this asset type and sub-type.
Throws:
ServiceException - wraps any exception underlying the service call.

newAsset

AssetData newAsset(java.lang.String type,
                   java.lang.String subtype,
                   StartMenuBean startMenu)
                   throws ServiceException

Returns an empty asset data instance for a given asset type.

This method can be considered a starting point for creating a new asset for a specific asset type. The asset data will be populated with the default values set in the start menu, only if a non-null startMenu is passed, and the start menu exists. Note: While creating the start menu to be passed in the parameter, it is necessary to make sure that the sub-type is populated correctly as per the definition of TypeBean.
Parameters:
type - the asset type whose instance is to be created.
subType - the asset subType whose instance is to be created.
startMenu - the start menu corresponding to the asset type, set as null to avoid setting default values.
Returns:
asset data
Throws:
ServiceException

read

AssetData read(AssetId assetId)
               throws ServiceException

Returns data associated with asset.

This method accepts an asset identifier. It reads the data associated with the asset and populates the data associated with that asset. If the asset is voided or if the asset does not exist, this method returns null.
Parameters:
assetIds - the identifier of the asset to retrieve.
Returns:
data associated with the given assets.
Throws:
ServiceException - wraps any exception underlying the service call.

read

java.util.List<AssetData> read(java.util.List<AssetId> assetIds)
                               throws ServiceException

Returns data associated with asset.

This method accepts an asset identifier. It reads the data associated with the asset and populates the data associated with that asset. If the asset is voided or if the asset does not exist, this method returns null.
Parameters:
assetId - the identifier of the asset to retrieve.
Returns:
data associated with the given assets.
Throws:
ServiceException - wraps any exception underlying the service call.

read

AssetData read(AssetId assetId,
               java.util.List<java.lang.String> fields)
               throws ServiceException

Returns a subset of the data associated with asset, retrieving only a subset of the available fields.

This method accepts an asset identifier. It reads the data associated with the asset and populates the data associated with that asset. If the asset is voided or if the asset does not exist, this method returns null. If the list contains fields which are not available in the asset definition, those fields are ignored. This method should be preferred over AssetService.read(AssetId, List) if it is only required to read only specific fields of the asset.
Parameters:
assetIds - the list of identifier for the assets to load.
fields - the list of fields which are to be retrieved.
Returns:
the list of data associated with the given assets.
Throws:
ServiceException - wraps any exception underlying the service call.

save

AssetSaveStatusBean save(AssetData assetData,
                         MessageCollectors.SaveAssetsMessageCollector collector)
                         throws ServiceException
Saves the data associated with an asset. This method attempts to save all the data, and returns true if the asset has changed as a result of this save.
Parameters:
assetData - the data associated with the asset to save.
Returns:
true if the asset has changed as a result of this save, false otherwise.
Throws:
ServiceException - wraps any exception underlying the service call.

delete

boolean delete(AssetId assetId,
               MessageCollectors.DeleteAssetsMessageCollector collector)
               throws ServiceException
Deletes an asset. This method should be safe i.e., it should fail to delete an asset if there are integrity constraints (for example, references by other assets).
Parameters:
assetId - the identifier of the asset to delete.
Returns:
true if delete was successful, false otherwise.
Throws:
ServiceException - wraps any exception underlying the service call.

delete

java.util.List<AssetId> delete(java.util.List<AssetId> assetIds,
                               MessageCollectors.DeleteAssetsMessageCollector collector)
                               throws ServiceException
Deletes a list of assets identified by the asset identifiers in assetsToDelete. This method is used primarily for bulk delete of assets. This method should be safe i.e., it should fail to delete an asset if there are integrity constraints (for example, references by other assets).
Parameters:
assetIds - the list containing identifiers of the assets to delete.
Returns:
list containing all assets which were successfully deleted.
Throws:
ServiceException - wraps any exception underlying the service call.

getReferences

java.util.List<AssetId> getReferences(AssetId assetId)
                                      throws ServiceException
Returns a list of asset identifiers for all assets which reference a given asset.
Parameters:
assetId - the identifier for the asset whose references are to be retrieved.
Returns:
list containing asset identifiers for asset references.
Throws:
ServiceException - wraps any exception underlying the service call.

removeReferences

java.util.List<AssetId> removeReferences(AssetId assetId,
                                         java.util.List<AssetId> references,
                                         MessageCollectors.RemoveReferenceMessageCollector collector)
                                         throws ServiceException
Removes the references of an asset. This method may be used when an asset operation is blocked due to the asset being referenced by other assets (for example, an asset may not be deleted without removing its references).
Parameters:
assetId - identifier of the asset to delete.
references - list containing identifiers of assets referencing asset.
Returns:
list of asset identifiers for those reference assets which were successfully deleted.
Throws:
ServiceException - wraps any exception underlying the service call.

getSitesInWhichEnabled

java.util.List<SiteBean> getSitesInWhichEnabled(java.lang.String assetType)
                                                throws ServiceException
Returns the list of sites for which the given asset type is enabled. If the type is not enabled in any site, this returns an empty list.
Parameters:
type - the asset type which should be enabled in the list of sites returned.
Returns:
list of sites in which the asset type is enabled, empty list if the type is not enabled in any site.
Throws:
ServiceException - wraps any exception underlying the service call.

getSitesInWhichShared

java.util.List<SiteBean> getSitesInWhichShared(AssetId assetId)
                                               throws ServiceException
Returns the list of sites in which an asset is shared. If the asset is not shared in any site, this returns an empty list.
Parameters:
assetId - identifier of the asset which should be shared in the list of sites returned.
Returns:
list of sites in which this asset is shared, empty list if the asset is not shared in any site.
Throws:
ServiceException - wraps any exception underlying the service call.

getCommonEnabledSites

java.util.List<SiteBean> getCommonEnabledSites(java.util.List<AssetId> assetIds)
                                               throws ServiceException
Returns the list of sites in which intersection of all the assets enabled sites. If the all the assets are not enable to any common site, this returns an empty list.
Parameters:
assetIds - list of asset ids
Returns:
list of sites in which intersection of all the assets enabled sites, empty list if all the assets are not enable to any common site.
Throws:
ServiceException - wraps any exception underlying the service call.

getCommonSharedSites

java.util.List<SiteBean> getCommonSharedSites(java.util.List<AssetId> assetIds)
                                              throws ServiceException
Returns the list of sites in which intersection of all the assets shared sites. If the all the assets are not shared to any common site, this returns an empty list.
Parameters:
assetIds - list of asset ids
Returns:
list of sites in which intersection of all the assets shared sites, empty list if all the assets are not shared to any common site.
Throws:
ServiceException - wraps any exception underlying the service call.

share

java.lang.Boolean share(AssetId assetId,
                        java.util.List<java.lang.Long> sites)
                        throws ServiceException
Shares an asset with all the sites in the specified list. if the list is empty or null, the asset is not shared with any site. If the asset is already shared with some sites, this method will only share the asset with those sites in the list with which it is not shared.
Parameters:
assetId - identifier of the asset to share.
sites - list of sites with which asset is to be shared.
Returns:
true if the asset could successfully be shared across all specified sites.
Throws:
ServiceException - wraps any exception underlying the service call.

getSubtypes

java.util.List<java.lang.String> getSubtypes(java.lang.String assetType,
                                             java.lang.Long site)
                                             throws ServiceException

Returns the List of subtypes for the given flex asset type and site.

If the specified type is not a Flex asset type, the returned list will empty.
Parameters:
type - The flex asset type for which to retrieve the list of sub types in the specified site (the type returned by TypeBean.getType() is considered).
site - the site in which to search for the subtypes.
Returns:
list of string (SubTypes)
Throws:
ServiceException - wraps any exception underlying the service call.

translate

AssetSaveStatusBean translate(AssetId assetid,
                              java.lang.String targetName,
                              DimensionBean dimension,
                              MessageCollectors.SaveAssetsMessageCollector collector)
                              throws ServiceException

Translates an asset and returns a new asset as governed by the specified dimension object.

Parameters:
source - the asset from which the translation is to be made.
targetName - name of the target asset which is created by the translation process.
dimension - name of the dimension using which the translation has to be made.
Returns:
a newly created asset.
Throws:
ServiceException - wraps any exception underlying the service call.

copy

AssetSaveStatusBean copy(AssetId source,
                         java.lang.String targetName,
                         MessageCollectors.SaveAssetsMessageCollector collector)
                         throws ServiceException

Copies an asset and returns a new asset with the specified name by copying fields from the source asset and mutating field values as governed by the dimension object.

Parameters:
source - the identifier for the asset.
targetName - name of the target asset which is created by the copy process.
Returns:
a newly created asset.
Throws:
ServiceException - wraps any exception underlying the service call.

exists

boolean exists(AssetId assetId)
               throws ServiceException

Returns true if an asset exists.

Parameters:
assetId - the identifier for the asset.
Returns:
true if an asset exists.
Throws:
ServiceException - wraps any exception underlying the service call.

existsInSite

boolean existsInSite(AssetId assetId,
                     long siteId)
                     throws ServiceException

Returns true if an asset exists in the given site.

Parameters:
assetId - the identifier for the asset.
siteId - the identifier for the site.
Returns:
true if an asset exists.
Throws:
ServiceException - wraps any exception underlying the service call.

Skip navigation links


Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.