API entities and entity service methods
- Last Updated: August 4, 2022
- 4 minute read
- OpenEdge
- Version 12.2
- Documentation
The IDataAdminstrationService interface
provides service methods that implement create, read, update, and delete operations against
single schema elements, or a collection of schema elements, accessed through supported entity
and entity collection interfaces. The following tables list the available service methods for
accessing the basic entities and entity collections with these operations. The listed entity
name is the implementing class name for each entity object and is also part of each entity
method name, for example, "Area" as in the NewArea( ) method.
Corresponding entity collection methods have a similar method name using the plural of the
entity name, for example in the NewAreas( ) method.
All method parameters are passed as INPUT and
are indicated in the method syntax by data type only. Method return types are shown only for
methods that return entity or entity collection objects. All other entity service methods
return a LOGICAL of TRUE when
execution returns successfully.
The API supports additional entities (for example partitions) that you can access as child entity or collection objects using properties and methods of the basic entity objects that you access through the service.
The following table provides a summary of factory and create methods on the
IDataAdminstrationService interface for entities and entity
collections that you can create through the service.
| Entity name | Factory (New) methods | Create methods |
|---|---|---|
| Area |
|
|
| AuthenticationSystem |
|
|
| Domain |
|
|
| Extent |
|
– |
| Sequence |
|
|
| Tenant |
|
|
| TenantGroup |
|
|
| User |
|
|
| PartitionPolicy |
|
|
| PartitionPolicyDetail |
|
|
The factory (New*( )) methods return a new
entity class instance (as the entity interface type) or an empty entity collection object (as
the entity collection interface type), which you can update and pass to the corresponding
Create*( ) methods to commit the changes to the database.
The entity factory methods take a character key as input and return a new
entity object with the passed key assigned to the associated key property (typically Name or Id). All other properties
are set to their default values. The NewExtent( ) method does
not take any parameter and the service does not have a corresponding create method, because
you add the extent object to an area object and committed it with the area object.
The collection factory methods have no parameter and return a new empty
collection object. You can then add entity instances returned from the entity factory methods
to the collection object and pass it to the corresponding Create*( ) method for the collection to commit all the entities to the database in
a single transaction. For more information on transactions, see Managing transactions.
For IPartitionPolicyDetail, a factory method
that returns an empty collection does not exist, since the details collection always exists on
the policy. Similarly, for IIndex, a factory method that returns an empty collection does not
exist, since the a policy always consists an index.
The instances returned from the entity factory methods can also be added to
existing collections retrieved with a Get*( ) method, then
committed with the corresponding Update*( ) method in the
service (see the following table). This is only necessary if the new instances need to be
committed in the same transaction as other changes.
Similarly, the collections returned from the collection factory methods can
also be added to existing collections retrieved with a Get*( ) method and then committed with the corresponding Update*( ) method in the service. This approach is only necessary if you need to
ensure that instances imported from an external file are treated as new instances and gives
an error if an instance with the same key already exists.
The following table provides a summary of read and update methods on the
IDataAdminstrationService interface for entities and entity
collections that you can read and update (if applicable) through the service.
| Entity name | Read methods | Update methods |
|---|---|---|
| Administrator |
|
|
| Area |
|
|
| AuthenticationSystem |
|
|
| Domain |
|
|
| Schema1 |
|
|
| Sequence |
|
|
| Table |
|
|
| TablePermission |
|
|
| Tenant |
|
|
| TenantGroup |
|
|
| User |
|
|
| UserPermission |
|
– |
| PartitionPolicy |
|
|
The Get*( ) methods return a single entity
instance or a collection with entities that you can update, then pass to a corresponding
Update*( ) method to committed the changes to the
database.
Most entity Get*( ) methods take a
character key as input (which typically maps to the Name
property value) and return an existing entity object. Some entity Get*( ) methods are overloaded to take an integer key (which typically maps to the
Id property value) as an alternative to the character
parameter shown in the above table.
For entity collection Get*( ) methods, the
service also provides overloadings with an OpenEdge.DataAdmin.IRequestInfo parameter to provide filter information for the
retrieved collection, as well as any child collections. For more information, see Filtering and sorting.
The DataAdminService Get*( ) methods provide the most efficient way to get
an ad-hoc single record. If you want to work with many records, use the methods on the
collection object returned from the DataAdminService. Note, however, a
Collection:Find() or
Collection:CanFind() will not find an entity that
exists in the database if it was excluded by a filter when requesting the collection.
Therefore, avoid using a filter when requesting the collection if you expect to see all the
database records.
The following table provides a summary of delete methods on the IDataAdminstrationService interface for entities and entity
collections that you can delete through the service.
| Entity name | Delete methods |
|---|---|
| AuthenticationSystem |
|
| Domain |
|
| Sequence |
|
| Tenant |
|
| TenantGroup |
|
| User |
|
| PartitionPolicy |
|
The Delete*( ) methods take a single
character key as input and delete the corresponding entity from the database without any
warning or prompt. The methods throw an error if an entity with the specified key does not
exist.
Get*( )
method, then commit the collections with the corresponding Update*( ) method. This approach allows you to make many deletions, along with
other changes, to be committed in a single transaction. For more information on transactions,
see Managing transactions.