Search in sources :

Example 11 with AccessCertificationCampaignType

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

the class TestCriticalRolesCertification method test290CloseSecondStage.

@Test
public void test290CloseSecondStage() throws Exception {
    final String TEST_NAME = "test290CloseSecondStage";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestCriticalRolesCertification.class.getName() + "." + TEST_NAME);
    task.setOwner(userAdministrator.asPrismObject());
    OperationResult result = task.getResult();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    certificationManager.closeCurrentStage(campaignOid, 2, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
    display("campaign after closing stage 2", campaign);
    assertAfterStageClose(campaign, certificationDefinition, 2);
    List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
    assertEquals("wrong # of cases", 6, caseList.size());
    assertCaseOutcome(caseList, USER_ELAINE_OID, ROLE_CEO_OID, ACCEPT, ACCEPT, 2);
    assertCaseOutcome(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID, REVOKE, REVOKE, 2);
    assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID, ACCEPT, ACCEPT, 2);
    assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID, ACCEPT, ACCEPT, 2);
    assertCaseOutcome(caseList, USER_JACK_OID, ROLE_CEO_OID, NO_RESPONSE, NO_RESPONSE, 2);
    assertCaseOutcome(caseList, USER_JACK_OID, ROLE_CTO_OID, ACCEPT, ACCEPT, 2);
    assertPercentComplete(campaignOid, 83, 83, 80);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AccessCertificationCampaignType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType) Test(org.testng.annotations.Test)

Example 12 with AccessCertificationCampaignType

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

the class TestCriticalRolesCertification method test400OpenFourthStage.

@Test
public void test400OpenFourthStage() throws Exception {
    final String TEST_NAME = "test400OpenFourthStage";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestCriticalRolesCertification.class.getName() + "." + TEST_NAME);
    task.setOwner(userAdministrator.asPrismObject());
    OperationResult result = task.getResult();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    certificationManager.openNextStage(campaignOid, 4, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
    display("campaign in stage 4", campaign);
    assertAfterStageOpen(campaign, certificationDefinition, 4);
    List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
    assertEquals("Wrong number of certification cases", 6, caseList.size());
    AccessCertificationCaseType elaineCeoCase = findCase(caseList, USER_ELAINE_OID, ROLE_CEO_OID);
    AccessCertificationCaseType guybrushCooCase = findCase(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID);
    AccessCertificationCaseType administratorCooCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID);
    AccessCertificationCaseType administratorCeoCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID);
    AccessCertificationCaseType jackCeoCase = findCase(caseList, USER_JACK_OID, ROLE_CEO_OID);
    AccessCertificationCaseType jackCtoCase = findCase(caseList, USER_JACK_OID, ROLE_CTO_OID);
    /*
Stage4: allMustAccept

Overall: allMustAccept

owners: CEO: elaine, COO: administrator, CTO: none

Case                        Stage1              Stage2                           Stage3                                            Stage4
===============================================================================================================================================
elaine->CEO                 none (A) -> A       elaine A -> A             | A    elaine:null,administrator:ND -> ND  [STOP] | ND
guybrush->COO               cheese: A -> A      admin: RV -> RV   [STOP]  | RV
administrator->COO          none (A) -> A       admin: A -> A             | A    elaine:A,administrator:null -> A           | A    cheese
administrator->CEO          none (A) -> A       elaine: A -> A            | A    elaine:NR,administrator:NR -> NR           | NR   cheese
jack->CEO                   none (A) -> A       elaine: null -> NR [STOP] | NR
jack->CTO                   none (A) -> A       none (A) -> A             | A    elaine:null,administrator:null -> NR       | NR   cheese
         */
    assertCaseReviewers(elaineCeoCase, NOT_DECIDED, 3, Arrays.asList(USER_ELAINE_OID, USER_ADMINISTRATOR_OID));
    assertCaseReviewers(guybrushCooCase, REVOKE, 2, Collections.singletonList(USER_ADMINISTRATOR_OID));
    assertCaseReviewers(administratorCooCase, NO_RESPONSE, 4, Collections.singletonList(USER_CHEESE_OID));
    assertCaseReviewers(administratorCeoCase, NO_RESPONSE, 4, Collections.singletonList(USER_CHEESE_OID));
    assertCaseReviewers(jackCeoCase, NO_RESPONSE, 2, Collections.singletonList(USER_ELAINE_OID));
    assertCaseReviewers(jackCtoCase, NO_RESPONSE, 4, Collections.singletonList(USER_CHEESE_OID));
    assertCaseOutcome(caseList, USER_ELAINE_OID, ROLE_CEO_OID, NOT_DECIDED, NOT_DECIDED, null);
    assertCaseOutcome(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID, REVOKE, REVOKE, null);
    assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID, NO_RESPONSE, NO_RESPONSE, null);
    assertCaseOutcome(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID, NO_RESPONSE, NO_RESPONSE, null);
    assertCaseOutcome(caseList, USER_JACK_OID, ROLE_CEO_OID, NO_RESPONSE, NO_RESPONSE, null);
    assertCaseOutcome(caseList, USER_JACK_OID, ROLE_CTO_OID, NO_RESPONSE, NO_RESPONSE, null);
    assertPercentComplete(campaignOid, 50, 17, 0);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AccessCertificationCampaignType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType) Test(org.testng.annotations.Test)

