Search in sources :

Example 36 with Containerable

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Containerable(com.evolveum.midpoint.prism.Containerable) Test(org.testng.annotations.Test)

Example 37 with Containerable

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Containerable(com.evolveum.midpoint.prism.Containerable) Test(org.testng.annotations.Test)

Example 38 with Containerable

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);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Containerable(com.evolveum.midpoint.prism.Containerable) Test(org.testng.annotations.Test)

Example 39 with Containerable

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;
}
Also used : Containerable(com.evolveum.midpoint.prism.Containerable)

Example 40 with Containerable

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);
        }
    }
}
Also used : ItemProcessingRequest(com.evolveum.midpoint.repo.common.activity.run.processing.ItemProcessingRequest) ActivityRunException(com.evolveum.midpoint.repo.common.activity.run.ActivityRunException) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) com.evolveum.midpoint.repo.common.activity.run(com.evolveum.midpoint.repo.common.activity.run) RunningTask(com.evolveum.midpoint.task.api.RunningTask) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) com.evolveum.midpoint.report.impl.controller(com.evolveum.midpoint.report.impl.controller) ReportServiceImpl(com.evolveum.midpoint.report.impl.ReportServiceImpl) CommonException(com.evolveum.midpoint.util.exception.CommonException) LinkedHashMap(java.util.LinkedHashMap) List(java.util.List) Handler(com.evolveum.midpoint.util.Handler) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Containerable(com.evolveum.midpoint.prism.Containerable) DashboardWidgetHolder(com.evolveum.midpoint.report.impl.activity.ExportDashboardActivitySupport.DashboardWidgetHolder) NotNull(org.jetbrains.annotations.NotNull) ReportUtils(com.evolveum.midpoint.report.impl.ReportUtils) DashboardWidgetHolder(com.evolveum.midpoint.report.impl.activity.ExportDashboardActivitySupport.DashboardWidgetHolder) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ItemProcessingRequest(com.evolveum.midpoint.repo.common.activity.run.processing.ItemProcessingRequest) Containerable(com.evolveum.midpoint.prism.Containerable)

Aggregations

Containerable (com.evolveum.midpoint.prism.Containerable)42 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)15 ArrayList (java.util.ArrayList)12 Test (org.testng.annotations.Test)10 Task (com.evolveum.midpoint.task.api.Task)9 PrismObject (com.evolveum.midpoint.prism.PrismObject)7 Collection (java.util.Collection)6 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)5 PrismProperty (com.evolveum.midpoint.prism.PrismProperty)5 ResourceAttribute (com.evolveum.midpoint.schema.processor.ResourceAttribute)5 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)5 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)5 QName (javax.xml.namespace.QName)5 IModel (org.apache.wicket.model.IModel)5 RefinedObjectClassDefinition (com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition)4 RefinedResourceSchema (com.evolveum.midpoint.common.refinery.RefinedResourceSchema)4 PrismPropertyWrapperColumn (com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn)4 Item (com.evolveum.midpoint.prism.Item)4 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)4 List (java.util.List)4