public abstract class RelationshipMapping extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RelationshipMapping.OptimalStart
The optimal endpoint from which to retrieve the relationship:
- ONE = from ProxyOne
- TWO = from ProxyTwo
- OPPOSITE = from whichever Proxy does not match the entity for which relationships are being retrieved
- CUSTOM = must be custom implemented via a complexRelationshipMappings method
|
class |
RelationshipMapping.ProxyMapping
Class to represent each side of a relationship mapping, keeping the details of that side of the mapping together.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
SELF_REFERENCE_SENTINEL |
| Modifier | Constructor and Description |
|---|---|
protected |
RelationshipMapping(String igcAssetTypeProxyOne,
String igcAssetTypeProxyTwo,
String igcRelationshipPropertyFromOne,
String igcRelationshipPropertyFromTwo,
String omrsRelationshipType,
String omrsRelationshipProxyOneProperty,
String omrsRelationshipProxyTwoProperty) |
protected |
RelationshipMapping(String igcAssetTypeProxyOne,
String igcAssetTypeProxyTwo,
String igcRelationshipPropertyFromOne,
String igcRelationshipPropertyFromTwo,
String omrsRelationshipType,
String omrsRelationshipProxyOneProperty,
String omrsRelationshipProxyTwoProperty,
String igcProxyOneRidPrefix,
String igcProxyTwoRidPrefix) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAlternativePropertyFromOne(String property)
Add an alternative IGC property that can be used to traverse the relationship from proxy one to proxy two.
|
void |
addAlternativePropertyFromTwo(String property)
Add an alternative IGC property that can be used to traverse the relationship from proxy two to proxy one.
|
static Relationship |
addIgcRelationship(IGCOMRSRepositoryConnector igcomrsRepositoryConnector,
RelationshipMapping relationshipMapping,
InstanceProperties initialProperties,
Reference proxyOne,
Reference proxyTwo,
String userId)
Adds the provided relationship to IGC (if possible), or throws a RepositoryErrorException if the relationship
cannot be created in IGC.
|
void |
addMappedOmrsProperty(String name)
Add the provided property name as one supported by this classification mapping.
|
void |
addMappedOMRSRelationships(IGCOMRSRepositoryConnector igcomrsRepositoryConnector,
List<Relationship> relationships,
Reference fromIgcObject,
String userId)
Must be implemented to define how to map the relationships defined by the mapper, if there are any complex
custom mappings to be done for relationships.
|
void |
addSubType(RelationshipMapping subRelationshipMapping)
Adds a subtype to this relationship mapping.
|
void |
addSupportedStatus(InstanceStatus status)
Add the provided status as one supported by this relationship mapping.
|
static EntityProxy |
getEntityProxyForObject(IGCOMRSRepositoryConnector igcomrsRepositoryConnector,
Reference igcObj,
String userId,
String ridPrefix)
Retrieves an EntityProxy object for the provided IGC object.
|
List<String> |
getIgcRelationshipPropertiesForType(String igcAssetType)
Retrieve the IGC relationship properties that define the relationship for the provided IGC asset type.
|
String |
getLinkingAssetType()
Retrieve the name of the asset type needed to link together the two endpoints of the relationship (if any), or null.
|
Set<String> |
getMappedOmrsPropertyNames()
Retrieve the set of OMRS properties that are supported by the classification mapping.
|
protected static Relationship |
getMappedRelationship(IGCOMRSRepositoryConnector igcomrsRepositoryConnector,
RelationshipMapping relationshipMapping,
RelationshipDef omrsRelationshipDef,
Reference proxyOne,
Reference proxyTwo,
String igcPropertyName,
String userId)
Retrieve a Relationship instance based on the provided definition and endpoints.
|
static Relationship |
getMappedRelationship(IGCOMRSRepositoryConnector igcomrsRepositoryConnector,
RelationshipMapping relationshipMapping,
RelationshipDef omrsRelationshipDef,
Reference proxyOne,
Reference proxyTwo,
String igcPropertyName,
String userId,
String relationshipLevelRid)
Retrieve a Relationship instance based on the provided definition, endpoints, and optional prefixes.
|
static void |
getMappedRelationships(IGCOMRSRepositoryConnector igcomrsRepositoryConnector,
List<Relationship> relationships,
List<RelationshipMapping> mappings,
String relationshipTypeGUID,
Reference fromIgcObject,
String userId)
Utility function that actually does the Relationship object setup and addition to 'relationships' member.
|
String |
getOmrsRelationshipType()
Retrieve the type of OMRS relationship this mapping handles.
|
RelationshipMapping.OptimalStart |
getOptimalStart()
Get the optimal starting point for traversing this relationship.
|
RelationshipMapping.ProxyMapping |
getOtherProxyFromType(String igcAssetType)
Retrieve the proxy details for the other side of the relationship from the IGC asset type provided.
|
RelationshipMapping.ProxyMapping |
getProxyFromType(String igcAssetType)
Retrieve the proxy details for the side of the relationship given by the asset type provided.
|
List<Reference> |
getProxyOneAssetFromAsset(Reference relationshipAsset,
IGCRestClient igcRestClient)
By default, return the asset itself.
|
static String |
getProxyOneGUIDFromRelationshipGUID(String relationshipGUID)
Retrieve the portion of the provided relationship GUID that represents the GUID for proxy one of the relationship.
|
RelationshipMapping.ProxyMapping |
getProxyOneMapping()
Retrieves the mapping details for endpoint 1 (proxy 1) of the OMRS relationship.
|
List<Reference> |
getProxyTwoAssetFromAsset(Reference relationshipAsset,
IGCRestClient igcRestClient)
By default, return the asset itself.
|
static String |
getProxyTwoGUIDFromRelationshipGUID(String relationshipGUID)
Retrieve the portion of the provided relationship GUID that represents the GUID for proxy two of the relationship.
|
RelationshipMapping.ProxyMapping |
getProxyTwoMapping()
Retrieves the mapping detals for endpoint 2 (proxy 2) of the OMRS relationship.
|
static String |
getRelationshipGUID(RelationshipMapping relationshipMapping,
Reference endOne,
Reference endTwo,
String igcPropertyName,
String relationshipLevelRid)
Generates a unique relationship GUID based on the provided parameters.
|
String |
getRelationshipLevelIgcAsset()
Retrieve the name of the IGC asset type that represents the relationship itself.
|
static String |
getRelationshipTypeFromRelationshipGUID(String relationshipGUID)
Retrieve the portion of the provided relationship GUID that represents the OMRS relationship type.
|
List<RelationshipMapping> |
getSubTypes()
Retrieve the listing of sub-relationship mappings of this mapping.
|
List<InstanceStatus> |
getSupportedStatuses()
Retrieve the list of statuses that are supported by the relationship mapping.
|
boolean |
hasLinkingAsset()
Indicates whether this mapping needs an IGC asset linking the endpoints (true) or not (false).
|
boolean |
hasRelationshipLevelAsset()
Indicates whether this mapping has an IGC asset that represents the relationship directly (true) or not (false).
|
boolean |
hasSubTypes()
Indicates whether this relationship mapping has subtypes (true) or not (false).
|
boolean |
isSelfReferencing()
Indicates whether the relationship references the same IGC object (true) or not (false).
|
boolean |
samePropertiesOnBothEnds()
Indicates whether the same relationship properties are used on both ends of the relationship (true) or not (false).
|
boolean |
sameTypeOnBothEnds()
Indicates whether the same asset / entity type is used on both ends of the relationship (true) or not (false).
|
void |
setLinkingAssetType(String igcAssetType)
Define an IGC asset type as linking together the two endpoints of the relationship translated by this mapping.
|
void |
setOptimalStart(RelationshipMapping.OptimalStart optimalStart)
Set the optimal starting point for traversing this relationship.
|
void |
setRelationshipLevelIgcAsset(String igcAssetType)
Sets a relationship-level IGC asset type (these very rarely exist, only known example is 'classification').
|
String |
toString() |
public static final String SELF_REFERENCE_SENTINEL
protected RelationshipMapping(String igcAssetTypeProxyOne, String igcAssetTypeProxyTwo, String igcRelationshipPropertyFromOne, String igcRelationshipPropertyFromTwo, String omrsRelationshipType, String omrsRelationshipProxyOneProperty, String omrsRelationshipProxyTwoProperty)
protected RelationshipMapping(String igcAssetTypeProxyOne, String igcAssetTypeProxyTwo, String igcRelationshipPropertyFromOne, String igcRelationshipPropertyFromTwo, String omrsRelationshipType, String omrsRelationshipProxyOneProperty, String omrsRelationshipProxyTwoProperty, String igcProxyOneRidPrefix, String igcProxyTwoRidPrefix)
public void addSupportedStatus(InstanceStatus status)
status - a status that is supported by the mappingpublic List<InstanceStatus> getSupportedStatuses()
List<InstanceStatus>public void addMappedOmrsProperty(String name)
name - the name of the OMRS property supported by the mappingpublic Set<String> getMappedOmrsPropertyNames()
Set<String>public void setRelationshipLevelIgcAsset(String igcAssetType)
igcAssetType - the name of the IGC asset that represents this relationship in IGCpublic boolean hasRelationshipLevelAsset()
public String getRelationshipLevelIgcAsset()
public void setLinkingAssetType(String igcAssetType)
igcAssetType - the IGC asset type that links together the two endpoints of the relationshippublic boolean hasLinkingAsset()
public String getLinkingAssetType()
public List<Reference> getProxyOneAssetFromAsset(Reference relationshipAsset, IGCRestClient igcRestClient)
relationshipAsset - the asset to use to lookup the actual first endpoint in IGCigcRestClient - REST API connectivitypublic List<Reference> getProxyTwoAssetFromAsset(Reference relationshipAsset, IGCRestClient igcRestClient)
relationshipAsset - the asset to use to lookup the actual second endpoint in IGCigcRestClient - REST API connectivitypublic boolean hasSubTypes()
public void addSubType(RelationshipMapping subRelationshipMapping)
subRelationshipMapping - the relationship mapping that defines a subtype of this mappingpublic List<RelationshipMapping> getSubTypes()
List<RelationshipMapping>public void addMappedOMRSRelationships(IGCOMRSRepositoryConnector igcomrsRepositoryConnector, List<Relationship> relationships, Reference fromIgcObject, String userId)
igcomrsRepositoryConnector - relationships - fromIgcObject - userId - public String getOmrsRelationshipType()
public void setOptimalStart(RelationshipMapping.OptimalStart optimalStart)
optimalStart - public RelationshipMapping.OptimalStart getOptimalStart()
public void addAlternativePropertyFromOne(String property)
property - the name of the additional IGC relationship propertypublic void addAlternativePropertyFromTwo(String property)
property - the name of the additional IGC relationship propertypublic boolean isSelfReferencing()
public RelationshipMapping.ProxyMapping getProxyOneMapping()
public RelationshipMapping.ProxyMapping getProxyTwoMapping()
public boolean sameTypeOnBothEnds()
public boolean samePropertiesOnBothEnds()
public RelationshipMapping.ProxyMapping getProxyFromType(String igcAssetType)
igcAssetType - the IGC asset type for which to find the same side of the relationshippublic RelationshipMapping.ProxyMapping getOtherProxyFromType(String igcAssetType)
igcAssetType - the IGC asset type for which to find the other side of the relationshippublic List<String> getIgcRelationshipPropertiesForType(String igcAssetType)
igcAssetType - the IGC asset type for which to retrieve the relationship propertiesList<String>public static String getRelationshipGUID(RelationshipMapping relationshipMapping, Reference endOne, Reference endTwo, String igcPropertyName, String relationshipLevelRid)
relationshipMapping - the relationship mapping defining how an IGC relationship maps to an OMRS relationshipendOne - the candidate to consider for endpoint 1 of the relationshipendTwo - the candidate to consider for endpoint 2 of the relationshipigcPropertyName - the name of the IGC property for which the relationship is being generatedrelationshipLevelRid - the relationship-level RID (if any) within IGC (these are very rare)public static String getProxyOneGUIDFromRelationshipGUID(String relationshipGUID)
relationshipGUID - the relationship GUIDpublic static String getProxyTwoGUIDFromRelationshipGUID(String relationshipGUID)
relationshipGUID - the relationship GUIDpublic static String getRelationshipTypeFromRelationshipGUID(String relationshipGUID)
relationshipGUID - the relationship GUIDpublic static EntityProxy getEntityProxyForObject(IGCOMRSRepositoryConnector igcomrsRepositoryConnector, Reference igcObj, String userId, String ridPrefix)
igcomrsRepositoryConnector - OMRS connector to the IBM IGC repositoryigcObj - the IGC object for which to retrieve an EntityProxyuserId - the user through which to retrieve the EntityProxy (unused)ridPrefix - any prefix required on the object's ID to make it uniquepublic static void getMappedRelationships(IGCOMRSRepositoryConnector igcomrsRepositoryConnector, List<Relationship> relationships, List<RelationshipMapping> mappings, String relationshipTypeGUID, Reference fromIgcObject, String userId)
igcomrsRepositoryConnector - connectivity to an IGC environmentrelationships - the list of relationships to append tomappings - the mappings to use for retrieving the relationshipsrelationshipTypeGUID - String GUID of the the type of relationship required (null for all).fromIgcObject - the IGC object that is the source of the relationshipsuserId - protected static Relationship getMappedRelationship(IGCOMRSRepositoryConnector igcomrsRepositoryConnector, RelationshipMapping relationshipMapping, RelationshipDef omrsRelationshipDef, Reference proxyOne, Reference proxyTwo, String igcPropertyName, String userId) throws RepositoryErrorException
igcomrsRepositoryConnector - connectivity to the IGC repositoryrelationshipMapping - the definition of how to map the relationshipomrsRelationshipDef - the OMRS relationship definitionproxyOne - the IGC asset to use for endpoint 1 of the relationshipproxyTwo - the IGC asset to use for endpoint 2 of the relationshipigcPropertyName - the name of the IGC relationship propertyuserId - RepositoryErrorExceptionpublic static Relationship getMappedRelationship(IGCOMRSRepositoryConnector igcomrsRepositoryConnector, RelationshipMapping relationshipMapping, RelationshipDef omrsRelationshipDef, Reference proxyOne, Reference proxyTwo, String igcPropertyName, String userId, String relationshipLevelRid) throws RepositoryErrorException
igcomrsRepositoryConnector - connectivity to the IGC repositoryrelationshipMapping - the definition of how to map the relationshipomrsRelationshipDef - the OMRS relationship definitionproxyOne - the IGC asset to consider for endpoint 1 of the relationshipproxyTwo - the IGC asset to consider for endpoint 2 of the relationshipigcPropertyName - the name of the IGC relationship propertyuserId - relationshipLevelRid - the IGC RID for the relationship itself (in rare instances where it exists)RepositoryErrorExceptionpublic static Relationship addIgcRelationship(IGCOMRSRepositoryConnector igcomrsRepositoryConnector, RelationshipMapping relationshipMapping, InstanceProperties initialProperties, Reference proxyOne, Reference proxyTwo, String userId) throws RepositoryErrorException
igcomrsRepositoryConnector - connectivity via an IGC OMRS Repository ConnectorrelationshipMapping - relationship mapping definitioninitialProperties - the properties to set on the relationshipproxyOne - IGC object representing the first proxy of the relationshipproxyTwo - IGC object representing the second proxy of the relationshipuserId - userId through which to create the relationshipRepositoryErrorExceptionCopyright © 2018–2019 ODPi. All rights reserved.