Package br.jus.tjrn.arq.persistence

Examples of br.jus.tjrn.arq.persistence.FindByAttribute


                if (!type.isCollectionType()) {

                    log.debug("Atributo adicionado: " + name);

                    FindByAttribute findByAttibute = getFindByAttributeAnnotation(name);
                    if (findByAttibute == null) {
                        if (type instanceof StringType) {
                            criteria.add(Restrictions.like(name, "%" + value + "%"));
                        } else {
                            criteria.add(Restrictions.eq(name, value));
                        }
                    } else {
                        if (type instanceof StringType) {

                            StringComparation stringComparation = findByAttibute.stringComparation();
                            if(stringComparation != null && stringComparation == StringComparation.EXACT) {
                                criteria.add(Restrictions.eq(name, value));
                            } else if(stringComparation != null && stringComparation == StringComparation.END) {
                                criteria.add(Restrictions.like(name, "%" + value));
                            } else if(stringComparation != null && stringComparation == StringComparation.START) {
                                criteria.add(Restrictions.like(name, value + "%"));
                            } else {
                                criteria.add(Restrictions.like(name, "%" + value + "%"));
                            }

                        } else if (type instanceof TimestampType) {
                            DateComparation dateComparation = findByAttibute.dateComparation();
                            if(dateComparation != null && dateComparation == DateComparation.EXACT) {
                                criteria.add(Restrictions.eq(name, value));
                            } else if(dateComparation != null && dateComparation == DateComparation.GREATER_THAN) {
                                criteria.add(Restrictions.ge(name, value));
                            } else if(dateComparation != null && dateComparation == DateComparation.LESS_THAN) {
View Full Code Here

TOP

Related Classes of br.jus.tjrn.arq.persistence.FindByAttribute

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.