use of com.evolveum.midpoint.prism.Containerable in project midpoint by Evolveum.
the class TestMapping method test520DeleteUserAssignment.
/**
* MID-4863
*/
@Test
public void test520DeleteUserAssignment() throws Exception {
given();
Task task = getTestTask();
OperationResult result = getTestOperationResult();
PrismObject<UserType> jim = findUserByUsername(USER_JIM_NAME);
when();
AssignmentType orgAssignment = findAssignment(jim, ORG_SAVE_ELAINE_OID, SchemaConstants.ORG_DEFAULT);
assertNotNull("org assignment not found", orgAssignment);
PrismContainerValue<Containerable> orgAssignmentPcv = prismContext.itemFactory().createContainerValue();
orgAssignmentPcv.setId(orgAssignment.getId());
ObjectDelta<UserType> delta = prismContext.deltaFor(UserType.class).item(UserType.F_ASSIGNMENT).delete(orgAssignmentPcv).asObjectDeltaCast(jim.getOid());
executeChanges(delta, null, task, result);
then();
assertSuccess(result);
PrismObject<UserType> userAfter = getUser(jim.getOid());
display("User after", userAfter);
assertAssignments(userAfter, 1);
}
use of com.evolveum.midpoint.prism.Containerable in project midpoint by Evolveum.
the class TestRoleEntitlement method test102GetGroupNoFetch.
@Test
public void test102GetGroupNoFetch() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createNoFetch());
// WHEN
PrismObject<ShadowType> shadow = modelService.getObject(ShadowType.class, groupOid, options, task, result);
display("Account", shadow);
displayDumpable("Account def", shadow.getDefinition());
PrismContainer<Containerable> accountContainer = shadow.findContainer(ShadowType.F_ATTRIBUTES);
displayDumpable("Account attributes def", accountContainer.getDefinition());
displayDumpable("Account attributes def complex type def", accountContainer.getDefinition().getComplexTypeDefinition());
assertDummyGroupShadowRepo(shadow, groupOid, GROUP_PIRATE_DUMMY_NAME);
result.computeStatus();
TestUtil.assertSuccess("getObject result", result);
}
use of com.evolveum.midpoint.prism.Containerable in project midpoint by Evolveum.
the class TestRoleEntitlement method test103GetGroupRaw.
@Test
public void test103GetGroupRaw() throws Exception {
// GIVEN
Task task = getTestTask();
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createRaw());
// WHEN
PrismObject<ShadowType> shadow = modelService.getObject(ShadowType.class, groupOid, options, task, result);
display("Account", shadow);
displayDumpable("Account def", shadow.getDefinition());
PrismContainer<Containerable> accountContainer = shadow.findContainer(ShadowType.F_ATTRIBUTES);
displayDumpable("Account attributes def", accountContainer.getDefinition());
displayDumpable("Account attributes def complex type def", accountContainer.getDefinition().getComplexTypeDefinition());
assertDummyGroupShadowRepo(shadow, groupOid, GROUP_PIRATE_DUMMY_NAME);
result.computeStatus();
TestUtil.assertSuccess("getObject result", result);
}
use of com.evolveum.midpoint.prism.Containerable in project midpoint by Evolveum.
the class ClassicCollectionReportExportActivityRun method processItem.
@Override
public boolean processItem(@NotNull ItemProcessingRequest<Containerable> request, @NotNull RunningTask workerTask, OperationResult result) throws CommonException, ActivityRunException {
Containerable record = request.getItem();
controller.handleDataRecord(request.getSequentialNumber(), record, workerTask, result);
return true;
}
use of com.evolveum.midpoint.prism.Containerable in project midpoint by Evolveum.
the class ClassicDashboardReportExportActivityRun method iterateOverItemsInBucket.
@Override
public void iterateOverItemsInBucket(OperationResult result) throws CommonException {
// Issue the search to audit or model/repository
// And use the following handler to handle the results
List<DashboardWidgetType> widgets = support.getDashboard().getWidget();
AtomicInteger widgetSequence = new AtomicInteger(1);
for (DashboardWidgetType widget : widgets) {
ExportDashboardReportLine<Containerable> widgetLine = new ExportDashboardReportLine<>(widgetSequence.getAndIncrement(), widget);
ItemProcessingRequest<ExportDashboardReportLine<Containerable>> widgetRequest = new ExportDashboardReportLineProcessingRequest(widgetLine, this);
coordinator.submit(widgetRequest, result);
if (support.isWidgetTableVisible()) {
AtomicInteger sequence = new AtomicInteger(1);
Handler<Containerable> handler = record -> {
ExportDashboardReportLine<Containerable> line = new ExportDashboardReportLine<>(sequence.getAndIncrement(), record, widget.getIdentifier());
ItemProcessingRequest<ExportDashboardReportLine<Containerable>> request = new ExportDashboardReportLineProcessingRequest(line, this);
coordinator.submit(request, result);
return true;
};
DashboardWidgetHolder holder = mapOfWidgetsController.get(widget.getIdentifier());
ContainerableReportDataSource searchSpecificationHolder = holder.getSearchSpecificationHolder();
searchSpecificationHolder.run(handler, result);
}
}
}
Aggregations