Search in sources :

Example 41 with LookupTableType

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);
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) File(java.io.File) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) Test(org.testng.annotations.Test)

Example 42 with LookupTableType

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);
    }
}
Also used : BooleanExpression(com.querydsl.core.types.dsl.BooleanExpression) QueryException(com.evolveum.midpoint.repo.sqlbase.QueryException) SystemException(com.evolveum.midpoint.util.exception.SystemException) RelationalValueSearchQuery(com.evolveum.midpoint.schema.RelationalValueSearchQuery) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) LookupTableRowType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType)

Example 43 with LookupTableType

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);
        }
    }
}
Also used : RLookupTableRow(com.evolveum.midpoint.repo.sql.data.common.other.RLookupTableRow) LookupTableRowType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType)

Aggregations

LookupTableType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType)39 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)27 Test (org.testng.annotations.Test)26 SqaleRepoBaseTest (com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)22 LookupTableRowType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType)16 GetOperationOptionsBuilder (com.evolveum.midpoint.schema.GetOperationOptionsBuilder)9 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)5 List (java.util.List)5 IModel (org.apache.wicket.model.IModel)5 PropertyModel (org.apache.wicket.model.PropertyModel)5 AutoCompleteTextPanel (com.evolveum.midpoint.gui.api.component.autocomplete.AutoCompleteTextPanel)4 InputPanel (com.evolveum.midpoint.web.component.prism.InputPanel)4 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)4 File (java.io.File)3 ArrayList (java.util.ArrayList)3 Component (org.apache.wicket.Component)3 GetOperationOptions (com.evolveum.midpoint.schema.GetOperationOptions)2 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)2 DisplayableValue (com.evolveum.midpoint.util.DisplayableValue)2 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)2