Example 13 with AccessCertificationCampaignType

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

the class TestCriticalRolesCertification method test490CloseFourthStage.

@Test
public void test490CloseFourthStage() throws Exception {
    final String TEST_NAME = "test490CloseFourthStage";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestCriticalRolesCertification.class.getName() + "." + TEST_NAME);
    task.setOwner(userAdministrator.asPrismObject());
    OperationResult result = task.getResult();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    certificationManager.closeCurrentStage(campaignOid, 4, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    AccessCertificationCampaignType campaign = getCampaignWithCases(campaignOid);
    display("campaign after closing stage 4", campaign);
    assertAfterStageClose(campaign, certificationDefinition, 4);
    List<AccessCertificationCaseType> caseList = queryHelper.searchCases(campaignOid, null, null, result);
    assertEquals("wrong # of cases", 6, caseList.size());
    AccessCertificationCaseType elaineCeoCase = findCase(caseList, USER_ELAINE_OID, ROLE_CEO_OID);
    AccessCertificationCaseType guybrushCooCase = findCase(caseList, USER_GUYBRUSH_OID, ROLE_COO_OID);
    AccessCertificationCaseType administratorCooCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_COO_OID);
    AccessCertificationCaseType administratorCeoCase = findCase(caseList, USER_ADMINISTRATOR_OID, ROLE_CEO_OID);
    AccessCertificationCaseType jackCeoCase = findCase(caseList, USER_JACK_OID, ROLE_CEO_OID);
    AccessCertificationCaseType jackCtoCase = findCase(caseList, USER_JACK_OID, ROLE_CTO_OID);
    /*
Stage4: allMustAccept

Overall: allMustAccept

Case                        Stage1              Stage2                           Stage3                                            Stage4
===============================================================================================================================================
elaine->CEO                 none (A) -> A       elaine A -> A             | A    elaine:null,administrator:ND -> ND  [STOP] | ND
guybrush->COO               cheese: A -> A      admin: RV -> RV   [STOP]  | RV
administrator->COO          none (A) -> A       admin: A -> A             | A    elaine:A,administrator:null -> A           | A    cheese:A -> A | A
administrator->CEO          none (A) -> A       elaine: A -> A            | A    elaine:NR,administrator:NR -> NR           | NR   cheese:A -> A | NR
jack->CEO                   none (A) -> A       elaine: null -> NR [STOP] | NR
jack->CTO                   none (A) -> A       none (A) -> A             | A    elaine:null,administrator:null -> NR       | NR   cheese:NR -> NR | NR
*/
    assertCaseHistoricOutcomes(elaineCeoCase, ACCEPT, ACCEPT, NOT_DECIDED);
    assertCaseHistoricOutcomes(guybrushCooCase, ACCEPT, REVOKE);
    assertCaseHistoricOutcomes(administratorCooCase, ACCEPT, ACCEPT, ACCEPT, ACCEPT);
    assertCaseHistoricOutcomes(administratorCeoCase, ACCEPT, ACCEPT, NO_RESPONSE, ACCEPT);
    assertCaseHistoricOutcomes(jackCeoCase, ACCEPT, NO_RESPONSE);
    assertCaseHistoricOutcomes(jackCtoCase, ACCEPT, ACCEPT, NO_RESPONSE, NO_RESPONSE);
    assertPercentComplete(campaignOid, 83, 33, 67);
}
Also used : AccessCertificationCaseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType) Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AccessCertificationCampaignType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType) Test(org.testng.annotations.Test)

Example 14 with AccessCertificationCampaignType

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

the class PageCertDecisions method initColumns.

