public interface ModelChangeOperations
ModelChangeOperations provide methods to alter the
OrgModel (add and delete attributes), add/delete entities, change their
attributes and add/delete relations between entities.
IDs of created entities must start with 1! IDs <= 0 are reserved for special (e.g. system-internal) purposes.
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(SessionToken session,
EntityType entType,
java.lang.String attrName,
DataType dataType)
Adds a new attribute with the given data type to the given
entity type.
|
void |
addAttribute(SessionToken session,
EntityType entType,
java.lang.String attrName,
DataType dataType,
int sizeHint)
Adds a new attribute with the given data type to the given
entity type.
|
void |
addAttribute(SessionToken session,
EntityType entType,
java.lang.String attrName,
DataType dataType,
int sizeHint,
java.lang.String omExtension,
java.lang.String mappedTo,
boolean isImported,
boolean isReadOnly)
Adds a new attribute with the given data type to the given entity type
which is being mapped from the designated org model extension.
|
void |
addAttribute(SessionToken session,
EntityType entType,
java.lang.String attrName,
DataType dataType,
java.lang.String omExtension,
java.lang.String mappedTo,
boolean isImported,
boolean isReadOnly)
Adds a new attribute with the given data type to the given entity type
which is being mapped from the designated org model extension.
|
void |
addRelation(SessionToken session,
RelationType relType,
long id1,
long id2)
This method adds a relation of the given type between the two entities
identified by the given IDs.
|
long |
createAgent(SessionToken session,
java.lang.String agentUserName,
java.lang.String password)
Adds a new Agent with the given (unique!)
|
long |
createEntity(SessionToken session,
Entity entity)
Creates a new entity with the type and attribute values provided in the
given
Entity object and returns the assigned ID. |
void |
deleteAttribute(SessionToken session,
EntityType entType,
java.lang.String attrName)
This method removes an attribute from an entity type.
|
void |
deleteEntity(SessionToken session,
EntityType entType,
long id)
This method deletes the entity with the given ID of the given type.
|
void |
deleteEntity(SessionToken session,
EntityType entType,
long id,
boolean recursive)
This method deletes the entity with the given ID of the given type and all
its relations.
|
void |
deleteRelation(SessionToken session,
RelationType relType,
long id1,
long id2)
This method deletes a relation of the given type between the two entities
identified by the given IDs.
|
void |
modifyAttribute(SessionToken session,
EntityType entType,
java.lang.String attrName,
java.lang.String mappedTo,
boolean isImported,
boolean isReadOnly)
Changes the mapping properties of the specified attribute.
|
void |
modifyAttribute(SessionToken session,
EntityType entType,
java.lang.String attrName,
java.lang.String omExt,
java.lang.String mappedTo,
boolean isImported,
boolean isReadOnly)
Changes the mapping properties of the specified attribute including the org
model extension.
|
void |
updateEntity(SessionToken session,
Entity entity)
Updates an entity with the attribute values provided in the given
Entity object. |
void addAttribute(SessionToken session, EntityType entType, java.lang.String attrName, DataType dataType) throws OrgModelException, DataSourceException
OrgModelTools.isValidAttributeName(String) to find out
whether a string is a valid attribute name if you're not sure.
DataType.NULL is not allowed as the data type of an attribute!
session - The session which is used to check for access rights on this
method.entType - the entity type to which the attribute should be addedattrName - the name of the new attributedataType - the data type of the attribute to be addedjava.lang.IllegalArgumentException - when DataType.NULL is used as data
type or the attribute name isn't validOrgModelException - when the attribute already existsDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid addAttribute(SessionToken session, EntityType entType, java.lang.String attrName, DataType dataType, java.lang.String omExtension, java.lang.String mappedTo, boolean isImported, boolean isReadOnly) throws OrgModelException, DataSourceException
OrgModelTools.isValidAttributeName(String) to find out whether a
string is a valid attribute name if you're not sure.
DataType.NULL is not allowed as the data type of an
attribute!
session - The session which is used to check for access rights on this
method.entType - the entity type to which the attribute should be addedattrName - the name of the new attributedataType - the data type of the attribute to be addedomExtension - The name of the org model extension which handles the
mapping or null.mappedTo - The name of the mapped attribute in the designated org
model extension.isImported - if the mapped attribute should be imported in the OMisReadOnly - if the mapped attribute should be read-onlyjava.lang.IllegalArgumentException - when DataType.NULL is used as data
type or the attribute name isn't validOrgModelException - when the attribute already existsDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid addAttribute(SessionToken session, EntityType entType, java.lang.String attrName, DataType dataType, int sizeHint) throws OrgModelException, DataSourceException
OrgModelTools.isValidAttributeName(String) to find out
whether a string is a valid attribute name if you're not sure.
DataType.NULL is not allowed as the data type of an attribute!
session - The session which is used to check for access rights on this
method.entType - the entity type to which the attribute should be addedattrName - the name of the new attributedataType - the data type of the attribute to be addedsizeHint - the desired size (only for STRING attributes)java.lang.IllegalArgumentException - when DataType.NULL is used as data
type or the attribute name isn't validOrgModelException - when the attribute already existsDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid addAttribute(SessionToken session, EntityType entType, java.lang.String attrName, DataType dataType, int sizeHint, java.lang.String omExtension, java.lang.String mappedTo, boolean isImported, boolean isReadOnly) throws OrgModelException, DataSourceException
OrgModelTools.isValidAttributeName(String) to find out whether a
string is a valid attribute name if you're not sure.
DataType.NULL is not allowed as the data type of an
attribute!
session - The session which is used to check for access rights on this
method.entType - the entity type to which the attribute should be addedattrName - the name of the new attributedataType - the data type of the attribute to be addedsizeHint - the desired size (only for STRING attributes)omExtension - The name of the org model extension which handles the
mapping or null.mappedTo - The name of the mapped attribute in the designated org
model extension.isImported - if the mapped attribute should be imported in the OMisReadOnly - if the mapped attribute should be read-onlyjava.lang.IllegalArgumentException - when DataType.NULL is used as data
type or the attribute name isn't validOrgModelException - when the attribute already existsDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid modifyAttribute(SessionToken session, EntityType entType, java.lang.String attrName, java.lang.String mappedTo, boolean isImported, boolean isReadOnly) throws OrgModelException, DataSourceException
session - The session which is used to check for access rights on this
method.entType - the entity type to which the attribute belongsattrName - the name of the attribute to be editedmappedTo - the name of the mapped attribute in LDAP or nullisImported - if the mapped attribute should be imported in the OMisReadOnly - if the mapped attribute should be read-onlyOrgModelException - when the attribute doesn't exist or the attribute
is mandatoryDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid modifyAttribute(SessionToken session, EntityType entType, java.lang.String attrName, java.lang.String omExt, java.lang.String mappedTo, boolean isImported, boolean isReadOnly) throws OrgModelException, DataSourceException
session - The session which is used to check for access rights on this
method.entType - the entity type to which the attribute belongsattrName - the name of the attribute to be edited. This must not be
null and it has to exist.omExt - The name of the org model extension from which to map the
designated attribute or null to remove the mapping.
model extension or null to remove the mapping.mappedTo - The name of the mapped attribute in the designated org
model extension or null to remove the mapping.isImported - if the mapped attribute should be imported in the OMisReadOnly - if the mapped attribute should be read-onlyOrgModelException - when the attribute doesn't exist or the attribute
is mandatoryDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid deleteAttribute(SessionToken session, EntityType entType, java.lang.String attrName) throws OrgModelException, DataSourceException
EntityType.getMandatoryAttributes() and
EntityType.hasMandatoryAttribute(String)).session - The session which is used to check for access rights on this
method.entType - the entity type from which to remove the attributeattrName - the name of the attribute to be deletedjava.lang.IllegalArgumentException - when the attribute name isn't validOrgModelException - when the attribute doesn't exist or the attribute
is mandatoryDataSourceException - when an unrecoverable error occurs while
accessing the data sourcelong createAgent(SessionToken session, java.lang.String agentUserName, java.lang.String password) throws OrgModelException, DataSourceException
createEntity(SessionToken, Entity), because the latter will
create an agent with random user name and password, which makes it
necessary to change them both afterwards using
updateEntity(SessionToken, Entity).session - The session which is used to check for access rights on this
method.agentUserName - the user name of the new agentpassword - the agent's passwordOrgModelException - when an agent with the same user name already
existsDataSourceException - when an unrecoverable error occurs while
accessing the data sourcelong createEntity(SessionToken session, Entity entity) throws OrgModelException, DataSourceException
Entity object and returns the assigned ID. All other
attributes are set to null. An exception is the Agent
entity: userName and password will receive a random value, therefore
createAgent(SessionToken, String, String) is the preferred way to
add new agents to the system.
read-only attributes
(other than user name and password) are simply ignored.session - The session which is used to check for access rights on this
method.entity - the entity object containing the desired attribute values for
the new entityOrgModelException - when one of the attributes doesn't exist or the
value object doesn't have a data type that's compatible to the
attribute's data typeDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid updateEntity(SessionToken session, Entity entity) throws OrgModelException, DataSourceException
Entity object. The entity to be updated is determined by the
attribute id of the data type DataType.INTEGER which must
be set within the Entity object.session - The session which is used to check for access rights on this
method.entity - contains the ID of the entity to be updated and the attribute
values it should be updated withOrgModelException - when no entity with the given ID exists, one of
the attributes doesn't exist or the value object doesn't have a
data type that's compatible to the attribute's data typeDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid deleteEntity(SessionToken session, EntityType entType, long id) throws OrgModelException, DataSourceException
deleteEntity(entType, id, false).session - The session which is used to check for access rights on this
method.entType - the type of the entity to be deletedid - the ID of the entity to be deletedOrgModelException - when no entity with this ID existsDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid deleteEntity(SessionToken session, EntityType entType, long id, boolean recursive) throws OrgModelException, DataSourceException
If the boolean parameter is true not only the entity will be
deleted but also every other entity that in some way depends on it:
session - The session which is used to check for access rights on this
method.entType - the type of the entity to be deletedid - the ID of the entity to be deletedrecursive - OrgModelException - when no entity with this ID existsDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid addRelation(SessionToken session, RelationType relType, long id1, long id2) throws OrgModelException, DataSourceException
As both IDs are simple longs, you have to pay extra
attention to their order. The following table will show you the required
order for each relation type. See RelationType for information
about why they are ordered like that.
| RelationType | id1 | id2 |
|---|---|---|
| OrgPositionOccupation (n:m) | OrgPosition | Agent |
| OrgPositionDescription (n:m) | OrgPosition | Role |
| OrgPositionAffiliation (1:m) | OrgUnit | OrgPosition |
| OrgUnitSubordination (1:m) | OrgUnit | the subordinate OrgUnit (OrgUnit.supId) |
| OrgUnitManagement (1:m) | the managing OrgPosition | OrgUnit (OrgUnit.managerId) |
| OrgGroupManagement (1:m) | the managing OrgPosition | OrgGroup (OrgGroup.managerId) |
| OrgGroupInvolvement (n:m) | OrgGroup | the involved OrgUnit |
| ProjectGroupSubordination (1:m) | ProjectGroup | the subordinate ProjectGroup (ProjectGroup.supId) |
| ProjectGroupManagement (1:m) | OrgPosition | ProjectGroup (ProjectGroup.managerId) |
| ProjectInvolvementOrgPosition (n:m) | ProjectGroup | the involved OrgPosition |
| ProjectInvolvementOrgUnit (n:m) | ProjectGroup | the involved OrgUnit |
| AgentAbility (n:m) | Agent | Ability |
| RoleDescription (n:m) | Role | Ability |
| RoleSpecialisation (1:m) | the more generic Role | the specialised Role (Role.supId) |
| OrgPositionSubstitution (1:m) | OrgPosition | SubstitutionRule |
| OrgPositionSubstitute (1:m) | the OrgPosition to substitute the other one | SubstitutionRule |
| RoleSubstitution (1:m) | Role | SubstitutionRule |
session - The session which is used to check for access rights on this
method.relType - the type of the relation to be addedid1 - the ID of the first entity (see table)id2 - the ID of the second entity (see table)OrgModelException - when one of the entities does not exist, this
exact relation already exists, the second entity already is in a
relation and can only be in one (this is the case for 1:n
relation types), the relation would create a cycle or it was
tried to substitute an OrgPosition for itself in a
SubstitutionRuleDataSourceException - when an unrecoverable error occurs while
accessing the data sourcevoid deleteRelation(SessionToken session, RelationType relType, long id1, long id2) throws OrgModelException, DataSourceException
As both IDs are simple longs, you have to pay extra
attention to their order. See addRelation(SessionToken, RelationType, long, long)
for more information.
session - The session which is used to check for access rights on this
method.relType - the type of the relation to be removedid1 - the ID of the first entity (see table)id2 - the ID of the second entity (see table)OrgModelException - when one of the entities does not exist or this
exact relation does not existDataSourceException - when an unrecoverable error occurs while
accessing the data source