List of usage examples for org.apache.commons.jxpath Pointer getValue
Object getValue();
From source file:org.openvpms.archetype.function.party.PartyFunctions.java
/** * Returns the most recent weight in string format for a patient. * * @param context the expression context. Expected to reference a party or * act/*w w w. jav a 2 s . c o m*/ * @return a formatted weight , or {@code null} */ public String getPatientWeight(ExpressionContext context) { Pointer pointer = context.getContextNodePointer(); Object value = pointer.getValue(); if (value instanceof Party) { return getPatientWeight((Party) value); } else if (value instanceof Act) { return getPatientWeight((Act) value); } return null; }
From source file:org.openvpms.archetype.function.party.PartyFunctions.java
/** * Returns the Desex status of a Patient. * * @param context the expression context. Expected to reference a party or * act//from w w w. ja v a2 s.c om * @return desex status, or an empty string */ public String getPatientDesexStatus(ExpressionContext context) { Pointer pointer = context.getContextNodePointer(); Object value = pointer.getValue(); if (value instanceof Party) { return getPatientDesexStatus((Party) value); } else if (value instanceof Act) { return getPatientDesexStatus((Act) value); } return null; }
From source file:org.openvpms.archetype.function.party.PartyFunctions.java
/** * Returns the Bpay ID for a customer.// w w w .ja v a2 s .c o m * * @param context the expression context. Expected to reference a party or act * @return a Bpay ID for the customer, or {@code null} */ public String getBpayID(ExpressionContext context) { Pointer pointer = context.getContextNodePointer(); Object value = pointer.getValue(); if (value instanceof Party) { return getBpayId((Party) value); } else if (value instanceof Act) { return getBpayId((Act) value); } return null; }
From source file:org.openvpms.component.business.domain.im.common.IMObject.java
/** * This method will retrieve a reference to a value collection. If the * returned object is already an instance of a collection then it will * return it as is. If the returned object is an instance of a Map then * it will return the value objects//from ww w . java2 s. com * * @param path a xpath expression in to this object * @return Pointer * a pointer to the location */ @Deprecated public Pointer pathToCollection(String path) { Pointer ptr = pathToObject(path); if (ptr != null) { Object obj = ptr.getValue(); if (obj instanceof Map) { ptr = JXPathHelper.newContext(obj).getPointer("values(.)"); } else if (obj instanceof PropertyCollection) { ptr = JXPathHelper.newContext(obj).getPointer("values(.)"); } } return ptr; }
From source file:org.openvpms.macro.impl.MacroFunctions.java
/** * Evaluates a macro against the context object. * <p/>/*from w w w. j a v a2 s . c o m*/ * This may be used in jxpath expressions as: * <pre> * macro:eval(<name>) * </pre> * E.g: * <pre> * macro:eval('displayName') * </pre> * * @param context the expression context * @param macro the macro name * @return the result of the macro evaluation */ public String eval(ExpressionContext context, String macro) { Pointer pointer = context.getContextNodePointer(); Object value = pointer.getValue(); return eval(macro, value); }
From source file:org.paxml.el.XpathFunctions.java
/** * Check if a value matches a java class. * /*from w w w.ja v a 2 s. c o m*/ * @param context * the xpath context * @param className * the class name * @param exact * false to consider inheritance, true to only do exact class * match. * @return true if matches, false if not match */ public static boolean matchClass(ExpressionContext context, String className, boolean exact) { Pointer pointer = context.getContextNodePointer(); if (pointer == null) { return false; } Object value = pointer.getValue(); if (value == null) { return false; } if (exact) { return ReflectUtils.loadClassStrict(className, null).equals(value.getClass()); } else { return ReflectUtils.loadClassStrict(className, null).isInstance(value); } }
From source file:org.paxml.el.XpathFunctions.java
/** * Check if a value is in a collection./* w w w. ja v a 2 s . c o m*/ * * @param context * the xpath context * @param collection * comma delimited string or collection * @return true if the comma delimited string is in */ public static boolean in(ExpressionContext context, Object collection) { if (collection == null) { return false; } Pointer pointer = context.getContextNodePointer(); if (pointer == null) { return false; } Object value = pointer.getValue(); if (value == null) { return false; } if (collection instanceof Collection) { return UtilFunctions.in(value, (Collection) collection); } else { return UtilFunctions.in(value, UtilFunctions.breakString(collection.toString(), null)); } }
From source file:org.paxml.el.XpathFunctions.java
/** * Get the current node.//from w ww .j a v a 2 s .co m * * @param context * the xpath context * @return the current node, null if no current node */ public static Object current(ExpressionContext context) { Pointer pointer = context.getContextNodePointer(); if (pointer == null) { return null; } return pointer.getValue(); }
From source file:org.paxml.el.XpathFunctions.java
/** * Get the id of the current node//from w w w . j a va 2s . com * * @param obj * @return */ public static String findId(ExpressionContext context) { Pointer pointer = context.getContextNodePointer(); if (pointer == null) { return null; } Object obj = pointer.getValue(); return Context.getCurrentContext().findConstId(obj, true, true); }
From source file:org.talend.esb.sam.common.filter.impl.JxPathFilter.java
@Override public boolean filter(Event event) { JXPathContext context = JXPathContext.newContext(event); Pointer pointer = context.getPointer(expression); return (Boolean) pointer.getValue(); }