Package org.apdplat.platform.criteria

Examples of org.apdplat.platform.criteria.PropertyCriteria


     * @param code 数据字典编码
     * @return 数据字典项
     */
    public DicItem getDicItemByCode(String dicEnglish,String code){
        LOG.debug("根据 数据字典英文名称 ["+dicEnglish+"] 以及 数据字典编码 ["+code+"] 查找 数据字典项");
        PropertyCriteria propertyCriteria=new PropertyCriteria(Criteria.and);
        propertyCriteria.addPropertyEditor(new PropertyEditor("dic.english",Operator.eq,dicEnglish));
        propertyCriteria.addPropertyEditor(new PropertyEditor("code",Operator.eq,"String",code));

        List<DicItem> page=serviceFacade.query(DicItem.class, null, propertyCriteria).getModels();
        if(page.size() != 1){
            return null;
        }
View Full Code Here


    private ServiceFacade serviceFacade;
   
    public Dic getRootDic(){
        PropertyEditor propertyEditor=new PropertyEditor("english",Operator.eq,"root");

        PropertyCriteria propertyCriteria=new PropertyCriteria();
        propertyCriteria.addPropertyEditor(propertyEditor);

        List<Dic> dics = serviceFacade.query(Dic.class, null, propertyCriteria).getModels();
        if(dics!=null && dics.size()==1){
            return dics.get(0);
        }
View Full Code Here

    private ServiceFacade serviceFacade;

    public Module getRootModule() {
        PropertyEditor propertyEditor = new PropertyEditor("english", Operator.eq, "root");

        PropertyCriteria propertyCriteria = new PropertyCriteria();
        propertyCriteria.addPropertyEditor(propertyEditor);

        List<Module> roots = serviceFacade.query(Module.class, null, propertyCriteria).getModels();
        if(roots!=null && roots.size()==1){
            return roots.get(0);
        }
View Full Code Here

    }

    public Dic getDic(String english){
        PropertyEditor propertyEditor=new PropertyEditor("english",Operator.eq,english);

        PropertyCriteria propertyCriteria=new PropertyCriteria();
        propertyCriteria.addPropertyEditor(propertyEditor);

        List<Dic> page=serviceFacade.query(Dic.class, null, propertyCriteria).getModels();
        if(page.isEmpty()){
            return null;
        }
View Full Code Here

    }

    public Dic getDic(int id){
        PropertyEditor propertyEditor=new PropertyEditor("id",Operator.eq,Integer.toString(id));

        PropertyCriteria propertyCriteria=new PropertyCriteria();
        propertyCriteria.addPropertyEditor(propertyEditor);

        List<Dic> page=serviceFacade.query(Dic.class, null, propertyCriteria).getModels();
        if(page.isEmpty()){
            LOG.error("没有找到ID等于"+id+"的字典");
            return null;
View Full Code Here

    }

    public Module getModule(String english) {
        PropertyEditor propertyEditor = new PropertyEditor("english", Operator.eq, english);

        PropertyCriteria propertyCriteria = new PropertyCriteria();
        propertyCriteria.addPropertyEditor(propertyEditor);

        List<Module> page = serviceFacade.query(Module.class, null, propertyCriteria).getModels();
        if (page.isEmpty()) {
            return null;
        }
View Full Code Here

    }

    public Module getModule(int id) {
        PropertyEditor propertyEditor = new PropertyEditor("id", Operator.eq, Integer.toString(id));

        PropertyCriteria propertyCriteria = new PropertyCriteria();
        propertyCriteria.addPropertyEditor(propertyEditor);

        List<Module> page = serviceFacade.query(Module.class, null, propertyCriteria).getModels();
        if (page.isEmpty()) {
            LOG.error("没有找到ID等于" + id + "的模块");
            return null;
View Full Code Here

    //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;
    }
View Full Code Here

        json.append("]");

        return json.toString();
    }
    public Position getRootPosition(){
        PropertyCriteria propertyCriteria = new PropertyCriteria(Criteria.or);
        propertyCriteria.addPropertyEditor(new PropertyEditor("positionName", Operator.eq, "String","岗位"));
        Page<Position> page = serviceFacade.query(Position.class, null, propertyCriteria);
        if (page.getTotalRecords() == 1) {
            return page.getModels().get(0);
        }
        return null;
View Full Code Here

        json.append("]");

        return json.toString();
    }
    public Org getRootOrg(){
        PropertyCriteria propertyCriteria = new PropertyCriteria(Criteria.or);
        propertyCriteria.addPropertyEditor(new PropertyEditor("orgName", Operator.eq, "String","组织架构"));
        Page<Org> page = serviceFacade.query(Org.class, null, propertyCriteria);
        if (page.getTotalRecords() == 1) {
            return page.getModels().get(0);
        }
        return null;
View Full Code Here

TOP

Related Classes of org.apdplat.platform.criteria.PropertyCriteria

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.