Search in sources :

Example 1 with AccessCertificationResponseType

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

the class DefinitionBasicPanel method initBasicInfoLayout.

private void initBasicInfoLayout() {
    final TextField nameField = new TextField(ID_NAME, new PropertyModel<>(getModel(), CertDefinitionDto.F_NAME));
    nameField.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return true;
        }
    });
    add(nameField);
    final TextArea descriptionField = new TextArea(ID_DESCRIPTION, new PropertyModel<>(getModel(), CertDefinitionDto.F_DESCRIPTION));
    descriptionField.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return true;
        }
    });
    add(descriptionField);
    final WebMarkupContainer ownerRefChooser = createOwnerRefChooser(ID_OWNER_REF_CHOOSER);
    ownerRefChooser.setOutputMarkupId(true);
    add(ownerRefChooser);
    DropDownChoice remediation = new DropDownChoice<>(ID_REMEDIATION, new Model<AccessCertificationRemediationStyleType>() {

        @Override
        public AccessCertificationRemediationStyleType getObject() {
            return getModel().getObject().getRemediationStyle();
        }

        @Override
        public void setObject(AccessCertificationRemediationStyleType object) {
            getModel().getObject().setRemediationStyle(object);
        }
    }, WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationRemediationStyleType.class), new EnumChoiceRenderer<>(this));
    add(remediation);
    final TextField<String> automaticIterationAfterField = new TextField<>(ID_AUTOMATIC_ITERATION_AFTER, new PropertyModel<>(getModel(), CertDefinitionDto.F_AUTOMATIC_ITERATION_AFTER));
    add(automaticIterationAfterField);
    final TextField<Integer> automaticIterationLimitField = new TextField<>(ID_AUTOMATIC_ITERATION_LIMIT, new PropertyModel<>(getModel(), CertDefinitionDto.F_AUTOMATIC_ITERATION_LIMIT));
    automaticIterationLimitField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    add(automaticIterationLimitField);
    final TextField<Integer> overallIterationLimitField = new TextField<>(ID_OVERALL_ITERATION_LIMIT, new PropertyModel<>(getModel(), CertDefinitionDto.F_OVERALL_ITERATION_LIMIT));
    overallIterationLimitField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    add(overallIterationLimitField);
    DropDownChoice outcomeStrategy = new DropDownChoice<>(ID_OUTCOME_STRATEGY, new PropertyModel<>(getModel(), CertDefinitionDto.F_OUTCOME_STRATEGY), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationCaseOutcomeStrategyType.class), new EnumChoiceRenderer<>(this));
    add(outcomeStrategy);
    add(WebComponentUtil.createHelp(ID_OUTCOME_STRATEGY_HELP));
    Label stopReviewOn = new Label(ID_STOP_REVIEW_ON, new IModel<String>() {

        @Override
        public String getObject() {
            List<AccessCertificationResponseType> stopOn = getModel().getObject().getStopReviewOn();
            return CertMiscUtil.getStopReviewOnText(stopOn, getPageBase());
        }
    });
    add(stopReviewOn);
    // add(new Label(ID_REVIEW_STAGE_CAMPAIGNS, new PropertyModel<>(getModel(), CertDefinitionDto.F_NUMBER_OF_STAGES)));
    // add(new Label(ID_CAMPAIGNS_TOTAL, new PropertyModel<>(getModel(), CertDefinitionDto.F_NUMBER_OF_STAGES)));
    add(new Label(ID_LAST_STARTED, new PropertyModel<>(getModel(), CertDefinitionDto.F_LAST_STARTED)));
    add(new Label(ID_LAST_CLOSED, new PropertyModel<>(getModel(), CertDefinitionDto.F_LAST_CLOSED)));
    add(WebComponentUtil.createHelp(ID_LAST_STARTED_HELP));
    add(WebComponentUtil.createHelp(ID_LAST_CLOSED_HELP));
}
Also used : EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) Label(org.apache.wicket.markup.html.basic.Label) PropertyModel(org.apache.wicket.model.PropertyModel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AccessCertificationRemediationStyleType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationRemediationStyleType) AccessCertificationCaseOutcomeStrategyType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseOutcomeStrategyType) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 2 with AccessCertificationResponseType

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

the class DefinitionStagePanel method initLayout.

