Class GovernanceActionHandler<B>

java.lang.Object
org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericHandler<B>
org.odpi.openmetadata.commonservices.generichandlers.GovernanceActionHandler<B>

public class GovernanceActionHandler<B> extends OpenMetadataAPIGenericHandler<B>
MetadataElementHandler manages MetadataElement objects from the Governance Action Framework (GAF). These objects are 1-1 with an open metadata entity.
  • Constructor Details

    • GovernanceActionHandler

      public GovernanceActionHandler(OpenMetadataAPIGenericConverter<B> converter, Class<B> beanClass, String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, String localServerUserId, OpenMetadataServerSecurityVerifier securityVerifier, List<String> supportedZones, List<String> defaultZones, List<String> publishZones, AuditLog auditLog)
      Construct the handler for metadata elements.
      Parameters:
      converter - specific converter for this bean class
      beanClass - name of bean class that is represented by the generic class B
      serviceName - name of this service
      serverName - name of the local server
      invalidParameterHandler - handler for managing parameter errors
      repositoryHandler - manages calls to the repository services
      repositoryHelper - provides utilities for manipulating the repository services objects
      localServerUserId - userId for this server
      securityVerifier - open metadata security services verifier
      supportedZones - list of zones that the access service is allowed to serve Asset instances from.
      defaultZones - list of zones that the access service should set in all new Asset instances.
      publishZones - list of zones that the access service sets up in published Asset instances.
      auditLog - destination for audit log events.
  • Method Details

    • initiateGovernanceActionProcess

      public String initiateGovernanceActionProcess(String userId, String processQualifiedName, List<String> requestSourceGUIDs, List<NewActionTarget> actionTargets, Map<String,String> requestParameters, Date startTime, String originatorServiceName, String originatorEngineName, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Using the named governance action process as a template, initiate a chain of governance actions.
      Parameters:
      userId - caller's userId
      processQualifiedName - unique name to give this governance action process
      requestSourceGUIDs - request source elements for the resulting governance action service
      actionTargets - list of action target names to GUIDs for the resulting governance action service
      requestParameters - initial set of request parameters from the caller
      startTime - future start time or null for "as soon as possible"
      originatorServiceName - unique identifier of the originator - typically an ActorProfile or Process such as a GovernanceService.
      originatorEngineName - optional unique name of the governance engine (if initiated by a governance engine).
      methodName - calling method
      Returns:
      unique identifier of the first governance action
      Throws:
      InvalidParameterException - null qualified name
      UserNotAuthorizedException - this governance action service is not authorized to create a governance action
      PropertyServerException - there is a problem with the metadata store
    • approveGovernanceAction

      public String approveGovernanceAction(String userId, String governanceActionGUID, String qualifiedName, List<String> mandatoryGuards, List<String> receivedGuards, Date startTime, String governanceEngineName, String requestType, Map<String,String> requestParameters, String governanceActionTypeName, String requestSourceName, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Move a governance action from REQUESTED state to APPROVED status and log an audit message to say that the governance action is starting.
      Parameters:
      userId - caller's userId
      governanceActionGUID - unique identifier of the governance action
      qualifiedName - unique identifier of this governance action
      mandatoryGuards - list of guards that must be received in order to proceed with the governance action
      receivedGuards - list of guards to initiate the governance action
      startTime - future start time or null for "as soon as possible"
      governanceEngineName - name of the governance engine that should execute the request
      requestType - request type to identify the governance action service to run
      requestParameters - properties to pass to the governance action service
      governanceActionTypeName - unique name of the governance action type that initiated this governance action as part of a governance action process (or null if this is standalone governance action)
      requestSourceName - where did the request come from
      methodName - calling method
      Returns:
      unique identifier of the governance action
      Throws:
      InvalidParameterException - null qualified name
      UserNotAuthorizedException - this governance action service is not authorized to create a governance action
      PropertyServerException - there is a problem with the metadata store
    • createGovernanceAction

      public String createGovernanceAction(String userId, String qualifiedName, int domainIdentifier, String displayName, String description, List<String> requestSourceGUIDs, List<NewActionTarget> actionTargets, List<String> mandatoryGuards, List<String> receivedGuards, Date startTime, String governanceEngineName, String requestType, Map<String,String> requestParameters, String governanceActionTypeGUID, String governanceActionTypeName, String anchorGUID, String processName, String requestSourceName, String originatorServiceName, String originatorEngineName, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Create a governance action in REQUESTED state in the metadata store with all the relationships, so it is ready to execute. Nothing will happen until it moves to APPROVED state.
      Parameters:
      userId - caller's userId
      qualifiedName - unique identifier to give this governance action
      domainIdentifier - governance domain associated with this action (0=ALL)
      displayName - display name for this action
      description - description for this action
      requestSourceGUIDs - request source elements for the resulting governance action service
      actionTargets - list of action target names to GUIDs for the resulting governance action service
      mandatoryGuards - list of guards that must be received in order to proceed with the governance action
      receivedGuards - list of guards to initiate the governance action
      startTime - future start time or null for "as soon as possible"
      governanceEngineName - name of the governance engine that should execute the request
      requestType - request type to identify the governance action service to run
      requestParameters - properties to pass to the governance action service
      anchorGUID - identifier of the first governance action of the process (null for standalone governance actions and the first governance action in a governance action process).
      governanceActionTypeGUID - unique identifier of the governance action type that initiated this governance action as part of a governance action process (or null if this is standalone governance action)
      governanceActionTypeName - unique name of the governance action type that initiated this governance action as part of a governance action process (or null if this is standalone governance action)
      processName - name of the process
      requestSourceName - where did the request come from
      originatorServiceName - unique identifier of the originator - typically an ActorProfile or Process such as a GovernanceService.
      originatorEngineName - optional unique name of the governance engine (if initiated by a governance engine)
      methodName - calling method
      Returns:
      unique identifier of the governance action
      Throws:
      InvalidParameterException - null qualified name
      UserNotAuthorizedException - this governance action service is not authorized to create a governance action
      PropertyServerException - there is a problem with the metadata store
    • getGovernanceAction

      public B getGovernanceAction(String userId, String governanceActionGUID, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Request the status of an executing governance action request.
      Parameters:
      userId - identifier of calling user
      governanceActionGUID - identifier of the governance action request
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Returns:
      status enum
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • getGovernanceAction

      public B getGovernanceAction(String userId, EntityDetail primaryEntity, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Request the status of an executing governance action request.
      Parameters:
      userId - identifier of calling user
      primaryEntity - entity of the governance action request
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Returns:
      status enum
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • getActionStatus

      public GovernanceActionStatus getActionStatus(String propertyName, InstanceProperties properties)
      Retrieve the ActionStatus enum property from the instance properties of a Governance Action.
      Parameters:
      propertyName - name of property to extract the enum from
      properties - entity properties
      Returns:
      ActionStatus enum value
    • claimGovernanceAction

      public void claimGovernanceAction(String userId, String governanceActionGUID, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Request that execution of a governance action is allocated to the caller. This is only permitted if no other caller has claimed it.
      Parameters:
      userId - identifier of calling user
      governanceActionGUID - identifier of the governance action request
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • updateGovernanceActionStatus

      public void updateGovernanceActionStatus(String userId, String governanceActionGUID, int governanceActionStatus, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the status of the governance action - providing the caller is permitted.
      Parameters:
      userId - identifier of calling user
      governanceActionGUID - identifier of the governance action request
      governanceActionStatus - new status ordinal
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • recordCompletionStatus

      public void recordCompletionStatus(String userId, String governanceActionGUID, int status, Map<String,String> callerRequestParameters, List<String> outputGuards, List<NewActionTarget> newActionTargets, String completionMessage, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Declare that all the processing for the governance action service is finished along with status of the work. If this is part of a governance action process, and it defines that there is a follow-on governance action then this is set up at this time.
      Parameters:
      userId - caller's userId
      governanceActionGUID - unique identifier of the governance action to update
      status - completion status enum value
      callerRequestParameters - request parameters used by the caller
      outputGuards - optional guard strings for triggering subsequent action(s)
      newActionTargets - additional elements to add to the action targets for the next phase
      completionMessage - message to describe completion results or reasons for failure
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Throws:
      InvalidParameterException - the completion status is null
      UserNotAuthorizedException - the governance action service is not authorized to update the governance action service status
      PropertyServerException - there is a problem connecting to the metadata store
    • getGovernanceActions

      public List<B> getGovernanceActions(String userId, int startFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the governance actions that are known to this server.
      Parameters:
      userId - userId of caller
      startFrom - starting from element
      pageSize - maximum elements to return
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Returns:
      list of governance action elements
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • getActiveGovernanceActions

      public List<B> getActiveGovernanceActions(String userId, int startFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the governance actions that are still in process.
      Parameters:
      userId - userId of caller
      startFrom - starting from element
      pageSize - maximum elements to return
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Returns:
      list of governance action elements
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • getActiveClaimedGovernanceActions

      public List<B> getActiveClaimedGovernanceActions(String userId, String governanceEngineGUID, int startFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the governance actions that are still in process and that have been claimed by this caller's userId. This call is used when the caller restarts.
      Parameters:
      userId - userId of caller
      governanceEngineGUID - unique identifier of governance engine
      startFrom - starting from element
      pageSize - maximum elements to return
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Returns:
      list of governance action elements
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem detected by the metadata store.
    • findGovernanceActions

      public List<B> findGovernanceActions(String userId, String searchString, String searchStringParameterName, int startFrom, int pageSize, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the list of governance action metadata elements that contain the search string. The search string is treated as a regular expression.
      Parameters:
      userId - calling user
      searchString - string to find in the properties
      searchStringParameterName - parameter supplying search string
      startFrom - paging start point
      pageSize - maximum results that can be returned
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - what is the effective time for related queries needed to do the update
      methodName - calling method
      Returns:
      list of matching metadata elements
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user is not authorized to issue this request
      PropertyServerException - there is a problem reported in the open metadata server(s)
    • getGovernanceActionsByName

      public List<B> getGovernanceActionsByName(String userId, String name, String nameParameterName, int startFrom, int pageSize, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the list of governance action type metadata elements with a matching qualified or display name. There are no wildcards supported on this request.
      Parameters:
      userId - calling user
      name - name to search for
      nameParameterName - name of parameter supplying name
      startFrom - paging start point
      pageSize - maximum results that can be returned
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Returns:
      list of matching metadata elements
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user is not authorized to issue this request
      PropertyServerException - there is a problem reported in the open metadata server(s)
    • updateActionTargetStatus

      public void updateActionTargetStatus(String userId, String actionTargetGUID, int status, Date startDate, Date completionDate, String completionMessage, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the status of a specific action target. By default, these values are derived from the values for the governance action service. However, if the governance action service has to process name target elements, then setting the status on each individual target will show the progress of the governance action service.
      Parameters:
      userId - caller's userId
      actionTargetGUID - unique identifier of the governance action service
      status - status enum to show its progress
      startDate - date/time that the governance action service started processing the target
      completionDate - date/time that the governance process completed processing this target
      completionMessage - message to describe completion results or reasons for failure
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      methodName - calling method
      Throws:
      InvalidParameterException - the action target GUID is not recognized
      UserNotAuthorizedException - the governance action service is not authorized to update the action target properties
      PropertyServerException - there is a problem connecting to the metadata store