Class DiscoveryAnnotationStoreClient
java.lang.Object
org.odpi.openmetadata.frameworks.discovery.DiscoveryAnnotationStore
org.odpi.openmetadata.accessservices.discoveryengine.client.DiscoveryAnnotationStoreClient
DiscoveryAnnotationStoreClient provides a client-side implementation of the ODF DiscoveryAnnotationStore
that is backed by calls to the Discovery Engine OMAS.
An instance of this client is created for each discovery service instance that runs. This is
why the REST client is passed in on the constructor (since creating a new RestTemplate object is
very expensive).
-
Field Summary
Fields inherited from class org.odpi.openmetadata.frameworks.discovery.DiscoveryAnnotationStore
assetGUID, discoveryReport, userId
-
Constructor Summary
ConstructorsConstructorDescriptionDiscoveryAnnotationStoreClient
(String userId, String assetGUID, DiscoveryAnalysisReportClient discoveryAnalysisReportClient, DiscoveryEngineClient discoveryEngineClient) Constructor sets up the key parameters for accessing the annotations store. -
Method Summary
Modifier and TypeMethodDescriptionaddAnnotationToAnnotation
(String parentAnnotationGUID, Annotation annotation) Add a new annotation and link it to an existing annotation.addAnnotationToDataField
(String parentDataFieldGUID, Annotation annotation) Add a new annotation and link it to an existing data field.addAnnotationToDiscoveryReport
(Annotation annotation) Add a new annotation to the annotation store as a top level annotation linked directly off of the report.addDataFieldToDataField
(String parentDataFieldGUID, DataField dataField) Add a new data field and link it to an existing data field.addDataFieldToDiscoveryReport
(String annotationGUID, DataField dataField) Add a new data field to the Annotation store linked off of an annotation (typically SchemaAnalysisAnnotation).void
deleteAnnotation
(String annotationGUID) Remove an annotation from the annotation store.void
deleteDataField
(String dataFieldGUID) Remove a data field from the annotation store.getAnnotation
(String annotationGUID) Return a specific annotation stored in the annotation store (previous or new).getDataField
(String dataFieldGUID) Return a specific data field stored in the annotation store (previous or new).getExtendedAnnotations
(String annotationGUID, int startingFrom, int maximumResults) Return any annotations attached to this annotation.getNestedDataFields
(String parentDataFieldGUID, int startingFrom, int maximumResults) Return any annotations attached to this annotation.getNewAnnotationsForAsset
(int startingFrom, int maximumResults) Return the current list of annotations for this discovery run.getNewDataFieldsForAsset
(int startingFrom, int maximumResults) Return the current list of data fields for this discovery run.getPreviousAnnotationsForAsset
(int startingFrom, int maximumResults) Return the list of Annotations created for the asset by previous runs of the discovery service.getPreviousAnnotationsForAsset
(AnnotationStatus status, int startingFrom, int maximumResults) Return the list of annotations from previous runs of the discovery service that are set to a specific status.getPreviousDataFieldsForAsset
(int startingFrom, int maximumResults) Return the list of data fields from previous runs of the discovery service.Return the annotation subtype names.Return the annotation subtype names mapped to their descriptions.void
updateAnnotation
(Annotation annotation) Replace the current properties of an annotation.void
updateDataField
(DataField dataField) Replace the current properties of a data field.Methods inherited from class org.odpi.openmetadata.frameworks.discovery.DiscoveryAnnotationStore
getDiscoveryReport
-
Constructor Details
-
DiscoveryAnnotationStoreClient
public DiscoveryAnnotationStoreClient(String userId, String assetGUID, DiscoveryAnalysisReportClient discoveryAnalysisReportClient, DiscoveryEngineClient discoveryEngineClient) Constructor sets up the key parameters for accessing the annotations store.- Parameters:
userId
- calling userassetGUID
- unique identifier of the asset that the annotations should be attached todiscoveryAnalysisReportClient
- discovery report that is linked to the annotations.discoveryEngineClient
- client for calling REST APIs
-
-
Method Details
-
getTypesOfAnnotation
public List<String> getTypesOfAnnotation() throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionReturn the annotation subtype names.- Specified by:
getTypesOfAnnotation
in classDiscoveryAnnotationStore
- Returns:
- list of type names that are subtypes of annotation
- Throws:
InvalidParameterException
- full path or userId is nullPropertyServerException
- problem accessing property serverUserNotAuthorizedException
- security access problem
-
getTypesOfAnnotationWithDescriptions
public Map<String,String> getTypesOfAnnotationWithDescriptions() throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionReturn the annotation subtype names mapped to their descriptions.- Specified by:
getTypesOfAnnotationWithDescriptions
in classDiscoveryAnnotationStore
- Returns:
- map of type names that are subtypes of annotation to their descriptions
- Throws:
InvalidParameterException
- full path or userId is nullPropertyServerException
- problem accessing property serverUserNotAuthorizedException
- security access problem
-
getPreviousAnnotationsForAsset
public List<Annotation> getPreviousAnnotationsForAsset(int startingFrom, int maximumResults) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return the list of Annotations created for the asset by previous runs of the discovery service.- Specified by:
getPreviousAnnotationsForAsset
in classDiscoveryAnnotationStore
- Parameters:
startingFrom
- starting position in the list.maximumResults
- maximum number of elements that can be returned- Returns:
- list of annotation (or null if none are registered)
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem retrieving annotations from the annotation store.
-
getPreviousAnnotationsForAsset
public List<Annotation> getPreviousAnnotationsForAsset(AnnotationStatus status, int startingFrom, int maximumResults) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return the list of annotations from previous runs of the discovery service that are set to a specific status. If status is null then annotations that have been reviewed, approved and/or actioned are returned from discovery reports that are not waiting or in progress.- Specified by:
getPreviousAnnotationsForAsset
in classDiscoveryAnnotationStore
- Parameters:
status
- status value to use on the querystartingFrom
- starting position in the list.maximumResults
- maximum number of elements that can be returned- Returns:
- list of annotation (or null if none are registered)
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem retrieving annotations from the annotation store.
-
getNewAnnotationsForAsset
public List<Annotation> getNewAnnotationsForAsset(int startingFrom, int maximumResults) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return the current list of annotations for this discovery run.- Specified by:
getNewAnnotationsForAsset
in classDiscoveryAnnotationStore
- Parameters:
startingFrom
- starting position in the list.maximumResults
- maximum number of elements that can be returned- Returns:
- list of annotation (or null if none are registered)
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem retrieving annotations from the annotation store.
-
getExtendedAnnotations
public List<Annotation> getExtendedAnnotations(String annotationGUID, int startingFrom, int maximumResults) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return any annotations attached to this annotation.- Specified by:
getExtendedAnnotations
in classDiscoveryAnnotationStore
- Parameters:
annotationGUID
- parent annotationstartingFrom
- starting position in the listmaximumResults
- maximum number of annotations that can be returned.- Returns:
- list of Annotation objects
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.UserNotAuthorizedException
- user not authorized to issue this request.PropertyServerException
- there was a problem that occurred within the property server.
-
getAnnotation
public Annotation getAnnotation(String annotationGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return a specific annotation stored in the annotation store (previous or new).- Specified by:
getAnnotation
in classDiscoveryAnnotationStore
- Parameters:
annotationGUID
- unique identifier of the annotation- Returns:
- annotation object
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem retrieving the annotation from the annotation store.
-
addAnnotationToDiscoveryReport
public String addAnnotationToDiscoveryReport(Annotation annotation) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Add a new annotation to the annotation store as a top level annotation linked directly off of the report.- Specified by:
addAnnotationToDiscoveryReport
in classDiscoveryAnnotationStore
- Parameters:
annotation
- annotation object- Returns:
- unique identifier of new annotation
- Throws:
InvalidParameterException
- the annotation is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem adding the annotation to the annotation store.
-
addAnnotationToAnnotation
public String addAnnotationToAnnotation(String parentAnnotationGUID, Annotation annotation) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Add a new annotation and link it to an existing annotation.- Specified by:
addAnnotationToAnnotation
in classDiscoveryAnnotationStore
- Parameters:
parentAnnotationGUID
- unique identifier of the annotation that this new one is to be attached toannotation
- annotation object- Returns:
- unique identifier of new annotation
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem saving annotations in the annotation store.
-
updateAnnotation
public void updateAnnotation(Annotation annotation) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Replace the current properties of an annotation.- Specified by:
updateAnnotation
in classDiscoveryAnnotationStore
- Parameters:
annotation
- new properties- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem updating the annotation in the annotation store.
-
deleteAnnotation
public void deleteAnnotation(String annotationGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Remove an annotation from the annotation store.- Specified by:
deleteAnnotation
in classDiscoveryAnnotationStore
- Parameters:
annotationGUID
- unique identifier of the annotation- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem deleting the annotation from the annotation store.
-
getPreviousDataFieldsForAsset
public List<DataField> getPreviousDataFieldsForAsset(int startingFrom, int maximumResults) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return the list of data fields from previous runs of the discovery service.- Specified by:
getPreviousDataFieldsForAsset
in classDiscoveryAnnotationStore
- Parameters:
startingFrom
- starting position in the list.maximumResults
- maximum number of elements that can be returned- Returns:
- list of data fields (or null if none are registered)
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem retrieving data fields from the annotation store.
-
getNewDataFieldsForAsset
public List<DataField> getNewDataFieldsForAsset(int startingFrom, int maximumResults) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return the current list of data fields for this discovery run.- Specified by:
getNewDataFieldsForAsset
in classDiscoveryAnnotationStore
- Parameters:
startingFrom
- starting position in the list.maximumResults
- maximum number of elements that can be returned- Returns:
- list of data fields (or null if none are registered)
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem retrieving data fields from the annotation store.
-
getNestedDataFields
public List<DataField> getNestedDataFields(String parentDataFieldGUID, int startingFrom, int maximumResults) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return any annotations attached to this annotation.- Specified by:
getNestedDataFields
in classDiscoveryAnnotationStore
- Parameters:
parentDataFieldGUID
- parent data field identifierstartingFrom
- starting position in the listmaximumResults
- maximum number of annotations that can be returned.- Returns:
- list of DataField objects
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.UserNotAuthorizedException
- user not authorized to issue this request.PropertyServerException
- there was a problem that occurred within the property server.
-
getDataField
public DataField getDataField(String dataFieldGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return a specific data field stored in the annotation store (previous or new).- Specified by:
getDataField
in classDiscoveryAnnotationStore
- Parameters:
dataFieldGUID
- unique identifier of the data field- Returns:
- data field object
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem retrieving the data field from the annotation store.
-
addDataFieldToDiscoveryReport
public String addDataFieldToDiscoveryReport(String annotationGUID, DataField dataField) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Add a new data field to the Annotation store linked off of an annotation (typically SchemaAnalysisAnnotation).- Specified by:
addDataFieldToDiscoveryReport
in classDiscoveryAnnotationStore
- Parameters:
annotationGUID
- unique identifier of the annotation that the data field is to be linked todataField
- dataField object- Returns:
- unique identifier of new dataField
- Throws:
InvalidParameterException
- the dataField is invalid or the annotation GUID points to an annotation that can not be associated with a data field.UserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem adding the data field to the Annotation store.
-
addDataFieldToDataField
public String addDataFieldToDataField(String parentDataFieldGUID, DataField dataField) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Add a new data field and link it to an existing data field.- Specified by:
addDataFieldToDataField
in classDiscoveryAnnotationStore
- Parameters:
parentDataFieldGUID
- unique identifier of the data field that this new one is to be attached todataField
- data field object- Returns:
- unique identifier of new data field
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem saving data fields in the annotation store.
-
addAnnotationToDataField
public String addAnnotationToDataField(String parentDataFieldGUID, Annotation annotation) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Add a new annotation and link it to an existing data field.- Specified by:
addAnnotationToDataField
in classDiscoveryAnnotationStore
- Parameters:
parentDataFieldGUID
- unique identifier of the data field that this new one is to be attached toannotation
- data field object- Returns:
- unique identifier of annotation
- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem saving data fields in the annotation store.
-
updateDataField
public void updateDataField(DataField dataField) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Replace the current properties of a data field.- Specified by:
updateDataField
in classDiscoveryAnnotationStore
- Parameters:
dataField
- new properties- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem updating the data field in the annotation store.
-
deleteDataField
public void deleteDataField(String dataFieldGUID) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Remove a data field from the annotation store.- Specified by:
deleteDataField
in classDiscoveryAnnotationStore
- Parameters:
dataFieldGUID
- unique identifier of the data field- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user id not authorized to issue this requestPropertyServerException
- there was a problem deleting the data field from the annotation store.
-