Package org.apache.commons.jxpath

Examples of org.apache.commons.jxpath.JXPathContext


        throws ConfigurationException {

        if (contextObj == null)
            return null;
        try {
            JXPathContext jxContext = JXPathContext.newContext(contextObj);
            setupExtensions(setup, jxContext, modeConf);
            if (setup.isLenient())
                jxContext.setLenient(true); // return null insted of exception on non existing property
            Object obj = jxContext.getValue(name);
            return obj;
        } catch (Exception e) {
            throw new ConfigurationException("Module does not support <" + name + ">" + "attribute.", e);
        }
    }
View Full Code Here


        throws ConfigurationException {
           
        if (contextObj == null)
            return null;
        try {
            JXPathContext jxContext = JXPathContext.newContext(contextObj);
            List values = null;
            setupExtensions(setup, jxContext, modeConf);
            if (setup.isLenient())
                jxContext.setLenient(true); // return null insted of exception on non existing property
            Iterator i = jxContext.iterate(name);
            if (i.hasNext()) {
                values = new LinkedList();
            }
            while (i.hasNext()) {
                values.add(i.next());
View Full Code Here

            // get the layout
            final Object layout = portalService.getComponentManager().getProfileManager().getPortalLayout(layoutKey, layoutId);
            Object value = layout;
            if ( layout != null && path != null ) {
                final JXPathContext jxpathContext = JXPathContext.newContext(layout);
                value = jxpathContext.getValue(path);
            }
            return value;
           
        } catch (ServiceException e) {
            throw new ConfigurationException("ServiceException ", e);
View Full Code Here

           
            // return the coplet id
            if ( name.equals("#") ) {
                return copletId;
            }
            JXPathContext jxpathContext = JXPathContext.newContext(portalService.getComponentManager().getProfileManager().getCopletInstanceData(copletId));
            Object value = jxpathContext.getValue(name);
               
            if (value == null) {
                return null;
            }
               
View Full Code Here

     * the new overloaded version of this method.
     */
    public final void loadFormFromModel(Widget frmModel, Object objModel)
            throws BindingException {
        if (objModel != null) {
            JXPathContext jxpc = makeJXPathContext(objModel);
            loadFormFromModel(frmModel, jxpc);
        } else {
            throw new NullPointerException(
                    "null object passed to loadFormFromModel() method");
        }
View Full Code Here

     * the new overloaded version of this method.
     */
    public void saveFormToModel(Widget frmModel, Object objModel)
                throws BindingException {
        if (objModel != null) {
            JXPathContext jxpc = makeJXPathContext(objModel);
            saveFormToModel(frmModel, jxpc);   
        } else {
            throw new NullPointerException(
                    "null object passed to saveFormToModel() method");
        }
View Full Code Here

            }
        }
    }

    private JXPathContext makeJXPathContext(Object objModel) {
        JXPathContext jxpc;
        if (!(objModel instanceof JXPathContext)) {
            jxpc = JXPathContext.newContext(objModel);
            jxpc.setLenient(true);
            jxpc.setFactory(new BindingJXPathFactory());
        } else {
            jxpc = (JXPathContext) objModel;
        }
        return jxpc;
    }
View Full Code Here

        if ((value == null && oldValue != null) || value != null && !value.equals(oldValue)) {
            // first update the value itself
            jxpc.createPathAndSetValue(this.xpath, value);

            // now perform any other bindings that need to be performed when the value is updated
            JXPathContext subContext = null;
            try {
                subContext = jxpc.getRelativeContext(jxpc.getPointer(this.xpath));
            } catch (JXPathException e) {
                // if the value has been set to null and the underlying model is a bean, then
                // JXPath will not be able to create a relative context
View Full Code Here

     * @param jxpc the narrowed jxpath context from the parent binding
     * @throws BindingException when the wrapped CustomBinding fails
     */
    public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
        Widget selectedWidget = selectWidget(frmModel, this.widgetId);
        JXPathContext context = jxpc.getRelativeContext(jxpc.getPointer(this.xpath));
       
        this.wrappedBinding.loadFormFromModel(selectedWidget, context);
    }   
View Full Code Here

     * @param jxpc the narrowed jxpath context from the parent binding
     * @throws BindingException when the wrapped CustomBinding fails
     */
    public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
        Widget selectedWidget = selectWidget(frmModel, this.widgetId);
        JXPathContext context = jxpc.getRelativeContext(jxpc.getPointer(this.xpath));
       
        this.wrappedBinding.saveFormToModel(selectedWidget, context);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jxpath.JXPathContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.