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 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;
}
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;
}
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)" });
}
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();
}
Aggregations