//propertyCriteria =score:gt:30,score:lt:60,birthday:gt:1983-10-21,birthday:lt:2009-12-12
public PropertyCriteria buildPropertyCriteria() {
if (StringUtils.isBlank(propertyCriteria)) {
return null;
}
PropertyCriteria result = new PropertyCriteria();
propertyCriteria=propertyCriteria.replace(",", ",");
propertyCriteria=propertyCriteria.replace(";", ",");
propertyCriteria=propertyCriteria.replace(";", ",");
//,号用来分割属性
String[] properties = propertyCriteria.split(",");
int start=0;
//判断是否支持集合查询
if(propertyCriteria.startsWith("collection:") && properties.length>2){
String collection=properties[0].split(":")[1];
String object=properties[1].split(":")[1];
result.setCollection(collection);
result.setObject(object);
start=2;
}
for (int i=start;i<properties.length;i++) {
String prop=properties[i];
//:号用来分割属性内部的类型、属性名、操作符、属性值
String[] propInfo = prop.split(":");
if(propInfo.length!=3){
LOG.error("属性过滤器错误:"+prop);
continue;
}
PropertyEditor propertyEditor = new PropertyEditor(propInfo[0], propInfo[1], propInfo[2]);
result.addPropertyEditor(propertyEditor);
}
return result;
}