private void writeState(XmlSerializer serializer, Node<?> node) throws IOException { Entity parent = node.getParent(); if (parent != null) { State s = parent.getChildState(node.getName()); int state = s.intValue(); if (state > 0) { serializer.attribute(null, STATE_ATTRIBUTE, Integer.toString(state)); } } }
private Object extractNonEmptyChildren(String propertyName, Entity entity) { List<Node<?>> list = new ArrayList<Node<?>>(); for (Node<?> childNode : entity.getAll(propertyName)) { if (childNode instanceof Entity || (!childNode.isEmpty())) { list.add(childNode); } } if (list.isEmpty()) { return null; } return Collections.unmodifiableList(list); }
private Object evaluateExpression(Node<?> context, Node<?> thisNode, String expr) throws InvalidExpressionException { ExpressionFactory expressionFactory = context.getRecord().getSurveyContext().getExpressionFactory(); DefaultValueExpression expression = expressionFactory.createDefaultValueExpression(expr); Object object = expression.evaluate(context, thisNode); return object; }