Package dk.brics.jwig.persistence

Examples of dk.brics.jwig.persistence.Querier


     */
    public WebApp() {
        super();
        configuration = new Config();
        WebSite webSite = getWebSite();
        Querier querier;
        if (webSite != null) {
            querier = webSite.getQuerier();
        } else {
            querier = new FailingQuerier();
        }
View Full Code Here


     * Finds a persistable object via the persistable querier.
     */
    private Object getPersistable(Object actual,
            Class<? extends Persistable> type, String parameterName) {
        Class<? extends Persistable> ptype = type.asSubclass(Persistable.class);
        Querier querier = ThreadContext.getWebSite().getQuerier();
        int id = -1;
        Method p = findQueryMethod(ptype);
        if ("".equals(actual)) {
            return null;
        }
        if (p != null) {
            String name = p.getName();
            name = name.substring(3, 4).toLowerCase() + name.substring(4);
            id = querier.getIdFromProperty(ptype, name, (String) actual);
        } else {
            try {
                id = Integer.parseInt(String.valueOf(actual));
            } catch (NumberFormatException e) {
                throw new BadRequestException(String.format("Expected '%s' to be an integer, but it was %s", parameterName, actual));
            }
        }
        return querier.getObject(ptype, id);
    }
View Full Code Here

TOP

Related Classes of dk.brics.jwig.persistence.Querier

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.