Package org.apache.cocoon.precept

Examples of org.apache.cocoon.precept.Instance


    }


    final protected Instance createInstance(String id) throws ComponentException {
        InstanceFactory factory = (InstanceFactory) manager.lookup(InstanceFactory.ROLE);
        Instance instance = factory.createInstance(id);
        manager.release(factory);
        return (instance);
    }
View Full Code Here


    final protected void populate(Map objectModel, String instanceId, String xpath) throws PreceptorViolationException, InvalidXPathSyntaxException {
        Request request = ObjectModelHelper.getRequest(objectModel);
        Session session = request.getSession(false);
        if (session != null) {
            Instance instance = (Instance) session.getAttribute(instanceId);
            if (instance != null) {
                String value = request.getParameter(xpath);
                //String[] values = request.getParameterValues(xpath);

                if (value == null) value = "false";

                getLogger().debug("populating into " + String.valueOf(xpath) + " = " + String.valueOf(value));

                instance.setValue(xpath, value);
            }
        }
    }
View Full Code Here

        }
    }


    final protected Collection validate(Map objectModel, String instanceId) throws InvalidXPathSyntaxException, NoSuchNodeException {
        Instance instance = getInstance(objectModel, instanceId);
        Preceptor preceptor = instance.getPreceptor();
        Collection violations = preceptor.validate(instance, null);
        return (violations);
    }
View Full Code Here

        return (violations);
    }


    final protected Collection validate(Map objectModel, String instanceId, String xpath) throws InvalidXPathSyntaxException, NoSuchNodeException {
        Instance instance = getInstance(objectModel, instanceId);
        Preceptor preceptor = instance.getPreceptor();
        Collection violations = preceptor.validate(instance, xpath, null);
        return (violations);
    }
View Full Code Here

        }
    }


    final protected Collection validate(Map objectModel, String instanceId, String[] xpaths) throws InvalidXPathSyntaxException, NoSuchNodeException {
        Instance instance = getInstance(objectModel, instanceId);
        Preceptor preceptor = instance.getPreceptor();
        ArrayList allErrors = null;
        for (int i = 0; i < xpaths.length; i++) {
            Collection errors = preceptor.validate(instance, xpaths[i], null);
            if (errors != null) {
                if (allErrors == null) allErrors = new ArrayList(1);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.precept.Instance

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.