Class RoleAnalysisServiceImpl

java.lang.Object
com.evolveum.midpoint.model.impl.mining.RoleAnalysisServiceImpl
All Implemented Interfaces:
RoleAnalysisService, Serializable

@Component public class RoleAnalysisServiceImpl extends Object implements RoleAnalysisService, Serializable
Utility methods for working with role analysis objects in the Midpoint system.
See Also:
  • Field Details

    • OPERATION_PREPARE_OBJECTS

      public static final String OPERATION_PREPARE_OBJECTS
  • Constructor Details

    • RoleAnalysisServiceImpl

      public RoleAnalysisServiceImpl()
  • Method Details

    • getUserTypeObject

      @Nullable public @Nullable PrismObject<UserType> getUserTypeObject(@NotNull @NotNull String oid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Retrieves a PrismObject of UserType object based on its OID.
      Specified by:
      getUserTypeObject in interface RoleAnalysisService
      Parameters:
      oid - The OID of the UserType object to retrieve.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The PrismObject of UserType object, or null if not found.
    • getFocusTypeObject

      @Nullable public @Nullable PrismObject<FocusType> getFocusTypeObject(@NotNull @NotNull String oid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Retrieves a PrismObject of FocusType object based on its OID.
      Specified by:
      getFocusTypeObject in interface RoleAnalysisService
      Parameters:
      oid - The OID of the FocusType object to retrieve.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The PrismObject of FocusType object, or null if not found.
    • getRoleTypeObject

      @Nullable public @Nullable PrismObject<RoleType> getRoleTypeObject(@NotNull @NotNull String oid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Retrieves a PrismObject of RoleType object based on its OID.
      Specified by:
      getRoleTypeObject in interface RoleAnalysisService
      Parameters:
      oid - The OID of the RoleType object to retrieve.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The PrismObject of RoleType object, or null if not found.
    • getClusterTypeObject

      @Nullable public @Nullable PrismObject<RoleAnalysisClusterType> getClusterTypeObject(@NotNull @NotNull String oid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Retrieves a PrismObject of RoleAnalysisClusterType object based on its OID.
      Specified by:
      getClusterTypeObject in interface RoleAnalysisService
      Parameters:
      oid - The OID of the RoleAnalysisClusterType object to retrieve.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The PrismObject of RoleAnalysisClusterType object, or null if not found.
    • getSessionTypeObject

      @Nullable public @Nullable PrismObject<RoleAnalysisSessionType> getSessionTypeObject(@NotNull @NotNull String oid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Retrieves a PrismObject of RoleAnalysisSessionType object based on its OID.
      Specified by:
      getSessionTypeObject in interface RoleAnalysisService
      Parameters:
      oid - The OID of the RoleAnalysisSessionType object to retrieve.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The PrismObject of RoleAnalysisSessionType object, or null if not found.
    • getObject

      @Nullable public <T extends ObjectType> @Nullable PrismObject<T> getObject(@NotNull @NotNull Class<T> objectTypeClass, @NotNull @NotNull String oid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Retrieves a PrismObject based on its OID.
      Specified by:
      getObject in interface RoleAnalysisService
      oid - The OID of the object to retrieve.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The PrismObject of object, or null if not found.
    • countSessionTypeObjects

      @NotNull public @NotNull Integer countSessionTypeObjects(@NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Retrieves the number of RoleAnalysisSessionType objects in the system.
      Specified by:
      countSessionTypeObjects in interface RoleAnalysisService
      Parameters:
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The number of RoleAnalysisSessionType objects in the system.
    • extractUserTypeMembers

      @NotNull public @NotNull com.google.common.collect.ListMultimap<String,String> extractUserTypeMembers(@NotNull @NotNull Map<String,PrismObject<UserType>> userExistCache, @Nullable @Nullable ObjectFilter userFilter, @NotNull @NotNull Set<String> clusterMembers, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Extracts a list of user members from set of RoleType object based on provided parameters.
      Specified by:
      extractUserTypeMembers in interface RoleAnalysisService
      Parameters:
      userExistCache - The cache of user objects.
      userFilter - The UserType filter.
      clusterMembers - The set of cluster members.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      A list of user members.
    • importCluster

      public void importCluster(@NotNull @NotNull PrismObject<RoleAnalysisClusterType> clusterPrismObject, @NotNull @NotNull RoleAnalysisDetectionOptionType roleAnalysisSessionDetectionOption, @NotNull @NotNull ObjectReferenceType parentRef, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Imports a RoleAnalysisClusterType object into the system.
      Specified by:
      importCluster in interface RoleAnalysisService
      Parameters:
      clusterPrismObject - The cluster for importing.
      roleAnalysisSessionDetectionOption - The session detection option.
      parentRef - The parent Role analysis session reference.
      task - The task associated with this operation.
      result - The operation result.
    • updateSessionStatistics

      public void updateSessionStatistics(@NotNull @NotNull ObjectReferenceType sessionRef, @NotNull @NotNull RoleAnalysisSessionStatisticType sessionStatistic, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Modifies statistics of a RoleAnalysisSessionType object.
      Specified by:
      updateSessionStatistics in interface RoleAnalysisService
      Parameters:
      sessionRef - The session reference.
      sessionStatistic - The session statistic to modify.
      task - The task associated with this operation.
      result - The operation result.
    • replaceDetectionPattern

      public void replaceDetectionPattern(@NotNull @NotNull String clusterOid, @NotNull @NotNull List<DetectedPattern> detectedPatterns, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Replaces the detected patterns of a RoleAnalysisClusterType object.
      Specified by:
      replaceDetectionPattern in interface RoleAnalysisService
      Parameters:
      clusterOid - The cluster OID.
      detectedPatterns - The detected patterns to replace.
      task - The task associated with this operation.
      result - The operation result.
    • getUpdatedAnalysisClusterStatistic

      @NotNull public @NotNull AnalysisClusterStatisticType getUpdatedAnalysisClusterStatistic(double maxReduction, @NotNull @NotNull AnalysisClusterStatisticType clusterStatistics)
      Specified by:
      getUpdatedAnalysisClusterStatistic in interface RoleAnalysisService
    • generateObjectReferences

      @NotNull public @NotNull Set<ObjectReferenceType> generateObjectReferences(@NotNull @NotNull Set<String> objects, @NotNull @NotNull QName complexType, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult operationResult)
      Description copied from interface: RoleAnalysisService
      Generates a set of object references based on a provided parameters.
      Specified by:
      generateObjectReferences in interface RoleAnalysisService
      Parameters:
      objects - The objects to create references for.
      complexType - The complex type of the objects.
      task - The task associated with this operation.
      operationResult - The operation result.
      Returns:
      A set of object references.
    • deleteSessionClustersMembers

      public void deleteSessionClustersMembers(@NotNull @NotNull String sessionOid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Deletes all RoleAnalysisClusterType objects associated with a specific session.
      Specified by:
      deleteSessionClustersMembers in interface RoleAnalysisService
      Parameters:
      sessionOid - The session OID.
      task - The task associated with this operation.
      result - The operation result.
    • deleteCluster

      public void deleteCluster(@NotNull @NotNull RoleAnalysisClusterType cluster, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Deletes a single RoleAnalysisClusterType object.
      Specified by:
      deleteCluster in interface RoleAnalysisService
      Parameters:
      cluster - The cluster to delete.
      task - The task associated with this operation.
      result - The operation result.
    • recomputeSessionStatics

      public void recomputeSessionStatics(@NotNull @NotNull String sessionOid, @NotNull @NotNull RoleAnalysisClusterType roleAnalysisClusterType, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Recomputes the statistics of a RoleAnalysisSessionType object.
      Specified by:
      recomputeSessionStatics in interface RoleAnalysisService
      Parameters:
      sessionOid - The session OID.
      roleAnalysisClusterType - The cluster to recompute statistics for.
      task - The task associated with this operation.
      result - The operation result.
    • cacheRoleTypeObject

      @Nullable public @Nullable PrismObject<RoleType> cacheRoleTypeObject(@NotNull @NotNull Map<String,PrismObject<RoleType>> roleExistCache, @NotNull @NotNull String roleOid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Retrieves a RoleType PrismObject from a cache or, if not present, fetches it from the ModelService and stores it in the cache.
      Specified by:
      cacheRoleTypeObject in interface RoleAnalysisService
      Parameters:
      roleExistCache - A cache storing previously fetched RoleType PrismObjects.
      roleOid - The OID of the RoleType PrismObject to retrieve.
      task - The task associated with the operation.
      result - The operation result.
      Returns:
      The RoleType PrismObject fetched from the cache or ModelService, or null if not found.
    • cacheUserTypeObject

      @Nullable public @Nullable PrismObject<UserType> cacheUserTypeObject(@NotNull @NotNull Map<String,PrismObject<UserType>> userExistCache, @NotNull @NotNull String userOid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Retrieves a UserType PrismObject from a cache or, if not present, fetches it from the ModelService and stores it in the cache.
      Specified by:
      cacheUserTypeObject in interface RoleAnalysisService
      Parameters:
      userExistCache - A cache storing previously fetched UserType PrismObjects.
      userOid - The OID of the UserType PrismObject to retrieve.
      task - The task associated with the operation.
      result - The operation result.
      Returns:
      The UserType PrismObject fetched from the cache or ModelService, or null if not found.
    • countUserTypeMembers

      @NotNull public @NotNull Integer countUserTypeMembers(@Nullable @Nullable ObjectFilter userFilter, @NotNull @NotNull String objectId, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Counts the number of members of a RoleType object.
      Specified by:
      countUserTypeMembers in interface RoleAnalysisService
      Parameters:
      userFilter - The UserType filter.
      objectId - The OID of the RoleType object.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The number of user members of a RoleType object.
    • generateBusinessRole

      @NotNull public @NotNull PrismObject<RoleType> generateBusinessRole(@NotNull @NotNull List<AssignmentType> assignmentTypes, @NotNull @NotNull PolyStringType name)
      Description copied from interface: RoleAnalysisService
      Retrieves a RoleType object that represents a business role.
      Specified by:
      generateBusinessRole in interface RoleAnalysisService
      Parameters:
      assignmentTypes - The assignment types that represent inducements of the business role.
      name - The name of the business role.
      Returns:
      The PrismObject of RoleType object.
    • deleteSession

      public void deleteSession(@NotNull @NotNull String sessionOid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Deletes a single RoleAnalysisSessionType object.
      Specified by:
      deleteSession in interface RoleAnalysisService
      Parameters:
      sessionOid - The role analysis session OID.
      task - The task associated with this operation.
      result - The operation result.
    • resolveClusterProcessMode

      public RoleAnalysisProcessModeType resolveClusterProcessMode(@NotNull @NotNull PrismObject<RoleAnalysisClusterType> cluster, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Resolves the process mode of a RoleAnalysisClusterType object based on role analysis session.
      Specified by:
      resolveClusterProcessMode in interface RoleAnalysisService
      Parameters:
      cluster - The cluster to resolve the process mode for.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The resolved process mode.
    • recomputeClusterDetectionOptions

      public void recomputeClusterDetectionOptions(@NotNull @NotNull String clusterOid, @NotNull @NotNull DetectionOption detectionOption, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Recompute the detection options of a RoleAnalysisClusterType object.
      Specified by:
      recomputeClusterDetectionOptions in interface RoleAnalysisService
      Parameters:
      clusterOid - The cluster OID.
      detectionOption - The detection option to recompute.
      task - The task associated with this operation.
      result - The operation result.
    • prepareCompressedMiningStructure

      @NotNull public @NotNull MiningOperationChunk prepareCompressedMiningStructure(@NotNull @NotNull RoleAnalysisClusterType cluster, boolean fullProcess, @NotNull @NotNull RoleAnalysisProcessModeType processMode, @NotNull @NotNull OperationResult result, @NotNull @NotNull Task task)
      Description copied from interface: RoleAnalysisService
      Method for preparing a compressed mining structure for role analysis.
      Specified by:
      prepareCompressedMiningStructure in interface RoleAnalysisService
      Parameters:
      cluster - The cluster for which the mining structure is prepared.
      fullProcess - The full process flag. If true, the entire structure is prepared. If false, only a partial structure (members) is prepared.
      processMode - The process mode.
      result - The operation result.
      task - The task associated with this operation.
      Returns:
      A MiningOperationChunk containing user and role chunks for further processing.
    • prepareExpandedMiningStructure

      @NotNull public @NotNull MiningOperationChunk prepareExpandedMiningStructure(@NotNull @NotNull RoleAnalysisClusterType cluster, boolean fullProcess, @NotNull @NotNull RoleAnalysisProcessModeType processMode, @NotNull @NotNull OperationResult result, @NotNull @NotNull Task task)
      Description copied from interface: RoleAnalysisService
      Method for preparing an expanded mining structure for role analysis.
      Specified by:
      prepareExpandedMiningStructure in interface RoleAnalysisService
      Parameters:
      cluster - The cluster for which the mining structure is prepared.
      fullProcess - The full process flag. If true, the entire structure is prepared. If false, only a partial structure (members) is prepared.
      processMode - The process mode.
      result - The operation result.
      task - The task associated with this operation.
      Returns:
      A MiningOperationChunk containing user and role chunks for further processing.
    • executeClusteringTask

      public void executeClusteringTask(@NotNull @NotNull PrismObject<RoleAnalysisSessionType> session, @Nullable @Nullable String taskOid, @Nullable @Nullable PolyStringType taskName, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      This method is used to execute a clustering task. It creates a new cluster and stores it in the session.
      Specified by:
      executeClusteringTask in interface RoleAnalysisService
      Parameters:
      session - The session under which the clustering task is executed.
      taskOid - The OID of the task.
      taskName - The name of the task.
      task - The task associated with this operation.
      result - The operation result.
    • executeDetectionTask

      public void executeDetectionTask(@NotNull @NotNull PrismObject<RoleAnalysisClusterType> cluster, @Nullable @Nullable String taskOid, @Nullable @Nullable PolyStringType taskName, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      This method is used to execute a detection task. Detected patterns are stored in the cluster.
      Specified by:
      executeDetectionTask in interface RoleAnalysisService
      Parameters:
      cluster - The cluster under which the detection task is executed.
      taskOid - The OID of the task.
      taskName - The name of the task.
      task - The task associated with this operation.
      result - The operation result.
    • executeMigrationTask

      public void executeMigrationTask(@NotNull @NotNull PrismObject<RoleAnalysisClusterType> cluster, @NotNull @NotNull ActivityDefinitionType activityDefinition, @NotNull @NotNull PrismObject<RoleType> roleObject, @Nullable @Nullable String taskOid, @Nullable @Nullable PolyStringType taskName, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      This method is used to execute a migration task. It replaces the role assignment with business role assignment.
      Specified by:
      executeMigrationTask in interface RoleAnalysisService
      Parameters:
      cluster - The cluster under which the migration task is executed.
      activityDefinition - The activity definition.
      roleObject - The role object for migration.
      taskOid - The OID of the task.
      taskName - The name of the task.
      task - The task associated with this operation.
      result - The operation result.
    • recomputeAndResolveClusterOpStatus

      @NotNull public @NotNull String recomputeAndResolveClusterOpStatus(@NotNull @NotNull PrismObject<RoleAnalysisClusterType> clusterPrismObject, @NotNull @NotNull RoleAnalysisChannelMode channelMode, @NotNull @NotNull OperationResult result, @NotNull @NotNull Task task)
      Description copied from interface: RoleAnalysisService
      Recompute and resolve the cluster operation status. This method also update the cluster operation status if detect some changes.
      Specified by:
      recomputeAndResolveClusterOpStatus in interface RoleAnalysisService
      Parameters:
      clusterPrismObject - The cluster for recompute and resolve.
      channelMode - The channel mode.
      result - The operation result.
      task - The task associated with this operation.
      Returns:
      The cluster operation status.
    • recomputeAndResolveSessionOpStatus

      @NotNull public @NotNull String recomputeAndResolveSessionOpStatus(@NotNull @NotNull PrismObject<RoleAnalysisSessionType> sessionPrismObject, @NotNull @NotNull RoleAnalysisChannelMode channelMode, @NotNull @NotNull OperationResult result, @NotNull @NotNull Task task)
      Description copied from interface: RoleAnalysisService
      Recompute and resolve the cluster operation status. This method also update the cluster operation status if detect some changes.
      Specified by:
      recomputeAndResolveSessionOpStatus in interface RoleAnalysisService
      Parameters:
      sessionPrismObject - The cluster for recompute and resolve.
      channelMode - The channel mode.
      result - The operation result.
      task - The task associated with this operation.
      Returns:
      The cluster operation status.
    • clusterObjectMigrationRecompute

      public void clusterObjectMigrationRecompute(@NotNull @NotNull String clusterRefOid, @NotNull @NotNull String roleRefOid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      Recompute role analysis cluster (RoleAnalysisClusterType) parameters. This method should be called after migration to business role.
      Specified by:
      clusterObjectMigrationRecompute in interface RoleAnalysisService
      Parameters:
      clusterRefOid - The cluster OID.
      roleRefOid - The role OID.
      task - The task associated with this operation.
      result - The operation result.
    • updateClusterPatterns

      public void updateClusterPatterns(@NotNull @NotNull String clusterRefOid, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      This method is used to update the cluster detected patterns. Currently, it is used to update the cluster detected patterns after the migration task in the cluster.
      Specified by:
      updateClusterPatterns in interface RoleAnalysisService
      Parameters:
      clusterRefOid - The cluster OID.
      task - The task associated with this operation.
      result - The operation result.
    • setOpStatus

      public <T extends AssignmentHolderType & Objectable> void setOpStatus(@NotNull @NotNull PrismObject<T> object, @NotNull @NotNull String taskOid, OperationResultStatusType operationResultStatusType, String message, @NotNull @NotNull RoleAnalysisChannelMode channelMode, @NotNull @NotNull OperationResult result, @NotNull @NotNull Task task)
      Description copied from interface: RoleAnalysisService
      This method is used to update the cluster operation status.
      Specified by:
      setOpStatus in interface RoleAnalysisService
      Parameters:
      object - The assignment holder object.
      taskOid - The OID of the task.
      operationResultStatusType - The operation result status type.
      message - The message to set.
      channelMode - The channel mode.
      result - The operation result.
      task - The task associated with this operation.
    • isUnderActivity

      public <T extends AssignmentHolderType & Objectable> boolean isUnderActivity(@NotNull @NotNull PrismObject<T> object, @NotNull @NotNull RoleAnalysisChannelMode channelMode, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      This method is used to check if the role analysis object is under activity.
      Specified by:
      isUnderActivity in interface RoleAnalysisService
      Type Parameters:
      T - The assignment holder type.
      Parameters:
      object - The assignment holder object.
      channelMode - The channel mode.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The operation execution status.
    • resolveTaskObject

      @Nullable public @Nullable PrismObject<TaskType> resolveTaskObject(@NotNull @NotNull List<OperationExecutionType> operationExecution, @NotNull @NotNull RoleAnalysisChannelMode channelMode, @NotNull @NotNull Task task, @NotNull @NotNull OperationResult result)
      Description copied from interface: RoleAnalysisService
      This method is used to retrive the task object for specific roleAnalysisChannelMode.
      Specified by:
      resolveTaskObject in interface RoleAnalysisService
      Parameters:
      operationExecution - The operation execution list.
      channelMode - The channel mode.
      task - The task associated with this operation.
      result - The operation result.
      Returns:
      The task object.