| Oracle Repository API and Model Reference Guide |
CDAPI's element packages provide the following methods for managing objects in the repository:
For details of the various access rights and system privileges, see The Privileges and Access Rights API.
Notes:
PROCEDURE cio<element type>.check_in (i_irid NUMBER , i_ivid NUMBER , i_notes VARCHAR2 default NULL , i_vlabel VARCHAR2 default NULL , o_ivid OUT NUMBER);
Where:
i_irid is the IRID of the object to be checked in.
i_ivid is IVID of the particular version of the element. This can be left NULL.
i_notes is an optional checkin note.
i_vlabel is an optional version label for the new version created by the checkin operation. If NULL
o_ivid is the IVID assigned to the new version created by the check in.
IRID must be the identifier for a PAC object or container element, which must either be new or have a currently checked out version.
The checkin operation updates the version history of the object identified by IRID.
This procedure is a wrapper for JR_VERSION.check_in . The object is checked in at the tip of the current branch. Methods on the JR_VERSION package provide for more flexible checkin operations .
Applies to PACs and container element types only.
For a checkin operation, a context workarea must be set. The operation fails if the object has already been branched to the default branch and the checked out version is on a different branch. The operation also fails if it will result in a check-in at tip on a branch that has been locked by another user.
Does not check whether the version being checked in is different to the current tip node; so a new version will be added to the branch, even if no changes have been made.
After an object version has been checked in, it is not available for update or delete, though it is otherwise available in the workarea.
This method can be called outside any CDAPI activity.
Note: When an object is checked in for the first time, its owning container must also be explicitly checked in, otherwise the new object is not visible to other repository users.
Errors are passed out on the built in PLSQL error stack, and are generated if:
jr_version.check_in
API Methods List
PROCEDURE cio<element type>.check_out (i_irid NUMBER
, i_ivid NUMBER
, i_lock VARCHAR2 default 'Y'
, i_notes VARCHAR2 default NULL
, i_vlabel VARCHAR2 default NULL
, o_ivid OUT NUMBER
, copy_deps_policy in VARCHAR2);
Where:
i_irid is the IRID of element to be checked out.
i_ivid is the IVID of the object version to be checked out.
i_lock, i_notes, i_vlabel, o_ivid, are as described for JR_VERSION.check_out. (Note, however, that with JR_VERSION.check_out, the i_lock parameter is a boolean).
copy_deps_policy specifies whether dependency information should be copied when the new version of the object is created: 'Y' = copy dependency information. 'N' = do not copy dependency information.
This procedure is a wrapper for JR_VERSION.check_out. The object is checked out from the tip of the current branch. Methods on the JR_VERSION package provide for more flexible checkout operations .
The object identified by IRID must be currently checked in. A checkout operation does not contribute to the version history of the object.
This procedure is available in packages for PAC element types and container element types only.
Can be called outside a CDAPI activity.
Any errors from JR_VERSION.check_out are passed out on the built in PL/SQL error stack.
PROCEDURE cio<element type>.copy_pac (i_irid in number
, container_reference in number
, pl in out cio<element type>.data
, ensure_unique in VARCHAR2 default 'Y'
, deep in VARCHAR2 default 'Y'
, copy_deps_policy in VARCHAR2 default 'Y');
Where:
i_irid is the IRID of element to be copied.
container_reference is the IRID of the container into which the copy is to be placed. If NULL, the context container is assumed.
pl is a property list (of type cio<element type>.data) containing modifications to be made in the copy that differentiate it from the original.
ensure_unique specifies that the API should adjust the definition of the copy to meet uniqueness requirements of the repository.
deep is the single-character depth specifier: 'Y' = deep copy - copy child elements too (default). 'N' = shallow copy - only copy the element.
copy_deps_policy specifies whether dependency information should be copied when the new version of the object is created: 'Y' = copy dependency information. 'N' = do not copy dependency information.
Copies the currently visible version of the element specified by irid. The copy is modified as specified by the contents of the property list pl. Any property (except for system properties) can be set in the property list. However, if the property values in the copy break uniqueness rules, errors are generated. Copy_pac creates a new non-versioned object in the workarea.
The container specified by container_reference owns the copy; ownership of the original remains unchanged.
In cases where the caller must specify the IRID and IVID of the copy, the caller must set these values in the property list. However, specifying an IRID and an IVID is not recommended; this should be left to the API, which returns these values in the property list.
All API checks are performed on the new element, so in general at least one property in the element's unique identifier (IRID and IVID) must be modified, or ensure that the copy is placed in a different container than the original.
If ensure_unique is set to 'Y' (the default), the set of properties required to be unique in the repository are adjusted by the API. Typically, this involves appending to the Name property a single digit in the range 1 through 9, starting with 1 and checking each time that the resulting Name is unique. If this fails, the call is deemed to have failed. For some element types, properties in addition to the Name property are treated in this way.
The deep parameter can be one of:
When a container element is copied using this procedure, elements contained in the original are not copied; only the original and pointers to its contained elements (FOLDER_MEMBER elements) are copied. The effect is that the new container shares contents with the original container.
Also, note that only contents at the first level are affected by the copy operation on a container element; that is, the copy is not recursive all the way down any containership hierarchy.
The following conditions cause errors to be passed on the CDAPI error stack:
API Methods List
Uniqueness Requirements
PROCEDURE cio<element type>.copy_sac (i_irid IN NUMBER
, pl IN OUT cio<element type>.data
, ensure_unique IN VARCHAR2 DEFAULT 'Y'
, deep IN VARCHAR2 DEFAULT 'Y'
, copy_deps_policy IN VARCHAR2 DEFAULT 'Y');
Where:
i_irid is the IRID of element to be copied.
pl is a property list (of type cio<element type>.data) containing modifications to be made in the copy that differentiate it from the original.
ensure_unique specifies that the API should adjust the definition of the copy to meet uniqueness requirements of the repository.
deep is the single-character depth specifier: 'Y' = deep copy - copy child elements too (default). 'N' = shallow copy - only copy the element.
copy_deps_policy specifies whether dependency information should be copied when the new version of the object is created: 'Y' = copy dependency information. 'N' = do not copy dependency information.
Copies the currently visible version of the element specified by irid. This method is for copying SAC element types (that is, all element types that are not PACs or are not Containers).
Any property (except for system properties) can be set in the property list pl, so a copy of a column say, may be placed in a different table by setting pl.V.TABLE_REFERENCE. The appropriate reference property must be set in pl to specify the target PAC into which the SAC is to be copied.
If ensure_unique is set to 'Y' (the default), the set of properties required to be unique in the repository are adjusted by the API. Typically, this involves appending to the Name property a single digit in the range 1 through 9, starting with 1 and checking each time that the resulting Name is unique. If this fails, the call is deemed to have failed. For some element types, properties in addition to the Name property are treated in this way.
The deep parameter is be one of:
PROCEDURE cio<element type>.del (irid NUMBER);
Where:
irid is the IRID of the object to be deleted.
Removes the currently checked out version of the object specified by irid from the context workarea, after validating against referential integrity constraints in force for the element type. The object version is made invisible in the context workarea, and visible in the associated wastebasket.
Calls JR_WASTEBASKET.delete .
The result of a delete operation depends on checkin status of object version:
To remove a checked-in object version, use jr_wastebasket.purge (which requires the PURGE system privilege).
Each element type in the repository has its own delete constraints, described in the 'API Specs' section of its Element Type Definition page..
Notes:
The JR_WASTEBASKET.force_delete method overrules these restrictions, causing cascade deletes.
wastebasket concepts.
Purge and delete methods
on the JR_WASTEBASKET package.
API Methods List
PROCEDURE cio<element type>.ins (irid IN NUMBER
, pl IN OUT cio<element type>.data);
Where:
irid is the application-supplied IRID of the new element
pl is the property list (of type cio<element type>.data) containing property values for the new object.
Creates the base version of a new element of type element type in the context workarea.
Any context container becomes the owning container of the new element.
The owning container is not automatically versioned when a new object is added.
If no context container is set and the element is a container element, this creates a root container (a container that has no owning container). In that case the ROOT_FLAG property of the container is set to 'Y'.
Note: ROOT_FLAG is a system-maintained property of container element types.
An error is generated if no context container is set and the element is not a container element.
Parameter |
Before |
After |
|---|---|---|
| irid | If NULL, the IRID of the new object is generated by the API. If not NULL, irid must contain a value that is unique within the repository. Generally, callers should leave this parameter as NULL. The exception is where a caller adopts the strategy of creating objects in batches, or where there is a need to create objects having IRIDs in a controlled range. This is best achieved by calls to cilok.idgen, which returns unique values suitable for use as IRIDs. |
Unchanged. Note: The IRID of the new object is returned in the property list's v.IRID, not in the irid parameter. |
| pl | Mandatory. Contains the details of the new element. | On return, contains:
|
The newly created element is not under version control.
API Methods List
Uniqueness Requirements
PROCEDURE cio<element type>.lck (irid IN NUMBER);
Where:
irid is the IRID of the object version whose row in the repository database is to be locked.
Locks the database row for the object specified by irid, thus preventing other users from updating or deleting it. The target can be a new object, or a currently checked out object version. The version locked is the one visible in the context workarea. The lock is automatically released when the outermost activity ends.
On return, irid is unchanged.
Note: Locking a PAC does not prevent its SACs from being deleted or updated.
PROCEDURE cio<element type>.sel (IRID NUMBER
, pl cio<element type>.data);
Where:
IRID is the element to be queried.
pl is a property (of type cio<element type>.data) list to hold the results of the query.
Retrieves property values for the currently visible version of the element identified by IRID. On return, property values are in pl.
Note: It is generally quicker to issue a SQL query on the element's view (CI_<element type_pluralname>) to select data.
PROCEDURE cio<element type>.upd (irid NUMBER
, pl cio<element type>.data);
Where:
IRID identifies the element to be updated.
pl is a property list (of type cio<element type>.data) containing the new property values.
Updates the currently visible version of the element identified by irid, using property values and indicator settings supplied in the property list pl.
The target must be either a currently checked out object version or an object that is not under version control.
The updated object version remains checked out and available for further update.
Notes:
API Methods List
Uniqueness Requirements
FUNCTION idgen RETURN number;
Returns a single unique sequence number that can be used as an identifier (IRID) for a new element.
PROCEDURE idgen (current_array in out NumberArray, num_seq number)
Where:
current_array is the array to be populated
num_seq the number of elements to return in the array.
Populates a supplied array with a number of unique sequence numbers that can be used as identifiers (IRIDs) for new elements.
Every element type has a set of uniqueness rules (described in its API specification or the Element Type Definition).
In addition, the NAME property of a PAC object must be unique for its type within its owning container and in any container into which it is shared. This is validated when an element is created (inserted) or when any of the properties in its uniqueness rules is updated.
The API does not check for uniqueness of name outside the context workarea.
Note: Because a structured variable such as a property list always contains the current values of the data on return from a call, re-using such a variable immediately after a call can cause problems unless steps are taken to set the members of the variable appropriately. For example:
The second call to ins fails because pl.v.irid has been set by the first call.