This section of blog lists how to create, update and delete assets (flex, basic and flex parents only) using Asset API. Most of examples are present in Developer's guide which can be accessed here -> http://docs.oracle.com/cd/E29542_01/doc.1111/e29634/asset_api_tutorial.htm#WBCSD2403
All examples for creating, updating and deleting assets are already present.
All examples for creating, updating and deleting assets are already present.
Although methods are defined in developer's guide, but some are missing, so I have listed those:
1. Updating an asset's attribute of type-asset
a.getAttributeData("<Attribute Name>").setDataAsList(Arrays.<AssetId>asList( new AssetIdImpl( "<ASSET TYPE>", <ASSET ID in LONG>)));
2. Get an asset's locale
data.getAttributeData("Dimension").getData());
3. Avoid getting parent's attribute value if child has no attribute value by setting immediateOnly
query.getProperties().setIsImmediateOnly(true);
4. While querying asset, you can set Site condition as shown:
query.getProperties().setSite(<SITE ID in Long>);
5. While querying asset, you can set locale condition only if you have copied its name to some other custom attribute via flex filter
6. Get parents or immediate parents
java.util.List<AssetId> parents = data.getImmediateParents();
java.util.List<AssetId> parents = data.getParents();
NOTE: Before using those methods mentioned in guide, please note that:
- Flex family or Basic asset family should already be created i.e. framework must be ready
- For flex -> attributes, flex parent definition, flex content definition and flex filters must be present too.
- Considering that you have FSIISite in your installation, examples provided in guide are valid
General steps to follow:
- Get a session
- Get a handle to
AssetDataManager
- Use appropriate method to
- CREATE - AssetDataManager.insert( List<AssetData> data )
- UPDATE - AssetDataManager.update( List<AssetData> data )
- DELETE - AssetDataManager.delete( List<AssetData> data )
- Use the above API with care and always handle all exceptions with logging
----------------------------------------------------
SUGGESTIONS/COMMENTS ARE INVITED
----------------------------------------------------