Class CocoClinicalTrialBaseService
java.lang.Object
org.odpi.openmetadata.frameworks.connectors.Connector
org.odpi.openmetadata.frameworks.connectors.ConnectorBase
org.odpi.openmetadata.frameworks.opengovernance.GovernanceActionServiceConnector
org.odpi.openmetadata.frameworks.opengovernance.GeneralGovernanceActionService
org.odpi.openmetadata.samples.governanceactions.clinicaltrials.CocoClinicalTrialBaseService
- All Implemented Interfaces:
AuditLoggingComponent,SecureConnectorExtension,VirtualConnectorExtension,GovernanceActionService
- Direct Known Subclasses:
CocoClinicalTrialCertifyHospitalService,CocoClinicalTrialHospitalOnboardingService,CocoClinicalTrialNominateHospitalService,CocoClinicalTrialSetUpDataLakeService,CocoClinicalTrialSetUpService
Provides shared functions for the clinical trial services.
The services are written to be re-runnable: if a run fails part way through, or a clinical trial is set up a second time, each element and relationship that the earlier run created is found and reused rather than created again. Without this, the second run fails on the first element it tries to create, since its qualified name is already taken (OMAG-COMMON-409-001), and the elements the earlier run left behind have to be removed by hand before the service can be run again. The find-or-create methods below provide this behaviour.
The services are written to be re-runnable: if a run fails part way through, or a clinical trial is set up a second time, each element and relationship that the earlier run created is found and reused rather than created again. Without this, the second run fails on the first element it tries to create, since its qualified name is already taken (OMAG-COMMON-409-001), and the elements the earlier run left behind have to be removed by hand before the service can be run again. The find-or-create methods below provide this behaviour.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classNested classes/interfaces inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
ConnectorBase.ProtectedConnection -
Field Summary
Fields inherited from class org.odpi.openmetadata.frameworks.opengovernance.GeneralGovernanceActionService
governanceContextFields inherited from class org.odpi.openmetadata.frameworks.opengovernance.GovernanceActionServiceConnector
governanceServiceName, propertyHelperFields inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
auditLog, connectionBean, connectorInstanceId, embeddedConnectors, messageFormatter, secretsStoreConnectorMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddActionTargetToProcess(String processGUID, String actionTargetName, String actionTargetGUID) Link an action target to a process.protected voidaddGovernedByRelationship(String dataQualityCertificationTypeGUID, String sandboxSchemaGUID) Link the certification type to the schema.protected voidaddResourceListRelationship(String consumerGUID, String resourceGUID, ResourceUse resourceUse) Set up the ResourceList relationship between an implementation component and a solution component.protected voidaddSolutionComponentImplementationResource(String solutionComponentGUID, String implementationGUID, String role, String description) Set up the ImplementedBy relationship between an implementation component and a solution component.protected voidaddSolutionComponentImplementedByRelationship(String solutionComponentGUID, String implementationGUID, String informationSupplyChainQualifiedName, String role) Set up the ImplementedBy relationship between an implementation component and a solution component.protected voidcheckCertificationValidForProject(String projectGUID, String certificationTypeGUID) Check that the certification type is associated with the requested project.protected StringcreateLineageRelationshipIfAbsent(String relationshipName, String sourceElementGUID, String iscQualifiedName, String label, String description, String formula, String formulaType, String queryId, String query, String guard, String lineNumber, String targetElementGUID) Create a lineage relationship unless an identical one is already in place.protected StringcreatePopulateSandboxDAG(String airflowDAGName, String topLevelProjectGUID) Create a process to represent the Airflow DAG that populates the sandbox.protected StringcreateProcessFromGovernanceActionTypeIfAbsent(String processType, String processQualifiedName, String processName, String processDescription, int domainIdentifier, String governanceActionTypeGUID, Map<String, String> additionalRequestParameters, String anchorGUID, List<String> anchorScopeGUIDs) Create a specific governance action process from a generic governance action type, unless a process with this qualified name already exists.protected StringcreateRelationshipIfAbsent(String relationshipTypeName, String end1GUID, String end2GUID, ElementProperties properties) Create a relationship unless an identical one is already in place.protected StringcreateSandboxSchema(String topLevelProjectGUID) Create the sandbox database schema - it is assumed that details of the schema are passed in the request parameters.getContactDetailsForPersonGUID(String personGUID) Retrieve the email for a specific person.protected StringgetElementGUIDByQualifiedName(String qualifiedName) Return the unique identifier of the element with this qualified name, or null if there is none.protected StringgetExistingElementGUID(ElementProperties properties) Return the unique identifier of the element that would be created with these properties, if it already exists.protected StringgetExistingRelationshipGUID(String relationshipTypeName, String end1GUID, String end2GUID, ElementProperties properties) Return the unique identifier of the relationship of this type from end1 to end2 whose properties include all the supplied string properties, or null if there is none.protected StringgetExistingTemplatedElementGUID(String templateGUID, ElementProperties replacementProperties, Map<String, String> placeholderProperties) Return the unique identifier of the element that a template would create, if it already exists.protected StringgetInformationSupplyChainQualifiedName(String informationSupplyChainGUID) Extract the qualified name for the information supply chain.protected NewElementPropertiesgetResourceUseProperties(ResourceUse resourceUse) Set up the properties for a resource use enum.protected booleanisClassified(String elementGUID, String classificationName) Return whether the element already has the named classification.Methods inherited from class org.odpi.openmetadata.frameworks.opengovernance.GeneralGovernanceActionService
disconnect, getActionTarget, getAllActionTargets, getProperty, setGovernanceContext, startMethods inherited from class org.odpi.openmetadata.frameworks.opengovernance.GovernanceActionServiceConnector
getArrayRequestParameter, getBooleanRequestParameter, getConnectorComponentDescription, getIntRequestParameter, getLongRequestParameter, getStringRequestParameter, handleUnexpectedException, setAuditLog, setGovernanceServiceName, validateContextMethods inherited from class org.odpi.openmetadata.frameworks.connectors.ConnectorBase
combineConfigurationProperties, disconnectConnectors, equals, fromCamelToCanonicalCase, fromCanonicalToCamelCase, fromCanonicalToKebabCase, fromCanonicalToSnakeCase, fromKebabToCanonicalCase, fromSnakeToCanonicalCase, getArrayConfigurationProperty, getArrayConfigurationProperty, getArrayConfigurationProperty, getArrayValue, getBooleanConfigurationProperty, getConnection, getConnectorInstanceId, getDateConfigurationProperty, getIntConfigurationProperty, getLongConfigurationProperty, getSecretsCollectionName, getSecretsLocation, getSecretsProvider, getStringConfigurationProperty, getStringConfigurationProperty, getSuppliedPlaceholderProperties, hashCode, initialize, initializeEmbeddedConnectors, initializeSecretsStoreConnector, isActive, logExceptionRecord, logExceptionRecord, logRecord, logRecord, throwMissingConfigurationProperty, throwMissingElement, throwMissingEndpointAddress, throwMissingResource, throwNoAsset, throwWrongTypeOfAsset, throwWrongTypeOfResource, throwWrongTypeOfRootSchema, toStringMethods inherited from class org.odpi.openmetadata.frameworks.connectors.Connector
clearStatisticProperty, clearStatisticTimestamp, getConnectorStatistics, getStatisticCounter, getStatisticProperty, getStatisticTimestamp, incrementStatisticCounter, initializeStatisticCounter, refreshStatistics, setStatisticProperty, setStatisticTimestamp
-
Constructor Details
-
CocoClinicalTrialBaseService
public CocoClinicalTrialBaseService()
-
-
Method Details
-
getElementGUIDByQualifiedName
protected String getElementGUIDByQualifiedName(String qualifiedName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Return the unique identifier of the element with this qualified name, or null if there is none.- Parameters:
qualifiedName- qualified name to look for- Returns:
- unique identifier or null
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem accessing the metadata repository/serverUserNotAuthorizedException- security problem
-
getExistingElementGUID
protected String getExistingElementGUID(ElementProperties properties) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Return the unique identifier of the element that would be created with these properties, if it already exists.- Parameters:
properties- properties of the new element, which include its qualified name- Returns:
- unique identifier or null
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem accessing the metadata repository/serverUserNotAuthorizedException- security problem
-
getExistingTemplatedElementGUID
protected String getExistingTemplatedElementGUID(String templateGUID, ElementProperties replacementProperties, Map<String, String> placeholderProperties) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedExceptionReturn the unique identifier of the element that a template would create, if it already exists. The new element's qualified name comes from the replacement properties if they set one, and from the template otherwise, with the placeholders filled in the same way the template is copied. If a placeholder is left unfilled, the name cannot be predicted, and null is returned so that the element is created.- Parameters:
templateGUID- unique identifier of the templatereplacementProperties- properties that override the template's (may be null)placeholderProperties- placeholder values (may be null)- Returns:
- unique identifier or null
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem accessing the metadata repository/serverUserNotAuthorizedException- security problem
-
getExistingRelationshipGUID
protected String getExistingRelationshipGUID(String relationshipTypeName, String end1GUID, String end2GUID, ElementProperties properties) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Return the unique identifier of the relationship of this type from end1 to end2 whose properties include all the supplied string properties, or null if there is none. Matching on the properties as well as the ends keeps apart relationships that are legitimately repeated between the same two elements - an action target under two different names, a person assigned to a project in two roles, or lineage for two information supply chains.- Parameters:
relationshipTypeName- type of relationshipend1GUID- unique identifier of the element at end 1end2GUID- unique identifier of the element at end 2properties- properties of the new relationship (may be null)- Returns:
- unique identifier of the relationship or null
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem accessing the metadata repository/serverUserNotAuthorizedException- security problem
-
createRelationshipIfAbsent
protected String createRelationshipIfAbsent(String relationshipTypeName, String end1GUID, String end2GUID, ElementProperties properties) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Create a relationship unless an identical one is already in place.- Parameters:
relationshipTypeName- type of relationshipend1GUID- unique identifier of the element at end 1end2GUID- unique identifier of the element at end 2properties- properties of the relationship (may be null)- Returns:
- unique identifier of the new or existing relationship
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem accessing the metadata repository/serverUserNotAuthorizedException- security problem
-
createLineageRelationshipIfAbsent
protected String createLineageRelationshipIfAbsent(String relationshipName, String sourceElementGUID, String iscQualifiedName, String label, String description, String formula, String formulaType, String queryId, String query, String guard, String lineNumber, String targetElementGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Create a lineage relationship unless an identical one is already in place. The parameters are those of GovernanceActionContext.createLineageRelationship.- Parameters:
relationshipName- either LineageMapping, ProcessCall, DataFlow, ControlFlow.sourceElementGUID- unique identifier of the element that describes the source of the data.iscQualifiedName- qualifiedName of the information supply chainlabel- label for when the lineage relationship is visualizeddescription- description of the lineage relationshipformula- expression summaryformulaType- language used to express the formulaqueryId- identifier for the process query - DataMapping Relationshipquery- the process query - DataMapping Relationshipguard- value that indicated a control path to take - ControlFlow relationshiplineNumber- line number where the call is made - ProcessCall RelationshiptargetElementGUID- unique identifier of the element that describes the destination of the data.- Returns:
- unique identifier of the new or existing relationship
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem accessing the metadata repository/serverUserNotAuthorizedException- security problem
-
isClassified
protected boolean isClassified(String elementGUID, String classificationName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Return whether the element already has the named classification.- Parameters:
elementGUID- unique identifier of the elementclassificationName- name of the classification- Returns:
- flag
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem accessing the metadata repository/serverUserNotAuthorizedException- security problem
-
createProcessFromGovernanceActionTypeIfAbsent
protected String createProcessFromGovernanceActionTypeIfAbsent(String processType, String processQualifiedName, String processName, String processDescription, int domainIdentifier, String governanceActionTypeGUID, Map<String, String> additionalRequestParameters, String anchorGUID, List<String> anchorScopeGUIDs) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedExceptionCreate a specific governance action process from a generic governance action type, unless a process with this qualified name already exists. The parameters are those of createProcessFromGovernanceActionType.- Parameters:
processType- type of the processprocessQualifiedName- new qualified name for the processprocessName- new name for the processprocessDescription- new description for the processdomainIdentifier- governance domaingovernanceActionTypeGUID- the unique identifier of the governance action typeadditionalRequestParameters- the additional, predefined request parameters to add to the GovernanceActionProcessFlow relationshipanchorGUID- unique identifier of the anchoranchorScopeGUIDs- unique identifier for the top level project - used as a search scope- Returns:
- unique identifier of the new or existing governance action process
- Throws:
InvalidParameterException- parameter errorPropertyServerException- repository errorUserNotAuthorizedException- authorization error
-
getInformationSupplyChainQualifiedName
protected String getInformationSupplyChainQualifiedName(String informationSupplyChainGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Extract the qualified name for the information supply chain.- Parameters:
informationSupplyChainGUID- unique identifier of the information supply chain element- Returns:
- string
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem accessing the metadata repository/serverUserNotAuthorizedException- security problem
-
getContactDetailsForPersonGUID
protected CocoClinicalTrialBaseService.PersonContactDetails getContactDetailsForPersonGUID(String personGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Retrieve the email for a specific person.- Parameters:
personGUID- unique identifier of the person entity for the individual- Returns:
- email address for the individual; or null if it is not found
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem accessing the metadata repository/serverUserNotAuthorizedException- security problem
-
checkCertificationValidForProject
protected void checkCertificationValidForProject(String projectGUID, String certificationTypeGUID) throws ConnectorCheckedException, InvalidParameterException, PropertyServerException, UserNotAuthorizedException Check that the certification type is associated with the requested project. Otherwise, the certification does not make sense.- Parameters:
projectGUID- unique identifier of the projectcertificationTypeGUID- unique identifier of the certification type- Throws:
ConnectorCheckedException- the certification type is not linked to the projectInvalidParameterException- invalid parameter passed somehowPropertyServerException- problem connecting to the open metadata repositoryUserNotAuthorizedException- security problem
-
addActionTargetToProcess
protected void addActionTargetToProcess(String processGUID, String actionTargetName, String actionTargetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Link an action target to a process. This action target will be available for all steps in the process.- Parameters:
processGUID- unique identifier of the processactionTargetName- name of the target for action relationshipactionTargetGUID- unique identifier of the target- Throws:
InvalidParameterException- parameter errorPropertyServerException- repository errorUserNotAuthorizedException- authorization error
-
addSolutionComponentImplementedByRelationship
protected void addSolutionComponentImplementedByRelationship(String solutionComponentGUID, String implementationGUID, String informationSupplyChainQualifiedName, String role) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Set up the ImplementedBy relationship between an implementation component and a solution component. The information supply chain qualified names ensures that the appropriate assets are returned on a specific ISC lineage query.- Parameters:
solutionComponentGUID- unique identifier of the solution componentimplementationGUID- unique identifier of the newly set up governance action processinformationSupplyChainQualifiedName- option name of information supply chain - used to identify solution component implementations that are specific to a particular information supply chainrole- optional role of the implementation- Throws:
InvalidParameterException- invalid parameterPropertyServerException- repository errorUserNotAuthorizedException- security error
-
addSolutionComponentImplementationResource
protected void addSolutionComponentImplementationResource(String solutionComponentGUID, String implementationGUID, String role, String description) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Set up the ImplementedBy relationship between an implementation component and a solution component. The information supply chain qualified names ensures that the appropriate assets are returned on a specific ISC lineage query.- Parameters:
solutionComponentGUID- unique identifier of the solution componentimplementationGUID- unique identifier of the newly set up governance action processrole- role of the component in an implementationdescription- optional description of the implementation- Throws:
InvalidParameterException- invalid parameterPropertyServerException- repository errorUserNotAuthorizedException- security error
-
addResourceListRelationship
protected void addResourceListRelationship(String consumerGUID, String resourceGUID, ResourceUse resourceUse) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Set up the ResourceList relationship between an implementation component and a solution component.- Parameters:
consumerGUID- unique identifier of the element that is to use the elementresourceGUID- unique identifier of the resourceresourceUse- how is the resource to be used?- Throws:
InvalidParameterException- invalid parameterPropertyServerException- repository errorUserNotAuthorizedException- security error
-
getResourceUseProperties
Set up the properties for a resource use enum.- Parameters:
resourceUse- enum- Returns:
- element properties
-
addGovernedByRelationship
protected void addGovernedByRelationship(String dataQualityCertificationTypeGUID, String sandboxSchemaGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Link the certification type to the schema.- Parameters:
dataQualityCertificationTypeGUID- certification typesandboxSchemaGUID- database schema for the sandbox- Throws:
InvalidParameterException- invalid parameterPropertyServerException- repository errorUserNotAuthorizedException- security error
-
createPopulateSandboxDAG
protected String createPopulateSandboxDAG(String airflowDAGName, String topLevelProjectGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Create a process to represent the Airflow DAG that populates the sandbox.- Parameters:
airflowDAGName- nametopLevelProjectGUID- unique identifier for the top level project - used as a search scope- Returns:
- guid
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- repository errorUserNotAuthorizedException- security error
-
createSandboxSchema
protected String createSandboxSchema(String topLevelProjectGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Create the sandbox database schema - it is assumed that details of the schema are passed in the request parameters.- Parameters:
topLevelProjectGUID- unique identifier for the top level project - used as a search scope- Returns:
- guid
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- repository errorUserNotAuthorizedException- security error
-