Oracle® Fusion Middleware Integration Guide for Oracle Enterprise Repository 11g Release 1 (11.1.1.4.0) E15754-07 |
|
![]() Previous |
![]() Next |
This chapter provides an overview of AssetType API and describes the use cases using this API.
This chapter contains the following sections:
Types (Asset Types and Compliance Templates) define the structure of assets. Types consist of two main parts:
Editor
Defines the metadata that is stored for the assets and determines how metadata elements are organized in the Asset Editor.
Viewer
Defines how the metadata elements are displayed in the asset detail in Oracle Enterprise Repository.
When creating or editing a Type, acceptable value lists and categorization types are used as metadata elements. These metadata elements are referenced by ID in the Editor and Viewer XML for the Type.When creating or editing assets, Types define the metadata elements that are used in the custom data for the asset (Asset.GetCustomData()).
Note:
|
This section describes the use cases using the Asset Type API. It contains the following topics:
Description
Adding a new Type to the repository.
Sample code is as follows:
package com.flashline.sample.assettypeapi; import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import java.util.Calendar; import javax.xml.rpc.ServiceException; import com.flashline.registry.openapi.base.OpenAPIException; import com.flashline.registry.openapi.entity.AssetType; import com.flashline.registry.openapi.entity.AuthToken; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class CreateNewAssetType { public static void main(String pArgs[]) throws RemoteException, OpenAPIException, ServiceException { try { /////////////////////////////////////////////////////////// // Connect to Oracle Enterprise Repository /////////////////////////////////////////////////////////// URL lURL = null; lURL = new URL(pArgs[0]); FlashlineRegistry repository = new FlashlineRegistryServiceLocator() .getFlashlineRegistry(lURL); // ////////////////////////////// // Authenticate with OER // ////////////////////////////// AuthToken authToken = repository.authTokenCreate(pArgs[1], pArgs[2]); // ////////////////////////////// // Select an existing Type on which to base the new one // ////////////////////////////// String newAssetTypeName = "My AssetType"; long baseAssetTypeID = 151; AssetType newAssetType = repository.assetTypeCreateClone( authToken, baseAssetTypeID, newAssetTypeName); System.out.println("The new Asset Type id =\"" + newAssetType.getID() + "\""); // ////////////////////////////// // Manipulate xml strings // ////////////////////////////// String lEditorXML = newAssetType.getEditorXML(); String lViewerXML = newAssetType.getViewerXML(); // Perform XML manipulation on the editor and viewer definitions... // ////////////////////////////// // Set the new editor/viewer definitions on the asset type, and save the // type back to OER // ////////////////////////////// newAssetType.setEditorXML(lEditorXML); newAssetType.setViewerXML(lViewerXML); repository.assetTypeUpdate(authToken, newAssetType); // ---------------------------------------- // clean up sample repository.assetTypeDelete(authToken, newAssetType.getID()); } catch (OpenAPIException lEx) { System.out.println("ServerCode = " + lEx.getServerErrorCode()); System.out.println("Message = " + lEx.getMessage()); System.out.println("StackTrace:"); lEx.printStackTrace(); } catch (RemoteException lEx) { lEx.printStackTrace(); } catch (ServiceException lEx) { lEx.printStackTrace(); } catch (MalformedURLException lEx) { lEx.printStackTrace(); } } }
Description
Adding a new Compliance Template Type to the repository.
Sample code is as follows:
package com.flashline.sample.assettypeapi; import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import java.util.Calendar; import javax.xml.rpc.ServiceException; import com.flashline.registry.openapi.base.OpenAPIException; import com.flashline.registry.openapi.entity.AssetType; import com.flashline.registry.openapi.entity.AuthToken; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class CreateNewComplianceTemplateType { public static void main(String pArgs[]) throws RemoteException, OpenAPIException, ServiceException { try { /////////////////////////////////////////////////////////// // Connect to Oracle Enterprise Repository /////////////////////////////////////////////////////////// URL lURL = null; lURL = new URL( pArgs[0]); FlashlineRegistry repository = new FlashlineRegistryServiceLocator() .getFlashlineRegistry(lURL); // ////////////////////////////// // Authenticate with OER // ////////////////////////////// AuthToken authToken = repository.authTokenCreate(pArgs[1], pArgs[2]); // ////////////////////////////// // Create a new compliance template. // ////////////////////////////// String newAssetTypeName = "My Compliance Template"+Calendar.getInstance().getTimeInMillis(); AssetType newAssetType = repository .assetTypeCreateComplianceTemplate(authToken, newAssetTypeName); } catch (OpenAPIException lEx) { System.out.println("ServerCode = " + lEx.getServerErrorCode()); System.out.println("Message = " + lEx.getMessage()); System.out.println("StackTrace:"); lEx.printStackTrace(); } catch (RemoteException lEx) { lEx.printStackTrace(); } catch (ServiceException lEx) { lEx.printStackTrace(); } catch (MalformedURLException lEx) { lEx.printStackTrace(); } } }
Description
Locating a Type in the repository.
Sample Code is as follows:
package com.flashline.sample.assettypeapi; import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import javax.xml.rpc.ServiceException; import com.flashline.registry.openapi.base.OpenAPIException; import com.flashline.registry.openapi.entity.AssetType; import com.flashline.registry.openapi.entity.AuthToken; import com.flashline.registry.openapi.query.AssetTypeCriteria; import com.flashline.registry.openapi.query.SearchTerm; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class FindAssetType { public static void main(String pArgs[]) throws RemoteException, OpenAPIException, ServiceException { try { /////////////////////////////////////////////////////////// // Connect to Oracle Enterprise Repository /////////////////////////////////////////////////////////// URL lURL = null; lURL = new URL(pArgs[0]); FlashlineRegistry repository = new FlashlineRegistryServiceLocator() .getFlashlineRegistry(lURL); // ////////////////////////////// // Authenticate with OER // ////////////////////////////// AuthToken authToken = repository.authTokenCreate(pArgs[1], pArgs[2]); // ////////////////////////////// // Create SearchTerms and set them on the AssetSearchCriteria // ////////////////////////////// AssetTypeCriteria assetTypeCriteria = new AssetTypeCriteria(); SearchTerm[] searchTerms = new SearchTerm[1]; searchTerms[0] = new SearchTerm(); searchTerms[0].setKey("name"); searchTerms[0].setValue("Component"); assetTypeCriteria.setSearchTerms(searchTerms); // ////////////////////////////// // Perform the search using the specified criteria // ////////////////////////////// AssetType[] assetTypes = repository.assetTypeQuery(authToken, assetTypeCriteria); } catch (OpenAPIException lEx) { System.out.println("ServerCode = " + lEx.getServerErrorCode()); System.out.println("Message = " + lEx.getMessage()); System.out.println("StackTrace:"); lEx.printStackTrace(); } catch (RemoteException lEx) { lEx.printStackTrace(); } catch (ServiceException lEx) { lEx.printStackTrace(); } catch (MalformedURLException lEx) { lEx.printStackTrace(); } } }
Methods to Avoid:
setIcon
setID
Description
Retrieve the list of tabs available for an asset type.
Sample Code is as follows:
package com.flashline.sample.assettypeapi; import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import javax.xml.rpc.ServiceException; import com.flashline.registry.openapi.base.OpenAPIException; import com.flashline.registry.openapi.entity.AuthToken; import com.flashline.registry.openapi.entity.TabTypeBean; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class ReadTabTypes { public static void main(String pArgs[]) throws OpenAPIException, RemoteException, ServiceException { try { /////////////////////////////////////////////////////////// // Connect to Oracle Enterprise Repository /////////////////////////////////////////////////////////// URL lURL = null; lURL = new URL(pArgs[0]); FlashlineRegistry repository = new FlashlineRegistryServiceLocator().getFlashlineRegistry(lURL); TabTypeBean[] lTabTypeBeans = null; /////////////////////////////////// // Login to OER /////////////////////////////////// AuthToken authToken = repository.authTokenCreate(pArgs[1],pArgs[2]); /////////////////////////////////// // read the tab types of an assettype /////////////////////////////////// lTabTypeBeans = repository.assetTypeTabsRead(authToken, 100); } catch (OpenAPIException lEx) { System.out.println("ServerCode = " + lEx.getServerErrorCode()); System.out.println("Message = " + lEx.getMessage()); System.out.println("StackTrace:"); lEx.printStackTrace(); } catch (RemoteException lEx) { lEx.printStackTrace(); } catch (ServiceException lEx) { lEx.printStackTrace(); } catch (MalformedURLException lEx) { lEx.printStackTrace(); } } }
Description
Retrieves all asset type tabs within the Oracle Enterprise Repository.
Sample Code is as follows:
package com.flashline.sample.assettypeapi; import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import javax.xml.rpc.ServiceException; import com.flashline.registry.openapi.base.OpenAPIException; import com.flashline.registry.openapi.entity.AuthToken; import com.flashline.registry.openapi.entity.TabTypeBean; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class ReadTabTypes { public static void main(String pArgs[]) throws OpenAPIException, RemoteException, ServiceException { try { /////////////////////////////////////////////////////////// // Connect to Oracle Enterprise Repository /////////////////////////////////////////////////////////// URL lURL = null; lURL = new URL(pArgs[0]); FlashlineRegistry repository = new FlashlineRegistryServiceLocator().getFlashlineRegistry(lURL); TabTypeBean[] lTabTypeBeans = null; /////////////////////////////////// // Login to OER /////////////////////////////////// AuthToken authToken = repository.authTokenCreate(pArgs[1],pArgs[2]); /////////////////////////////////// // read the tab types of an assettype /////////////////////////////////// lTabTypeBeans = repository.assetTypeTabsRead(authToken, 100); } catch (OpenAPIException lEx) { System.out.println("ServerCode = " + lEx.getServerErrorCode()); System.out.println("Message = " + lEx.getMessage()); System.out.println("StackTrace:"); lEx.printStackTrace(); } catch (RemoteException lEx) { lEx.printStackTrace(); } catch (ServiceException lEx) { lEx.printStackTrace(); } catch (MalformedURLException lEx) { lEx.printStackTrace(); } } }
Example of the RelationshipTypeQuery
try { RelationshipTypeCriteria rCriteria = new RelationshipTypeCriteria(); RelationshipType[] allRelationshipTypes = FlashlineRegistry.relationshipQuery(lAuthToken, rCriteria); } catch (OpenAPIException e) { e.printStackTrace(); } catch (RemoteException re) { re.printStackTrace(); }