package com.fp.general.rules.query.code;

import java.util.List;

import com.fp.dto.query.QueryBean;
import com.fp.dto.query.QueryCriteria;

public class CriteriaValidator {

    public static String[] validatePercentage(QueryBean qb) {
        String resp[] = new String[2];
        resp[0] = "0";
        List<QueryCriteria> lcriteria = qb.getCriteria();
        for (QueryCriteria obj : lcriteria) {
            if ((obj.getProperty() != null) && (obj.getValue() != null) && (obj.getOperation() != null)) {
                if (obj.getValue().toString().compareTo("%") == 0) {
                    resp[1] = (String) obj.getValue();
                    return resp;
                }
            }
        }
        resp[0] = "1";
        return resp;
    }
}
