PK
\Eoa, mimetypeapplication/epub+zipPK \E iTunesMetadata.plistv
This chapter provides use cases for the Extraction API that describe how to extract an asset, read an extraction, and update an extraction in Oracle Enterprise Repository.
This chapter includes the following sections:
As part of the Use - Download (extraction) process the user is asked to associate the selected asset with a particular project. These instances of usage, along with surveys (which are included in usage updates) are the primary drivers for metrics within Oracle Enterprise Repository.
Note: In earlier product releases the term Extraction was used to describe the act of downloading or otherwise accessing an asset's payload. The term Extraction has since been replaced by the phrase Use - Download. Note, however, that within the context of this Extraction API document, most instances of use of the term Extraction (particularly in code examples) were left intact to simplify the use of REX API. |
Definitions
State
State refers to the usage status of an asset that has been selected for use/download. There are four possible states:
IN PROCESS
ACCEPTED
REJECTED
DEPLOYED (DEPLOYED is covered under Projects).
Extraction Download
Contains the file info associated with the extracted asset. Values for an extraction download can be 0 or 1.
File Info
Information and URL links to the actual files associated with the asset make up the File Info as contained in an extraction download. File Info values for an extraction download can be 0 to n.
Related Asset
Within Oracle Enterprise Repository, a given asset can be associated with others through a number of pre-defined and/or custom-configured relationships. An asset can contain 0 to n related assets.
Related Subsystems
AssetSubsystem
ProjectSubsystem
CategorizationTypeSubsystem
SurveySubsystem
This section describes the use cases using the Extraction API. It includes the following topics:
Description
An Extraction is created when an asset is associated for use in a project by the user. A list of related assets is also made available for extraction during this process. In this case the user can simultaneously extract both the primary asset and any related assets. A unique extraction is then recorded for each asset. Creating an extraction results in an array containing 0 to n extraction downloads. The file info value for each download can be 0 to n. The file info contains information about the file. This information is used to create a link to the file.
To extract an asset the following conditions must be met:
The user must be a member of the project to which the asset is to be extracted.
The user must be assigned the appropriate role type(s).
The project must be open.
The asset(s) must be registered and active.
If Custom Access Settings are enabled, the user performing the extraction must have appropriate access rights to the specified asset(s).
If Custom Access Settings are enabled, the user performing the extraction receives file info only for those files to which the user has the appropriate permissions.
These conditions are checked by the appropriate methods in which they are used. Exceptions are thrown if the conditions are not met.
Sample Code
Example 21-1 Use Case: Extract an Asset
package com.flashline.sample.extractionapi; import java.net.MalformedURLException; import java.net.URL; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.rpc.ServiceException; import com.flashline.registry.openapi.base.OpenAPIException; import com.flashline.registry.openapi.entity.Asset; import com.flashline.registry.openapi.entity.AuthToken; import com.flashline.registry.openapi.entity.Extraction; import com.flashline.registry.openapi.entity.ExtractionDownload; import com.flashline.registry.openapi.entity.FileInfo; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class ExtractAsset { 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); // ////////////////////////////// // Authenticate with OER // ////////////////////////////// AuthToken authToken = repository.authTokenCreate( pArgs[1], pArgs[2]); long ASSET_ID_1 = 589; // must be a valid asset id in OER long ASSET_ID_2 = 569; // must be a valid asset id in OER long PROJECT_ID = 50000; // must be a valid project id in OER long EXTRACTION_ID = 0; // ---------------------------------------- // Create a new extraction long[] lAssetIDs = { ASSET_ID_1, ASSET_ID_2 }; ExtractionDownload[] extractionDownloads = repository.extractionCreate(authToken, PROJECT_ID, lAssetIDs); System.out.println("Number of new extraction downloads created: " + extractionDownloads.length); // ---------------------------------------- // Read an extraction by project and asset Extraction extraction = repository.extractionReadByProjectAndAsset(authToken, PROJECT_ID, ASSET_ID_1); EXTRACTION_ID = extraction.getID(); // ---------------------------------------- // Read an extraction by ID Extraction extractionByID = repository.extractionRead(authToken, EXTRACTION _ID); System.out.println("The extraction '"+extractionByID.getDisplayName()+"' was read by id ("+EXTRACTION_ID+")"); // ---------------------------------------- // Read asset extractions Extraction[] assetExtractions = repository.extractionReadAssetExtractions(authToken, PROJECT_ID, ASSET_ID_1, true); System.out.println("The number of extractions for this asset is: "+(assetExtractions==null ? 0 : assetExtractions.length)); // ---------------------------------------- // Read project extractions Extraction[] projectExtractions = repository.extractionReadProjectExtractions(authToken, PROJECT_ID, true); System.out.println("The number of extractions for this project is: "+(projectExtractions==null ? 0 : projectExtractions.length)); // ---------------------------------------- // Read related assets Asset[] relatedAssets = repository.extractionReadRelatedAssets(authToken, ASSET_ID_2); System.out.println("The number of related assets is: "+relatedAssets==null ? 0 : relatedAssets.length); // ---------------------------------------- // Read File-Info for an extraction List fileInfosList = new ArrayList(); if (projectExtractions != null) { for (int i = 0; i < projectExtractions.length; i++) { extraction = repository.extractionRead(authToken, projectExtractions[i].getID()); fileInfosList.add(repository.extractionReadFileInfos(authToken, extraction)); } } // ---------------------------------------- // Get File List fileInfoList = new ArrayList(); Iterator fileInfosListIter = fileInfosList.iterator(); while (fileInfosListIter.hasNext()) { FileInfo[] fileInfos = (FileInfo[]) fileInfosListIter.next(); for (int i = 0; i < fileInfos.length; i++) { fileInfoList.add(fileInfos[i]); } } String[] fileLinks = new String[fileInfoList.size()]; for (int i = 0; i < fileInfoList.size(); i++) { FileInfo fileInfo = (FileInfo) fileInfoList.get(i); fileLinks[i] = repository.repositoryFileTranslator(authToken, fileInfo); System.out.println("Project extraction file-info link: "+fileLinks[i]); } // ----------------------------------- // revert extractions repository.extractionResetDatabase(); } 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(); } } }
Notes about FileInfo Objects
FileInfo objects represent individual files associated with the extracted asset. The physical location of the file may be obtained by the two following methods.
Using the downloadURI property on the FileInfo object itself, for example, fileInfo.getDownloadURI().
Using the OpenAPI method repositoryFileTranslator passing the FileInfo object, for example, flashlineRegistry.repositoryFileTranslator(authToken, fileInfo).
Note: DO NOT use the URI property on the FileInfo object which represents an Oracle Enterprise Repository specific path. |
Description
Several methods beyond those covered in the Extract an Asset use case is used to read extractions. Extractions can be grouped by asset, project, or user. The specific grouping of extractions determines the method to be used.
To read an extraction the following conditions must be met:
The project must be open.
The asset(s) must be registered and active.
The extraction must be active.
These conditions are checked by the appropriate methods in which they are used. Exceptions are thrown if the conditions are not met.
Sample Code
Example 21-2 Use Case: Read an Extraction
package com.flashline.sample.extractionapi; 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.Asset; import com.flashline.registry.openapi.entity.AuthToken; import com.flashline.registry.openapi.entity.Extraction; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class ExtractRead { 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); // ////////////////////////////// // Authenticate with OER // ////////////////////////////// AuthToken authToken = repository.authTokenCreate( pArgs[1],pArgs[2]); long PROJECT_ID = 50000; // must be a valid project id in the OER long ASSET_ID = 569; // must be a valid asset id in the OER // ---------------------------------------- // Read project extractions Extraction[] projectExtractions = repository .extractionReadProjectExtractions(authToken, PROJECT_ID, true); // ---------------------------------------- // Read asset extractions Extraction[] assetExtractions = repository .extractionReadAssetExtractions(authToken, PROJECT_ID, ASSET_ID, true); // ---------------------------------------- // Read user extractions Extraction[] userExtractions = repository .extractionReadUserExtractions(authToken, true); // ---------------------------------------- // Read related assets Asset[] assets = repository.extractionReadRelatedAssets(authToken, ASSET_ID); } 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
An extraction record is updated when the state of the asset is changed or when the consumer of the asset completes an asset survey. A state change or survey completion can be separate transactions or performed in tandem.
To update an extraction the following conditions must be met:
The project must be open.
The asset must be registered and active.
The extraction must be active.
The survey taken must be active.
These conditions are checked by the appropriate methods in which they are used. Exceptions are thrown if the conditions are not met.
Sample Code
Example 21-3 Use Case: Update an Extraction
package com.flashline.sample.extractionapi; 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.Answer; import com.flashline.registry.openapi.entity.AuthToken; import com.flashline.registry.openapi.entity.Categorization; import com.flashline.registry.openapi.entity.Choice; import com.flashline.registry.openapi.entity.ChoiceList; import com.flashline.registry.openapi.entity.Extraction; import com.flashline.registry.openapi.entity.ExtractionDownload; import com.flashline.registry.openapi.entity.IExtraction; import com.flashline.registry.openapi.entity.Question; import com.flashline.registry.openapi.entity.SurveyTaken; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class ExtractUpdate { 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); // ////////////////////////////// // Authenticate with OER // ////////////////////////////// AuthToken authToken = repository.authTokenCreate( pArgs[1],pArgs[2]); long PROJECT_ID = 50000; // must be a valid project id in the OER long ASSET_ID = 569; // must be a valid asset id in the OER // ---------------------------------------- // Create a new extraction long[] lAssetIDs = { ASSET_ID }; ExtractionDownload[] extractionDownloads = repository.extractionCreate(authToken, PROJECT_ID, lAssetIDs); Extraction[] assetExtractions = repository .extractionReadAssetExtractions(authToken, PROJECT_ID, ASSET_ID, true); /////////////////////////////////////////////////////////////////////////// // this assumes that there is at least 1 extraction and the first one is // used /////////////////////////////////////////////////////////////////////////// IExtraction iExtraction = repository .extractionReadExtractionStates(authToken); Extraction extraction = repository.extractionRead(authToken, assetExtractions[0].getID()); /////////////////////////////////////////////////////////////////////////// // can set the status of the extraction to 'Deployed', 'Rejected', or 'In // Process'. /////////////////////////////////////////////////////////////////////////// assetExtractions[0].setStatus("In Process"); extraction = repository.extractionTentativelyAccept(authToken, extraction); SurveyTaken surveyTaken = repository.surveyTakenRead(authToken, extraction); extraction = repository.extractionUpdateSurvey(authToken, extraction, surveyTaken); extraction.setStatus(iExtraction.getInProcess()); surveyTaken = repository.surveyTakenRead(authToken, extraction); extraction = repository.extractionUpdateSurvey(authToken, extraction, surveyTaken); Categorization[] rejectionReasons = repository .extractionReadRejectionReasons(authToken); surveyTaken = repository.surveyTakenRead(authToken, extraction); extraction = repository.extractionUpdateSurvey(authToken, extraction, surveyTaken); surveyTaken = repository.surveyTakenRead(authToken, extraction); Question[] questions = repository.surveyReadQuestions(authToken); ChoiceList choiceList = null; Choice[] choices = null; Answer[] answers = new Answer[4]; for (int i = 0; i < answers.length; i++) { answers[i] = new Answer(); } answers[0].setQuestionId(questions[0].getId()); choiceList = questions[0].getChoiceList(); choices = choiceList.getChoices(); answers[0].setChoiceId(choices[0].getId()); answers[0].setValue(choices[0].getValue()); answers[1].setQuestionId(questions[1].getId()); answers[1].setChoiceId(0); answers[1].setValue("100"); answers[2].setQuestionId(questions[2].getId()); answers[2].setChoiceId(0); answers[2].setValue("200"); answers[3].setQuestionId(questions[3].getId()); choiceList = questions[3].getChoiceList(); choices = choiceList.getChoices(); answers[3].setChoiceId(choices[3].getId()); answers[3].setValue(choices[3].getValue()); surveyTaken.setAnswers(answers); surveyTaken = repository.surveyTakenUpdate(authToken, surveyTaken); // ----------------------------------- // revert extractions repository.extractionResetDatabase(); } 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(); } } }
Pitfalls
Bear in mind that a state change or a survey taken is a two-step process. The first step is to change the state or take the survey. The second step is to update the extraction status using the extractionUpdateStatus method. A state change or survey taken can be separate transactions or performed in tandem. If performed in tandem only a single extractionUpdateStatus method call is required.
The extractionUpdateStatus method requires a SurveyTaken. This is true regardless of whether a survey was taken at the time the extractionUpdateStatus method is called (as in a state change, for example). This survey is retrieved using the surveyTakenRead method. If a survey has not been taken for this extraction, then one is created by the surveyTakenRead method.
The current survey in Oracle Enterprise Repository consists of four questions. When a survey is taken an array is created storing answers for the four questions. Each answer must contain three pieces of information to be valid:
The value (the user response to the question)
The question ID
The choice ID
Questions 2 and 3 are single answer questions, so the choice ID here is always set to 0. Questions 1 and 4, however, are multiple-choice. The multiple choices are retrieved using the surveyReadChoiceList method.
Methods to Avoid:
The following objects are used in the Extraction and Survey subsystems:
Extraction
ExtractionDownload
FileInfo
SurveyTaken
Question
ChoiceList
Choice
Answer
The use of any of the get methods within these objects is acceptable. All the remaining methods - especially the set methods - should be avoided. The events provided by these remaining methods are covered by the methods in the Extraction and Survey subsystems.
This chapter provides use cases for the Categorization Types and Categorizations API that describe how to create a categorization type, manipulate categorizations, and manipulate categorization types.
This chapter includes the following sections:
It is important to understand the difference between Categorizations and Categorization Types.
Categorization Types provide the means to define custom taxonomies. Categorizations are subsets of Categorization Types, and are assigned to assets. For example, a Categorization Type called Technology might contain Java, .NET and COBOL as its assignable Categorizations. Additionally, sub-categorizations under Java might include Servlet and Applet. So an asset in Oracle Enterprise Repository might be assigned to the Java Categorization, or it might be more specifically assigned to the Servlet Sub-categorization.
The Categorizations to which a particular asset may be assigned are determined by the Categorization Types defined for that asset's Type. As in the example above, if the Technology Categorization Type is defined for Asset Type XYZ, assets of type XYZ may be assigned to the Java, .NET, or COBOL, Categorizations, or to the Sub-categorizations Servlet or Applet. This taxonomy structure enables assets to be grouped and viewed in a variety of ways within Oracle Enterprise Repository.
Categorization types can also be associated with projects (if Oracle Enterprise Repository is configured for that feature). Any project-assignable Categorization Type is available to all projects. As with assets, a project can be associated with any of the Categorizations available within its assigned Categorization Type(s).
Rules for Categorization Types and Categorizations include:
The Repository can contain 0 to n Categorization Types with each Categorization Type containing 0 to n Categorizations.
Each Categorization can contain 0 to n Sub-categorizations.
Each Categorization Type must have a unique name. This name cannot contain spaces or special characters.
As an option, Categorizations within a given Categorization Type may be made mutually exclusive. That is, when a list of Categorizations is presented, only one may be selected.
When the Mutually Exclusive option is selected for a Categorization Type, Oracle Enterprise Repository enforces the rule for future usage only. Existing references to multiple selected categorizations within the Type are unchanged.
When so configured, Categorization Types can be assigned to projects. This enables projects in Oracle Enterprise Repository to be organized by Categorization Type/Categorization.
If the configuration of a specific Categorization Type is changed to prevent its assignment to Projects, the change affects only subsequent Project assignment. The change does not affect the Categorization Type's assignment to existing Projects.
Categorization Types may be deleted from Oracle Enterprise Repository. However, doing so also deletes all categorizations within the deleted Categorization Type. Exercise caution when performing this task.
Categorizations may be deactivated. Deactivation prevents future use of the Categorization (and all sub-categorizations) but does not delete it from Oracle Enterprise Repository. Existing references to a Categorization are unaffected by deactivation.
Deactivated Categorizations may be reactivated, reversing the aforementioned process.
Within a given Categorization Type, all Categorizations must be uniquely named. However, the same name may be shared by multiple Categorizations residing in different Categorization Types.
The following methods provide the ability to create, update, list, query, and delete categorization types.
This section describes the use cases using the Categorization Types and Categorizations API. It includes the following topics:
Description
The element name given to a newly created Categorization Type cannot contain special characters or spaces. There are no restrictions on the characters used for singular and plural display names. The pExclusiveAssign Boolean determines whether one or multiple Categorizations can be assigned within the Categorization Type. The pExclusiveAssign Boolean determines if the Categorization Type is project-assigned. The method prevents duplication of existing Categorizations, and returns the created Categorization Type.
Sample Code
Example 17-1 Use Case: Create a Categorization Type
package com.flashline.sample.categorizationtypesandapi; 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.CategorizationType; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class CreateCategorizationType { public static void main(String pArgs[]) throws java.rmi.RemoteException, OpenAPIException { 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 the categorization type // ////////////////////////////// String pName = "Name"; String pSingularDisplay = "SingularDisplay"; String pPluralDisplay = "PluralDisplay"; boolean pExclusiveAssign = true; boolean pProjectAssign = true; CategorizationType lCategorizationType = repository.categorizationTypeCreate(authToken, pName, pSingularDisplay, pPluralDisplay, pExclusiveAssign, pProjectAssign); // ---------------------------------------- // clean up repository.categorizationTypeDelete(authToken, lCategorizationType); } 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
The following operations are demonstrated in the example below:
Retrieve Categorization Types by ID
Update a Categorization Type
Delete a Categorization Type
Exercise Caution! This method deletes the entire Categorization Type and all Categorizations contained therein.
Query a Categorization Type
Use various terms, including name, type, and if a Categorization Type is assigned to projects.
Retrieve all Categorization Types
Sample Code
Example 17-2 Use Case: Manipulate Categorization Types
package com.flashline.sample.categorizationtypesandapi; 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.Categorization; import com.flashline.registry.openapi.entity.CategorizationType; import com.flashline.registry.openapi.query.CategorizationTypeCriteria; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class CategorizationExamples { public static void main(String pArgs[]) throws ServiceException, RemoteException, OpenAPIException { 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 Categorization Type // ////////////////////////////// CategorizationType categorizationType = repository .categorizationTypeCreate(authToken, "exampleType", "Example Type", "Example Types", false, true); // ////////////////////////////// // Find and update a categorization type // ////////////////////////////// CategorizationTypeCriteria categorizationTypeCriteria = new CategorizationTypeCriteria(); boolean projectAssign = true; categorizationTypeCriteria.setProjectAssignCriteria(projectAssign + ""); CategorizationType[] categorizationTypes = repository .categorizationTypeQuery(authToken, categorizationTypeCriteria); // Set plural display name categorizationType.setDisplayPlural("Updated Example Types"); // Set singular display name categorizationType.setDisplaySingular("Updated Example Type"); // Set Categorization Type name categorizationType.setName("updatedExampleType"); // Set Categorization Type exclusive assign categorizationType.setExclusiveAssign(true); // Set Categorization Type project Assignable categorizationType.setProjectAssignable(false); // Update Categorization Type categorizationType = repository.categorizationTypeUpdate( authToken, categorizationType); // Read a Categorization Type CategorizationType categorizationTypeRead = repository .categorizationTypeRead(authToken, categorizationType.getID()); // ////////////////////////////// // Create a Categorization within a Categorization Type // ////////////////////////////// Categorization categorization = repository.categorizationCreate( authToken, "Example Categorization", categorizationType); // ////////////////////////////// // Create a Categorization within a Categorization (a.k.a. a // sub-categorization or child categorization) // // method validates that: // - no child categorization with the same name exists within the // parent categorization. // - the categorization type is valid // - the parent categorization is valid. // ////////////////////////////// Categorization childCategorization = repository .categorizationChildCreate(authToken, "Example Child Categorization", categorizationType, categorization); childCategorization.setName("Updated Example Child Categorization"); childCategorization = repository.categorizationUpdate(authToken, childCategorization, categorizationType); // ////////////////////////////// // Observe various properties of a categorization. Note that the // properties are not being assigned to local variables in // the interest of brevity... // ////////////////////////////// Categorization categorizationRead = repository.categorizationRead( authToken, childCategorization.getID()); // Get Categorization parent id //categorizationRead.getParentID(); // Get Categorization active status categorizationRead.getActiveStatus(); // Get Categorization ID categorizationRead.getID(); // Get Categorization name categorizationRead.getName(); // Get Categorization recursive name categorizationRead.getRecursiveName(); // Get Categorization Categorization Type ID categorizationRead.getTypeID(); // ////////////////////////////// // Retrieve the full tree of categorizations for a Categorization Type. // This means that the Categorization entity returned has children // which contain their children (if any), and so on. // ////////////////////////////// // Get active Categorizations full tree boolean active = true; boolean fullTree = true; Categorization[] categorizationArray = repository.categorizationReadByType( authToken, categorizationType, active, fullTree); // Get children categorizations for categorization Categorization[] childCategorizations = repository.categorizationChildRead(authToken, categorizationType, categorization, active); // ////////////////////////////// // Deactivate a Categorization // ////////////////////////////// categorization = repository.categorizationDeactivate(authToken, categorization, categorizationType); // pActive is set to "true" so that the method returns // only active categorizations Categorization[] activeCategorizations = repository .categorizationChildRead(authToken, categorizationType, categorization, true); // Get inactive child Categorizations Categorization[] inactiveCategorizations = repository.categorizationChildRead(authToken, categorizationType, categorization, false); // ///////////////////////////// // Reactivate Categorizations // ///////////////////////////// for(int i=0; i<inactiveCategorizations.length; i++){ categorization = repository.categorizationReactivate(authToken, inactiveCategorizations[i], categorizationType); } // ////////////////////////////// // Delete a Categorization Type // ////////////////////////////// repository.categorizationTypeDelete(authToken, categorizationType); } 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
The methods listed below are for internal Oracle Enterprise Repository use only. Incorrect use of these methods may disrupt the functionality of Categorization Types (though permanent damage is unlikely). The functionality provided by these methods is incorporated in the Oracle Enterprise Repository CategorizationType methods.
getActiveStatus() int - CategorizationType
getCategorizations() Categorizations[] - CategorizationType
GetEntityType() String - CategorizationType
getKey() String - CategorizationType
getTypeDesc() TypeDesc - CategorizationType
hashCode() int - CategorizationType
isCustom() boolean - CategorizationType
isFlat() boolean - CategorizationType
isSystemOnly() boolean - CategorizationType
setActiveStatus(int activeStatus) void - CategorizationType
setAssetAssignable(boolean assetAssignable) void - CategorizationType
setCategorizations(Categorizations[] categorizations) void - CategorizationType
setCustom(boolean custom) void - CategorizationType
setEntityType(String entityType) void - CategorizationType
setFlat(boolean flat) void - CategorizationType
setID(long ID) void - CategorizationType
setKey(String key) void - CategorizationType
setSystemOnly(boolean systemOnly) void - CategorizationType
Description
The following code sample illustrates creation, updating, listing, and deactivation/reactivation of Categorizations. As stated above, Categorizations are subordinate to Categorization Types. That is, a Categorization belongs to a Categorization Type.
Sample Code
Example 17-3 Use Case: Manipulate Categorizations
package com.flashline.sample.categorizationtypesandapi; 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.Categorization; import com.flashline.registry.openapi.entity.CategorizationType; import com.flashline.registry.openapi.query.CategorizationTypeCriteria; import com.flashline.registry.openapi.service.v300.FlashlineRegistry; import com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator; public class CategorizationExamples { public static void main(String pArgs[]) throws ServiceException, RemoteException, OpenAPIException { 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 Categorization Type // ////////////////////////////// CategorizationType categorizationType = repository .categorizationTypeCreate(authToken, "exampleType", "Example Type", "Example Types", false, true); // ////////////////////////////// // Find and update a categorization type // ////////////////////////////// CategorizationTypeCriteria categorizationTypeCriteria = new CategorizationTypeCriteria(); boolean projectAssign = true; categorizationTypeCriteria.setProjectAssignCriteria(projectAssign + ""); CategorizationType[] categorizationTypes = repository .categorizationTypeQuery(authToken, categorizationTypeCriteria); // Set plural display name categorizationType.setDisplayPlural("Updated Example Types"); // Set singular display name categorizationType.setDisplaySingular("Updated Example Type"); // Set Categorization Type name categorizationType.setName("updatedExampleType"); // Set Categorization Type exclusive assign categorizationType.setExclusiveAssign(true); // Set Categorization Type project Assignable categorizationType.setProjectAssignable(false); // Update Categorization Type categorizationType = repository.categorizationTypeUpdate( authToken, categorizationType); // Read a Categorization Type CategorizationType categorizationTypeRead = repository .categorizationTypeRead(authToken, categorizationType.getID()); // ////////////////////////////// // Create a Categorization within a Categorization Type // ////////////////////////////// Categorization categorization = repository.categorizationCreate( authToken, "Example Categorization", categorizationType); // ////////////////////////////// // Create a Categorization within a Categorization (a.k.a. a // sub-categorization or child categorization) // // method validates that: // - no child categorization with the same name exists within the // parent categorization. // - the categorization type is valid // - the parent categorization is valid. // ////////////////////////////// Categorization childCategorization = repository .categorizationChildCreate(authToken, "Example Child Categorization", categorizationType, categorization); childCategorization.setName("Updated Example Child Categorization"); childCategorization = repository.categorizationUpdate(authToken, childCategorization, categorizationType); // ////////////////////////////// // Observe various properties of a categorization. Note that the // properties are not being assigned to local variables in // the interest of brevity... // ////////////////////////////// Categorization categorizationRead = repository.categorizationRead( authToken, childCategorization.getID()); // Get Categorization parent id //categorizationRead.getParentID(); // Get Categorization active status categorizationRead.getActiveStatus(); // Get Categorization ID categorizationRead.getID(); // Get Categorization name categorizationRead.getName(); // Get Categorization recursive name categorizationRead.getRecursiveName(); // Get Categorization Categorization Type ID categorizationRead.getTypeID(); // ////////////////////////////// // Retrieve the full tree of categorizations for a Categorization Type. // This means that the Categorization entity returned has children // which contain their children (if any), and so on. // ////////////////////////////// // Get active Categorizations full tree boolean active = true; boolean fullTree = true; Categorization[] categorizationArray = repository.categorizationReadByType( authToken, categorizationType, active, fullTree); // Get children categorizations for categorization Categorization[] childCategorizations = repository.categorizationChildRead(authToken, categorizationType, categorization, active); // ////////////////////////////// // Deactivate a Categorization // ////////////////////////////// categorization = repository.categorizationDeactivate(authToken, categorization, categorizationType); // pActive is set to "true" so that the method returns // only active categorizations Categorization[] activeCategorizations = repository .categorizationChildRead(authToken, categorizationType, categorization, true); // Get inactive child Categorizations Categorization[] inactiveCategorizations = repository.categorizationChildRead(authToken, categorizationType, categorization, false); // ///////////////////////////// // Reactivate Categorizations // ///////////////////////////// for(int i=0; i<inactiveCategorizations.length; i++){ categorization = repository.categorizationReactivate(authToken, inactiveCategorizations[i], categorizationType); } // ////////////////////////////// // Delete a Categorization Type // ////////////////////////////// repository.categorizationTypeDelete(authToken, categorizationType); } 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:
The methods listed below are for internal Oracle Enterprise Repository use only and should not be used. Incorrect use of these methods could cause improper functioning of categorizations. The functions provided by these methods provide are incorporated in the Oracle Enterprise Repository categorization methods.
getDescription() String - Categorization
GetEntityType() String - Categorization
getKey() String - Categorization
getLevel() long - Categorization
getType() CategorizationType - Categorization
getTypeDesc() TypeDesc - Categorization
hashCode() int - Categorization
set_super(Categorization _super) void - Categorization
setActiveStatus(int activeStatus) void - Categorization
setDeleted(boolean deleted) void - Categorization
setDescription(String description) void - Categorization
setEntityType(String entityType) void - Categorization
setID(long ID) void - Categorization
setKey(String key) void - Categorization
setRecursiveName(String recursiveName) void - Categorization
setType(CategorizationType type) void - Categorization
setTypeID(long ID) void - Categorization
This chapter describes how to get started with the integration of Oracle Enterprise Repository with Amberpoint.
Note: Integration of Oracle Enterprise Repository with Amberpoint, which is now rebranded to Oracle Business Transaction Manager (OBTM), is supported only to product versions prior to OBTM 11. This integration support with Oracle Enterprise Repository is not supported for OBTM 11. |
Oracle Exchange Utility updates the endpoint asset with the performance metrics deposited by Amberpoint. The UDDIMappings.xml file contains the mapping between the performance metrics t-models and the keys to Oracle Enterprise Repository custom fields where these metrics are populated. You can also customize the UDDI Mapping file so that the metrics can appear on any tab mapped to any field in the tabs of any custom asset type. Example 6-1 describes the metrics part in the UDDIMappings.xml
file:
Example 6-1 Metrics Part of UDDIMappings.xml File
<metrics> <keyedReference metricsName="DailyAvailability" alerName="availability---year----" tModelKey="uddi:amberpoint.com:management:metrics:availability" keyName="Last 24 hours - Availability (percentage value)"/> <keyedReference metricsName="WeeklyAvailability" alerName="availability---week----" tModelKey="uddi:amberpoint.com:management:metrics:availability" keyName="Last week - Availability (percentage value)"/> <keyedReference metricsName="MonthlyAvailability" alerName="availability---month----" tModelKey="uddi:amberpoint.com:management:metrics:availability" keyName="Last month - Availability (percentage value)"/> <keyedReference metricsName="DailyAvgResponseTime" alerName="average-response-time--seconds-" tModelKey="uddi:amberpoint.com:management:metrics:avgResponseTime" keyName="Last 24 hours - Response Time (average value in milliseconds)"/> <keyedReference metricsName="WeeklyAvgResponseTime" alerName="weekly-average-response-time--milliseconds-" tModelKey="uddi:amberpoint.com:management:metrics:avgResponseTime" keyName="Last week - Response Time (average value in milliseconds)"/> <keyedReference metricsName="MonthlyAvgResponseTime" alerName="monthly-average-response-time--milliseconds-" tModelKey="uddi:amberpoint.com:management:metrics:avgResponseTime" keyName="Last month - Response Time (average value in milliseconds)"/> <keyedReference metricsName="DailyFaults" alerName="daily-faults" tModelKey="uddi:amberpoint.com:management:metrics:faults" keyName="Last 24 hours - Faults (number)"/> <keyedReference metricsName="WeeklyFaults" alerName="weekly-faults" tModelKey="uddi:amberpoint.com:management:metrics:faults" keyName="Last week - Faults (number)"/> <keyedReference metricsName="MonthlyFaults" alerName="monthly-faults" tModelKey="uddi:amberpoint.com:management:metrics:faults" keyName="Last month - Faults (number)"/> <keyedReference metricsName="DailyRequests" alerName="daily-requests" tModelKey="uddi:amberpoint.com:management:metrics:requests" keyName="Last 24 hours - Requests (number)"/> <keyedReference metricsName="WeeklyRequests" alerName="weekly-requests" tModelKey="uddi:amberpoint.com:management:metrics:requests" keyName="Last week - Requests (number)"/> <keyedReference metricsName="MonthlyRequests" alerName="monthly-requests" tModelKey="uddi:amberpoint.com:management:metrics:requests" keyName="Last month - Requests (number)"/> <keyedReference metricsName="Timestamp" alerName="last-updated" tModelKey="uddi:amberpoint.com:management:metrics:timeStamp" keyName=""/> <keyedReference metricsName="RegisteredDate" alerName="endpoint-publication-date" tModelKey="uddi:amberpoint.com:management:registeredDate" keyName=""/> </metrics>
Figure 6-1 illustrates how the performance metrics deposited by Amberpoint appears in Oracle Enterprise Repository after the endpoint is synchronized by the Exchange Utility.
Figure 6-2 illustrates how the performance metrics deposited by Amberpoint appear in Oracle Service Registry.