use of com.evolveum.midpoint.schema.SelectorOptions in project midpoint by Evolveum.
the class PageDebugList method deleteAllIdentitiesConfirmed.
private void deleteAllIdentitiesConfirmed(AjaxRequestTarget target, DeleteAllDto dto) {
Collection<SelectorOptions<GetOperationOptions>> options = new ArrayList<>();
GetOperationOptions opt = GetOperationOptions.createRaw();
options.add(SelectorOptions.create(ItemPath.EMPTY_PATH, opt));
OperationResult result = new OperationResult(OPERATION_LAXATIVE_DELETE);
String taskOid = null;
try {
if (dto.getDeleteUsers()) {
ObjectQuery query = createDeleteAllUsersQuery();
taskOid = deleteObjectsAsync(UserType.COMPLEX_TYPE, query, true, "Delete all users", result);
}
if (dto.getDeleteOrgs()) {
taskOid = deleteObjectsAsync(OrgType.COMPLEX_TYPE, null, true, "Delete all orgs", result);
}
if (dto.getDeleteAccountShadow()) {
taskOid = deleteAllShadowsConfirmed(result, true);
}
if (dto.getDeleteNonAccountShadow()) {
taskOid = deleteAllShadowsConfirmed(result, false);
}
} catch (Exception ex) {
result.computeStatus(getString("pageDebugList.message.laxativeProblem"));
LoggingUtils.logUnexpectedException(LOGGER, getString("pageDebugList.message.laxativeProblem"), ex);
}
if (taskOid != null) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, taskOid);
navigateToNext(PageTaskEdit.class, parameters);
} else {
navigateToNext(PageTasks.class);
}
target.add(getFeedbackPanel());
result.recomputeStatus();
showResult(result);
}
use of com.evolveum.midpoint.schema.SelectorOptions in project midpoint by Evolveum.
the class TestRoleEntitlement method test103GetGroupRaw.
@Test
public void test103GetGroupRaw() throws Exception {
final String TEST_NAME = "test103GetGroupRaw";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
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);
display("Account def", shadow.getDefinition());
PrismContainer<Containerable> accountContainer = shadow.findContainer(ShadowType.F_ATTRIBUTES);
display("Account attributes def", accountContainer.getDefinition());
display("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.schema.SelectorOptions in project midpoint by Evolveum.
the class TestRoleEntitlement method test110GetRoleResolveEntitlement.
@Test
public void test110GetRoleResolveEntitlement() throws Exception {
final String TEST_NAME = "test110GetRoleResolveEntitlement";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(UserType.F_LINK, GetOperationOptions.createResolve());
// WHEN
PrismObject<RoleType> role = modelService.getObject(RoleType.class, ROLE_PIRATE_OID, options, task, result);
RoleType roleType = role.asObjectable();
assertLinks(role, 1);
PrismReferenceValue linkRef = getSingleLinkRef(role);
assertEquals("OID mismatch in linkRefValue", groupOid, linkRef.getOid());
assertNotNull("Missing account object in linkRefValue", linkRef.getObject());
ShadowType shadow = roleType.getLink().get(0);
assertDummyGroupShadowModel(shadow.asPrismObject(), groupOid, GROUP_PIRATE_DUMMY_NAME);
result.computeStatus();
TestUtil.assertSuccess("getObject result", result);
}
use of com.evolveum.midpoint.schema.SelectorOptions in project midpoint by Evolveum.
the class TestRoleEntitlement method test111GetRoleResolveEntitlement.
@Test
public void test111GetRoleResolveEntitlement() throws Exception {
final String TEST_NAME = "test111GetRoleResolveEntitlement";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestRoleEntitlement.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.POSITIVE);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createResolve(), new ItemPath(UserType.F_LINK), new ItemPath(UserType.F_LINK, ShadowType.F_RESOURCE));
// WHEN
PrismObject<RoleType> role = modelService.getObject(RoleType.class, ROLE_PIRATE_OID, options, task, result);
RoleType roleType = role.asObjectable();
assertLinks(role, 1);
PrismReferenceValue linkRef = getSingleLinkRef(role);
assertEquals("OID mismatch in linkRefValue", groupOid, linkRef.getOid());
assertNotNull("Missing account object in linkRefValue", linkRef.getObject());
ShadowType shadow = roleType.getLink().get(0);
assertDummyGroupShadowModel(shadow.asPrismObject(), groupOid, GROUP_PIRATE_DUMMY_NAME);
assertNotNull("Resource in account was not resolved", shadow.getResource());
result.computeStatus();
TestUtil.assertSuccess("getObject result", result);
}
use of com.evolveum.midpoint.schema.SelectorOptions in project midpoint by Evolveum.
the class AbstractManualResourceTest method test108GetAccountWillFuture.
@Test
public void test108GetAccountWillFuture() throws Exception {
final String TEST_NAME = "test108GetAccountWillFuture";
displayTestTile(TEST_NAME);
// GIVEN
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(GetOperationOptions.createPointInTimeType(PointInTimeType.FUTURE));
// WHEN
displayWhen(TEST_NAME);
PrismObject<ShadowType> shadowModel = modelService.getObject(ShadowType.class, accountWillOid, options, task, result);
// THEN
displayThen(TEST_NAME);
assertSuccess(result);
display("Model shadow", shadowModel);
ShadowType shadowTypeProvisioning = shadowModel.asObjectable();
assertShadowName(shadowModel, USER_WILL_NAME);
assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeProvisioning.getKind());
assertAttribute(shadowModel, ATTR_USERNAME_QNAME, USER_WILL_NAME);
assertAttribute(shadowModel, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
assertAttributeFromBackingStore(shadowModel, ATTR_DESCRIPTION_QNAME, ACCOUNT_WILL_DESCRIPTION_MANUAL);
assertShadowActivationAdministrativeStatus(shadowModel, ActivationStatusType.ENABLED);
assertShadowExists(shadowModel, true);
// TODO
// assertShadowPassword(shadowProvisioning);
PrismObject<ShadowType> shadowRepo = repositoryService.getObject(ShadowType.class, accountWillOid, null, result);
display("Repo shadow", shadowRepo);
assertSinglePendingOperation(shadowRepo, accountWillReqestTimestampStart, accountWillReqestTimestampEnd);
assertAttribute(shadowRepo, ATTR_USERNAME_QNAME, USER_WILL_NAME);
assertAttributeFromCache(shadowRepo, ATTR_FULLNAME_QNAME, USER_WILL_FULL_NAME);
assertNoAttribute(shadowRepo, ATTR_DESCRIPTION_QNAME);
assertShadowActivationAdministrativeStatusFromCache(shadowRepo, ActivationStatusType.ENABLED);
assertNoShadowPassword(shadowRepo);
assertShadowExists(shadowRepo, supportsBackingStore());
}
Aggregations