Class OMEntityDao
- java.lang.Object
-
- org.odpi.openmetadata.accessservices.analyticsmodeling.contentmanager.OMEntityDao
-
public class OMEntityDao extends Object
The class implements access wrapper to retrieve data OMRS.
-
-
Field Summary
Fields Modifier and Type Field Description protected OMRSRepositoryConnectorenterpriseConnectorprotected List<String>supportedZones
-
Constructor Summary
Constructors Constructor Description OMEntityDao(OMRSRepositoryConnector enterpriseConnector, List<String> supportedZones, AuditLog auditLog)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InstancePropertiesbuildMatchingInstanceProperties(Map<String,String> properties, boolean zoneRestricted)Returns the properties object for the given pair of key - value that can be used for retrievingList<EntityDetail>findEntities(InstanceProperties matchProperties, String typeName, int fromElement, int pageSize)Find entities matching criteria.BooleangetEntityBooleanProperty(EntityDetail entity, String name)Get entity property of type boolean.EntityDetailgetEntityByGuid(String guid)Helper function to fetch entity by GUID from repository.intgetEntityIntProperty(EntityDetail entity, String name)Get entity property of type integer.StringgetEntityQName(EntityDetail entity)Get qualified name property for the entity.StringgetEntityStringProperty(EntityDetail entity, String name)Get entity property of type string.InstancePropertiesgetMapProperty(InstanceProperties properties, String name)Get map of property from collection of instance properties.List<Relationship>getRelationshipsByGUIDForEntity(EntityDetail entity, String relationshipTypeGUID)Get relationships of certain GUID for the entity.List<Relationship>getRelationshipsForEntity(EntityDetail entity, String relationshipType)Get relationships of certain type for the entity.StringgetStringProperty(String name, InstanceProperties properties)Get property of type string from collection of instance properties.voidsetContext(String value)Set context of the execution for logging.
-
-
-
Field Detail
-
enterpriseConnector
protected final OMRSRepositoryConnector enterpriseConnector
-
-
Constructor Detail
-
OMEntityDao
public OMEntityDao(OMRSRepositoryConnector enterpriseConnector, List<String> supportedZones, AuditLog auditLog)
-
-
Method Detail
-
setContext
public void setContext(String value)
Set context of the execution for logging.- Parameters:
value- high level method/operation requested by user.
-
findEntities
public List<EntityDetail> findEntities(InstanceProperties matchProperties, String typeName, int fromElement, int pageSize) throws AnalyticsModelingCheckedException
Find entities matching criteria.- Parameters:
matchProperties- filter.typeName- of the requested entity.fromElement- index of the first entity.pageSize- number of entities to return.- Returns:
- list of matching entities
- Throws:
AnalyticsModelingCheckedException- in case repository fails.
-
buildMatchingInstanceProperties
public InstanceProperties buildMatchingInstanceProperties(Map<String,String> properties, boolean zoneRestricted)
Returns the properties object for the given pair of key - value that can be used for retrieving- Parameters:
properties- - all properties to use for matchingzoneRestricted- to take into account zones.- Returns:
- properties with the given key - value pair
-
getEntityByGuid
public EntityDetail getEntityByGuid(String guid) throws AnalyticsModelingCheckedException
Helper function to fetch entity by GUID from repository.- Parameters:
guid- of the entity to fetch.- Returns:
- entity with required GUID.
- Throws:
AnalyticsModelingCheckedException- if entity cannot be fetched: failed request to repository or entity not found.
-
getRelationshipsForEntity
public List<Relationship> getRelationshipsForEntity(EntityDetail entity, String relationshipType) throws AnalyticsModelingCheckedException
Get relationships of certain type for the entity.- Parameters:
entity- whose relationships are requested.relationshipType- only relationship of the type are requested. All relationships are returned if null.- Returns:
- requested relationships.
- Throws:
AnalyticsModelingCheckedException- in case of repository fails.
-
getRelationshipsByGUIDForEntity
public List<Relationship> getRelationshipsByGUIDForEntity(EntityDetail entity, String relationshipTypeGUID) throws AnalyticsModelingCheckedException
Get relationships of certain GUID for the entity.- Parameters:
entity- whose relationships are requested.relationshipTypeGUID- only relationship of the type are requested. All relationships are returned if null.- Returns:
- requested relationships.
- Throws:
AnalyticsModelingCheckedException- in case of repository fails.
-
getEntityQName
public String getEntityQName(EntityDetail entity)
Get qualified name property for the entity.- Parameters:
entity- whose qualified name is requested.- Returns:
- qualified name.
-
getEntityStringProperty
public String getEntityStringProperty(EntityDetail entity, String name)
Get entity property of type string.- Parameters:
entity- whose property is requested.name- if the requested property.- Returns:
- property value.
-
getEntityBooleanProperty
public Boolean getEntityBooleanProperty(EntityDetail entity, String name)
Get entity property of type boolean.- Parameters:
entity- whose property is requested.name- if the requested property.- Returns:
- property value.
-
getEntityIntProperty
public int getEntityIntProperty(EntityDetail entity, String name)
Get entity property of type integer.- Parameters:
entity- whose property is requested.name- if the requested property.- Returns:
- property value.
-
getStringProperty
public String getStringProperty(String name, InstanceProperties properties)
Get property of type string from collection of instance properties.- Parameters:
name- if the requested property.properties- collection of instance properties- Returns:
- property value.
-
getMapProperty
public InstanceProperties getMapProperty(InstanceProperties properties, String name)
Get map of property from collection of instance properties.- Parameters:
name- if the requested property.properties- collection of instance properties- Returns:
- property value.
-
-