Package com.javaeye.jert.domain.query

Examples of com.javaeye.jert.domain.query.QueryParameter


        assertEquals("age1", query.getParameterNames().get(0));
        assertEquals("age2", query.getParameterNames().get(1));

        assertEquals("select * from user_impl where 1 = 1", query.getSql(null));

        QueryParameter p1 = new QueryParameter(new ParameterDefinition("age1"));
        QueryParameter p2 = new QueryParameter(new ParameterDefinition("age2"));
        p1.setValue("30");
        p2.setValue("");
       
        assertEquals("select * from user_impl where 1 = 1 and age > ?", query.getSql(new QueryParameter[] { p1, p2 }));

        p2.setValue("50");
        assertEquals("select * from user_impl where 1 = 1 and age > ? and age < ?", query.getSql(new QueryParameter[] { p1, p2 }));

    }
View Full Code Here


    }

    public QueryParameter[] getDefaultQueryParameters() {
        QueryParameter[] result = new QueryParameter[getParameterDefinitions().size()];
        for (int i = 0; i < getParameterDefinitions().size(); i++) {
            result[i] = new QueryParameter((ParameterDefinition) getParameterDefinitions().get(i));
        }
        return result;
    }
View Full Code Here

   
    //TODO can we move this validation to the xwork validate framework?
    protected boolean isValidateParameters() {
        boolean pass = true;
        for (int i = 0; i < parameters.length; i++) {
            QueryParameter parameter = parameters[i];
            if(!parameter.getParameterDefinition().isOptional() && parameter.getQueryValue() == null){
                addActionError(parameter.getParameterDefinition().getName() + " is required");
                //addFieldError("parameters[" + i + "].value", "required");
                pass = false;
            }
        }
        return pass;
View Full Code Here

    private String generateQueryString() {
        StringBuffer result = new StringBuffer();
        result.append("reportDefinitionId=").append(reportDefinitionId);
        for (int i = 0; i < parameters.length; i++) {
            QueryParameter p = parameters[i];
            result.append("&parameters[").append(i).append("].value=").append(p.getValue());
        }
        return result.toString();
    }
View Full Code Here

TOP

Related Classes of com.javaeye.jert.domain.query.QueryParameter

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.