Package org.apdplat.platform.criteria

Examples of org.apdplat.platform.criteria.PropertyEditor


     * @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 static final APDPlatLogger LOG = APDPlatLoggerFactory.getAPDPlatLogger(DicService.class);
    @Resource(name="serviceFacade")
    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();
View Full Code Here

        LOG.error("有多个根词典!");
        return null;
    }

    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();
View Full Code Here

        }
        return page.get(0);
    }

    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();
View Full Code Here

    private static final APDPlatLogger LOG = APDPlatLoggerFactory.getAPDPlatLogger(ModuleService.class);
    @Resource(name = "serviceFacade")
    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();
View Full Code Here

        LOG.error("有多个根模块!");
        return null;
    }

    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();
View Full Code Here

        }
        return page.get(0);
    }

    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();
View Full Code Here

    private void bindingPropertyCriteria(Query query, PropertyCriteria propertyCriteria) {
        if (query != null && propertyCriteria != null) {
            List<PropertyEditor> propertyEditors=propertyCriteria.getPropertyEditors();
            int len=propertyEditors.size();
            for (int i=0;i<len;i++) {
                PropertyEditor propertyEditor = propertyEditors.get(i);
                List<PropertyEditor> subPropertyEditor=propertyEditor.getSubPropertyEditor();
                if(subPropertyEditor==null || subPropertyEditor.isEmpty()){
                    query.setParameter(propertyEditor.getProperty().getNameParameter(), propertyEditor.getProperty().getValue());
                }else{
                    binding(query,propertyEditor,1);
                }
            }
        }
View Full Code Here

    private void binding(Query query, PropertyEditor propertyEditor,int level) {
            List<PropertyEditor> subPropertyEditor=propertyEditor.getSubPropertyEditor();

            int l=subPropertyEditor.size();
            for(int j=0;j<l;j++){
                PropertyEditor p = subPropertyEditor.get(j);
                List<PropertyEditor> ss=p.getSubPropertyEditor();
                if(ss==null || ss.isEmpty()){
                    query.setParameter(p.getProperty().getNameParameter()+"_"+level+"_"+j, p.getProperty().getValue());
                }else{
                    binding(query,p,++level);
                }
            }
    }
View Full Code Here

            wherejpql.append(" where ");

            List<PropertyEditor> propertyEditors=propertyCriteria.getPropertyEditors();
            int len=propertyEditors.size();
            for (int i=0;i<len;i++) {
                PropertyEditor propertyEditor=propertyEditors.get(i);
                List<PropertyEditor> subPropertyEditor=propertyEditor.getSubPropertyEditor();
                //当没有子属性的时候时,属性编辑器本身才是有效的,否则他就是子属性的一个容器而已
                if(subPropertyEditor==null || subPropertyEditor.isEmpty()){
                    //判断是否支持集合查询
                    if(propertyCriteria.getCollection()!=null && propertyCriteria.getObject()!=null && propertyEditor.getProperty().getName().startsWith(propertyCriteria.getObject())){
                        wherejpql.append(" ");
                    }else{
                        wherejpql.append(" o.");
                    }
                    wherejpql.append(propertyEditor.getProperty().getName())
                            .append(" ")
                            .append(propertyEditor.getPropertyOperator().getSymbol())
                            .append(" ")
                            .append(":")
                            .append(propertyEditor.getProperty().getNameParameter());
                    if(i<len-1){
                            wherejpql.append(" ");
                            wherejpql.append(propertyCriteria.getCriteria().name());
                            wherejpql.append(" ");
                    }
View Full Code Here

TOP

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

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.