use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType.F_ACTIVATION in project midpoint by Evolveum.
the class FocusValidityScannerTaskHandler method createQuery.
@Override
protected ObjectQuery createQuery(AbstractScannerResultHandler<UserType> handler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult) throws SchemaException {
initProcessedOids(coordinatorTask);
ObjectQuery query = new ObjectQuery();
ObjectFilter filter;
PrismObjectDefinition<UserType> focusObjectDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class);
XMLGregorianCalendar lastScanTimestamp = handler.getLastScanTimestamp();
XMLGregorianCalendar thisScanTimestamp = handler.getThisScanTimestamp();
if (lastScanTimestamp == null) {
filter = QueryBuilder.queryFor(FocusType.class, prismContext).item(F_ACTIVATION, F_VALID_FROM).le(thisScanTimestamp).or().item(F_ACTIVATION, F_VALID_TO).le(thisScanTimestamp).or().exists(F_ASSIGNMENT).block().item(AssignmentType.F_ACTIVATION, F_VALID_FROM).le(thisScanTimestamp).or().item(AssignmentType.F_ACTIVATION, F_VALID_TO).le(thisScanTimestamp).endBlock().buildFilter();
} else {
filter = QueryBuilder.queryFor(FocusType.class, prismContext).item(F_ACTIVATION, F_VALID_FROM).gt(lastScanTimestamp).and().item(F_ACTIVATION, F_VALID_FROM).le(thisScanTimestamp).or().item(F_ACTIVATION, F_VALID_TO).gt(lastScanTimestamp).and().item(F_ACTIVATION, F_VALID_TO).le(thisScanTimestamp).or().exists(F_ASSIGNMENT).block().item(AssignmentType.F_ACTIVATION, F_VALID_FROM).gt(lastScanTimestamp).and().item(AssignmentType.F_ACTIVATION, F_VALID_FROM).le(thisScanTimestamp).or().item(AssignmentType.F_ACTIVATION, F_VALID_TO).gt(lastScanTimestamp).and().item(AssignmentType.F_ACTIVATION, F_VALID_TO).le(thisScanTimestamp).endBlock().buildFilter();
}
query.setFilter(filter);
return query;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType.F_ACTIVATION in project midpoint by Evolveum.
the class TestAbstractAssignmentEvaluator method test200DisableEngineerEmployeeInducement.
/**
* Disable Engineer -> Employee inducement.
*/
@Test(enabled = false)
public void test200DisableEngineerEmployeeInducement() throws Exception {
final String TEST_NAME = "test200DisableEngineerEmployeeInducement";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestAssignmentEvaluator.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// disable Engineer->Employee inducement
ObjectDelta disableInducementDelta = DeltaBuilder.deltaFor(RoleType.class, prismContext).item(RoleType.F_INDUCEMENT, 3, F_ACTIVATION, F_ADMINISTRATIVE_STATUS).replace(ActivationStatusType.DISABLED).asObjectDelta(ROLE_CORP_ENGINEER_OID);
modelService.executeChanges(Collections.singletonList(disableInducementDelta), null, task, result);
AssignmentEvaluator<UserType> assignmentEvaluator = createAssignmentEvaluator();
PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject());
AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_ROLE_ENGINEER_FILE);
ObjectDeltaObject<UserType> userOdo = new ObjectDeltaObject<>(userTypeJack.asPrismObject(), null, null);
userOdo.recompute();
ItemDeltaItem<PrismContainerValue<AssignmentType>, PrismContainerDefinition<AssignmentType>> assignmentIdi = new ItemDeltaItem<>();
assignmentIdi.setItemOld(LensUtil.createAssignmentSingleValueContainerClone(assignmentType));
assignmentIdi.recompute();
// WHEN
TestUtil.displayWhen(TEST_NAME);
EvaluatedAssignmentImpl<UserType> evaluatedAssignment = assignmentEvaluator.evaluate(assignmentIdi, PlusMinusZero.ZERO, false, userTypeJack, "testRoleEngineer", task, result);
evaluatedAssignment.evaluateConstructions(userOdo, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
assertNotNull(evaluatedAssignment);
display("Evaluated assignment", evaluatedAssignment.debugDump());
// TODO
// assertEquals(2, evaluatedAssignment.getConstructions().size());
// PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject());
//
// assertConstruction(evaluatedAssignment, ZERO, "title", ZERO, "Engineer");
// assertConstruction(evaluatedAssignment, ZERO, "title", PLUS);
// assertConstruction(evaluatedAssignment, ZERO, "title", MINUS);
// assertNoConstruction(evaluatedAssignment, PLUS, "title");
// assertNoConstruction(evaluatedAssignment, MINUS, "title");
//
// assertConstruction(evaluatedAssignment, ZERO, "location", ZERO, "Caribbean");
// assertConstruction(evaluatedAssignment, ZERO, "location", PLUS);
// assertConstruction(evaluatedAssignment, ZERO, "location", MINUS);
// assertNoConstruction(evaluatedAssignment, PLUS, "location");
// assertNoConstruction(evaluatedAssignment, MINUS, "location");
//
// assertEquals("Wrong number of admin GUI configs", 1, evaluatedAssignment.getAdminGuiConfigurations().size());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType.F_ACTIVATION in project midpoint by Evolveum.
the class TestAbstractAssignmentEvaluator method test299ReenableEngineerEmployeeInducement.
@Test(enabled = false)
public void test299ReenableEngineerEmployeeInducement() throws Exception {
final String TEST_NAME = "test299ReenableEngineerEmployeeInducement";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestAssignmentEvaluator.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// disable Engineer->Employee inducement
ObjectDelta enableInducementDelta = DeltaBuilder.deltaFor(RoleType.class, prismContext).item(RoleType.F_INDUCEMENT, 3, F_ACTIVATION, F_ADMINISTRATIVE_STATUS).replace(ActivationStatusType.DISABLED).asObjectDelta(ROLE_CORP_ENGINEER_OID);
modelService.executeChanges(Collections.singletonList(enableInducementDelta), null, task, result);
}
Aggregations