Class RelationshipMapper<R extends Relationship>
- java.lang.Object
-
- org.odpi.openmetadata.accessservices.subjectarea.server.mappers.relationships.RelationshipMapper<R>
-
- All Implemented Interfaces:
IRelationshipMapper<R>,Mapper<Relationship,R>
- Direct Known Subclasses:
AntonymMapper,CategoryAnchorMapper,CategoryHierarchyLinkMapper,IsARelationshipMapper,IsATypeOfMapper,PreferredTermMapper,ProjectScopeMapper,RelatedTermMapper,ReplacementTermMapper,SemanticAssignmentMapper,SynonymMapper,TermAnchorMapper,TermCategorizationMapper,TermHasARelationshipMapper,TermIsATypeOfRelationshipDeprecatedMapper,TermTypedByRelationshipMapper,TranslationMapper,UsedInContextMapper,ValidValueMapper
public abstract class RelationshipMapper<R extends Relationship> extends Object implements IRelationshipMapper<R>
Static mapping methods to map between the relationship and the equivalent generated OMRSRelationshipBean
-
-
Field Summary
Fields Modifier and Type Field Description protected OpenMetadataAPIGenericHandlergenericHandlerprotected OMRSRepositoryHelperrepositoryHelper
-
Constructor Summary
Constructors Constructor Description RelationshipMapper(OpenMetadataAPIGenericHandler genericHandler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringgetTypeDefGuid()get the relationshipTypeDef Guid This method should be overridden to provide the appropriate guid for the type.abstract StringgetTypeName()get type nameRmap(Relationship omrsRelationship)Map from an OMRS Relationship to a Subject Area OMAS relationshipRelationshipmap(R omasRelationship)Map omasRelationship to the omrs relationship equivalentprotected booleanmapEnumToRelationship(R relationship, String propertyName, EnumPropertyValue enumPropertyValue)Map an omrs enum property to a Subject Area relationship property.protected voidmapInstancePropertiesToRelationship(R relationship, InstanceProperties instanceProperties)Map the instance properties to the relationship This method should be overridden by subclasses to map the properties to the relationship.protected booleanmapMapToRelationship(R omasRelationship, String propertyName, InstanceProperties instancePropertyForMap)Map an omrs map property to a Subject Area relationship property.protected booleanmapPrimitiveToRelationship(R relationship, String propertyName, Object value)Map an omrs primitive property to a Subject Area relationship property.protected voidmapRelationshipToInstanceProperties(R omasRelationship, InstanceProperties instanceProperties)Map the supplied relationship to omrs InstanceProperties.
-
-
-
Field Detail
-
genericHandler
protected final OpenMetadataAPIGenericHandler genericHandler
-
repositoryHelper
protected final OMRSRepositoryHelper repositoryHelper
-
-
Constructor Detail
-
RelationshipMapper
public RelationshipMapper(OpenMetadataAPIGenericHandler genericHandler)
-
-
Method Detail
-
map
public R map(Relationship omrsRelationship)
Description copied from interface:IRelationshipMapperMap from an OMRS Relationship to a Subject Area OMAS relationship- Specified by:
mapin interfaceIRelationshipMapper<R extends Relationship>- Specified by:
mapin interfaceMapper<Relationship,R extends Relationship>- Parameters:
omrsRelationship- OMRS relationships- Returns:
- Subject Area OMAS relationship
-
mapInstancePropertiesToRelationship
protected void mapInstancePropertiesToRelationship(R relationship, InstanceProperties instanceProperties)
Map the instance properties to the relationship This method should be overridden by subclasses to map the properties to the relationship.- Parameters:
relationship- relationship to be updatedinstanceProperties- properties to use for the update
-
map
public Relationship map(R omasRelationship) throws InvalidParameterException
Map omasRelationship to the omrs relationship equivalent- Specified by:
mapin interfaceIRelationshipMapper<R extends Relationship>- Specified by:
mapin interfaceMapper<Relationship,R extends Relationship>- Parameters:
omasRelationship- supplied omasRelationship- Returns:
- omrs relationship equivalent
- Throws:
InvalidParameterException
-
getTypeName
public abstract String getTypeName()
get type name- Specified by:
getTypeNamein interfaceMapper<Relationship,R extends Relationship>- Returns:
- the omrs type name.
-
getTypeDefGuid
public String getTypeDefGuid()
get the relationshipTypeDef Guid This method should be overridden to provide the appropriate guid for the type.- Specified by:
getTypeDefGuidin interfaceMapper<Relationship,R extends Relationship>- Returns:
- the guid of the relationship typedef
-
mapPrimitiveToRelationship
protected boolean mapPrimitiveToRelationship(R relationship, String propertyName, Object value)
Map an omrs primitive property to a Subject Area relationship property. The child class is expected to override this method if the type has primitive properties- Parameters:
relationship- the relationship to be updatedpropertyName- the omrs property namevalue- the omrs primitive property value- Returns:
- true if it was a property we were expecting , otherwise false;
-
mapEnumToRelationship
protected boolean mapEnumToRelationship(R relationship, String propertyName, EnumPropertyValue enumPropertyValue)
Map an omrs enum property to a Subject Area relationship property. The child class is expected to override this method if the type has enum properties- Parameters:
relationship- the relationship to be updatedpropertyName- the omrs property nameenumPropertyValue- the omrs enum property value- Returns:
- true if it was a property we were expecting , otherwise false;
-
mapMapToRelationship
protected boolean mapMapToRelationship(R omasRelationship, String propertyName, InstanceProperties instancePropertyForMap)
Map an omrs map property to a Subject Area relationship property. The child class is expected to override this method if the type has map properties- Parameters:
omasRelationship- the relationship to be updatedpropertyName- the omrs property nameinstancePropertyForMap- the omrs map property value- Returns:
- true if it was a property we were expecting , otherwise false;
-
mapRelationshipToInstanceProperties
protected void mapRelationshipToInstanceProperties(R omasRelationship, InstanceProperties instanceProperties)
Map the supplied relationship to omrs InstanceProperties. This method should be overridden to populate the instance properties- Parameters:
omasRelationship- supplied relationshipinstanceProperties- equivalent instance properties to the relationship
-
-