Search in sources :

Example 1 with AssignmentPolicyEnforcementType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType in project midpoint by Evolveum.

the class SystemConfigurationDto method getNewObject.

public SystemConfigurationType getNewObject() throws DatatypeConfigurationException {
    SystemConfigurationType newObject = oldObject.clone();
    if (StringUtils.isNotBlank(getPassPolicyDto().getOid())) {
        ObjectReferenceType globalPassPolicyRef = ObjectTypeUtil.createObjectRef(getPassPolicyDto().getOid(), ObjectTypes.PASSWORD_POLICY);
        newObject.setGlobalPasswordPolicyRef(globalPassPolicyRef);
    } else {
        newObject.setGlobalPasswordPolicyRef(null);
    }
    if (StringUtils.isNotBlank(getSecurityPolicyDto().getOid())) {
        ObjectReferenceType globalSecurityPolicyRef = ObjectTypeUtil.createObjectRef(getSecurityPolicyDto().getOid(), WebComponentUtil.createPolyFromOrigString(getSecurityPolicyDto().getName()), ObjectTypes.SECURITY_POLICY);
        newObject.setGlobalSecurityPolicyRef(globalSecurityPolicyRef);
    } else {
        newObject.setGlobalSecurityPolicyRef(null);
    }
    AssignmentPolicyEnforcementType globalAEP = AEPlevel.toAEPValueType(getAepLevel());
    if (globalAEP != null) {
        ProjectionPolicyType projectionPolicy = new ProjectionPolicyType();
        projectionPolicy.setAssignmentPolicyEnforcement(globalAEP);
        newObject.setGlobalAccountSynchronizationSettings(projectionPolicy);
    }
    Duration auditCleanupDuration = DatatypeFactory.newInstance().newDuration(getAuditCleanupValue());
    Duration cleanupTaskDuration = DatatypeFactory.newInstance().newDuration(getTaskCleanupValue());
    CleanupPolicyType auditCleanup = new CleanupPolicyType();
    CleanupPolicyType taskCleanup = new CleanupPolicyType();
    auditCleanup.setMaxAge(auditCleanupDuration);
    taskCleanup.setMaxAge(cleanupTaskDuration);
    CleanupPoliciesType cleanupPolicies = new CleanupPoliciesType();
    cleanupPolicies.setAuditRecords(auditCleanup);
    cleanupPolicies.setClosedTasks(taskCleanup);
    newObject.setCleanupPolicy(cleanupPolicies);
    SystemConfigurationTypeUtil.setEnableExperimentalCode(newObject, getEnableExperimentalCode());
    newObject.setLogging(loggingConfig.getNewObject());
    newObject.setNotificationConfiguration(notificationConfig.getNewObject(newObject));
    newObject.setProfilingConfiguration(profilingDto.getNewObject());
    ClassLoggerConfigurationType profilingClassLogger = profilingDto.getProfilingClassLogerConfig();
    if (newObject.getLogging() != null) {
        newObject.getLogging().getClassLogger().add(profilingClassLogger);
    } else {
        LoggingConfigurationType profLogging = new LoggingConfigurationType();
        profLogging.getClassLogger().add(profilingClassLogger);
        newObject.setLogging(profLogging);
    }
    return newObject;
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) CleanupPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPolicyType) LoggingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType) AssignmentPolicyEnforcementType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType) CleanupPoliciesType(com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPoliciesType) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) Duration(javax.xml.datatype.Duration) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) ProjectionPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType)

Example 2 with AssignmentPolicyEnforcementType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType in project midpoint by Evolveum.

the class SystemConfigurationDto method init.

