Package org.opencustomer.framework.db.util.engine

Examples of org.opencustomer.framework.db.util.engine.Restriction


                    hql.append(" OR ("+alias+".accessUser != '"+EntityAccess.Access.NONE+"' ");
                    hql.append(" AND "+alias+".ownerUser = {0})) ");
                   
                    boolean groupsAvailable = !engine.getConfiguration().getGroupProperties().isEmpty();
                   
                    this.addRestriction(new Restriction(hql.toString(), groupsAvailable, user.getId()));
                }
            }
        }
    }
View Full Code Here


                   
                    if(log.isDebugEnabled())
                        log.debug("add text criterion for "+property.getName()+": "+critValue);
                   
                    if(property.getAltName() == null) {
                        dynamicRestrictions.add(new Restriction("lower("+property.getName()+") like lower({0})", property.isGroup(), critValue));
                    } else {
                        dynamicRestrictions.add(new Restriction("(lower("+property.getName()+") like lower({0}) or ("+property.getName()+" is null and lower("+property.getAltName()+") like lower({0})))", property.isGroup(), critValue));
                    }
                }
            } else if(column.getSearch() instanceof EnumSearch) {
                EnumSearch search = (EnumSearch)column.getSearch();

                if(search.getValue() != null) {
                    dynamicRestrictions.add(new Restriction(property.getName()+" = {0}", property.isGroup(), search.getValue()));
                }
            } else if(column.getSearch() instanceof TextSelectSearch) {
                TextSelectSearch search = (TextSelectSearch)column.getSearch();
               
                if(search.isHql()) {
                    TextSelectSearch.Bean bean = search.getBeans().get(search.getValue());
                    if(bean.getHql() != null)
                        dynamicRestrictions.add(new Restriction(bean.getHql(), property.isGroup()));
                } else {
                    if(search.getValue() != null) {
                        dynamicRestrictions.add(new Restriction(property.getName()+" = {0}", property.isGroup(), search.getValue()));
                    }
                }
            } else if(column.getSearch() instanceof ListSelectSearch) {
                ListSelectSearch search = (ListSelectSearch)column.getSearch();
               
                if(search.getValue() != null)
                    dynamicRestrictions.add(new Restriction(search.getSearchProperty()+" = {0}", property.isGroup(), search.getValue()));
            } else if(column.getSearch() instanceof DateSearch) {
                DateSearch search = (DateSearch)column.getSearch();
               
                Date start = search.getValueStart();
                Date end   = search.getValueEnd();
                if(end != null) {
                    Calendar cal = GregorianCalendar.getInstance();
                    cal.setTime(end);
                    cal.add(Calendar.DAY_OF_MONTH, 1);
                    cal.add(Calendar.SECOND, -1);
                    end = cal.getTime();
                }
               
                if(start != null && end != null) {
                    dynamicRestrictions.add(new Restriction(property.getName()+" between {0} and {1}", property.isGroup(), start, end));
                } else if(start != null) {
                    dynamicRestrictions.add(new Restriction(property.getName()+" >= {0}", property.isGroup(), start));
                } else if(end != null) {
                    dynamicRestrictions.add(new Restriction(property.getName()+" <= {0}", property.isGroup(), end));
                }
            }
        }
       
        if(dynamicRestrictions.isEmpty()) {
View Full Code Here

TOP

Related Classes of org.opencustomer.framework.db.util.engine.Restriction

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.