Search in sources :

Example 1 with CertCampaignDto

use of com.evolveum.midpoint.web.page.admin.certification.dto.CertCampaignDto in project midpoint by Evolveum.

the class PageCertCampaign method loadCampaign.

@NotNull
private CertCampaignDto loadCampaign() {
    // todo
    Task task = createSimpleTask("dummy");
    OperationResult result = task.getResult();
    AccessCertificationCampaignType campaign = null;
    try {
        PrismObject<AccessCertificationCampaignType> campaignObject = WebModelServiceUtils.loadObject(AccessCertificationCampaignType.class, campaignOid, PageCertCampaign.this, task, result);
        if (campaignObject != null) {
            campaign = campaignObject.asObjectable();
        }
        result.recordSuccessIfUnknown();
    } catch (Exception ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't get campaign", ex);
        result.recordFatalError("Couldn't get campaign.", ex);
    }
    result.recomputeStatus();
    if (!WebComponentUtil.isSuccessOrHandledError(result)) {
        showResult(result);
    }
    if (campaign != null) {
        return new CertCampaignDto(campaign, this, task, result);
    } else {
        throw redirectBackViaRestartResponseException();
    }
}
Also used : Task(com.evolveum.midpoint.task.api.Task) CertCampaignDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCampaignDto) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with CertCampaignDto

use of com.evolveum.midpoint.web.page.admin.certification.dto.CertCampaignDto in project midpoint by Evolveum.

the class PageCertCampaign method initBasicInfoLayout.

private void initBasicInfoLayout(Form mainForm) {
    mainForm.add(new Label(ID_CAMPAIGN_NAME, new PropertyModel<>(campaignModel, CertCampaignDto.F_NAME)));
    mainForm.add(new Label(ID_CAMPAIGN_DESCRIPTION, new PropertyModel<>(campaignModel, CertCampaignDto.F_DESCRIPTION)));
    mainForm.add(new Label(ID_CAMPAIGN_OWNER, new PropertyModel<>(campaignModel, CertCampaignDto.F_OWNER_NAME)));
    mainForm.add(new Label(ID_CAMPAIGN_NUMBER_OF_STAGES, new PropertyModel<>(campaignModel, CertCampaignDto.F_NUMBER_OF_STAGES)));
    mainForm.add(new Label(ID_CAMPAIGN_CURRENT_STATE, new PropertyModel<>(campaignModel, CertCampaignDto.F_CURRENT_STATE)));
    mainForm.add(new Label(ID_CAMPAIGN_TIME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            CertCampaignDto dto = campaignModel.getObject();
            return formatDuration(dto.getCampaignStart(), dto.getCampaignEnd());
        }
    }));
    mainForm.add(new Label(ID_STAGE_TIME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            CertCampaignDto dto = campaignModel.getObject();
            return formatStageDuration(dto.getStageStart(), dto.getStageDeadline(), dto.getStageEnd());
        }
    }));
    WebMarkupContainer escalationLevelInfoContainer = new WebMarkupContainer(ID_ESCALATION_LEVEL_INFO_CONTAINER);
    mainForm.add(escalationLevelInfoContainer);
    escalationLevelInfoContainer.add(new Label(ID_ESCALATION_LEVEL_INFO, new PropertyModel<String>(campaignModel, CertCampaignDto.F_ESCALATION_LEVEL_INFO)));
    escalationLevelInfoContainer.add(new VisibleBehaviour(() -> campaignModel.getObject().getEscalationLevelInfo() != null));
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Label(org.apache.wicket.markup.html.basic.Label) PropertyModel(org.apache.wicket.model.PropertyModel) CertCampaignDto(com.evolveum.midpoint.web.page.admin.certification.dto.CertCampaignDto) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

CertCampaignDto (com.evolveum.midpoint.web.page.admin.certification.dto.CertCampaignDto)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Task (com.evolveum.midpoint.task.api.Task)1 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 Label (org.apache.wicket.markup.html.basic.Label)1 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)1 PropertyModel (org.apache.wicket.model.PropertyModel)1 NotNull (org.jetbrains.annotations.NotNull)1