Package org.apdplat.platform.criteria

Examples of org.apdplat.platform.criteria.PropertyEditor


    private String dealWithSubPropertyEditor(PropertyEditor propertyEditor,int level){
            StringBuilder wherejpql=new StringBuilder();
            List<PropertyEditor> subPropertyEditor=propertyEditor.getSubPropertyEditor();
            wherejpql.append(" ( ");
            for (int j=0;j<subPropertyEditor.size();j++) {
                PropertyEditor sub = subPropertyEditor.get(j);
                List<PropertyEditor> ss=sub.getSubPropertyEditor();
                //当没有子属性的时候时,属性编辑器本身才是有效的,否则他就是子属性的一个容器而已
                if(ss!=null && !ss.isEmpty()){
                    wherejpql.append(dealWithSubPropertyEditor(sub,++level));
                }
                else{
                    wherejpql.append(" o.").append(sub.getProperty().getName()).append(" ").append(sub.getPropertyOperator().getSymbol()).append(" ")
                            .append(":")
                            .append(sub.getProperty().getNameParameter())
                            .append("_")
                            .append(level)
                            .append("_")
                            .append(j);
                }
View Full Code Here


            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

            String par = (String) pars.nextElement();
            if (par.startsWith("model.")) {
                String fieldName = par.replace("model.", "");
                String value = getRequestParameterValue(par);
                //这里应该有类型转换和合法性校验
                PropertyEditor propertyEditor = new PropertyEditor(fieldName, Operator.eq, value);
                Class<?> fieldType = ReflectionUtils.getDeclaredField(model, fieldName).getType();
                Object fieldValue;
                if (fieldType != propertyEditor.getPropertyType().getValue()) {
                    LOG.debug(fieldType + "!=" + propertyEditor.getPropertyType().getValue());
                    fieldValue = propertyEditor.getProperty().getValue().toString();
                } else {
                    fieldValue = propertyEditor.getProperty().getValue();
                }
                ReflectionUtils.setFieldValue(model, fieldName, fieldValue);
            }
        }
    }
View Full Code Here

        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

        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

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

            LOG.info(message);
            throw new UsernameNotFoundException(message);
        }
        /* 取得用户 */
        PropertyCriteria propertyCriteria = new PropertyCriteria(Criteria.or);
        propertyCriteria.addPropertyEditor(new PropertyEditor("username", Operator.eq, "String",username));

        //PropertyEditor sub1=new PropertyEditor(Criteria.or);
        //sub1.addSubPropertyEditor(new PropertyEditor("id", Operator.eq, 1));
        //sub1.addSubPropertyEditor(new PropertyEditor("id", Operator.eq, 2));

View Full Code Here

            //获取orgId的所有子机构的ID
            List<Integer> orgIds = OrgService.getChildIds(org);
            //加上orgId
            orgIds.add(org.getId());
           
            PropertyEditor pe = new PropertyEditor("org.id", Operator.in, PropertyType.List, orgIds);
            propertyCriteria.addPropertyEditor(pe);
        }
        return propertyCriteria;
    }   
View Full Code Here

     * @param model 模型
     */
    public void checkModel(User model){
        /* 取得用户 */
        PropertyCriteria propertyCriteria = new PropertyCriteria();
        propertyCriteria.addPropertyEditor(new PropertyEditor("username", Operator.eq, "String", model.getUsername()));
        Page<User> pape = serviceFacade.query(User.class, null, propertyCriteria);
        if(pape.getTotalRecords() > 0){
            String message = "用户名【"+model.getUsername()+"】已存在,请更换用户名";
            LOG.error(message);
            //加快内存释放
View Full Code Here

        return json.toString();
    }
    public InfoType getRootInfoType(){
        try{
            PropertyCriteria propertyCriteria = new PropertyCriteria(Criteria.or);
            propertyCriteria.addPropertyEditor(new PropertyEditor("infoTypeName", Operator.eq, "String","新闻类别"));
            Page<InfoTypeContent> page = serviceFacade.query(InfoTypeContent.class, null, propertyCriteria);
            if (page.getTotalRecords() == 1) {
                return page.getModels().get(0).getInfoType();
            }
        }catch(Exception e){
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.