Class OpenMetadataAPIGenericBuilder
java.lang.Object
org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericBuilder
- Direct Known Subclasses:
EmbeddedConnectionBuilder,MetadataElementBuilder,ReferenceableBuilder
OpenMetadataAPIGenericBuilder provides the common functions for building new entities, relationships and
classifications. Subtypes push details of their classifications to this supertype. They manage their instance properties.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RepositoryErrorHandlerprotected List<Classification>protected Map<String,Classification> protected OMRSRepositoryHelperprotected Stringprotected Stringprotected InstancePropertiesprotected Stringprotected String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOpenMetadataAPIGenericBuilder(String typeGUID, String typeName, Map<String, Object> extendedProperties, Date effectiveFrom, Date effectiveTo, List<Classification> existingClassifications, OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName) Constructor for type specific creates.protectedOpenMetadataAPIGenericBuilder(String typeGUID, String typeName, Map<String, Object> extendedProperties, List<Classification> existingClassifications, OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName) Constructor for type specific creates.OpenMetadataAPIGenericBuilder(String typeGUID, String typeName, OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName) Constructor for working with classifications. -
Method Summary
Modifier and TypeMethodDescriptiongetClassification(String classificationName) Return a proposed classification for this elementReturn a list of entity classifications that can be stored in the metadata repository.Retrieve the initial zones.getInstanceProperties(String methodName) Return the supplied bean properties in an InstanceProperties object.getInstanceProperties(Map<String, InstancePropertyValue> propertyMap, Date effectiveFrom, Date effectiveTo) Return the properties based on the parameters supplied.Return the bean's type idReturn the bean's type namebooleanisClassificationSet(String classificationName) Return whether a particular classification has been set up by the caller.voidsetAnchors(String userId, String anchorGUID, String anchorTypeName, String anchorDomainName, String anchorScopeGUID, List<String> zoneMembership, String methodName) Set up the "Anchors" classification for this entity.voidsetAnchors(String userId, OpenMetadataAPIAnchorHandler.AnchorIdentifiers anchorIdentifiers, String methodName) Set up the "Anchors" classification for this entity.voidsetClassification(Classification newClassification) Add a classification to the entity.voidsetEffectivityDates(Date effectiveFrom, Date effectiveTo) Set up the effective dates for the entity.protected InstancePropertiessetEffectivityDates(InstanceProperties properties) Set the supplied effectivity dates into the instance properties.protected voidsetGovernanceZones(String userId, List<String> zoneMembership, String methodName) Set up the ZoneMembership classification for this entity.voidsetTemplateClassifications(String userId, String externalSourceGUID, String externalSourceName, List<Classification> templateClassifications, Map<String, String> placeholderProperties, String methodName) Set up the list of classifications from a template entity.voidsetTemplateSubstitute(String userId, String methodName) Set up the "TemplateSubstitute" classification for this entity.protected InstancePropertiesupdateInstanceProperties(InstanceProperties properties, Map<String, InstancePropertyValue> propertyMap) Add the supplied properties to the supplied instance properties object.
-
Field Details
-
errorHandler
-
repositoryHelper
-
serviceName
-
serverName
-
extendedProperties
-
typeGUID
-
typeName
-
existingClassifications
-
newClassifications
-
templateProperties
-
-
Constructor Details
-
OpenMetadataAPIGenericBuilder
public OpenMetadataAPIGenericBuilder(String typeGUID, String typeName, OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName) Constructor for working with classifications.- Parameters:
typeGUID- type GUID to use for the entitytypeName- type name to use for the entityrepositoryHelper- helper methodsserviceName- name of this OMASserverName- name of local server
-
OpenMetadataAPIGenericBuilder
protected OpenMetadataAPIGenericBuilder(String typeGUID, String typeName, Map<String, Object> extendedProperties, List<Classification> existingClassifications, OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName) Constructor for type specific creates.- Parameters:
typeGUID- type GUID to use for the entitytypeName- type name to use for the entityextendedProperties- properties for the sub ype (if any)existingClassifications- classifications that are currently storedrepositoryHelper- helper methodsserviceName- name of this OMASserverName- name of local server
-
OpenMetadataAPIGenericBuilder
protected OpenMetadataAPIGenericBuilder(String typeGUID, String typeName, Map<String, Object> extendedProperties, Date effectiveFrom, Date effectiveTo, List<Classification> existingClassifications, OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName) Constructor for type specific creates.- Parameters:
typeGUID- type GUID to use for the entitytypeName- type name to use for the entityextendedProperties- properties for the subtype (if any)effectiveFrom- date to make the element active in the governance program (null for now)effectiveTo- date to remove the element from the governance program (null = until deleted)existingClassifications- classifications that are currently storedrepositoryHelper- helper methodsserviceName- name of this OMASserverName- name of local server
-
-
Method Details
-
setClassification
Add a classification to the entity. This overrides any existing value for this classification.- Parameters:
newClassification- classification object ready for the repository
-
getClassification
Return a proposed classification for this element- Returns:
- classification object ready for the repository
-
getInitialGovernanceZones
Retrieve the initial zones.- Returns:
- list of null
-
setGovernanceZones
protected void setGovernanceZones(String userId, List<String> zoneMembership, String methodName) throws InvalidParameterException Set up the ZoneMembership classification for this entity. This method overrides any previously defined ZoneMembership classification for this entity.- Parameters:
userId- calling userzoneMembership- list of zone names for the zones this asset is a member ofmethodName- calling method- Throws:
InvalidParameterException- AssetZones is not supported in the local repository, or any repository connected by an open metadata repository cohort
-
isClassificationSet
Return whether a particular classification has been set up by the caller.- Parameters:
classificationName- name of the classification to test for- Returns:
- boolean
-
setTemplateClassifications
public void setTemplateClassifications(String userId, String externalSourceGUID, String externalSourceName, List<Classification> templateClassifications, Map<String, String> placeholderProperties, String methodName) throws InvalidParameterExceptionSet up the list of classifications from a template entity.- Parameters:
userId- calling userexternalSourceGUID- guid of the software capability entity that represented the external source - null for localexternalSourceName- name of the software capability entity that represented the external sourcetemplateClassifications- list of classifications from the templateplaceholderProperties- map of placeholder names to placeholder values to substitute into the template propertiesmethodName- calling method- Throws:
InvalidParameterException- the type of one of the classifications is not supported
-
setTemplateSubstitute
Set up the "TemplateSubstitute" classification for this entity. This is used when a new entity is being created, and it is known to be created as a template substitute.- Parameters:
userId- calling usermethodName- calling method- Throws:
PropertyServerException- a null anchors GUID has been supplied
-
setAnchors
public void setAnchors(String userId, OpenMetadataAPIAnchorHandler.AnchorIdentifiers anchorIdentifiers, String methodName) throws PropertyServerException Set up the "Anchors" classification for this entity. This is used when a new entity is being created, and it is known to be connected to a specific anchor.- Parameters:
userId- calling useranchorIdentifiers- values for anchors classificationmethodName- calling method- Throws:
PropertyServerException- a null anchors GUID has been supplied
-
setAnchors
public void setAnchors(String userId, String anchorGUID, String anchorTypeName, String anchorDomainName, String anchorScopeGUID, List<String> zoneMembership, String methodName) throws PropertyServerException Set up the "Anchors" classification for this entity. This is used when a new entity is being created, and it is known to be connected to a specific anchor.- Parameters:
userId- calling useranchorGUID- unique identifier of the anchor entity that this entity is linked to directly or indirectlyanchorTypeName- unique name of the anchor entity's typeanchorDomainName- unique name of the anchor entity's domainanchorScopeGUID- unique identifier of the anchor's scopezoneMembership- zone membership from the anchormethodName- calling method- Throws:
PropertyServerException- a null anchors GUID has been supplied
-
setEffectivityDates
Set up the effective dates for the entity. This determines- Parameters:
effectiveFrom- date that the element is effective fromeffectiveTo- date that the element is effective to
-
getTypeName
Return the bean's type name- Returns:
- string name
-
getTypeGUID
Return the bean's type id- Returns:
- string id
-
getInstanceProperties
Return the supplied bean properties in an InstanceProperties object.- Parameters:
methodName- name of the calling method- Returns:
- InstanceProperties object
- Throws:
InvalidParameterException- there is a problem with the properties
-
getInstanceProperties
public InstanceProperties getInstanceProperties(Map<String, InstancePropertyValue> propertyMap, Date effectiveFrom, Date effectiveTo) throws InvalidParameterExceptionReturn the properties based on the parameters supplied. This is typically used for relationship and classification properties.- Parameters:
propertyMap- map of property names to valueseffectiveFrom- date to make the element active in the governance program (null for now)effectiveTo- date to remove the element from the governance program (null = until deleted)- Returns:
- repository services properties
- Throws:
InvalidParameterException- problem mapping properties
-
updateInstanceProperties
protected InstanceProperties updateInstanceProperties(InstanceProperties properties, Map<String, InstancePropertyValue> propertyMap) throws InvalidParameterExceptionAdd the supplied properties to the supplied instance properties object.- Parameters:
properties- current accumulated propertiespropertyMap- map of property names to values- Returns:
- repository services properties
- Throws:
InvalidParameterException- problem mapping properties
-
setEffectivityDates
Set the supplied effectivity dates into the instance properties.- Parameters:
properties- current accumulated properties- Returns:
- augmented instance properties
-
getEntityClassifications
Return a list of entity classifications that can be stored in the metadata repository.- Returns:
- list of entity classification objects
-