use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class ModelDiagController method repositorySelfTestLookupTable.
private void repositorySelfTestLookupTable(Task task, OperationResult testResult) {
OperationResult result = testResult.createSubresult(REPOSITORY_SELF_TEST_LOOKUP_TABLE);
PrismObject<LookupTableType> lookupTable;
try {
lookupTable = getObjectDefinition(LookupTableType.class).instantiate();
} catch (SchemaException e) {
result.recordFatalError(e);
return;
}
LookupTableType lookupTableType = lookupTable.asObjectable();
String name = generateRandomName();
PolyStringType namePolyStringType = toPolyStringType(name);
lookupTableType.setName(namePolyStringType);
result.addContext("name", name);
lookupTableType.setDescription(SelfTestData.POLICIJA);
LookupTableRowType rowType = new LookupTableRowType(prismContext);
rowType.setKey(INSANE_NATIONAL_STRING);
rowType.setValue(INSANE_NATIONAL_STRING);
rowType.setLabel(toPolyStringType(INSANE_NATIONAL_STRING));
lookupTableType.getRow().add(rowType);
String oid;
try {
oid = repositoryService.addObject(lookupTable, null, result);
} catch (ObjectAlreadyExistsException | SchemaException | RuntimeException e) {
result.recordFatalError(e);
return;
}
try {
{
OperationResult subresult = result.createSubresult(result.getOperation() + ".getObject");
PrismObject<LookupTableType> lookupTableRetrieved;
try {
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(LookupTableType.F_ROW, GetOperationOptions.createRetrieve());
lookupTableRetrieved = repositoryService.getObject(LookupTableType.class, oid, options, subresult);
} catch (ObjectNotFoundException | SchemaException | RuntimeException e) {
result.recordFatalError(e);
return;
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Self-test:lookupTable getObject:\n{}", lookupTableRetrieved.debugDump());
}
checkLookupTable(lookupTableRetrieved, name, subresult);
subresult.recordSuccessIfUnknown();
}
{
OperationResult subresult = result.createSubresult(result.getOperation() + ".getObject.key");
try {
RelationalValueSearchQuery subquery = new RelationalValueSearchQuery(LookupTableRowType.F_KEY, INSANE_NATIONAL_STRING, RelationalValueSearchType.EXACT);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(LookupTableType.F_ROW, GetOperationOptions.createRetrieve(subquery));
PrismObject<LookupTableType> lookupTableRetrieved = repositoryService.getObject(LookupTableType.class, oid, options, result);
subresult.addParam("subquery", subquery);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Self-test:lookupTable getObject by row key:\n{}", DebugUtil.debugDump(lookupTableRetrieved));
}
checkLookupTable(lookupTableRetrieved, name, subresult);
subresult.recordSuccessIfUnknown();
} catch (ObjectNotFoundException | SchemaException | RuntimeException e) {
subresult.recordFatalError(e);
return;
}
}
} finally {
try {
repositoryService.deleteObject(LookupTableType.class, oid, testResult);
} catch (ObjectNotFoundException | RuntimeException e) {
result.recordFatalError(e);
return;
}
result.computeStatus();
}
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class MidpointFunctionsImpl method createEmptyObjectWithName.
@Override
public <T extends ObjectType> T createEmptyObjectWithName(Class<T> type, PolyString name) throws SchemaException {
T objectType = createEmptyObject(type);
objectType.setName(new PolyStringType(name));
return objectType;
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class MidpointFunctionsImpl method createEmptyObjectWithName.
@Override
public <T extends ObjectType> T createEmptyObjectWithName(Class<T> type, String name) throws SchemaException {
T objectType = createEmptyObject(type);
objectType.setName(new PolyStringType(name));
return objectType;
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class ModelDiagController method toPolyStringType.
private PolyStringType toPolyStringType(String orig) {
PolyStringType polyStringType = new PolyStringType();
polyStringType.setOrig(orig);
return polyStringType;
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class TestOrgStructMeta method assertUserOrg.
@Override
protected void assertUserOrg(PrismObject<UserType> user, String... orgOids) throws Exception {
super.assertUserOrg(user, orgOids);
List<PolyStringType> userOrganizations = user.asObjectable().getOrganization();
List<PolyStringType> expextedOrgs = new ArrayList<PolyStringType>();
for (String orgOid : orgOids) {
PrismObject<OrgType> org = getObject(OrgType.class, orgOid);
List<String> orgType = org.asObjectable().getOrgType();
if (orgType.contains("functional")) {
PolyStringType orgName = org.asObjectable().getName();
assertTrue("Value " + orgName + " not found in user organization property: " + userOrganizations, userOrganizations.contains(orgName));
if (!expextedOrgs.contains(orgName)) {
expextedOrgs.add(orgName);
}
}
}
assertEquals("Wrong number of user organization property values: " + userOrganizations, expextedOrgs.size(), userOrganizations.size());
}
Aggregations