protected void initLayout(PageBase pageBase) {
    TextField nameField = new TextField<>(ID_NAME, new PropertyModel<>(getModel(), StageDefinitionDto.F_NAME));
    add(nameField);
    TextArea descriptionField = new TextArea<>(ID_DESCRIPTION, new PropertyModel<>(getModel(), StageDefinitionDto.F_DESCRIPTION));
    add(descriptionField);
    TextField durationField = new TextField<>(ID_DURATION, new PropertyModel<>(getModel(), StageDefinitionDto.F_DURATION));
    add(durationField);
    add(WebComponentUtil.createHelp(ID_STAGE_DURATION_HELP));
    TextField notifyBeforeDeadlineField = new TextField<>(ID_NOTIFY_BEFORE_DEADLINE, new PropertyModel<>(getModel(), StageDefinitionDto.F_NOTIFY_BEFORE_DEADLINE));
    add(notifyBeforeDeadlineField);
    add(WebComponentUtil.createHelp(ID_NOTIFY_BEFORE_DEADLINE_HELP));
    add(new CheckBox(ID_NOTIFY_ONLY_WHEN_NO_DECISION, new PropertyModel<>(getModel(), StageDefinitionDto.F_NOTIFY_ONLY_WHEN_NO_DECISION)));
    add(WebComponentUtil.createHelp(ID_NOTIFY_WHEN_NO_DECISION_HELP));
    TextField reviewerNameField = new TextField<>(ID_REVIEWER_NAME, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_NAME));
    add(reviewerNameField);
    TextArea reviewerDescriptionField = new TextArea<>(ID_REVIEWER_DESCRIPTION, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_DESCRIPTION));
    add(reviewerDescriptionField);
    add(new CheckBox(ID_USE_TARGET_OWNER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_TARGET_OWNER)));
    add(new CheckBox(ID_USE_TARGET_APPROVER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_TARGET_APPROVER)));
    add(WebComponentUtil.createHelp(ID_TARGET_HELP));
    add(new CheckBox(ID_USE_OBJECT_OWNER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_OWNER)));
    add(new CheckBox(ID_USE_OBJECT_APPROVER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_APPROVER)));
    add(WebComponentUtil.createHelp(ID_OBJECT_HELP));
    AjaxCheckBox useObjectManagerCheckbox = new AjaxCheckBox(ID_USE_OBJECT_MANAGER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER_PRESENT)) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(DefinitionStagePanel.this.get(ID_USE_OBJECT_MANAGER_DETAILS));
        }
    };
    add(useObjectManagerCheckbox);
    WebMarkupContainer useObjectManagerDetails = new WebMarkupContainer(ID_USE_OBJECT_MANAGER_DETAILS);
    useObjectManagerDetails.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return useObjectManagerCheckbox.getModelObject();
        }
    });
    useObjectManagerDetails.setOutputMarkupId(true);
    add(useObjectManagerDetails);
    add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_HELP));
    TextField orgTypeField = new TextField<>(ID_USE_OBJECT_MANAGER_ORG_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER + "." + ManagerSearchDto.F_ORG_TYPE));
    orgTypeField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    useObjectManagerDetails.add(orgTypeField);
    useObjectManagerDetails.add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_ORG_TYPE_HELP));
    CheckBox allowSelf = new CheckBox(ID_USE_OBJECT_MANAGER_ALLOW_SELF, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER + "." + ManagerSearchDto.F_ALLOW_SELF));
    allowSelf.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    useObjectManagerDetails.add(allowSelf);
    useObjectManagerDetails.add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_ALLOW_SELF_HELP));
    try {
        ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder().visibilityHandler(iw -> ItemVisibility.AUTO);
        Panel defaultOwnerRefPanel = pageBase.initItemPanel(ID_DEFAULT_REVIEWER_REF, ObjectReferenceType.COMPLEX_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_DEFAULT_REVIEWERS), builder.build());
        add(defaultOwnerRefPanel);
        add(WebComponentUtil.createHelp(ID_DEFAULT_REVIEWER_REF_HELP));
        Panel additionalOwnerRefPanel = pageBase.initItemPanel(ID_ADDITIONAL_REVIEWER_REF, ObjectReferenceType.COMPLEX_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_ADDITIONAL_REVIEWERS), builder.build());
        add(additionalOwnerRefPanel);
        add(WebComponentUtil.createHelp(ID_ADDITIONAL_REVIEWER_REF_HELP));
    } catch (SchemaException e) {
    }
    DropDownChoice outcomeStrategy1 = new DropDownChoice<>(ID_OUTCOME_STRATEGY, new PropertyModel<>(getModel(), StageDefinitionDto.F_OUTCOME_STRATEGY), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationCaseOutcomeStrategyType.class), new EnumChoiceRenderer<>(this));
    add(outcomeStrategy1);
    add(WebComponentUtil.createHelp(ID_OUTCOME_STRATEGY_HELP));
    DropDownChoice<AccessCertificationResponseType> outcomeIfNoReviewers = new DropDownChoice<>(ID_OUTCOME_IF_NO_REVIEWERS, new PropertyModel<>(getModel(), StageDefinitionDto.F_OUTCOME_IF_NO_REVIEWERS), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationResponseType.class), new EnumChoiceRenderer<>(this));
    add(outcomeIfNoReviewers);
    add(WebComponentUtil.createHelp(ID_OUTCOME_IF_NO_REVIEWERS_HELP));
    Label stopReviewOn = new Label(ID_STOP_REVIEW_ON, new IModel<String>() {

        @Override
        public String getObject() {
            List<AccessCertificationResponseType> stopOn = getModelObject().getStopReviewOn();
            return CertMiscUtil.getStopReviewOnText(stopOn, getPageBase());
        }
    });
    add(stopReviewOn);
    add(WebComponentUtil.createHelp(ID_STOP_REVIEW_ON_HELP));
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) TextArea(org.apache.wicket.markup.html.form.TextArea) PropertyModel(org.apache.wicket.model.PropertyModel) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) Label(org.apache.wicket.markup.html.basic.Label) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AccessCertificationResponseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationResponseType) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ItemPanelSettingsBuilder(com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder) ItemHeaderPanel(com.evolveum.midpoint.gui.impl.prism.panel.ItemHeaderPanel) Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) AccessCertificationCaseOutcomeStrategyType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseOutcomeStrategyType) CheckBox(org.apache.wicket.markup.html.form.CheckBox) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) TextField(org.apache.wicket.markup.html.form.TextField) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 3 with AccessCertificationResponseType

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