//	private void addVisibleOnWarningBehavior(Component c) {
//		c.add(new VisibleEnableBehaviour() {
//			@Override
//			public boolean isVisible() {
//				return PageCertDecisions.this.getFeedbackMessages().hasMessage(FeedbackMessage.WARNING);
//			}
//		});
//	}
private List<IColumn<CertWorkItemDto, String>> initColumns() {
    List<IColumn<CertWorkItemDto, String>> columns = new ArrayList<>();
    IColumn<CertWorkItemDto, String> column;
    column = new CheckBoxHeaderColumn<>();
    columns.add(column);
    column = helper.createTypeColumn(OBJECT, this);
    columns.add(column);
    column = helper.createObjectNameColumn(this, "PageCertDecisions.table.objectName");
    columns.add(column);
    column = helper.createTypeColumn(TARGET, this);
    columns.add(column);
    column = helper.createTargetNameColumn(this, "PageCertDecisions.table.targetName");
    columns.add(column);
    column = helper.createDetailedInfoColumn(this);
    columns.add(column);
    column = helper.createConflictingNameColumn(this, "PageCertDecisions.table.conflictingTargetName");
    columns.add(column);
    if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_CERTIFICATION_ALL_URL, AuthorizationConstants.AUTZ_UI_CERTIFICATION_CAMPAIGN_URL)) {
        column = new LinkColumn<CertWorkItemDto>(createStringResource("PageCertDecisions.table.campaignName"), SearchingUtils.CAMPAIGN_NAME, CertWorkItemDto.F_CAMPAIGN_NAME) {

            @Override
            public void populateItem(Item<ICellPopulator<CertWorkItemDto>> item, String componentId, IModel<CertWorkItemDto> rowModel) {
                super.populateItem(item, componentId, rowModel);
                AccessCertificationCampaignType campaign = rowModel.getObject().getCampaign();
                if (campaign != null && campaign.getDescription() != null) {
                    item.add(AttributeModifier.replace("title", campaign.getDescription()));
                    item.add(new TooltipBehavior());
                }
            }

            @Override
            public void onClick(AjaxRequestTarget target, IModel<CertWorkItemDto> rowModel) {
                CertWorkItemDto dto = rowModel.getObject();
                PageParameters parameters = new PageParameters();
                parameters.add(OnePageParameterEncoder.PARAMETER, dto.getCampaignRef().getOid());
                navigateToNext(PageCertCampaign.class, parameters);
            }
        };
    } else {
        column = new AbstractColumn<CertWorkItemDto, String>(createStringResource("PageCertDecisions.table.campaignName"), SearchingUtils.CAMPAIGN_NAME) {

            @Override
            public void populateItem(Item<ICellPopulator<CertWorkItemDto>> item, String componentId, final IModel<CertWorkItemDto> rowModel) {
                item.add(new Label(componentId, new AbstractReadOnlyModel<Object>() {

                    @Override
                    public Object getObject() {
                        return rowModel.getObject().getCampaignName();
                    }
                }));
            }
        };
    }
    columns.add(column);
    column = new AbstractColumn<CertWorkItemDto, String>(createStringResource("PageCertDecisions.table.campaignStage")) {

        @Override
        public void populateItem(Item<ICellPopulator<CertWorkItemDto>> item, String componentId, final IModel<CertWorkItemDto> rowModel) {
            item.add(new Label(componentId, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    CertWorkItemDto dto = rowModel.getObject();
                    return dto.getCampaignStageNumber() + "/" + dto.getCampaignStageCount();
                }
            }));
            String stageName = rowModel.getObject().getCurrentStageName();
            if (stageName != null) {
                item.add(AttributeModifier.replace("title", stageName));
                item.add(new TooltipBehavior());
            }
        }
    };
    columns.add(column);
    column = new AbstractColumn<CertWorkItemDto, String>(createStringResource("PageCertDecisions.table.escalation")) {

        @Override
        public void populateItem(Item<ICellPopulator<CertWorkItemDto>> item, String componentId, final IModel<CertWorkItemDto> rowModel) {
            item.add(new Label(componentId, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    CertWorkItemDto dto = rowModel.getObject();
                    Integer n = dto.getEscalationLevelNumber();
                    return n != null ? String.valueOf(n) : null;
                }
            }));
            String info = rowModel.getObject().getEscalationLevelInfo();
            if (info != null) {
                item.add(AttributeModifier.replace("title", info));
                item.add(new TooltipBehavior());
            }
        }
    };
    columns.add(column);
    column = new PropertyColumn<CertWorkItemDto, String>(createStringResource("PageCertDecisions.table.requested"), SearchingUtils.CURRENT_REVIEW_REQUESTED_TIMESTAMP, CertWorkItemDto.F_REVIEW_REQUESTED) {

        @Override
        public void populateItem(Item<ICellPopulator<CertWorkItemDto>> item, String componentId, IModel<CertWorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            CertWorkItemDto dto = rowModel.getObject();
            Date started = dto.getStageStarted();
            if (started != null) {
                item.add(AttributeModifier.replace("title", WebComponentUtil.getLocalizedDate(started, DateLabelComponent.LONG_MEDIUM_STYLE)));
                item.add(new TooltipBehavior());
            }
        }
    };
    columns.add(column);
    column = new PropertyColumn<CertWorkItemDto, String>(createStringResource("PageCertDecisions.table.deadline"), SearchingUtils.CURRENT_REVIEW_DEADLINE, CertWorkItemDto.F_DEADLINE_AS_STRING) {

        @Override
        public void populateItem(Item<ICellPopulator<CertWorkItemDto>> item, String componentId, final IModel<CertWorkItemDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            XMLGregorianCalendar deadline = rowModel.getObject().getCertCase().getCurrentStageDeadline();
            if (deadline != null) {
                item.add(AttributeModifier.replace("title", WebComponentUtil.formatDate(deadline)));
                item.add(new TooltipBehavior());
            }
        }
    };
    columns.add(column);
    final AvailableResponses availableResponses = new AvailableResponses(getPage());
    final int responses = availableResponses.getResponseKeys().size();
    column = new MultiButtonColumn<CertWorkItemDto>(new Model(), responses + 1) {

        @Override
        public String getCaption(int id) {
            return availableResponses.getCaption(id);
        }

        @Override
        public boolean isButtonEnabled(int id, IModel<CertWorkItemDto> model) {
            if (id < responses) {
                return !decisionEquals(model, availableResponses.getResponseValues().get(id));
            } else {
                return false;
            }
        }

        @Override
        public boolean isButtonVisible(int id, IModel<CertWorkItemDto> model) {
            if (id < responses) {
                return true;
            } else {
                return !availableResponses.isAvailable(model.getObject().getResponse());
            }
        }

        @Override
        public String getButtonColorCssClass(int id) {
            if (id < responses) {
                return getDecisionButtonColor(getRowModel(), availableResponses.getResponseValues().get(id));
            } else {
                return BUTTON_COLOR_CLASS.DANGER.toString();
            }
        }

        @Override
        public void clickPerformed(int id, AjaxRequestTarget target, IModel<CertWorkItemDto> model) {
            if (id < responses) {
                // should be always the case
                recordActionPerformed(target, model.getObject(), availableResponses.getResponseValues().get(id));
            }
        }
    };
    columns.add(column);
    column = new DirectlyEditablePropertyColumn<CertWorkItemDto>(createStringResource("PageCertDecisions.table.comment"), CertWorkItemDto.F_COMMENT) {

        @Override
        public void onBlur(AjaxRequestTarget target, IModel model) {
            // TODO determine somehow if the model.comment was really changed
            recordActionPerformed(target, (CertWorkItemDto) model.getObject(), null);
        }
    };
    columns.add(column);
    columns.add(new InlineMenuHeaderColumn(createInlineMenu(availableResponses)));
    return columns;
}
Also used : ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) AvailableResponses(com.evolveum.midpoint.web.page.admin.certification.helpers.AvailableResponses) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) CertWorkItemDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertWorkItemDto) AccessCertificationCampaignType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType) IModel(org.apache.wicket.model.IModel) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) Date(java.util.Date) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model)

