use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class SearchFilterPanel method loadFilterClause.
private String loadFilterClause(PrismContext prismContext) {
try {
T filter = getModelObject();
if (filter.containsFilterClause()) {
RootXNode clause = filter.getFilterClauseAsRootXNode();
String xml = prismContext.xmlSerializer().serialize(clause);
return WebXmlUtil.stripNamespaceDeclarations(xml);
} else {
return null;
}
} catch (SchemaException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Could not load filterClause from SearchFilterType object.", e);
// TODO - find better solution to inform user about fail in filterClause loading
return e.getMessage();
}
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class DefinitionScopeDto method loadSearchFilter.
public void loadSearchFilter(SearchFilterType searchFilterType, PrismContext prismContext) {
if (searchFilterType == null) {
return;
}
try {
RootXNode clause = searchFilterType.getFilterClauseAsRootXNode();
searchFilterText = prismContext.xmlSerializer().serialize(clause);
} catch (SchemaException e) {
throw new SystemException("Cannot serialize search filter " + searchFilterType + ": " + e.getMessage(), e);
}
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class TestBeanSerialization method testPipelineItemXsdType.
@Test
public void testPipelineItemXsdType() throws SchemaException {
PipelineDataType bean = new PipelineDataType();
bean.beginItem().value("s1");
PrismContext prismContext = PrismTestUtil.getPrismContext();
RootXNode xnode = prismContext.xnodeSerializer().root(new QName("output")).serializeRealValue(bean);
MapXNode output = (MapXNode) xnode.toMapXNode().get(new QName("output"));
XNode item = ((ListXNode) output.get(PipelineDataType.F_ITEM)).get(0);
assertTrue(item instanceof MapXNode);
XNode value = ((MapXNode) item).get(PipelineItemType.F_VALUE);
assertTrue(value instanceof PrimitiveXNodeImpl);
assertTrue(value.isExplicitTypeDeclaration());
assertEquals(value.getTypeQName(), DOMUtil.XSD_STRING);
// displayValue("output in XML", prismContext.xmlSerializer().root(new QName("output")).serializeRealValue(bean));
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class ObjectQueryUtil method dump.
public static String dump(QueryType query, @NotNull PrismContext prismContext) throws SchemaException {
if (query == null) {
return "null";
}
StringBuilder sb = new StringBuilder("Query(");
sb.append(query.getDescription()).append("):\n");
if (query.getFilter() != null && query.getFilter().containsFilterClause()) {
RootXNode clause = query.getFilter().getFilterClauseAsRootXNode();
sb.append(prismContext.xmlSerializer().serialize(clause));
} else {
sb.append("(no filter)");
}
return sb.toString();
}
use of com.evolveum.midpoint.prism.xnode.RootXNode in project midpoint by Evolveum.
the class TestParseDiffPatch method assertModificationPolyStringValue.
private void assertModificationPolyStringValue(RawType value, PolyStringType... expectedValues) throws SchemaException {
XNode xnode = value.serializeToXNode();
assertFalse(xnode.isEmpty());
PrismContext pc = value.getPrismContext();
RootXNode rootNode = pc.xnodeFactory().root(new ItemName("dummy"), xnode);
PolyStringType valueAsPoly = pc.parserFor(rootNode).parseRealValue(PolyStringType.class);
boolean found = false;
for (PolyStringType expectedValue : expectedValues) {
if (expectedValue.getOrig().equals(valueAsPoly.getOrig()) && expectedValue.getNorm().equals(valueAsPoly.getNorm())) {
found = true;
break;
}
}
assertTrue(found);
}
Aggregations