the class AccCertCaseOperationsHelper method recordDecision.

/**
 * Records a decision. Updates necessary items like the outcomes.
 */
void recordDecision(String campaignOid, long caseId, long workItemId, AccessCertificationResponseType response, String comment, Task task, OperationResult result) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException {
    AccessCertificationCaseType acase = queryHelper.getCase(campaignOid, caseId, task, result);
    if (acase == null) {
        throw new ObjectNotFoundException("Case " + caseId + " was not found in campaign " + campaignOid);
    }
    AccessCertificationCampaignType campaign = CertCampaignTypeUtil.getCampaign(acase);
    if (campaign == null) {
        throw new IllegalStateException("No owning campaign present in case " + acase);
    }
    AccessCertificationWorkItemType workItem = CertCampaignTypeUtil.findWorkItem(acase, workItemId);
    if (workItem == null) {
        throw new ObjectNotFoundException("Work item " + workItemId + " was not found in campaign " + toShortString(campaign) + ", case " + caseId);
    }
    ObjectReferenceType responderRef = ObjectTypeUtil.createObjectRef(securityContextManager.getPrincipal().getFocus(), prismContext);
    XMLGregorianCalendar now = clock.currentTimeXMLGregorianCalendar();
    ItemPath workItemPath = ItemPath.create(F_CASE, caseId, F_WORK_ITEM, workItemId);
    Collection<ItemDelta<?, ?>> deltaList = prismContext.deltaFor(AccessCertificationCampaignType.class).item(workItemPath.append(AccessCertificationWorkItemType.F_OUTPUT)).replace(new AbstractWorkItemOutputType().outcome(toUri(normalizeToNull(response))).comment(comment)).item(workItemPath.append(AccessCertificationWorkItemType.F_OUTPUT_CHANGE_TIMESTAMP)).replace(now).item(workItemPath.append(AccessCertificationWorkItemType.F_PERFORMER_REF)).replace(responderRef).asItemDeltas();
    // to have data for outcome computation
    ItemDeltaCollectionsUtil.applyTo(deltaList, campaign.asPrismContainerValue());
    AccessCertificationResponseType newCurrentOutcome = computationHelper.computeOutcomeForStage(acase, campaign, campaign.getStageNumber());
    AccessCertificationResponseType newOverallOutcome = computationHelper.computeOverallOutcome(acase, campaign, campaign.getStageNumber(), newCurrentOutcome);
    deltaList.addAll(prismContext.deltaFor(AccessCertificationCampaignType.class).item(F_CASE, caseId, F_CURRENT_STAGE_OUTCOME).replace(toUri(newCurrentOutcome)).item(F_CASE, caseId, F_OUTCOME).replace(toUri(newOverallOutcome)).asItemDeltas());
    updateHelper.modifyObjectPreAuthorized(AccessCertificationCampaignType.class, campaignOid, deltaList, task, result);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 4 with AccessCertificationResponseType

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

the class AccCertOpenerHelper method getDeltasToUpdateCases.

/**
 * Deltas to advance cases to next stage when opening it.
 */
private void getDeltasToUpdateCases(AccessCertificationCampaignType campaign, AccessCertificationStageType stage, ModificationsToExecute modifications, OpeningContext openingContext, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException {
    int stageToBe = stage.getNumber();
    int iteration = norm(campaign.getIteration());
    LOGGER.trace("Updating cases in {}; current stage = {}, stageToBe = {}, iteration = {}", toShortStringLazy(campaign), campaign.getStageNumber(), stageToBe, iteration);
    List<AccessCertificationCaseType> caseList = queryHelper.getAllCurrentIterationCases(campaign.getOid(), iteration, null, result);
    AccessCertificationReviewerSpecificationType reviewerSpec = reviewersHelper.findReviewersSpecification(campaign, stageToBe);
    LOGGER.trace("cases: {}, reviewerSpec: {}", caseList.size(), reviewerSpec);
    for (AccessCertificationCaseType aCase : caseList) {
        LOGGER.trace("----------------------------------------------------------------------------------------");
        LOGGER.trace("Considering case: {}", aCase);
        Long caseId = aCase.asPrismContainerValue().getId();
        assert caseId != null;
        if (aCase.getReviewFinishedTimestamp() != null) {
            LOGGER.trace("Case {} review process has already finished", caseId);
            continue;
        }
        AccessCertificationResponseType stageOutcome = computationHelper.getStageOutcome(aCase, stageToBe);
        if (OutcomeUtils.normalizeToNull(stageOutcome) != null) {
            LOGGER.trace("Case {} already has an outcome for stage {} - it will not be reviewed in this stage in iteration {}", caseId, stageToBe, iteration);
            continue;
        }
        List<ObjectReferenceType> reviewers = reviewersHelper.getReviewersForCase(aCase, campaign, reviewerSpec, task, result);
        List<AccessCertificationWorkItemType> workItems = createWorkItems(reviewers, stageToBe, iteration, aCase);
        openingContext.workItemsCreated += workItems.size();
        openingContext.casesEnteringStage++;
        aCase.getWorkItem().addAll(CloneUtil.cloneCollectionMembers(workItems));
        AccessCertificationResponseType currentStageOutcome = computationHelper.computeOutcomeForStage(aCase, campaign, stageToBe);
        AccessCertificationResponseType overallOutcome = computationHelper.computeOverallOutcome(aCase, campaign, stageToBe, currentStageOutcome);
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Computed: reviewers: {}, workItems: {}, currentStageOutcome: {}, overallOutcome: {}", PrettyPrinter.prettyPrint(reviewers), workItems.size(), currentStageOutcome, overallOutcome);
        }
        modifications.add(prismContext.deltaFor(AccessCertificationCampaignType.class).item(F_CASE, caseId, F_WORK_ITEM).add(PrismContainerValue.toPcvList(workItems)).item(F_CASE, caseId, F_CURRENT_STAGE_CREATE_TIMESTAMP).replace(stage.getStartTimestamp()).item(F_CASE, caseId, F_CURRENT_STAGE_DEADLINE).replace(stage.getDeadline()).item(F_CASE, caseId, F_CURRENT_STAGE_OUTCOME).replace(toUri(currentStageOutcome)).item(F_CASE, caseId, F_OUTCOME).replace(toUri(overallOutcome)).item(F_CASE, caseId, F_STAGE_NUMBER).replace(stageToBe).item(F_CASE, caseId, F_ITERATION).replace(iteration).asItemDeltas());
    }
    LOGGER.debug("Created {} deltas (in {} batches) to advance {} out of {} cases for campaign {}; work items created: {}", modifications.getTotalDeltasCount(), modifications.batches.size(), openingContext.casesEnteringStage, caseList.size(), toShortString(campaign), openingContext.workItemsCreated);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType)

Example 5 with AccessCertificationResponseType

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

the class AccCertOpenerHelper method getDeltasToCreateCases.

/**
 *  Creates certification cases (in the form of delta list) on first stage opening.
 */
private <F extends FocusType> void getDeltasToCreateCases(AccessCertificationCampaignType campaign, AccessCertificationStageType stage, CertificationHandler handler, ModificationsToExecute modifications, OpeningContext openingContext, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException {
    String campaignShortName = toShortString(campaign);
    AccessCertificationScopeType scope = campaign.getScopeDefinition();
    LOGGER.trace("Creating cases for scope {} in campaign {}", scope, campaignShortName);
    if (scope != null && !(scope instanceof AccessCertificationObjectBasedScopeType)) {
        throw new IllegalStateException("Unsupported access certification scope type: " + scope.getClass() + " for campaign " + campaignShortName);
    }
    AccessCertificationObjectBasedScopeType objectBasedScope = (AccessCertificationObjectBasedScopeType) scope;
    assertNoExistingCases(campaign, result);
    TypedObjectQuery<F> typedQuery = prepareObjectQuery(objectBasedScope, handler, campaignShortName);
    List<AccessCertificationCaseType> caseList = new ArrayList<>();
    // create certification cases by executing the query and caseExpression on its results
    // here the subclasses of this class come into play
    repositoryService.searchObjectsIterative(typedQuery.getObjectClass(), typedQuery.getObjectQuery(), (object, parentResult) -> {
        try {
            caseList.addAll(handler.createCasesForObject(object, campaign, task, parentResult));
        } catch (CommonException | RuntimeException e) {
            // TODO process the exception more intelligently
            throw new SystemException("Cannot create certification case for object " + toShortString(object.asObjectable()) + ": " + e.getMessage(), e);
        }
        return true;
    }, null, true, result);
    AccessCertificationReviewerSpecificationType reviewerSpec = reviewersHelper.findReviewersSpecification(campaign, 1);
    assert norm(campaign.getIteration()) == 1;
    for (AccessCertificationCaseType acase : caseList) {
        ContainerDelta<AccessCertificationCaseType> caseDelta = prismContext.deltaFactory().container().createDelta(F_CASE, AccessCertificationCampaignType.class);
        acase.setIteration(1);
        acase.setStageNumber(1);
        acase.setCurrentStageCreateTimestamp(stage.getStartTimestamp());
        acase.setCurrentStageDeadline(stage.getDeadline());
        List<ObjectReferenceType> reviewers = reviewersHelper.getReviewersForCase(acase, campaign, reviewerSpec, task, result);
        acase.getWorkItem().addAll(createWorkItems(reviewers, 1, 1, acase));
        openingContext.workItemsCreated += acase.getWorkItem().size();
        openingContext.casesEnteringStage++;
        AccessCertificationResponseType currentStageOutcome = computationHelper.computeOutcomeForStage(acase, campaign, 1);
        acase.setCurrentStageOutcome(toUri(currentStageOutcome));
        acase.setOutcome(toUri(computationHelper.computeOverallOutcome(acase, campaign, 1, currentStageOutcome)));
        @SuppressWarnings({ "raw", "unchecked" }) PrismContainerValue<AccessCertificationCaseType> caseCVal = acase.asPrismContainerValue();
        caseDelta.addValueToAdd(caseCVal);
        LOGGER.trace("Adding certification case:\n{}", caseCVal.debugDumpLazily());
        modifications.add(caseDelta);
    }
    LOGGER.trace("Created {} deltas (in {} batches) to create {} cases ({} work items) for campaign {}", modifications.getTotalDeltasCount(), modifications.batches.size(), caseList.size(), openingContext.workItemsCreated, campaignShortName);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) ObjectTypeUtil.toShortString(com.evolveum.midpoint.schema.util.ObjectTypeUtil.toShortString) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Aggregations

AccessCertificationCaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType)5 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)2 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)2 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)2 AccessCertificationCaseOutcomeStrategyType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseOutcomeStrategyType)2 AccessCertificationResponseType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationResponseType)2 List (java.util.List)2 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 Label (org.apache.wicket.markup.html.basic.Label)2 PropertyModel (org.apache.wicket.model.PropertyModel)2 DummyResource (com.evolveum.icf.dummy.resource.DummyResource)1 OutcomeUtils (com.evolveum.midpoint.certification.api.OutcomeUtils)1 com.evolveum.midpoint.certification.impl (com.evolveum.midpoint.certification.impl)1 BasePanel (com.evolveum.midpoint.gui.api.component.BasePanel)1 ItemHeaderPanel (com.evolveum.midpoint.gui.impl.prism.panel.ItemHeaderPanel)1 ItemPanelSettingsBuilder (com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder)1 AccessCertificationService (com.evolveum.midpoint.model.api.AccessCertificationService)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1