package org.smartframework.common;


import java.util.Map;

public class NamedQuery {
    private String where;
    private String name;
    private String label;
    private boolean isAppend;
    private Object[] paramValues;
    private String[] paramNames;
    private boolean isInvokeMethod;

    public NamedQuery(String name) {
        this.name = name;
    }

    public NamedQuery(String name, String where) {
        this.name = name;
        this.where = where;
    }

    public NamedQuery(String name, String label, String where) {
        this.name = name;
        this.label = label;
        this.where = where;
    }

    public NamedQuery(String name, boolean isInvokeMethod) {
        this.name = name;
        this.isInvokeMethod = isInvokeMethod;
    }

    public String getWhere() {
        return this.where;
    }

    public void setWhere(String where) {
        this.where = where;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLabel() {
        return this.label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public boolean isAppend() {
        return this.isAppend;
    }

    public void setAppend(boolean isAppend) {
        this.isAppend = isAppend;
    }

    public Object[] buildParamValues(Map paramMap) {
        if(this.paramNames != null) {
            this.paramValues = new Object[this.paramNames.length];

            for(int i = 0; i < this.paramNames.length; ++i) {
                this.paramValues[i] = paramMap.get(this.paramNames[i]);
            }
        }

        return this.paramValues;
    }

    public Object[] getParamValues() {
        return this.paramValues;
    }

    public void setParamValues(Object[] paramValues) {
        this.paramValues = paramValues;
    }

    public String[] getParamNames() {
        return this.paramNames;
    }

    public void setParamNames(String[] paramNames) {
        this.paramNames = paramNames;
    }

    public boolean isInvokeMethod() {
        return this.isInvokeMethod;
    }

    public void setInvokeMethod(boolean isInvokeMethod) {
        this.isInvokeMethod = isInvokeMethod;
    }
}