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

Examples of org.opencustomer.framework.db.util.engine.configuration.EnumSearch


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


                    builder.append("</tr>");
                    builder.append("<tr>");
                    builder.append("<td>");
                   
                    if(column.getSearch() instanceof EnumSearch) {
                        EnumSearch search = (EnumSearch)column.getSearch();

                        builder.append("<select");
                        builder.append(" name=\"search_").append(column.getPosition()).append("\"");
                        builder.append(" id=\"search_").append(column.getPosition()).append("\"");
                        builder.append(">");
                        for(Enum e : search.getMessageKeys().keySet()) {
                            String messageKey = search.getMessageKeys().get(e);
                           
                            builder.append("<option value=\"").append(e == null ? "" : e.name()).append("\"");
                            if((e == null && search.getValue() == null) || (e != null && search.getValue() != null && e.equals(search.getValue()))) {
                                builder.append("selected=\"selected\"");
                            }
                            builder.append(">");
                            builder.append(resources.getMessage(locale, messageKey));
                            builder.append("</option>");
                        }
                        builder.append("</select>");
                    } else if(column.getSearch() instanceof ListSelectSearch) {
                        ListSelectSearch search = (ListSelectSearch)column.getSearch();
                        search.loadValues();
                       
                        builder.append("<select");
                        builder.append(" name=\"search_").append(column.getPosition()).append("\"");
                        builder.append(" id=\"search_").append(column.getPosition()).append("\"");
                        builder.append(">");
                        for(Integer id : search.getBeans().keySet()) {
                            ListSelectSearch.Bean bean = search.getBeans().get(id);
                           
                            builder.append("<option value=\"").append(id == null ? "" : id).append("\"");
                            if((id == null && search.getValue() == null) || (id != null && search.getValue() != null && id.equals(search.getValue()))) {
                                builder.append("selected=\"selected\"");
                            }
                            builder.append(">");
                            if(bean.getMessageKey() != null)
                                builder.append(resources.getMessage(locale, bean.getMessageKey()));
                            else
                                builder.append(bean.getMessage());
                            builder.append("</option>");
                        }
                        builder.append("</select>");
                    } else if(column.getSearch() instanceof TextSelectSearch) {
                        TextSelectSearch search = (TextSelectSearch)column.getSearch();

                        builder.append("<select");
                        builder.append(" name=\"search_").append(column.getPosition()).append("\"");
                        builder.append(" id=\"search_").append(column.getPosition()).append("\"");
                        builder.append(">");
                        for(String e : search.getBeans().keySet()) {
                            String messageKey = search.getBeans().get(e).getMessageKey();
                           
                            builder.append("<option value=\"").append(e == null ? "" : e).append("\"");
                            if((e == null && search.getValue() == null) || (e != null && search.getValue() != null && e.equals(search.getValue()))) {
                                builder.append("selected=\"selected\"");
                            }
                            builder.append(">");
                            builder.append(resources.getMessage(locale, messageKey));
                            builder.append("</option>");
                        }
                        builder.append("</select>");
                    } else if(column.getSearch() instanceof TextSearch) {
                        TextSearch search = (TextSearch)column.getSearch();
                       
                        builder.append("<input");
                        builder.append(" type=\"text\"");
                        builder.append(" name=\"search_").append(column.getPosition()).append("\"");
                        builder.append(" id=\"search_").append(column.getPosition()).append("\"");
                        builder.append(" value=\"").append(search.getValue() == null ? "" : search.getValue()).append("\"");
                        builder.append("/>");
                    } else if(column.getSearch() instanceof DateSearch) {
                        DateSearch search = (DateSearch)column.getSearch();
                       
                        SimpleDateFormat sdf = new SimpleDateFormat(resources.getMessage(locale, search.getFormatKey()));
                       
                        builder.append("<input");
                        builder.append(" type=\"text\"");
                        if(settings.getProperty(HALF_INPUT_CLASS) != null) {
                            builder.append(" class=\"").append(settings.getProperty(HALF_INPUT_CLASS)).append("\"");
                        }
                        builder.append(" name=\"search_").append(column.getPosition()).append("_start\"");
                        builder.append(" id=\"search_").append(column.getPosition()).append("_start\"");
                        builder.append(" value=\"").append(search.getValueStart() == null ? "" : sdf.format(search.getValueStart())).append("\"");
                        builder.append("/>");
                       
                        builder.append("<input");
                        builder.append(" type=\"text\"");
                        if(settings.getProperty(HALF_INPUT_CLASS) != null) {
                            builder.append(" class=\"").append(settings.getProperty(HALF_INPUT_CLASS)).append("\"");
                        }
                        builder.append(" name=\"search_").append(column.getPosition()).append("_end\"");
                        builder.append(" id=\"search_").append(column.getPosition()).append("_end\"");
                        builder.append(" value=\"").append(search.getValueEnd() == null ? "" : sdf.format(search.getValueEnd())).append("\"");
                        builder.append("/>");
                    }
                    builder.append("</td>");
                    builder.append("</tr>");
                    builder.append("</table>");
View Full Code Here

            if(attributeNode.getNodeType() == Node.ATTRIBUTE_NODE) {
                String name = attributeNode.getNodeName();
                if("type".equals(name)) {
                    if("enum".equals(attributeNode.getNodeValue())) {
                        try {
                            EnumSearch enumSearch = new EnumSearch((Class<? extends Enum>)Class.forName(attributes.getNamedItem("class").getNodeValue()));
                            NodeList nodes = node.getChildNodes();
                            for(int j=0; j<nodes.getLength(); j++) {
                                if(nodes.item(j).getNodeType() == Node.ELEMENT_NODE) {
                                    if("value".equals(nodes.item(i).getNodeName())) {
                                        parseValue(enumSearch, nodes.item(j));
View Full Code Here

TOP

Related Classes of org.opencustomer.framework.db.util.engine.configuration.EnumSearch

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.