Class EngineActionHandler<B>


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

    • EngineActionHandler

      public EngineActionHandler(OpenMetadataAPIGenericConverter<B> converter, Class<B> beanClass, String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, String localServerUserId, OpenMetadataServerSecurityVerifier securityVerifier, List<String> serviceSupportedZones, List<String> defaultZones, List<String> publishZones, AuditLog auditLog)
      Construct the handler for engine actions.
      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
      serviceSupportedZones - 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

    • initiateGovernanceActionType

      public String initiateGovernanceActionType(String userId, String governanceActionTypeQualifiedName, List<String> requestSourceGUIDs, List<NewActionTarget> actionTargets, Map<String,String> requestParameters, Date startTime, String originatorServiceName, String originatorEngineName, List<String> serviceSupportedZones, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Using the named governance action type as a template, initiate a chain of engine actions.
      Parameters:
      userId - caller's userId
      governanceActionTypeQualifiedName - unique name to give this governance action type
      requestSourceGUIDs - request source elements for the resulting governance service
      actionTargets - list of action target names to GUIDs for the resulting governance 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).
      serviceSupportedZones - supported zones for calling service
      methodName - calling method
      Returns:
      unique identifier of the first engine action
      Throws:
      InvalidParameterException - null qualified name
      UserNotAuthorizedException - this governance service is not authorized to create a governance action
      PropertyServerException - there is a problem with the metadata store
    • initiateGovernanceActionProcess

      public String initiateGovernanceActionProcess(String userId, String processQualifiedName, List<String> requestSourceGUIDs, List<NewActionTarget> callersActionTargets, Map<String,String> callersRequestParameters, Date requestedStartDate, String originatorServiceName, String originatorEngineName, List<String> serviceSupportedZones, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Using the named governance action process as a template, initiate a chain of engine actions.
      Parameters:
      userId - caller's userId
      processQualifiedName - unique name to give this governance action process
      requestSourceGUIDs - request source elements for the resulting governance service
      callersActionTargets - list of action target names to GUIDs for the resulting governance service
      callersRequestParameters - initial set of request parameters from the caller
      requestedStartDate - 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).
      serviceSupportedZones - supported zones for calling service
      methodName - calling method
      Returns:
      unique identifier of the governance action process instance
      Throws:
      InvalidParameterException - null qualified name
      UserNotAuthorizedException - this governance service is not authorized to create a governance action
      PropertyServerException - there is a problem with the metadata store
    • approveEngineAction

      public void approveEngineAction(String userId, String engineActionGUID, String qualifiedName, List<String> mandatoryGuards, List<String> receivedGuards, Date startTime, String governanceEngineName, String requestType, Map<String,String> requestParameters, String governanceActionProcessStepName, String requestSourceName, List<String> serviceSupportedZones, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Move an engine action from REQUESTED state to APPROVED status and log an audit message to say that the engine action is starting.
      Parameters:
      userId - caller's userId
      engineActionGUID - unique identifier of the engine action
      qualifiedName - unique identifier of this engine action
      mandatoryGuards - list of guards that must be received in order to proceed with the engine action
      receivedGuards - list of guards to initiate the engine 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 service to run
      requestParameters - properties to pass to the governance service
      governanceActionProcessStepName - unique name of the governance action process step that initiated this engine action as part of a governance action process (or null if this is standalone engine action)
      requestSourceName - where did the request come from
      serviceSupportedZones - supported zones for calling service
      methodName - calling method
      Throws:
      InvalidParameterException - null qualified name
      UserNotAuthorizedException - the caller is not authorized to create an engine action
      PropertyServerException - there is a problem with the metadata store
    • createEngineAction

      public String createEngineAction(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 requesterUserId, String requestType, Map<String,String> requestParameters, String governanceActionTypeGUID, String governanceActionTypeName, String anchorGUID, String processName, String processStepGUID, String processStepName, String requestSourceName, String originatorServiceName, String originatorEngineName, List<String> serviceSupportedZones, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Create an engine 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 service
      actionTargets - list of action target names to GUIDs for the resulting governance 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
      requesterUserId - userId of the original requester
      requestType - request type to identify the governance service to run
      requestParameters - properties to pass to the governance service
      governanceActionTypeGUID - unique identifier for the governance action type (if any)
      governanceActionTypeName - unique name for the governance action type (if any)
      anchorGUID - identifier of the first engine action of the process (null for standalone engine actions and the first engine action in a governance action process).
      processStepGUID - unique identifier of the governance action process step that initiated this engine action as part of a governance action process (or null if this is standalone governance action)
      processStepName - unique name of the governance action process step that initiated this engine 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)
      serviceSupportedZones - supported zones for calling service
      methodName - calling method
      Returns:
      unique identifier of the engine action
      Throws:
      InvalidParameterException - null qualified name
      UserNotAuthorizedException - this governance service is not authorized to create a governance action
      PropertyServerException - there is a problem with the metadata store
    • getEngineAction

      public B getEngineAction(String userId, String engineActionGUID, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Request the status of an executing engine action request.
      Parameters:
      userId - identifier of calling user
      engineActionGUID - identifier of the engine action request
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      serviceSupportedZones - supported zones for calling service
      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.
    • getEngineAction

      public B getEngineAction(String userId, EntityDetail primaryEntity, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Request the status of an executing engine action request.
      Parameters:
      userId - identifier of calling user
      primaryEntity - entity of the engine action request
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      serviceSupportedZones - supported zones for calling service
      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 EngineActionStatus 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
    • claimEngineAction

      public void claimEngineAction(String userId, String engineActionGUID, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Request that execution of an engine action is allocated to the caller. This is only permitted if no other caller has claimed it.
      Parameters:
      userId - identifier of calling user
      engineActionGUID - identifier of the engine action request
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      serviceSupportedZones - supported zones for calling service
      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.
    • cancelEngineAction

      public void cancelEngineAction(String userId, String engineActionGUID, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Request that execution of an engine action is allocated to the caller. This is only permitted if no other caller has claimed it.
      Parameters:
      userId - identifier of calling user
      engineActionGUID - identifier of the engine action request
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      serviceSupportedZones - supported zones for calling service
      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.
    • updateEngineActionStatus

      public void updateEngineActionStatus(String userId, String engineActionGUID, int engineActionStatus, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the status of the engine action - providing the caller is permitted.
      Parameters:
      userId - identifier of calling user
      engineActionGUID - identifier of the engine action request
      engineActionStatus - new status ordinal
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      serviceSupportedZones - supported zones for calling service
      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 engineActionGUID, int status, Map<String,String> callerRequestParameters, List<String> outputGuards, List<NewActionTarget> newActionTargets, String completionMessage, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Declare that all the processing for the governance 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 engine action then this is set up at this time.
      Parameters:
      userId - caller's userId
      engineActionGUID - unique identifier of the engine 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; these are supplied by the governance service that ran the previous step
      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)
      serviceSupportedZones - supported zones for calling service
      methodName - calling method
      Throws:
      InvalidParameterException - the completion status is null
      UserNotAuthorizedException - the governance service is not authorized to update the engine action status
      PropertyServerException - there is a problem connecting to the metadata store
    • getEngineActions

      public List<B> getEngineActions(String userId, int startFrom, int pageSize, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the engine actions that are known to this server.
      Parameters:
      userId - userId of caller
      startFrom - starting from element
      pageSize - maximum elements to return
      serviceSupportedZones - supported zones for calling service
      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 engine 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.
    • getActiveEngineActions

      public List<B> getActiveEngineActions(String userId, int startFrom, int pageSize, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the engine actions that are still in progress.
      Parameters:
      userId - userId of caller
      startFrom - starting from element
      pageSize - maximum elements to return
      serviceSupportedZones - supported zones for calling service
      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 engine 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.
    • getActiveClaimedEngineActions

      public List<B> getActiveClaimedEngineActions(String userId, String governanceEngineGUID, int startFrom, int pageSize, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the engine actions that are still in progress 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
      serviceSupportedZones - supported zones for calling service
      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 engine 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.
    • findEngineActions

      public List<B> findEngineActions(String userId, String searchString, String searchStringParameterName, int startFrom, int pageSize, boolean forLineage, boolean forDuplicateProcessing, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the list of engine 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?
      serviceSupportedZones - supported zones for calling service
      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)
    • getEngineActionsByName

      public List<B> getEngineActionsByName(String userId, String name, String nameParameterName, int startFrom, int pageSize, List<String> serviceSupportedZones, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the list of engine action 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
      serviceSupportedZones - supported zones for calling service
      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 service. However, if the governance service has to process many target elements, then setting the status on each individual target will show the progress of the governance service.
      Parameters:
      userId - caller's userId
      actionTargetGUID - unique identifier of the target element
      status - status enum to show its progress
      startDate - date/time that the governance 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 service is not authorized to update the action target properties
      PropertyServerException - there is a problem connecting to the metadata store