Example 15 with AccessCertificationCampaignType

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

the class PageCertCampaigns method closeCampaignConfirmedPerformed.

private void closeCampaignConfirmedPerformed(AjaxRequestTarget target, CertCampaignListItemDto campaignDto) {
    AccessCertificationCampaignType campaign = campaignDto.getCampaign();
    LOGGER.debug("Close certification campaign performed for {}", campaign.asPrismObject());
    OperationResult result = new OperationResult(OPERATION_CLOSE_CAMPAIGN);
    try {
        AccessCertificationService acs = getCertificationService();
        Task task = createSimpleTask(OPERATION_CLOSE_CAMPAIGN);
        acs.closeCampaign(campaign.getOid(), task, result);
    } catch (Exception ex) {
        result.recordFatalError(ex);
    } finally {
        result.computeStatusIfUnknown();
    }
    showResult(result);
    target.add((Component) getCampaignsTable());
    target.add(getFeedbackPanel());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AccessCertificationService(com.evolveum.midpoint.model.api.AccessCertificationService) AccessCertificationCampaignType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType)

Aggregations

OperationResult (com.evolveum.midpoint.schema.result.OperationResult)31 AccessCertificationCampaignType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType)28 AccessCertificationCaseType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseType)27 Task (com.evolveum.midpoint.task.api.Task)22 Test (org.testng.annotations.Test)18 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)9 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)7 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)6 AccessCertificationCampaignStateType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignStateType)5 Date (java.util.Date)5 CertificationHandler (com.evolveum.midpoint.certification.impl.handlers.CertificationHandler)4 ObjectTypeUtil.toShortString (com.evolveum.midpoint.schema.util.ObjectTypeUtil.toShortString)4 AccessCertificationWorkItemType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationWorkItemType)4 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)3 PrismContext (com.evolveum.midpoint.prism.PrismContext)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 DeltaBuilder (com.evolveum.midpoint.prism.delta.builder.DeltaBuilder)3 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)3 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)3