use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class TextPopupPanel method prepareAutoCompleteList.
private List<String> prepareAutoCompleteList(String input) {
List<String> values = new ArrayList<>();
if (lookup == null || lookup.asObjectable().getRow() == null) {
return values;
}
List<LookupTableRowType> rows = new ArrayList<>();
rows.addAll(lookup.asObjectable().getRow());
Collections.sort(rows, new Comparator<LookupTableRowType>() {
@Override
public int compare(LookupTableRowType o1, LookupTableRowType o2) {
String s1 = WebComponentUtil.getOrigStringFromPoly(o1.getLabel());
String s2 = WebComponentUtil.getOrigStringFromPoly(o2.getLabel());
return String.CASE_INSENSITIVE_ORDER.compare(s1, s2);
}
});
for (LookupTableRowType row : rows) {
String rowLabel = WebComponentUtil.getOrigStringFromPoly(row.getLabel());
if (StringUtils.isEmpty(input) || rowLabel.toLowerCase().startsWith(input.toLowerCase())) {
values.add(rowLabel);
}
if (values.size() > MAX_ITEMS) {
break;
}
}
return values;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class RunReportPopupPanel method prepareAutoCompleteList.
private List<String> prepareAutoCompleteList(String input, LookupTableType lookupTable, JasperReportParameterDto param) {
List<String> values = new ArrayList<>();
if (lookupTable == null) {
return values;
}
List<LookupTableRowType> rows = createLookupTableRows(param, input);
if (rows == null) {
return values;
}
if (lookupTable.getRow() != null) {
lookupTable.getRow().addAll(rows);
}
for (LookupTableRowType row : rows) {
values.add(WebComponentUtil.getOrigStringFromPoly(row.getLabel()));
if (values.size() > AUTO_COMPLETE_BOX_SIZE) {
break;
}
}
return values;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class TestParseLookupTable method assertRow.
private void assertRow(PrismContainerValue<LookupTableRowType> tableContainerValue, String key, String value, PolyStringType label, XMLGregorianCalendar lastChangeTimestamp) {
LookupTableRowType row = tableContainerValue.asContainerable();
assertEquals("wrong key", key, row.getKey());
assertEquals("wrong value", value, row.getValue());
assertEquals("wrong label", label, row.getLabel());
assertEquals("wrong lastChangeTimestamp", lastChangeTimestamp, row.getLastChangeTimestamp());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class TestEditSchema method test170LookupLanguagesReplaceRows.
@Test
public void test170LookupLanguagesReplaceRows() throws Exception {
final String TEST_NAME = "test170LookupLanguagesReplaceRows";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
LookupTableRowType row1 = new LookupTableRowType();
row1.setKey("ja_JA");
row1.setValue("ja");
row1.setLabel(PrismTestUtil.createPolyStringType("Jabber"));
LookupTableRowType row2 = new LookupTableRowType();
row2.setKey("ja_MJ");
row2.setValue("ja");
row2.setLabel(PrismTestUtil.createPolyStringType("Mumbojumbo"));
LookupTableRowType row3 = new LookupTableRowType();
// existing key
row3.setKey("en_PR");
row3.setValue("en1");
row3.setLabel(PrismTestUtil.createPolyStringType("English (pirate1)"));
ObjectDelta<LookupTableType> delta = ObjectDelta.createModificationReplaceContainer(LookupTableType.class, LOOKUP_LANGUAGES_OID, LookupTableType.F_ROW, prismContext, row1, row2, row3);
// 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", 3, tableContainer.size());
assertLookupRow(tableContainer, "ja_JA", "ja", "Jabber");
assertLookupRow(tableContainer, "ja_MJ", "ja", "Mumbojumbo");
assertLookupRow(tableContainer, "en_PR", "en1", "English (pirate1)");
assertSteadyResources();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType in project midpoint by Evolveum.
the class TestEditSchema method test162LookupLanguagesDeleteRowFullNoId.
/**
* @throws Exception
*/
@Test
public void test162LookupLanguagesDeleteRowFullNoId() throws Exception {
final String TEST_NAME = "test162LookupLanguagesDeleteRowFullNoId";
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("sk_SK");
row.setValue("sk");
row.setLabel(PrismTestUtil.createPolyStringType("Slovak"));
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", 6, tableContainer.size());
assertLookupRow(tableContainer, "en_US", "en", "English (US)");
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