use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType in project midpoint by Evolveum.
the class LookupTableTest method test100AddTableNonOverwrite.
@Test
public void test100AddTableNonOverwrite() throws Exception {
PrismObject<LookupTableType> table = prismContext.parseObject(new File(TEST_DIR, "table-0.xml"));
OperationResult result = new OperationResult("test100AddTableNonOverwrite");
tableOid = repositoryService.addObject(table, null, result);
result.recomputeStatus();
assertTrue(result.isSuccess());
// rereading
PrismObject<LookupTableType> expected = prismContext.parseObject(new File(TEST_DIR, "table-0.xml"));
checkTable(tableOid, expected, result);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType in project midpoint by Evolveum.
the class QLookupTableMapping method appendLookupTableRows.
private void appendLookupTableRows(UUID ownerOid, LookupTableType base, GetOperationOptions rowOptions, JdbcSession session) {
try {
RelationalValueSearchQuery queryDef = rowOptions == null ? null : rowOptions.getRelationalValueSearchQuery();
QLookupTableRowMapping rowMapping = QLookupTableRowMapping.get();
QLookupTableRow alias = rowMapping.defaultAlias();
BooleanExpression whereQuery = appendConditions(alias, alias.ownerOid.eq(ownerOid), queryDef);
SQLQuery<MLookupTableRow> query = session.newQuery().from(alias).select(alias).where(whereQuery);
query = pagingAndOrdering(query, queryDef, rowMapping, alias);
List<MLookupTableRow> result = query.fetch();
for (MLookupTableRow r : result) {
LookupTableRowType lookupRow = new LookupTableRowType().key(r.key);
if (r.labelOrig != null || r.labelNorm != null) {
lookupRow.label(PolyString.toPolyStringType(new PolyString(r.labelOrig, r.labelNorm)));
}
lookupRow.lastChangeTimestamp(MiscUtil.asXMLGregorianCalendar(r.lastChangeTimestamp));
lookupRow.value(r.value);
lookupRow.asPrismContainerValue().setId(r.cid);
base.getRow().add(lookupRow);
}
} catch (QueryException e) {
throw new SystemException("Unable to fetch nested table rows", e);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType in project midpoint by Evolveum.
the class RLookupTable method copyFromJAXB.
// dynamically called
public static void copyFromJAXB(LookupTableType jaxb, RLookupTable repo, RepositoryContext repositoryContext, IdGeneratorResult generatorResult) throws DtoTranslationException, SchemaException {
copyAssignmentHolderInformationFromJAXB(jaxb, repo, repositoryContext, generatorResult);
repo.setNameCopy(RPolyString.copyFromJAXB(jaxb.getName()));
List<LookupTableRowType> rows = jaxb.getRow();
if (!rows.isEmpty()) {
repo.setRows(new HashSet<>());
for (LookupTableRowType row : rows) {
RLookupTableRow rRow = RLookupTableRow.toRepo(repo, row);
rRow.setTransient(generatorResult.isTransient(row.asPrismContainerValue()));
repo.getRows().add(rRow);
}
}
}
Aggregations