use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class CertificationTest method test280DeleteWorkItem.
@Test
public void test280DeleteWorkItem() throws Exception {
OperationResult result = new OperationResult("test280DeleteWorkItem");
PrismObject<AccessCertificationCampaignType> campaign = getFullCampaign(campaign1Oid, result);
AccessCertificationCaseType case100 = campaign.asObjectable().getCase().stream().filter(c -> c.getId() == NEW_CASE_ID).findFirst().orElseThrow(() -> new AssertionError("No case 100"));
assertEquals("Wrong # of work items in case 100", 2, case100.getWorkItem().size());
AccessCertificationWorkItemType workItem = case100.getWorkItem().stream().filter(wi -> wi.getOriginalAssigneeRef() != null).findFirst().orElse(null);
assertNotNull("No new work item", workItem);
List<ItemDelta<?, ?>> modifications = DeltaBuilder.deltaFor(AccessCertificationCampaignType.class, prismContext).item(F_CASE, NEW_CASE_ID, F_WORK_ITEM).delete(workItem.clone()).asItemDeltas();
// WHEN
executeAndCheckModification(modifications, result, 0);
// THEN
checkCasesForCampaign(campaign1Oid, 8, result);
checkCasesTotal(8, result);
checkWorkItemsForCampaign(campaign1Oid, 9, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, 1, 2, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, 2, 1, result);
checkWorkItemsForCampaignAndCase(campaign1Oid, NEW_CASE_ID, 1, result);
checkWorkItemsTotal(9, result);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class CertificationTest method test720AllCases.
@Test
public void test720AllCases() throws Exception {
OperationResult result = new OperationResult("test720AllCases");
List<AccessCertificationCaseType> cases = repositoryService.searchContainers(AccessCertificationCaseType.class, null, null, result);
AccessCertificationCampaignType campaign1 = getFullCampaign(campaign1Oid, result).asObjectable();
AccessCertificationCampaignType campaign2 = getFullCampaign(campaign2Oid, result).asObjectable();
List<AccessCertificationCaseType> expectedCases = new ArrayList<>();
expectedCases.addAll(campaign1.getCase());
expectedCases.addAll(campaign2.getCase());
PrismAsserts.assertEqualsCollectionUnordered("list of cases is different", cases, expectedCases.toArray(new AccessCertificationCaseType[0]));
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class RAccessCertificationCampaign method toJAXB.
@Override
public AccessCertificationCampaignType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
AccessCertificationCampaignType object = new AccessCertificationCampaignType();
RUtil.revive(object, prismContext);
RAccessCertificationCampaign.copyToJAXB(this, object, prismContext, options);
return object;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class RAccessCertificationCampaign method copyFromJAXB.
public static void copyFromJAXB(AccessCertificationCampaignType jaxb, RAccessCertificationCampaign repo, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException {
RObject.copyFromJAXB(jaxb, repo, repositoryContext, generatorResult);
repo.setName(RPolyString.copyFromJAXB(jaxb.getName()));
repo.setDefinitionRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getDefinitionRef(), repositoryContext.prismContext));
List<AccessCertificationCaseType> cases = jaxb.getCase();
if (!cases.isEmpty()) {
for (AccessCertificationCaseType case1 : cases) {
RAccessCertificationCase rCase = RAccessCertificationCase.toRepo(repo, case1, repositoryContext);
// redundant?
rCase.setTransient(generatorResult.isTransient(case1.asPrismContainerValue()));
repo.getCase().add(rCase);
}
}
repo.setOwnerRefCampaign(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getOwnerRef(), repositoryContext.prismContext));
repo.setHandlerUri(jaxb.getHandlerUri());
repo.setStart(jaxb.getStartTimestamp());
repo.setEnd(jaxb.getEndTimestamp());
repo.setState(RUtil.getRepoEnumValue(jaxb.getState(), RAccessCertificationCampaignState.class));
repo.setStageNumber(jaxb.getStageNumber());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class CertificationCaseHelper method updateLoadedCertificationCase.
// TODO find a better name
public AccessCertificationCaseType updateLoadedCertificationCase(GetContainerableResult result, Map<String, PrismObject<AccessCertificationCampaignType>> ownersMap, Collection<SelectorOptions<GetOperationOptions>> options, Session session, OperationResult operationResult) throws SchemaException {
AccessCertificationCaseType aCase = RAccessCertificationCase.createJaxb(result.getFullObject(), prismContext, false);
generalHelper.validateContainerable(aCase, AccessCertificationCaseType.class);
String ownerOid = result.getOwnerOid();
PrismObject<AccessCertificationCampaignType> campaign = resolveCampaign(ownerOid, ownersMap, session, operationResult);
if (campaign != null && !campaign.asObjectable().getCase().contains(aCase)) {
campaign.asObjectable().getCase().add(aCase);
}
return aCase;
}
Aggregations