Class 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 Detail

      • 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 Detail

      • 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
      • initiateGovernanceAction

        public String initiateGovernanceAction​(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 requestSourceName,
                                               String originatorServiceName,
                                               String originatorEngineName,
                                               String methodName)
                                        throws InvalidParameterException,
                                               UserNotAuthorizedException,
                                               PropertyServerException
        Create a governance action in the metadata store which will trigger the governance action service associated with the supplied request type. The governance action remains to act as a record of the actions taken for auditing.
        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)
        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
      • 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,
                                           Date effectiveTime,
                                           String methodName)
                                    throws InvalidParameterException,
                                           UserNotAuthorizedException,
                                           PropertyServerException
        Declare that all of 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
        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
      • 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.
      • updateActionTargetStatus

        public void updateActionTargetStatus​(String userId,
                                             String actionTargetGUID,
                                             int status,
                                             Date startDate,
                                             Date completionDate,
                                             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
        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