Class OpenMetadataAccess

java.lang.Object
org.odpi.openmetadata.frameworks.governanceaction.OpenMetadataStore
org.odpi.openmetadata.frameworks.integration.context.OpenMetadataAccess

public class OpenMetadataAccess extends OpenMetadataStore
OpenMetadataAccess provides an interface to the open metadata store. This is part of the Governance Action Framework (GAF) and provides a comprehensive interface for working with all types of metadata, subject to the user's (and this OMAS's) security permissions. The interface supports search, maintenance of metadata elements, classifications and relationships.
  • Constructor Details

    • OpenMetadataAccess

      public OpenMetadataAccess(OpenMetadataClient openMetadataClient, String userId, String externalSourceGUID, String externalSourceName, String originatorGUID, IntegrationReportWriter reportWriter)
      The constructor needs an implementation of the open metadata store.
      Parameters:
      openMetadataClient - client implementation
      userId - calling user
      externalSourceGUID - unique identifier for external source (or null)
      externalSourceName - unique name for external source (or null)
      originatorGUID - unique identifier of the source of the to do
      reportWriter - report writer (maybe null)
  • Method Details

    • createMetadataElementInStore

      public String createMetadataElementInStore(String metadataElementTypeName, ElementStatus initialStatus, Date effectiveFrom, Date effectiveTo, ElementProperties properties) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Create a new metadata element in the metadata store. The type name comes from the open metadata types. The selected type also controls the names and types of the properties that are allowed. This version of the method allows access to advanced features such as multiple states and effectivity dates.
      Overrides:
      createMetadataElementInStore in class OpenMetadataStore
      Parameters:
      metadataElementTypeName - type name of the new metadata element
      initialStatus - initial status of the metadata element
      effectiveFrom - the date when this element is active - null for active on creation
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      properties - properties of the new metadata element
      Returns:
      unique identifier of the new metadata element
      Throws:
      InvalidParameterException - the type name, status or one of the properties is invalid
      UserNotAuthorizedException - the governance action service is not authorized to create this type of element
      PropertyServerException - there is a problem with the metadata store
    • createMetadataElementInStore

      public String createMetadataElementInStore(String metadataElementTypeName, ElementStatus initialStatus, Map<String,ElementProperties> initialClassifications, String anchorGUID, boolean isOwnAnchor, Date effectiveFrom, Date effectiveTo, ElementProperties properties, String parentGUID, String parentRelationshipTypeName, ElementProperties parentRelationshipProperties, boolean parentAtEnd1) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Create a new metadata element in the metadata store. The type name comes from the open metadata types. The selected type also controls the names and types of the properties that are allowed. This version of the method allows access to advanced features such as multiple states and effectivity dates.
      Overrides:
      createMetadataElementInStore in class OpenMetadataStore
      Parameters:
      metadataElementTypeName - type name of the new metadata element
      initialStatus - initial status of the metadata element
      initialClassifications - map of classification names to classification properties to include in the entity creation request
      anchorGUID - unique identifier of the element that should be the anchor for the new element. Set to null if no anchor, or the Anchors classification is included in the initial classifications.
      isOwnAnchor - boolean flag to day that the element should be classified as its own anchor once its element is created in the repository.
      effectiveFrom - the date when this element is active - null for active on creation
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      properties - properties of the new metadata element
      parentGUID - unique identifier of optional parent entity
      parentRelationshipTypeName - type of relationship to connect the new element to the parent
      parentRelationshipProperties - properties to include in parent relationship
      parentAtEnd1 - which end should the parent GUID go in the relationship
      Returns:
      unique identifier of the new metadata element
      Throws:
      InvalidParameterException - the type name, status or one of the properties is invalid
      UserNotAuthorizedException - the governance action service is not authorized to create this type of element
      PropertyServerException - there is a problem with the metadata store
    • createMetadataElementFromTemplate

      public String createMetadataElementFromTemplate(String metadataElementTypeName, String anchorGUID, boolean isOwnAnchor, Date effectiveFrom, Date effectiveTo, String templateGUID, ElementProperties templateProperties, Map<String,String> placeholderProperties, String parentGUID, String parentRelationshipTypeName, ElementProperties parentRelationshipProperties, boolean parentAtEnd1) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Create a new metadata element in the metadata store using the template identified by the templateGUID. The type name comes from the open metadata types. The selected type also controls the names and types of the properties that are allowed. The template and any similar anchored objects are copied in this process.
      Overrides:
      createMetadataElementFromTemplate in class OpenMetadataStore
      Parameters:
      metadataElementTypeName - type name of the new metadata element
      anchorGUID - unique identifier of the element that should be the anchor for the new element. Set to null if no anchor, or the Anchors classification is included in the initial classifications.
      isOwnAnchor - boolean flag to day that the element should be classified as its own anchor once its element is created in the repository.
      effectiveFrom - the date when this element is active - null for active on creation
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      templateGUID - the unique identifier of the existing asset to copy (this will copy all the attachments such as nested content, schema connection etc)
      templateProperties - properties of the new metadata element. These override the template values
      placeholderProperties - property name-to-property value map to replace any placeholder values in the template element - and their anchored elements, which are also copied as part of this operation.
      parentGUID - unique identifier of optional parent entity
      parentRelationshipTypeName - type of relationship to connect the new element to the parent
      parentRelationshipProperties - properties to include in parent relationship
      parentAtEnd1 - which end should the parent GUID go in the relationship
      Returns:
      unique identifier of the new metadata element
      Throws:
      InvalidParameterException - the type name, status or one of the properties is invalid
      UserNotAuthorizedException - the governance action service is not authorized to create this type of element
      PropertyServerException - there is a problem with the metadata store
    • updateMetadataElementInStore

      public void updateMetadataElementInStore(String metadataElementGUID, boolean replaceProperties, ElementProperties properties) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the properties of a specific metadata element. The properties must match the type definition associated with the metadata element when it was created. However, it is possible to update a few properties, or replace all them by the value used in the replaceProperties flag.
      Overrides:
      updateMetadataElementInStore in class OpenMetadataStore
      Parameters:
      metadataElementGUID - unique identifier of the metadata element to update
      replaceProperties - flag to indicate whether to completely replace the existing properties with the new properties, or just update the individual properties specified on the request.
      properties - new properties for the metadata element
      Throws:
      InvalidParameterException - either the unique identifier or the properties are invalid in some way
      UserNotAuthorizedException - the governance action service is not authorized to update this element
      PropertyServerException - there is a problem with the metadata store
    • updateMetadataElementStatusInStore

      public void updateMetadataElementStatusInStore(String metadataElementGUID, ElementStatus newElementStatus) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the status of specific metadata element. The new status must match a status value that is defined for the element's type assigned when it was created.
      Overrides:
      updateMetadataElementStatusInStore in class OpenMetadataStore
      Parameters:
      metadataElementGUID - unique identifier of the metadata element to update
      newElementStatus - new status value - or null to leave as is
      Throws:
      InvalidParameterException - either the unique identifier or the status are invalid in some way
      UserNotAuthorizedException - the governance action service is not authorized to update this element
      PropertyServerException - there is a problem with the metadata store
    • updateMetadataElementEffectivityInStore

      public void updateMetadataElementEffectivityInStore(String metadataElementGUID, Date effectiveFrom, Date effectiveTo) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the effectivity dates control the visibility of the element through specific APIs.
      Overrides:
      updateMetadataElementEffectivityInStore in class OpenMetadataStore
      Parameters:
      metadataElementGUID - unique identifier of the metadata element to update
      effectiveFrom - the date when this element is active - null for active now
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      Throws:
      InvalidParameterException - either the unique identifier or the status are invalid in some way
      UserNotAuthorizedException - the governance action service is not authorized to update this element
      PropertyServerException - there is a problem with the metadata store
    • deleteMetadataElementInStore

      public void deleteMetadataElementInStore(String metadataElementGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Delete a specific metadata element.
      Overrides:
      deleteMetadataElementInStore in class OpenMetadataStore
      Parameters:
      metadataElementGUID - unique identifier of the metadata element to delete
      Throws:
      InvalidParameterException - the unique identifier is null or invalid in some way
      UserNotAuthorizedException - the governance action service is not authorized to delete this element
      PropertyServerException - there is a problem with the metadata store
    • archiveMetadataElementInStore

      public void archiveMetadataElementInStore(String metadataElementGUID, ArchiveProperties archiveProperties) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Archive a specific metadata element.
      Overrides:
      archiveMetadataElementInStore in class OpenMetadataStore
      Parameters:
      metadataElementGUID - unique identifier of the metadata element to archive
      archiveProperties - details of the archive process
      Throws:
      InvalidParameterException - the unique identifier is null or invalid in some way
      UserNotAuthorizedException - the governance action service is not authorized to archive this element
      PropertyServerException - there is a problem with the metadata store
    • classifyMetadataElementInStore

      public void classifyMetadataElementInStore(String metadataElementGUID, String classificationName, Date effectiveFrom, Date effectiveTo, ElementProperties properties) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Add a new classification to the metadata element. Note that only one classification with the same name can be attached to a metadata element.
      Overrides:
      classifyMetadataElementInStore in class OpenMetadataStore
      Parameters:
      metadataElementGUID - unique identifier of the metadata element to update
      classificationName - name of the classification to add (if the classification is already present then use reclassify)
      effectiveFrom - the date when this classification is active - null for active now
      effectiveTo - the date when this classification becomes inactive - null for active until deleted
      properties - properties to store in the new classification. These must conform to the valid properties associated with the classification name
      Throws:
      InvalidParameterException - the unique identifier or classification name is null or invalid in some way; properties do not match the valid properties associated with the classification's type definition
      UserNotAuthorizedException - the governance action service is not authorized to update this element
      PropertyServerException - there is a problem with the metadata store
    • reclassifyMetadataElementInStore

      public void reclassifyMetadataElementInStore(String metadataElementGUID, String classificationName, boolean replaceProperties, ElementProperties properties) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the properties of a classification that is currently attached to a specific metadata element.
      Overrides:
      reclassifyMetadataElementInStore in class OpenMetadataStore
      Parameters:
      metadataElementGUID - unique identifier of the metadata element to update
      classificationName - unique name of the classification to update
      replaceProperties - flag to indicate whether to completely replace the existing properties with the new properties, or just update the individual properties specified on the request.
      properties - new properties for the classification
      Throws:
      InvalidParameterException - the unique identifier or classification name is null or invalid in some way; properties do not match the valid properties associated with the classification's type definition
      UserNotAuthorizedException - the governance action service is not authorized to update this element/classification
      PropertyServerException - there is a problem with the metadata store
    • updateClassificationEffectivityInStore

      public void updateClassificationEffectivityInStore(String metadataElementGUID, String classificationName, Date effectiveFrom, Date effectiveTo) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the effectivity dates of a specific classification attached to a metadata element. The effectivity dates control the visibility of the classification through specific APIs.
      Overrides:
      updateClassificationEffectivityInStore in class OpenMetadataStore
      Parameters:
      metadataElementGUID - unique identifier of the metadata element to update
      classificationName - unique name of the classification to update
      effectiveFrom - the date when this element is active - null for active now
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      Throws:
      InvalidParameterException - either the unique identifier or the status are invalid in some way
      UserNotAuthorizedException - the governance action service is not authorized to update this element
      PropertyServerException - there is a problem with the metadata store
    • declassifyMetadataElementInStore

      public void declassifyMetadataElementInStore(String metadataElementGUID, String classificationName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Remove the named classification from a specific metadata element.
      Overrides:
      declassifyMetadataElementInStore in class OpenMetadataStore
      Parameters:
      metadataElementGUID - unique identifier of the metadata element to update
      classificationName - unique name of the classification to remove
      Throws:
      InvalidParameterException - the unique identifier or classification name is null or invalid in some way
      UserNotAuthorizedException - the governance action service is not authorized to remove this classification
      PropertyServerException - there is a problem with the metadata store
    • createRelatedElementsInStore

      public String createRelatedElementsInStore(String relationshipTypeName, String metadataElement1GUID, String metadataElement2GUID, Date effectiveFrom, Date effectiveTo, ElementProperties properties) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Create a relationship between two metadata elements. It is important to put the right element at each end of the relationship according to the type definition since this will affect how the relationship is interpreted.
      Overrides:
      createRelatedElementsInStore in class OpenMetadataStore
      Parameters:
      relationshipTypeName - name of the type of relationship to create. This will determine the types of metadata elements that can be related and the properties that can be associated with this relationship.
      metadataElement1GUID - unique identifier of the metadata element at end 1 of the relationship
      metadataElement2GUID - unique identifier of the metadata element at end 2 of the relationship
      effectiveFrom - the date when this element is active - null for active now
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      properties - the properties of the relationship
      Returns:
      unique identifier of the new relationship
      Throws:
      InvalidParameterException - the unique identifier's of the metadata elements are null or invalid in some way; the properties are not valid for this type of relationship
      UserNotAuthorizedException - the governance action service is not authorized to create this type of relationship
      PropertyServerException - there is a problem with the metadata store
    • updateRelatedElementsInStore

      public void updateRelatedElementsInStore(String relationshipGUID, boolean replaceProperties, ElementProperties properties) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the properties associated with a relationship.
      Overrides:
      updateRelatedElementsInStore in class OpenMetadataStore
      Parameters:
      relationshipGUID - unique identifier of the relationship to update
      replaceProperties - flag to indicate whether to completely replace the existing properties with the new properties, or just update the individual properties specified on the request.
      properties - new properties for the relationship
      Throws:
      InvalidParameterException - the unique identifier of the relationship is null or invalid in some way; the properties are not valid for this type of relationship
      UserNotAuthorizedException - the governance action service is not authorized to update this relationship
      PropertyServerException - there is a problem with the metadata store
    • updateRelatedElementsEffectivityInStore

      public void updateRelatedElementsEffectivityInStore(String relationshipGUID, Date effectiveFrom, Date effectiveTo) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the effectivity dates of a specific relationship between metadata elements. The effectivity dates control the visibility of the classification through specific APIs.
      Overrides:
      updateRelatedElementsEffectivityInStore in class OpenMetadataStore
      Parameters:
      relationshipGUID - unique identifier of the relationship to update
      effectiveFrom - the date when this element is active - null for active now
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      Throws:
      InvalidParameterException - either the unique identifier or the status are invalid in some way
      UserNotAuthorizedException - the governance action service is not authorized to update this element
      PropertyServerException - there is a problem with the metadata store
    • deleteRelatedElementsInStore

      public void deleteRelatedElementsInStore(String relationshipGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Delete a relationship between two metadata elements.
      Overrides:
      deleteRelatedElementsInStore in class OpenMetadataStore
      Parameters:
      relationshipGUID - unique identifier of the relationship to delete
      Throws:
      InvalidParameterException - the unique identifier of the relationship is null or invalid in some way
      UserNotAuthorizedException - the governance action service is not authorized to delete this relationship
      PropertyServerException - there is a problem with the metadata store