Search in sources :

Example 21 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 22 with LookupTableType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType in project midpoint by Evolveum.

the class SearchItemPanel method createPopoverFragment.

private SearchPopupPanel createPopoverFragment(IModel<DisplayableValue> data) {
    SearchPopupPanel popup;
    SearchItem item = getModelObject();
    IModel<? extends List> choices = null;
    switch(item.getType()) {
        case BROWSER:
            popup = new BrowserPopupPanel(ID_VALUE, data);
            break;
        case BOOLEAN:
            choices = createBooleanChoices();
        case ENUM:
            if (choices == null) {
                choices = new Model((Serializable) item.getAllowedValues());
            }
            popup = new ComboPopupPanel(ID_VALUE, data, choices);
            break;
        case TEXT:
        default:
            PrismObject<LookupTableType> lookupTable = findLookupTable(item.getDefinition());
            popup = new TextPopupPanel(ID_VALUE, data, lookupTable);
    }
    return popup;
}
Also used : Serializable(java.io.Serializable) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType)

Example 23 with LookupTableType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType in project midpoint by Evolveum.

the class RunReportPopupPanel method createTypedInputPanel.

private InputPanel createTypedInputPanel(String componentId, IModel<JasperReportValueDto> model, String expression, JasperReportParameterDto param) {
    InputPanel panel;
    Class<?> type;
    try {
        if (param.isMultiValue()) {
            type = param.getNestedType();
        } else {
            type = param.getType();
        }
    } catch (ClassNotFoundException e) {
        getSession().error("Could not find parameter type definition. Check the configuration.");
        throw new RestartResponseException(getPageBase());
    }
    if (type.isEnum()) {
        panel = WebComponentUtil.createEnumPanel(type, componentId, new PropertyModel<>(model, expression), this);
    } else if (XMLGregorianCalendar.class.isAssignableFrom(type)) {
        panel = new DatePanel(componentId, new PropertyModel<>(model, expression));
    } else if (param.getProperties() != null && param.getProperties().getTargetType() != null) {
        // render autocomplete box
        LookupTableType lookup = new LookupTableType();
        panel = new AutoCompleteTextPanel<String>(componentId, new LookupPropertyModel<>(model, expression, lookup, false), String.class) {

            @Override
            public Iterator<String> getIterator(String input) {
                return prepareAutoCompleteList(input, lookup, param).iterator();
            }
        };
    } else {
        panel = new TextPanel<>(componentId, new PropertyModel<>(model, expression), type);
    }
    List<FormComponent> components = panel.getFormComponents();
    for (FormComponent component : components) {
        component.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    }
    panel.setOutputMarkupId(true);
    return panel;
}
Also used : FormComponent(org.apache.wicket.markup.html.form.FormComponent) InputPanel(com.evolveum.midpoint.web.component.prism.InputPanel) LookupPropertyModel(com.evolveum.midpoint.web.model.LookupPropertyModel) PropertyModel(org.apache.wicket.model.PropertyModel) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) RestartResponseException(org.apache.wicket.RestartResponseException) DatePanel(com.evolveum.midpoint.web.component.input.DatePanel) Iterator(java.util.Iterator) LookupPropertyModel(com.evolveum.midpoint.web.model.LookupPropertyModel) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType)

Example 24 with LookupTableType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType in project midpoint by Evolveum.

the class TestEditSchema method test140LookupLanguagesGetByIdExisting.

/**
     * This test is disabled because id-based searching is not available yet (and it's unclear if it would be eventually necessary).
     */
@Test(enabled = false)
public void test140LookupLanguagesGetByIdExisting() throws Exception {
    final String TEST_NAME = "test140LookupLanguagesGetByIdExisting";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(new ItemPath(new NameItemPathSegment(LookupTableType.F_ROW), new IdItemPathSegment(1L)), GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE));
    PrismObject<LookupTableType> lookup = modelService.getObject(LookupTableType.class, LOOKUP_LANGUAGES_OID, options, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    checkLookupResult(lookup, new String[] { "en_US", "en", "English (US)" });
}
Also used : Task(com.evolveum.midpoint.task.api.Task) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) IdItemPathSegment(com.evolveum.midpoint.prism.path.IdItemPathSegment) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) NameItemPathSegment(com.evolveum.midpoint.prism.path.NameItemPathSegment) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 25 with LookupTableType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType in project midpoint by Evolveum.

the class TestEditSchema method test164LookupLanguagesDeleteRowFullId.

@Test
public void test164LookupLanguagesDeleteRowFullId() throws Exception {
    final String TEST_NAME = "test164LookupLanguagesDeleteRowFullId";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    LookupTableRowType row = new LookupTableRowType();
    row.setKey("en_US");
    row.setValue("en");
    row.setLabel(PrismTestUtil.createPolyStringType("English (US)"));
    row.setId(1L);
    ObjectDelta<LookupTableType> delta = ObjectDelta.createModificationDeleteContainer(LookupTableType.class, LOOKUP_LANGUAGES_OID, LookupTableType.F_ROW, prismContext, row);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    modelService.executeChanges(MiscSchemaUtil.createCollection(delta), null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    PrismObject<LookupTableType> lookup = getLookupTableAll(LOOKUP_LANGUAGES_OID, task, result);
    result.computeStatus();
    TestUtil.assertSuccess(result);
    IntegrationTestTools.display("Languages", lookup);
    assertEquals("Wrong lang lookup name", LOOKUP_LANGUAGES_NAME, lookup.asObjectable().getName().getOrig());
    PrismContainer<LookupTableRowType> tableContainer = lookup.findContainer(LookupTableType.F_ROW);
    assertNotNull("Table container missing", tableContainer);
    assertEquals("Unexpected table container size", 5, tableContainer.size());
    assertLookupRow(tableContainer, "en_PR", "en", "English (pirate)");
    assertLookupRow(tableContainer, "tr_TR", "tr", "Turkish");
    assertLookupRow(tableContainer, "gi_GI", "gi", "Gibberish");
    assertLookupRow(tableContainer, "gi_GO", null, "Gobbledygook");
    assertLookupRow(tableContainer, "gi_HU", "gi", "Humbug");
    assertSteadyResources();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) LookupTableRowType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType) LookupTableType(com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType) Test(org.testng.annotations.Test)

Aggregations

LookupTableType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType)33 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)27 Test (org.testng.annotations.Test)27 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)26 Task (com.evolveum.midpoint.task.api.Task)23 LookupTableRowType (com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType)17 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)10 RelationalValueSearchQuery (com.evolveum.midpoint.schema.RelationalValueSearchQuery)9 ObjectPaging (com.evolveum.midpoint.prism.query.ObjectPaging)3 File (java.io.File)3 RLookupTableRow (com.evolveum.midpoint.repo.sql.data.common.other.RLookupTableRow)2 PropertyModel (org.apache.wicket.model.PropertyModel)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 ModelExecuteOptions (com.evolveum.midpoint.model.api.ModelExecuteOptions)1 PrismContext (com.evolveum.midpoint.prism.PrismContext)1 IdItemPathSegment (com.evolveum.midpoint.prism.path.IdItemPathSegment)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 NameItemPathSegment (com.evolveum.midpoint.prism.path.NameItemPathSegment)1 RepoModifyOptions (com.evolveum.midpoint.repo.api.RepoModifyOptions)1 GetOperationOptions (com.evolveum.midpoint.schema.GetOperationOptions)1