use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationAssignmentCaseType in project midpoint by Evolveum.
the class TestParseCertificationCase method assertJaxb.
private void assertJaxb(AccessCertificationCaseType aCase) throws SchemaException {
PrismAsserts.assertRefEquivalent("Wrong objectRef", new PrismReferenceValue("ee53eba7-5c16-4c16-ad15-dd6a2360ab1a", UserType.COMPLEX_TYPE), aCase.getObjectRef().asReferenceValue());
PrismAsserts.assertRefEquivalent("Wrong targetRef", new PrismReferenceValue("ef2bc95b-76e0-48e2-86d6-3d4f02d3e1a2", ResourceType.COMPLEX_TYPE), aCase.getTargetRef().asReferenceValue());
assertTrue(aCase instanceof AccessCertificationAssignmentCaseType);
AccessCertificationAssignmentCaseType assignmentCase = (AccessCertificationAssignmentCaseType) aCase;
assertNotNull("no assignment", assignmentCase.getAssignment());
assertEquals((Long) 1L, assignmentCase.getAssignment().getId());
PrismAsserts.assertRefEquivalent("Wrong resourceRef in assignment", new PrismReferenceValue("ef2bc95b-76e0-48e2-86d6-3d4f02d3e1a2", ResourceType.COMPLEX_TYPE), assignmentCase.getAssignment().getConstruction().getResourceRef().asReferenceValue());
assertEquals("wrong isInducement", Boolean.FALSE, assignmentCase.isIsInducement());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationAssignmentCaseType in project midpoint by Evolveum.
the class DirectAssignmentCertGuiHandler method getCaseInfoButtonTitle.
@Override
public String getCaseInfoButtonTitle(IModel<? extends CertCaseOrWorkItemDto> rowModel, PageBase page) {
CertCaseOrWorkItemDto dto = rowModel.getObject();
AccessCertificationCaseType _case = dto.getCertCase();
if (!(_case instanceof AccessCertificationAssignmentCaseType)) {
// should not occur, TODO treat gracefully
return null;
}
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;
}
Aggregations