use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.
the class QAssignmentMapping method insert.
// about duplication see the comment in QObjectMapping.toRowObjectWithoutFullObject
@SuppressWarnings("DuplicatedCode")
@Override
public MAssignment insert(AssignmentType assignment, OR ownerRow, JdbcSession jdbcSession) {
MAssignment row = initRowObject(assignment, ownerRow);
row.lifecycleState = assignment.getLifecycleState();
row.orderValue = assignment.getOrder();
setReference(assignment.getOrgRef(), o -> row.orgRefTargetOid = o, t -> row.orgRefTargetType = t, r -> row.orgRefRelationId = r);
setReference(assignment.getTargetRef(), o -> row.targetRefTargetOid = o, t -> row.targetRefTargetType = t, r -> row.targetRefRelationId = r);
setReference(assignment.getTenantRef(), o -> row.tenantRefTargetOid = o, t -> row.tenantRefTargetType = t, r -> row.tenantRefRelationId = r);
row.policySituations = processCacheableUris(assignment.getPolicySituation());
row.subtypes = stringsToArray(assignment.getSubtype());
row.ext = processExtensions(assignment.getExtension(), MExtItemHolderType.EXTENSION);
ConstructionType construction = assignment.getConstruction();
if (construction != null) {
setReference(construction.getResourceRef(), o -> row.resourceRefTargetOid = o, t -> row.resourceRefTargetType = t, r -> row.resourceRefRelationId = r);
}
ActivationType activation = assignment.getActivation();
if (activation != null) {
row.administrativeStatus = activation.getAdministrativeStatus();
row.effectiveStatus = activation.getEffectiveStatus();
row.enableTimestamp = MiscUtil.asInstant(activation.getEnableTimestamp());
row.disableTimestamp = MiscUtil.asInstant(activation.getDisableTimestamp());
row.disableReason = activation.getDisableReason();
row.validityStatus = activation.getValidityStatus();
row.validFrom = MiscUtil.asInstant(activation.getValidFrom());
row.validTo = MiscUtil.asInstant(activation.getValidTo());
row.validityChangeTimestamp = MiscUtil.asInstant(activation.getValidityChangeTimestamp());
row.archiveTimestamp = MiscUtil.asInstant(activation.getArchiveTimestamp());
}
MetadataType metadata = assignment.getMetadata();
if (metadata != null) {
setReference(metadata.getCreatorRef(), o -> row.creatorRefTargetOid = o, t -> row.creatorRefTargetType = t, r -> row.creatorRefRelationId = r);
row.createChannelId = processCacheableUri(metadata.getCreateChannel());
row.createTimestamp = MiscUtil.asInstant(metadata.getCreateTimestamp());
setReference(metadata.getModifierRef(), o -> row.modifierRefTargetOid = o, t -> row.modifierRefTargetType = t, r -> row.modifierRefRelationId = r);
row.modifyChannelId = processCacheableUri(metadata.getModifyChannel());
row.modifyTimestamp = MiscUtil.asInstant(metadata.getModifyTimestamp());
}
// insert before treating sub-entities
insert(row, jdbcSession);
if (metadata != null) {
storeRefs(row, metadata.getCreateApproverRef(), QAssignmentReferenceMapping.getForAssignmentCreateApprover(), jdbcSession);
storeRefs(row, metadata.getModifyApproverRef(), QAssignmentReferenceMapping.getForAssignmentModifyApprover(), jdbcSession);
}
return row;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.
the class SqaleRepoAddDeleteObjectTest method test842AccessCertificationCampaign.
@Test
public void test842AccessCertificationCampaign() throws Exception {
OperationResult result = createOperationResult();
given("access certification campaign");
String objectName = "acc" + getTestNumber();
UUID definitionRefOid = UUID.randomUUID();
QName definitionRefRelationUri = QName.valueOf("{https://some.uri}definition-relation");
UUID ownerRefOid = UUID.randomUUID();
QName ownerRefRelationUri = QName.valueOf("{https://strange.uri}owner-relation");
Instant startTimestamp = Instant.ofEpochMilli(1234);
Instant validFrom = Instant.ofEpochMilli(444000);
Instant validityChangeTimestamp = Instant.ofEpochMilli(444001);
Instant case1CurrentStageCreateTimestamp = Instant.ofEpochMilli(444333);
Instant case2CurrentStageCreateTimestamp = Instant.ofEpochMilli(2444333);
Instant remediedTimestamp = Instant.ofEpochMilli(444555);
Instant currentStageDeadline = Instant.ofEpochMilli(444666);
Instant validTo = Instant.ofEpochMilli(999000);
Instant enableTimestamp = Instant.ofEpochMilli(555000);
Instant disableTimestamp = Instant.ofEpochMilli(555111);
Instant archiveTimestamp = Instant.ofEpochMilli(555123);
Instant endTimestamp = Instant.ofEpochMilli(System.currentTimeMillis());
String disableReason = "Whatever!";
String case1CurrentStageOutcome = "Bada BOOM";
String case2CurrentStageOutcome = "Big bada BOOM";
Integer case1Iteration = 5;
Integer case2Iteration = 15;
UUID caseObjectRefOid = UUID.randomUUID();
QName caseObjectRefRelationUri = QName.valueOf("{https://other.uri}case-object-ref-relation");
UUID caseOrgRefOid = UUID.randomUUID();
QName caseOrgRefRelationUri = QName.valueOf("{https://other.uri}case-org-ref-relation");
String caseOutcome = "... for ever and ever";
int caseStageNumber = 8;
UUID caseTargetRefOid = UUID.randomUUID();
QName caseTargetRefRelationUri = QName.valueOf("{https://some.uri}case-target-ref-relation");
UUID caseTenantRefOid = UUID.randomUUID();
QName caseTenantRefRelationUri = QName.valueOf("{https://some.uri}case-tenant-ref-relation");
Instant wi1CloseTimestamp = Instant.ofEpochMilli(999123);
Instant wi2CloseTimestamp = Instant.ofEpochMilli(2999123);
Instant wi3CloseTimestamp = Instant.ofEpochMilli(3999123);
Instant wi1OutputChangeTimestamp = Instant.ofEpochMilli(999001);
Instant wi2OutputChangeTimestamp = Instant.ofEpochMilli(2999001);
Instant wi3OutputChangeTimestamp = Instant.ofEpochMilli(3999001);
UUID performer1Oid = UUID.randomUUID();
QName performer1Relation = QName.valueOf("{https://random.org/ns}wi-performer1-rel");
UUID performer2Oid = UUID.randomUUID();
QName performer2Relation = QName.valueOf("{https://random.org/ns}wi-performer2-rel");
UUID performer3Oid = UUID.randomUUID();
QName performer3Relation = QName.valueOf("{https://random.org/ns}wi-performer3-rel");
// explicit UUID, to ensure ordering
UUID wi1AssigneeRef1Oid = UUID.fromString("7508a482-d8d1-11eb-9435-9b077bcc684b");
QName wi1AssigneeRef1Relation = QName.valueOf("{https://random.org/ns}acwi-1-assignee-1-rel");
// explicit UUID, to ensure ordering
UUID wi1AssigneeRef2Oid = UUID.fromString("77267d0c-d8d1-11eb-9ae9-8fb4530e4e64");
QName wi1AssigneeRef2Relation = QName.valueOf("{https://random.org/ns}acwi-1-assignee-2-rel");
// explicit UUID, to ensure ordering
UUID wi1CandidateRef1Oid = UUID.fromString("754f391a-d8d1-11eb-b269-9b322a63128e");
QName wi1CandidateRef1Relation = QName.valueOf("{https://random.org/ns}acwi-1-candidate-1-rel");
// explicit UUID, to ensure ordering
UUID wi2AssigneeRef1Oid = UUID.fromString("75cde882-d8d1-11eb-841f-6b8c0f5075f8");
QName wi2AssigneeRef1Relation = QName.valueOf("{https://random.org/ns}acwi-2-assignee-1-rel");
// explicit UUID, to ensure ordering
UUID wi2CandidateRef1Oid = UUID.fromString("765709aa-d8d1-11eb-9340-33ef5ec6b0e2");
QName wi2CandidateRef1Relation = QName.valueOf("{https://random.org/ns}acwi-2-candidate-1-rel");
// explicit UUID, to ensure ordering
UUID wi2CandidateRef2Oid = UUID.fromString("7576bd0a-d8d1-11eb-9171-bf2238c132b7");
QName wi2CandidateRef2Relation = QName.valueOf("{https://random.org/ns}acwi-2-candidate-2-rel");
// explicit UUID, to ensure ordering
UUID wi3AssigneeRef1Oid = UUID.fromString("b9f969b0-d8e4-11eb-aa14-6f0a7aff9550");
QName wi3AssigneeRef1Relation = QName.valueOf("{https://random.org/ns}acwi-3-assignee-1-rel");
// explicit UUID, to ensure ordering
UUID wi3CandidateRef1Oid = UUID.fromString("bb23b638-d8e4-11eb-9601-872386b50ce3");
QName wi3CandidateRef1Relation = QName.valueOf("{https://random.org/ns}acwi-3-candidate-1-rel");
var accessCertificationCampaign = new AccessCertificationCampaignType(prismContext).name(objectName).definitionRef(definitionRefOid.toString(), UserType.COMPLEX_TYPE, definitionRefRelationUri).endTimestamp(MiscUtil.asXMLGregorianCalendar(endTimestamp)).handlerUri("c-handler-uri").iteration(3).ownerRef(ownerRefOid.toString(), UserType.COMPLEX_TYPE, ownerRefRelationUri).stageNumber(2).startTimestamp(MiscUtil.asXMLGregorianCalendar(startTimestamp)).state(AccessCertificationCampaignStateType.IN_REVIEW_STAGE)._case(new AccessCertificationCaseType(prismContext).id(48L).activation(new ActivationType(prismContext).administrativeStatus(ActivationStatusType.ARCHIVED).archiveTimestamp(MiscUtil.asXMLGregorianCalendar(archiveTimestamp)).disableReason(disableReason).disableTimestamp(MiscUtil.asXMLGregorianCalendar(disableTimestamp)).effectiveStatus(ActivationStatusType.DISABLED).enableTimestamp(MiscUtil.asXMLGregorianCalendar(enableTimestamp)).validFrom(MiscUtil.asXMLGregorianCalendar(validFrom)).validTo(MiscUtil.asXMLGregorianCalendar(validTo)).validityChangeTimestamp(MiscUtil.asXMLGregorianCalendar(validityChangeTimestamp)).validityStatus(TimeIntervalStatusType.IN)).currentStageOutcome(case1CurrentStageOutcome).iteration(case1Iteration).objectRef(caseObjectRefOid.toString(), ServiceType.COMPLEX_TYPE, caseObjectRefRelationUri).orgRef(caseOrgRefOid.toString(), OrgType.COMPLEX_TYPE, caseOrgRefRelationUri).outcome(caseOutcome).remediedTimestamp(MiscUtil.asXMLGregorianCalendar(remediedTimestamp)).currentStageDeadline(MiscUtil.asXMLGregorianCalendar(currentStageDeadline)).currentStageCreateTimestamp(MiscUtil.asXMLGregorianCalendar(case1CurrentStageCreateTimestamp)).stageNumber(caseStageNumber).targetRef(caseTargetRefOid.toString(), RoleType.COMPLEX_TYPE, caseTargetRefRelationUri).tenantRef(caseTenantRefOid.toString(), OrgType.COMPLEX_TYPE, caseTenantRefRelationUri).workItem(new AccessCertificationWorkItemType(prismContext).id(55L).closeTimestamp(MiscUtil.asXMLGregorianCalendar(wi1CloseTimestamp)).iteration(81).output(new AbstractWorkItemOutputType().outcome("almost, but not quite, entirely done")).outputChangeTimestamp(MiscUtil.asXMLGregorianCalendar(wi1OutputChangeTimestamp)).performerRef(performer1Oid.toString(), UserType.COMPLEX_TYPE, performer1Relation).stageNumber(21).assigneeRef(wi1AssigneeRef1Oid.toString(), UserType.COMPLEX_TYPE, wi1AssigneeRef1Relation).assigneeRef(wi1AssigneeRef2Oid.toString(), UserType.COMPLEX_TYPE, wi1AssigneeRef2Relation).candidateRef(wi1CandidateRef1Oid.toString(), UserType.COMPLEX_TYPE, wi1CandidateRef1Relation)).workItem(new AccessCertificationWorkItemType(prismContext).id(56L).closeTimestamp(MiscUtil.asXMLGregorianCalendar(wi2CloseTimestamp)).iteration(82).output(new AbstractWorkItemOutputType().outcome("A tad more than almost, but not quite, entirely done")).outputChangeTimestamp(MiscUtil.asXMLGregorianCalendar(wi2OutputChangeTimestamp)).performerRef(performer2Oid.toString(), UserType.COMPLEX_TYPE, performer2Relation).stageNumber(22).assigneeRef(wi2AssigneeRef1Oid.toString(), UserType.COMPLEX_TYPE, wi2AssigneeRef1Relation).candidateRef(wi2CandidateRef1Oid.toString(), UserType.COMPLEX_TYPE, wi2CandidateRef1Relation).candidateRef(wi2CandidateRef2Oid.toString(), OrgType.COMPLEX_TYPE, wi2CandidateRef2Relation)))._case(new AccessCertificationCaseType(prismContext).id(49L).currentStageOutcome(case2CurrentStageOutcome).iteration(case2Iteration).outcome("whatever").currentStageCreateTimestamp(MiscUtil.asXMLGregorianCalendar(case2CurrentStageCreateTimestamp)).stageNumber(25).targetRef(caseTargetRefOid.toString(), RoleType.COMPLEX_TYPE, caseTargetRefRelationUri).workItem(new AccessCertificationWorkItemType(prismContext).id(59L).closeTimestamp(MiscUtil.asXMLGregorianCalendar(wi3CloseTimestamp)).iteration(83).output(new AbstractWorkItemOutputType().outcome("certainly not quite done")).outputChangeTimestamp(MiscUtil.asXMLGregorianCalendar(wi3OutputChangeTimestamp)).performerRef(performer3Oid.toString(), UserType.COMPLEX_TYPE, performer3Relation).stageNumber(21).assigneeRef(wi3AssigneeRef1Oid.toString(), UserType.COMPLEX_TYPE, wi3AssigneeRef1Relation).candidateRef(wi3CandidateRef1Oid.toString(), OrgType.COMPLEX_TYPE, wi3CandidateRef1Relation)));
when("adding it to the repository");
repositoryService.addObject(accessCertificationCampaign.asPrismObject(), null, result);
then("it is stored and relevant attributes are in columns");
assertThatOperationResult(result).isSuccess();
MAccessCertificationCampaign row = selectObjectByOid(QAccessCertificationCampaign.class, accessCertificationCampaign.getOid());
assertThat(row.definitionRefTargetOid).isEqualTo(definitionRefOid);
assertThat(row.definitionRefTargetType).isEqualTo(MObjectType.USER);
assertCachedUri(row.definitionRefRelationId, definitionRefRelationUri);
assertThat(row.endTimestamp).isEqualTo(endTimestamp);
assertCachedUri(row.handlerUriId, "c-handler-uri");
assertThat(row.campaignIteration).isEqualTo(3);
assertThat(row.ownerRefTargetOid).isEqualTo(ownerRefOid);
assertThat(row.ownerRefTargetType).isEqualTo(MObjectType.USER);
assertCachedUri(row.ownerRefRelationId, ownerRefRelationUri);
assertThat(row.stageNumber).isEqualTo(2);
assertThat(row.startTimestamp).isEqualTo(startTimestamp);
assertThat(row.state).isEqualTo(AccessCertificationCampaignStateType.IN_REVIEW_STAGE);
QAccessCertificationCase caseAlias = aliasFor(QAccessCertificationCase.class);
List<MAccessCertificationCase> caseRows = select(caseAlias, caseAlias.ownerOid.eq(UUID.fromString(accessCertificationCampaign.getOid())));
assertThat(caseRows).hasSize(2);
caseRows.sort(comparing(tr -> tr.cid));
MAccessCertificationCase caseRow = caseRows.get(0);
// assigned in advance
assertThat(caseRow.cid).isEqualTo(48);
assertThat(caseRow.containerType).isEqualTo(MContainerType.ACCESS_CERTIFICATION_CASE);
assertThat(caseRow.administrativeStatus).isEqualTo(ActivationStatusType.ARCHIVED);
assertThat(caseRow.archiveTimestamp).isEqualTo(archiveTimestamp);
assertThat(caseRow.disableReason).isEqualTo(disableReason);
assertThat(caseRow.disableTimestamp).isEqualTo(disableTimestamp);
assertThat(caseRow.effectiveStatus).isEqualTo(ActivationStatusType.DISABLED);
assertThat(caseRow.enableTimestamp).isEqualTo(enableTimestamp);
assertThat(caseRow.validFrom).isEqualTo(validFrom);
assertThat(caseRow.validTo).isEqualTo(validTo);
assertThat(caseRow.validityChangeTimestamp).isEqualTo(validityChangeTimestamp);
assertThat(caseRow.validityStatus).isEqualTo(TimeIntervalStatusType.IN);
assertThat(caseRow.currentStageOutcome).isEqualTo(case1CurrentStageOutcome);
assertContainerFullObject(caseRow.fullObject, accessCertificationCampaign.getCase().get(0));
assertThat(caseRow.campaignIteration).isEqualTo(case1Iteration);
assertThat(caseRow.objectRefTargetOid).isEqualTo(caseObjectRefOid);
assertThat(caseRow.objectRefTargetType).isEqualTo(MObjectType.SERVICE);
assertCachedUri(caseRow.objectRefRelationId, caseObjectRefRelationUri);
assertThat(caseRow.orgRefTargetOid).isEqualTo(caseOrgRefOid);
assertThat(caseRow.orgRefTargetType).isEqualTo(MObjectType.ORG);
assertCachedUri(caseRow.orgRefRelationId, caseOrgRefRelationUri);
assertThat(caseRow.outcome).isEqualTo(caseOutcome);
assertThat(caseRow.remediedTimestamp).isEqualTo(remediedTimestamp);
assertThat(caseRow.currentStageDeadline).isEqualTo(currentStageDeadline);
assertThat(caseRow.currentStageCreateTimestamp).isEqualTo(case1CurrentStageCreateTimestamp);
assertThat(caseRow.stageNumber).isEqualTo(caseStageNumber);
assertThat(caseRow.targetRefTargetOid).isEqualTo(caseTargetRefOid);
assertThat(caseRow.targetRefTargetType).isEqualTo(MObjectType.ROLE);
assertCachedUri(caseRow.targetRefRelationId, caseTargetRefRelationUri);
assertThat(caseRow.tenantRefTargetOid).isEqualTo(caseTenantRefOid);
assertThat(caseRow.tenantRefTargetType).isEqualTo(MObjectType.ORG);
assertCachedUri(caseRow.tenantRefRelationId, caseTenantRefRelationUri);
caseRow = caseRows.get(1);
// assigned in advance
assertThat(caseRow.cid).isEqualTo(49);
assertThat(caseRow.containerType).isEqualTo(MContainerType.ACCESS_CERTIFICATION_CASE);
assertThat(caseRow.administrativeStatus).isNull();
assertThat(caseRow.archiveTimestamp).isNull();
assertThat(caseRow.disableReason).isNull();
assertThat(caseRow.disableTimestamp).isNull();
assertThat(caseRow.effectiveStatus).isNull();
assertThat(caseRow.enableTimestamp).isNull();
assertThat(caseRow.validFrom).isNull();
assertThat(caseRow.validTo).isNull();
assertThat(caseRow.validityChangeTimestamp).isNull();
assertThat(caseRow.validityStatus).isNull();
assertThat(caseRow.currentStageOutcome).isEqualTo(case2CurrentStageOutcome);
assertContainerFullObject(caseRow.fullObject, accessCertificationCampaign.getCase().get(1));
assertThat(caseRow.campaignIteration).isEqualTo(case2Iteration);
assertThat(caseRow.objectRefTargetOid).isNull();
assertThat(caseRow.objectRefTargetType).isNull();
assertThat(caseRow.objectRefRelationId).isNull();
assertThat(caseRow.orgRefTargetOid).isNull();
assertThat(caseRow.orgRefTargetType).isNull();
assertThat(caseRow.orgRefRelationId).isNull();
assertThat(caseRow.outcome).isEqualTo("whatever");
assertThat(caseRow.remediedTimestamp).isNull();
assertThat(caseRow.currentStageDeadline).isNull();
assertThat(caseRow.currentStageCreateTimestamp).isEqualTo(case2CurrentStageCreateTimestamp);
assertThat(caseRow.stageNumber).isEqualTo(25);
assertThat(caseRow.targetRefTargetOid).isEqualTo(caseTargetRefOid);
assertThat(caseRow.targetRefTargetType).isEqualTo(MObjectType.ROLE);
assertCachedUri(caseRow.targetRefRelationId, caseTargetRefRelationUri);
assertThat(caseRow.tenantRefTargetOid).isNull();
assertThat(caseRow.tenantRefTargetType).isNull();
assertThat(caseRow.tenantRefRelationId).isNull();
QAccessCertificationWorkItem wiAlias = aliasFor(QAccessCertificationWorkItem.class);
List<MAccessCertificationWorkItem> wiRows = select(wiAlias, wiAlias.ownerOid.eq(UUID.fromString(accessCertificationCampaign.getOid())));
assertThat(wiRows).hasSize(3);
wiRows.sort(comparing(tr -> tr.cid));
MAccessCertificationWorkItem wiRow = wiRows.get(0);
// assigned in advance
assertThat(wiRow.cid).isEqualTo(55);
assertThat(wiRow.accessCertCaseCid).isEqualTo(48);
assertThat(wiRow.containerType).isEqualTo(MContainerType.ACCESS_CERTIFICATION_WORK_ITEM);
assertThat(wiRow.closeTimestamp).isEqualTo(wi1CloseTimestamp);
assertThat(wiRow.campaignIteration).isEqualTo(81);
assertThat(wiRow.outcome).isEqualTo("almost, but not quite, entirely done");
assertThat(wiRow.outputChangeTimestamp).isEqualTo(wi1OutputChangeTimestamp);
assertThat(wiRow.performerRefTargetOid).isEqualTo(performer1Oid);
assertThat(wiRow.performerRefTargetType).isEqualTo(MObjectType.USER);
assertCachedUri(wiRow.performerRefRelationId, performer1Relation);
assertThat(wiRow.stageNumber).isEqualTo(21);
wiRow = wiRows.get(1);
// assigned in advance
assertThat(wiRow.cid).isEqualTo(56);
assertThat(wiRow.accessCertCaseCid).isEqualTo(48);
assertThat(wiRow.containerType).isEqualTo(MContainerType.ACCESS_CERTIFICATION_WORK_ITEM);
assertThat(wiRow.closeTimestamp).isEqualTo(wi2CloseTimestamp);
assertThat(wiRow.campaignIteration).isEqualTo(82);
assertThat(wiRow.outcome).isEqualTo("A tad more than almost, but not quite, entirely done");
assertThat(wiRow.outputChangeTimestamp).isEqualTo(wi2OutputChangeTimestamp);
assertThat(wiRow.performerRefTargetOid).isEqualTo(performer2Oid);
assertThat(wiRow.performerRefTargetType).isEqualTo(MObjectType.USER);
assertCachedUri(wiRow.performerRefRelationId, performer2Relation);
assertThat(wiRow.stageNumber).isEqualTo(22);
// Assignee refs
QAccessCertificationWorkItemReference assigneeRefAlias = QAccessCertificationWorkItemReferenceMapping.getForCaseWorkItemAssignee().defaultAlias();
List<MAccessCertificationWorkItemReference> assigneeRefRows = select(assigneeRefAlias, assigneeRefAlias.ownerOid.eq(UUID.fromString(accessCertificationCampaign.getOid())));
assertThat(assigneeRefRows).hasSize(4);
assigneeRefRows.sort(comparing(tr -> tr.targetOid));
MAccessCertificationWorkItemReference assigneeRefRow = assigneeRefRows.get(0);
assertThat(assigneeRefRow.ownerOid).isEqualTo(UUID.fromString(accessCertificationCampaign.getOid()));
assertThat(assigneeRefRow.ownerType).isEqualTo(MObjectType.ACCESS_CERTIFICATION_CAMPAIGN);
assertThat(assigneeRefRow.referenceType).isEqualTo(MReferenceType.ACCESS_CERT_WI_ASSIGNEE);
assertThat(assigneeRefRow.targetType).isEqualTo(MObjectType.USER);
assertThat(assigneeRefRow.targetOid).isEqualTo(wi3AssigneeRef1Oid);
assertCachedUri(assigneeRefRow.relationId, wi3AssigneeRef1Relation);
assertThat(assigneeRefRow.accessCertCaseCid).isEqualTo(49);
assertThat(assigneeRefRow.accessCertWorkItemCid).isEqualTo(59);
assigneeRefRow = assigneeRefRows.get(1);
assertThat(assigneeRefRow.ownerOid).isEqualTo(UUID.fromString(accessCertificationCampaign.getOid()));
assertThat(assigneeRefRow.ownerType).isEqualTo(MObjectType.ACCESS_CERTIFICATION_CAMPAIGN);
assertThat(assigneeRefRow.referenceType).isEqualTo(MReferenceType.ACCESS_CERT_WI_ASSIGNEE);
assertThat(assigneeRefRow.targetType).isEqualTo(MObjectType.USER);
assertThat(assigneeRefRow.targetOid).isEqualTo(wi1AssigneeRef1Oid);
assertCachedUri(assigneeRefRow.relationId, wi1AssigneeRef1Relation);
assertThat(assigneeRefRow.accessCertCaseCid).isEqualTo(48);
assertThat(assigneeRefRow.accessCertWorkItemCid).isEqualTo(55);
assigneeRefRow = assigneeRefRows.get(2);
assertThat(assigneeRefRow.ownerOid).isEqualTo(UUID.fromString(accessCertificationCampaign.getOid()));
assertThat(assigneeRefRow.ownerType).isEqualTo(MObjectType.ACCESS_CERTIFICATION_CAMPAIGN);
assertThat(assigneeRefRow.referenceType).isEqualTo(MReferenceType.ACCESS_CERT_WI_ASSIGNEE);
assertThat(assigneeRefRow.targetType).isEqualTo(MObjectType.USER);
assertThat(assigneeRefRow.targetOid).isEqualTo(wi2AssigneeRef1Oid);
assertCachedUri(assigneeRefRow.relationId, wi2AssigneeRef1Relation);
assertThat(assigneeRefRow.accessCertCaseCid).isEqualTo(48);
assertThat(assigneeRefRow.accessCertWorkItemCid).isEqualTo(56);
assigneeRefRow = assigneeRefRows.get(3);
assertThat(assigneeRefRow.ownerOid).isEqualTo(UUID.fromString(accessCertificationCampaign.getOid()));
assertThat(assigneeRefRow.ownerType).isEqualTo(MObjectType.ACCESS_CERTIFICATION_CAMPAIGN);
assertThat(assigneeRefRow.referenceType).isEqualTo(MReferenceType.ACCESS_CERT_WI_ASSIGNEE);
assertThat(assigneeRefRow.targetType).isEqualTo(MObjectType.USER);
assertThat(assigneeRefRow.targetOid).isEqualTo(wi1AssigneeRef2Oid);
assertCachedUri(assigneeRefRow.relationId, wi1AssigneeRef2Relation);
assertThat(assigneeRefRow.accessCertCaseCid).isEqualTo(48);
assertThat(assigneeRefRow.accessCertWorkItemCid).isEqualTo(55);
// Candidate refs
QAccessCertificationWorkItemReference candidateRefAlias = QAccessCertificationWorkItemReferenceMapping.getForCaseWorkItemCandidate().defaultAlias();
List<MAccessCertificationWorkItemReference> candidateRefRows = select(candidateRefAlias, candidateRefAlias.ownerOid.eq(UUID.fromString(accessCertificationCampaign.getOid())));
assertThat(candidateRefRows).hasSize(4);
candidateRefRows.sort(comparing(tr -> tr.targetOid));
MAccessCertificationWorkItemReference candidateRefRow = candidateRefRows.get(0);
assertThat(candidateRefRow.ownerOid).isEqualTo(UUID.fromString(accessCertificationCampaign.getOid()));
assertThat(candidateRefRow.ownerType).isEqualTo(MObjectType.ACCESS_CERTIFICATION_CAMPAIGN);
assertThat(candidateRefRow.referenceType).isEqualTo(MReferenceType.ACCESS_CERT_WI_CANDIDATE);
assertThat(candidateRefRow.targetType).isEqualTo(MObjectType.ORG);
assertThat(candidateRefRow.targetOid).isEqualTo(wi3CandidateRef1Oid);
assertCachedUri(candidateRefRow.relationId, wi3CandidateRef1Relation);
assertThat(candidateRefRow.accessCertCaseCid).isEqualTo(49);
assertThat(candidateRefRow.accessCertWorkItemCid).isEqualTo(59);
candidateRefRow = candidateRefRows.get(1);
assertThat(candidateRefRow.ownerOid).isEqualTo(UUID.fromString(accessCertificationCampaign.getOid()));
assertThat(candidateRefRow.ownerType).isEqualTo(MObjectType.ACCESS_CERTIFICATION_CAMPAIGN);
assertThat(candidateRefRow.referenceType).isEqualTo(MReferenceType.ACCESS_CERT_WI_CANDIDATE);
assertThat(candidateRefRow.targetType).isEqualTo(MObjectType.USER);
assertThat(candidateRefRow.targetOid).isEqualTo(wi1CandidateRef1Oid);
assertCachedUri(candidateRefRow.relationId, wi1CandidateRef1Relation);
assertThat(candidateRefRow.accessCertCaseCid).isEqualTo(48);
assertThat(candidateRefRow.accessCertWorkItemCid).isEqualTo(55);
candidateRefRow = candidateRefRows.get(2);
assertThat(candidateRefRow.ownerOid).isEqualTo(UUID.fromString(accessCertificationCampaign.getOid()));
assertThat(candidateRefRow.ownerType).isEqualTo(MObjectType.ACCESS_CERTIFICATION_CAMPAIGN);
assertThat(candidateRefRow.referenceType).isEqualTo(MReferenceType.ACCESS_CERT_WI_CANDIDATE);
assertThat(candidateRefRow.targetType).isEqualTo(MObjectType.ORG);
assertThat(candidateRefRow.targetOid).isEqualTo(wi2CandidateRef2Oid);
assertCachedUri(candidateRefRow.relationId, wi2CandidateRef2Relation);
assertThat(candidateRefRow.accessCertCaseCid).isEqualTo(48);
assertThat(candidateRefRow.accessCertWorkItemCid).isEqualTo(56);
candidateRefRow = candidateRefRows.get(3);
assertThat(candidateRefRow.ownerOid).isEqualTo(UUID.fromString(accessCertificationCampaign.getOid()));
assertThat(candidateRefRow.ownerType).isEqualTo(MObjectType.ACCESS_CERTIFICATION_CAMPAIGN);
assertThat(candidateRefRow.referenceType).isEqualTo(MReferenceType.ACCESS_CERT_WI_CANDIDATE);
assertThat(candidateRefRow.targetType).isEqualTo(MObjectType.USER);
assertThat(candidateRefRow.targetOid).isEqualTo(wi2CandidateRef1Oid);
assertCachedUri(candidateRefRow.relationId, wi2CandidateRef1Relation);
assertThat(candidateRefRow.accessCertCaseCid).isEqualTo(48);
assertThat(candidateRefRow.accessCertWorkItemCid).isEqualTo(56);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.
the class SqaleRepoSmokeTest method test500ExecuteQueryDiagnostics.
@Test
public void test500ExecuteQueryDiagnostics() throws Exception {
// also known as "Query Playground"
OperationResult result = createOperationResult();
given("some objects are in the repository");
String name = "user" + getTestNumber();
repositoryService.addObject(new UserType(prismContext).name(name).activation(new ActivationType(prismContext).administrativeStatus(ActivationStatusType.ENABLED)).asPrismObject(), null, result);
queryRecorder.clearBufferAndStartRecording();
when("executeQueryDiagnostics is called with query");
RepositoryQueryDiagRequest request = new RepositoryQueryDiagRequest();
request.setType(UserType.class);
request.setQuery(prismContext.queryFor(UserType.class).item(UserType.F_NAME).eqPoly(name).and().item(UserType.F_ACTIVATION, ActivationType.F_ADMINISTRATIVE_STATUS).eq(ActivationStatusType.ENABLED).build());
RepositoryQueryDiagResponse response = repositoryService.executeQueryDiagnostics(request, result);
then("query is executed and low-level info returned");
assertThat(response).isNotNull();
assertThat(response.getQueryResult()).hasSize(1).extracting(o -> ((PrismObject<?>) o).asObjectable().getName().getOrig()).containsExactly(name);
assertThat(response.getImplementationLevelQuery()).asString().isEqualToIgnoringWhitespace("select u.oid, u.fullObject from m_user u" + " where u.nameNorm = ? and u.nameOrig = ? and u.administrativeStatus = ?" + " limit ?");
assertThat(queryRecorder.getQueryBuffer()).hasSize(1);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.
the class AbstractActivationComputerTest method testGetLimboAdministrativeEnabled.
@Test
public void testGetLimboAdministrativeEnabled() {
// GIVEN
Clock clock = createClock(YEAR_START);
ActivationComputer activationComputer = createActivationComputer(clock);
ActivationType activationType = createActivationType(ActivationStatusType.ENABLED, SPRING_EQUINOX, AUTUMN_EQUINOX);
// WHEN
ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(LIFECYCLE_STATE_LIMBO, activationType, null);
// THEN
assertEquals("Unexpected effective status", ActivationStatusType.DISABLED, effectiveStatus);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.
the class AbstractActivationComputerTest method testGetActiveAdministrativeArchived.
@Test
public void testGetActiveAdministrativeArchived() throws Exception {
// GIVEN
Clock clock = createClock(SUMMER_SOLSTICE);
ActivationComputer activationComputer = createActivationComputer(clock);
ActivationType activationType = createActivationType(ActivationStatusType.ARCHIVED, SPRING_EQUINOX, AUTUMN_EQUINOX);
// WHEN
ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(SchemaConstants.LIFECYCLE_ACTIVE, activationType, createLifecycleModel());
// THEN
assertEquals("Unexpected effective status", ActivationStatusType.ARCHIVED, effectiveStatus);
}
Aggregations