protected String getLocalizedTypeName(QName typeQName, PageBase page) { String targetTypeKey = ObjectTypeGuiDescriptor.getDescriptor(ObjectTypes.getObjectTypeFromTypeQName(typeQName)) .getLocalizationKey(); return page.createStringResource(targetTypeKey).getString(); }
@Override public String getCaseInfoButtonTitle( IModel<? extends CertCaseOrDecisionDto> rowModel, PageBase page) { CertCaseOrDecisionDto dto = rowModel.getObject(); AccessCertificationCaseType _case = dto.getCertCase(); if (!(_case instanceof AccessCertificationAssignmentCaseType)) { return null; // should not occur, TODO treat gracefully } AccessCertificationAssignmentCaseType assignmentCase = (AccessCertificationAssignmentCaseType) _case; AssignmentType assignment = assignmentCase.getAssignment(); List<String> infoList = new ArrayList<>(); String assignmentOrInducement; if (Boolean.TRUE.equals(assignmentCase.isIsInducement())) { assignmentOrInducement = page.createStringResource("PageCert.message.textInducement").getString(); } else { assignmentOrInducement = page.createStringResource("PageCert.message.textAssignment").getString(); } String targetType = getLocalizedTypeName(_case.getTargetRef().getType(), page); String targetName = dto.getTargetName(); String objectType = getLocalizedTypeName(_case.getObjectRef().getType(), page); String objectName = dto.getObjectName(); infoList.add( page.createStringResource( "PageCert.message.assignment", assignmentOrInducement, emptyToDash(targetType), emptyToDash(targetName), emptyToDash(objectType), emptyToDash(objectName)) .getString()); if (StringUtils.isNotEmpty(assignment.getDescription())) { infoList.add( page.createStringResource("PageCert.message.textDescription", assignment.getDescription()) .getString()); } if (assignment.getOrder() != null) { infoList.add( page.createStringResource("PageCert.message.textOrder", assignment.getOrder()) .getString()); } if (assignment.getConstruction() != null) { if (assignment.getConstruction().getKind() != null) { infoList.add( page.createStringResource( "PageCert.message.textKind", page.createStringResource(assignment.getConstruction().getKind()).getString()) .getString()); } if (assignment.getConstruction().getIntent() != null) { infoList.add( page.createStringResource( "PageCert.message.textIntent", assignment.getConstruction().getIntent()) .getString()); } } if (_case.getTargetRef().getRelation() != null) { infoList.add( page.createStringResource( "PageCert.message.textRelation", _case.getTargetRef().getRelation().getLocalPart()) .getString()); } Task task = page.createSimpleTask("dummy"); if (assignment.getOrgRef() != null) { String orgName = WebModelServiceUtils.resolveReferenceName( assignment.getOrgRef(), page, task, task.getResult()); infoList.add(page.createStringResource("PageCert.message.textOrg", orgName).getString()); } if (assignment.getTenantRef() != null) { String tenantName = WebModelServiceUtils.resolveReferenceName( assignment.getTenantRef(), page, task, task.getResult()); infoList.add( page.createStringResource("PageCert.message.textTenant", tenantName).getString()); } PrismContainer<? extends Containerable> extensionContainer = assignment.asPrismContainerValue().findContainer(AssignmentType.F_EXTENSION); if (extensionContainer != null && !extensionContainer.isEmpty()) { List<String> extensionItemNameList = new ArrayList<>(); for (Item extensionItem : extensionContainer.getValue().getItems()) { extensionItemNameList.add(extensionItem.getElementName().getLocalPart()); } infoList.add( page.createStringResource( "PageCert.message.textExtensions", StringUtils.join(extensionItemNameList, ", ")) .getString()); } if (assignment.getActivation() != null) { String validFrom = WebComponentUtil.formatDate(assignment.getActivation().getValidFrom()); if (validFrom != null) { infoList.add( page.createStringResource("PageCert.message.textValidFrom", validFrom).getString()); } String validTo = WebComponentUtil.formatDate(assignment.getActivation().getValidTo()); if (validTo != null) { infoList.add( page.createStringResource("PageCert.message.textValidTo", validTo).getString()); } if (assignment.getActivation().getAdministrativeStatus() != null) { infoList.add( page.createStringResource( "PageCert.message.textAdministrativeState", page.createStringResource(assignment.getActivation().getAdministrativeStatus()) .getString()) .getString()); } } String rv = StringUtils.join(infoList, "<br/>"); return rv; }
protected void populateCell( WebMarkupContainer cellContainer, final AssignmentEditorDto assignment) { AjaxLink inner = new AjaxLink(ID_INNER) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget ajaxRequestTarget) { assignmentDetailsPerformed(assignment, ajaxRequestTarget); } }; cellContainer.add(inner); Label nameLabel = new Label(ID_INNER_LABEL, assignment.getName()); inner.add(nameLabel); AjaxLink detailsLink = new AjaxLink(ID_DETAILS_LINK) { @Override public void onClick(AjaxRequestTarget ajaxRequestTarget) { assignmentDetailsPerformed(assignment, ajaxRequestTarget); } }; cellContainer.add(detailsLink); Label detailsLinkLabel = new Label( ID_DETAILS_LINK_LABEL, pageBase.createStringResource("MultiButtonPanel.detailsLink")); detailsLinkLabel.setRenderBodyOnly(true); detailsLink.add(detailsLinkLabel); AjaxLink detailsLinkIcon = new AjaxLink(ID_DETAILS_LINK_ICON) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) {} }; detailsLink.add(detailsLinkIcon); AjaxLink addToCartLink = new AjaxLink(ID_ADD_TO_CART_LINK) { @Override public void onClick(AjaxRequestTarget ajaxRequestTarget) { addAssignmentPerformed(assignment, ajaxRequestTarget); } }; cellContainer.add(addToCartLink); AjaxLink addToCartLinkIcon = new AjaxLink(ID_ADD_TO_CART_LINK_ICON) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) {} }; addToCartLink.add(addToCartLinkIcon); WebMarkupContainer icon = new WebMarkupContainer(ID_TYPE_ICON); icon.add(new AttributeAppender("class", getIconClass(assignment.getType()))); cellContainer.add(icon); }