private void init(SystemConfigurationType config) {
    if (config == null) {
        return;
    }
    if (config.getGlobalAccountSynchronizationSettings() != null) {
        AssignmentPolicyEnforcementType globalAEP = config.getGlobalAccountSynchronizationSettings().getAssignmentPolicyEnforcement();
        aepLevel = AEPlevel.fromAEPLevelType(globalAEP);
    }
    CleanupPolicyType auditCleanup = config.getCleanupPolicy().getAuditRecords();
    CleanupPolicyType taskCleanup = config.getCleanupPolicy().getClosedTasks();
    auditCleanupValue = auditCleanup.getMaxAge().toString();
    taskCleanupValue = taskCleanup.getMaxAge().toString();
    passPolicyDto = loadPasswordPolicy(config);
    securityPolicyDto = loadSecurityPolicy(config);
    objectPolicyList = new ArrayList<>();
    List<ObjectPolicyConfigurationType> objectPolicies = config.getDefaultObjectPolicyConfiguration();
    if (objectPolicies != null && !objectPolicies.isEmpty()) {
        for (ObjectPolicyConfigurationType policy : objectPolicies) {
            objectPolicyList.add(new ObjectPolicyConfigurationTypeDto(policy));
        }
    } else {
        objectPolicyList.add(new ObjectPolicyConfigurationTypeDto());
    }
    // NOTIFICATIONS
    if (config.getNotificationConfiguration() != null) {
        notificationConfig = new NotificationConfigurationDto(config.getNotificationConfiguration());
    } else {
        notificationConfig = new NotificationConfigurationDto();
    }
    // LOGGING
    LoggingConfigurationType logging = config.getLogging();
    if (logging != null) {
        for (AppenderConfigurationType appender : logging.getAppender()) {
            if (appender instanceof FileAppenderConfigurationType) {
                appenders.add(new FileAppenderConfig((FileAppenderConfigurationType) appender));
            } else {
                appenders.add(new AppenderConfiguration(appender));
            }
        }
        Collections.sort(appenders);
        loggingConfig = new LoggingDto(config.getLogging());
    } else {
        loggingConfig = new LoggingDto();
    }
    loggingConfig.setAppenders(appenders);
    // PROFILING
    if (config.getProfilingConfiguration() != null) {
        List<ClassLoggerConfigurationType> classLoggerConfig = config.getLogging() != null ? config.getLogging().getClassLogger() : null;
        profilingDto = new ProfilingDto(config.getProfilingConfiguration(), classLoggerConfig);
    } else {
        profilingDto = new ProfilingDto();
    }
    profilingDto.setAppenders(appenders);
    enableExperimentalCode = SystemConfigurationTypeUtil.isExperimentalCodeEnabled(config);
    userDashboardLink = loadUserDashboardLink(config);
    additionalMenuLink = loadAdditionalMenuItem(config);
}
Also used : CleanupPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPolicyType) AssignmentPolicyEnforcementType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType) ClassLoggerConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType) FileAppenderConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.FileAppenderConfigurationType) FileAppenderConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.FileAppenderConfigurationType) AppenderConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.AppenderConfigurationType) ObjectPolicyConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectPolicyConfigurationType) LoggingConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType)

Example 3 with AssignmentPolicyEnforcementType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType in project midpoint by Evolveum.

the class TestSanity method assertSyncSettingsAssignmentPolicyEnforcement.

private void assertSyncSettingsAssignmentPolicyEnforcement(AssignmentPolicyEnforcementType assignmentPolicy) throws ObjectNotFoundException, SchemaException {
    OperationResult result = new OperationResult("Asserting sync settings");
    PrismObject<SystemConfigurationType> systemConfigurationType = repositoryService.getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, result);
    result.computeStatus();
    TestUtil.assertSuccess("Asserting sync settings failed (result)", result);
    ProjectionPolicyType globalAccountSynchronizationSettings = systemConfigurationType.asObjectable().getGlobalAccountSynchronizationSettings();
    assertNotNull("globalAccountSynchronizationSettings is null", globalAccountSynchronizationSettings);
    AssignmentPolicyEnforcementType assignmentPolicyEnforcement = globalAccountSynchronizationSettings.getAssignmentPolicyEnforcement();
    assertNotNull("assignmentPolicyEnforcement is null", assignmentPolicyEnforcement);
    assertEquals("Assignment policy mismatch", assignmentPolicy, assignmentPolicyEnforcement);
}
Also used : AssignmentPolicyEnforcementType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) ProjectionPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType)

Example 4 with AssignmentPolicyEnforcementType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType in project midpoint by Evolveum.

the class TestSanityLegacy method assertSyncSettingsAssignmentPolicyEnforcement.

private void assertSyncSettingsAssignmentPolicyEnforcement(AssignmentPolicyEnforcementType assignmentPolicy) throws ObjectNotFoundException, SchemaException {
    OperationResult result = new OperationResult("Asserting sync settings");
    PrismObject<SystemConfigurationType> systemConfigurationType = repositoryService.getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, result);
    result.computeStatus();
    TestUtil.assertSuccess("Asserting sync settings failed (result)", result);
    ProjectionPolicyType globalAccountSynchronizationSettings = systemConfigurationType.asObjectable().getGlobalAccountSynchronizationSettings();
    assertNotNull("globalAccountSynchronizationSettings is null", globalAccountSynchronizationSettings);
    AssignmentPolicyEnforcementType assignmentPolicyEnforcement = globalAccountSynchronizationSettings.getAssignmentPolicyEnforcement();
    assertNotNull("assignmentPolicyEnforcement is null", assignmentPolicyEnforcement);
    assertEquals("Assignment policy mismatch", assignmentPolicy, assignmentPolicyEnforcement);
}
Also used : AssignmentPolicyEnforcementType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SystemConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType) ProjectionPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType)

Aggregations

AssignmentPolicyEnforcementType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType)4 ProjectionPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType)3 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 ClassLoggerConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ClassLoggerConfigurationType)2 CleanupPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPolicyType)2 LoggingConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.LoggingConfigurationType)2 AppenderConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.AppenderConfigurationType)1 CleanupPoliciesType (com.evolveum.midpoint.xml.ns._public.common.common_3.CleanupPoliciesType)1 FileAppenderConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.FileAppenderConfigurationType)1 ObjectPolicyConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectPolicyConfigurationType)1 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)1 Duration (javax.xml.datatype.Duration)1