Class DiscoveryAnnotationStoreClient
- java.lang.Object
-
- org.odpi.openmetadata.frameworks.discovery.DiscoveryAnnotationStore
-
- org.odpi.openmetadata.accessservices.discoveryengine.client.DiscoveryAnnotationStoreClient
-
public class DiscoveryAnnotationStoreClient extends DiscoveryAnnotationStore
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
Constructors Constructor Description DiscoveryAnnotationStoreClient(String userId, String assetGUID, DiscoveryAnalysisReportClient discoveryAnalysisReportClient, DiscoveryEngineClient discoveryEngineClient)Constructor sets up the key parameters for accessing the annotations store.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringaddAnnotationToAnnotation(String parentAnnotationGUID, Annotation annotation)Add a new annotation and link it to an existing annotation.StringaddAnnotationToDataField(String parentDataFieldGUID, Annotation annotation)Add a new annotation and link it to an existing data field.StringaddAnnotationToDiscoveryReport(Annotation annotation)Add a new annotation to the annotation store as a top level annotation linked directly off of the report.StringaddDataFieldToDataField(String parentDataFieldGUID, DataField dataField)Add a new data field and link it to an existing data field.StringaddDataFieldToDiscoveryReport(String annotationGUID, DataField dataField)Add a new data field to the Annotation store linked off of an annotation (typically SchemaAnalysisAnnotation).voiddeleteAnnotation(String annotationGUID)Remove an annotation from the annotation store.voiddeleteDataField(String dataFieldGUID)Remove a data field from the annotation store.AnnotationgetAnnotation(String annotationGUID)Return a specific annotation stored in the annotation store (previous or new).DataFieldgetDataField(String dataFieldGUID)Return a specific data field stored in the annotation store (previous or new).List<Annotation>getExtendedAnnotations(String annotationGUID, int startingFrom, int maximumResults)Return any annotations attached to this annotation.List<DataField>getNestedDataFields(String parentDataFieldGUID, int startingFrom, int maximumResults)Return any annotations attached to this annotation.List<Annotation>getNewAnnotationsForAsset(int startingFrom, int maximumResults)Return the current list of annotations for this discovery run.List<DataField>getNewDataFieldsForAsset(int startingFrom, int maximumResults)Return the current list of data fields for this discovery run.List<Annotation>getPreviousAnnotationsForAsset(int startingFrom, int maximumResults)Return the list of Annotations created for the asset by previous runs of the discovery service.List<Annotation>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.List<DataField>getPreviousDataFieldsForAsset(int startingFrom, int maximumResults)Return the list of data fields from previous runs of the discovery service.List<String>getTypesOfAnnotation()Return the annotation subtype names.Map<String,String>getTypesOfAnnotationWithDescriptions()Return the annotation subtype names mapped to their descriptions.voidupdateAnnotation(Annotation annotation)Replace the current properties of an annotation.voidupdateDataField(DataField dataField)Replace the current properties of a data field.-
Methods inherited from class org.odpi.openmetadata.frameworks.discovery.DiscoveryAnnotationStore
getDiscoveryReport
-
-
-
-
Constructor Detail
-
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 Detail
-
getTypesOfAnnotation
public List<String> getTypesOfAnnotation() throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
Return the annotation subtype names.- Specified by:
getTypesOfAnnotationin 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, PropertyServerException
Return the annotation subtype names mapped to their descriptions.- Specified by:
getTypesOfAnnotationWithDescriptionsin 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:
getPreviousAnnotationsForAssetin 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:
getPreviousAnnotationsForAssetin 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:
getNewAnnotationsForAssetin 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:
getExtendedAnnotationsin 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:
getAnnotationin 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:
addAnnotationToDiscoveryReportin 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:
addAnnotationToAnnotationin 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:
updateAnnotationin 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:
deleteAnnotationin 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:
getPreviousDataFieldsForAssetin 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:
getNewDataFieldsForAssetin 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:
getNestedDataFieldsin 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:
getDataFieldin 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:
addDataFieldToDiscoveryReportin 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:
addDataFieldToDataFieldin 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:
addAnnotationToDataFieldin 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:
updateDataFieldin 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:
deleteDataFieldin 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.
-
-