/** * TNTConcept Easy Enterprise Management by Autentia Real Bussiness Solution S.L. * Copyright (C) 2007 Autentia Real Bussiness Solution S.L. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.autentia.tnt.dao.search; import java.util.*; import java.math.*; import org.hibernate.type.*; import com.autentia.tnt.businessobject.*; import com.autentia.tnt.dao.*; /** * Class to search for Publication objects * @author stajanov code generator */ public class PublicationSearch extends SearchCriteria { /* generated by stajanov (do not edit/delete) */ @Override public String getHQL() { StringBuilder ret = new StringBuilder(); int iArgNum = 0; if( isNameSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getName()==null ){ ret.append( "name is NULL" ); } else { ret.append( "name like :arg"+(iArgNum++) ); } } if( isStartMagazineDeliveryDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( startMagazineDeliveryDate == null ){ ret.append( "magazineDeliveryDate=:arg"+(iArgNum++) ); } else { ret.append( "magazineDeliveryDate>=:arg"+(iArgNum++) ); } } if( isEndMagazineDeliveryDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( endMagazineDeliveryDate == null ){ ret.append( "magazineDeliveryDate=:arg"+(iArgNum++) ); } else { ret.append( "magazineDeliveryDate<=:arg"+(iArgNum++) ); } } if( isStartMagazinePublicationDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( startMagazinePublicationDate == null ){ ret.append( "magazinePublicationDate=:arg"+(iArgNum++) ); } else { ret.append( "magazinePublicationDate>=:arg"+(iArgNum++) ); } } if( isEndMagazinePublicationDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( endMagazinePublicationDate == null ){ ret.append( "magazinePublicationDate=:arg"+(iArgNum++) ); } else { ret.append( "magazinePublicationDate<=:arg"+(iArgNum++) ); } } if( isStartOwnPublicationDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( startOwnPublicationDate == null ){ ret.append( "ownPublicationDate=:arg"+(iArgNum++) ); } else { ret.append( "ownPublicationDate>=:arg"+(iArgNum++) ); } } if( isEndOwnPublicationDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( endOwnPublicationDate == null ){ ret.append( "ownPublicationDate=:arg"+(iArgNum++) ); } else { ret.append( "ownPublicationDate<=:arg"+(iArgNum++) ); } } if( isAcceptedSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getAccepted()==null ){ ret.append( "accepted is NULL" ); } else { ret.append( "accepted = :arg"+(iArgNum++) ); } } if( isOwnerIdSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getOwnerId()==null ){ ret.append( "ownerId is NULL" ); } else { ret.append( "ownerId = :arg"+(iArgNum++) ); } } if( isDepartmentIdSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getDepartmentId()==null ){ ret.append( "departmentId is NULL" ); } else { ret.append( "departmentId = :arg"+(iArgNum++) ); } } if( isStartInsertDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( startInsertDate == null ){ ret.append( "insertDate=:arg"+(iArgNum++) ); } else { ret.append( "insertDate>=:arg"+(iArgNum++) ); } } if( isEndInsertDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( endInsertDate == null ){ ret.append( "insertDate=:arg"+(iArgNum++) ); } else { ret.append( "insertDate<=:arg"+(iArgNum++) ); } } if( isStartUpdateDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( startUpdateDate == null ){ ret.append( "updateDate=:arg"+(iArgNum++) ); } else { ret.append( "updateDate>=:arg"+(iArgNum++) ); } } if( isEndUpdateDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( endUpdateDate == null ){ ret.append( "updateDate=:arg"+(iArgNum++) ); } else { ret.append( "updateDate<=:arg"+(iArgNum++) ); } } if( isMagazineSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getMagazine()==null ){ ret.append( "magazine is NULL" ); } else { ret.append( "magazine = :arg"+(iArgNum++) ); } } customGetHQL(ret,iArgNum); return ret.toString(); } @Override public Object[] getArguments(){ ArrayList<Object> ret = new ArrayList<Object>(); if( isNameSet() && getName()!=null ){ ret.add( name ); } if( isStartMagazineDeliveryDateSet() ){ ret.add( startMagazineDeliveryDate ); } if( isEndMagazineDeliveryDateSet() ){ ret.add( endMagazineDeliveryDate ); } if( isStartMagazinePublicationDateSet() ){ ret.add( startMagazinePublicationDate ); } if( isEndMagazinePublicationDateSet() ){ ret.add( endMagazinePublicationDate ); } if( isStartOwnPublicationDateSet() ){ ret.add( startOwnPublicationDate ); } if( isEndOwnPublicationDateSet() ){ ret.add( endOwnPublicationDate ); } if( isAcceptedSet() && getAccepted()!=null ){ ret.add( accepted ); } if( isOwnerIdSet() && getOwnerId()!=null ){ ret.add( ownerId ); } if( isDepartmentIdSet() && getDepartmentId()!=null ){ ret.add( departmentId ); } if( isStartInsertDateSet() ){ ret.add( startInsertDate ); } if( isEndInsertDateSet() ){ ret.add( endInsertDate ); } if( isStartUpdateDateSet() ){ ret.add( startUpdateDate ); } if( isEndUpdateDateSet() ){ ret.add( endUpdateDate ); } if( isMagazineSet() && getMagazine()!=null ){ ret.add( magazine ); } customGetArguments(ret); return ret.toArray(); } @Override public void reset(){ unsetName(); unsetStartMagazineDeliveryDate(); unsetEndMagazineDeliveryDate(); unsetStartMagazinePublicationDate(); unsetEndMagazinePublicationDate(); unsetStartOwnPublicationDate(); unsetEndOwnPublicationDate(); unsetAccepted(); unsetOwnerId(); unsetDepartmentId(); unsetStartInsertDate(); unsetEndInsertDate(); unsetStartUpdateDate(); unsetEndUpdateDate(); unsetMagazine(); customReset(); } @Override public String toString() { StringBuilder ret = new StringBuilder(); ret.append("PublicationSearch{"); if( isNameSet() ){ ret.append( "(name" ); ret.append( "="+name ); ret.append( ")" ); } if( isStartMagazineDeliveryDateSet() ){ ret.append( "(startMagazineDeliveryDate" ); ret.append( "="+startMagazineDeliveryDate ); ret.append( ")" ); } if( isEndMagazineDeliveryDateSet() ){ ret.append( "(endMagazineDeliveryDate" ); ret.append( "="+endMagazineDeliveryDate ); ret.append( ")" ); } if( isStartMagazinePublicationDateSet() ){ ret.append( "(startMagazinePublicationDate" ); ret.append( "="+startMagazinePublicationDate ); ret.append( ")" ); } if( isEndMagazinePublicationDateSet() ){ ret.append( "(endMagazinePublicationDate" ); ret.append( "="+endMagazinePublicationDate ); ret.append( ")" ); } if( isStartOwnPublicationDateSet() ){ ret.append( "(startOwnPublicationDate" ); ret.append( "="+startOwnPublicationDate ); ret.append( ")" ); } if( isEndOwnPublicationDateSet() ){ ret.append( "(endOwnPublicationDate" ); ret.append( "="+endOwnPublicationDate ); ret.append( ")" ); } if( isAcceptedSet() ){ ret.append( "(accepted" ); ret.append( "="+accepted ); ret.append( ")" ); } if( isOwnerIdSet() ){ ret.append( "(ownerId" ); ret.append( "="+ownerId ); ret.append( ")" ); } if( isDepartmentIdSet() ){ ret.append( "(departmentId" ); ret.append( "="+departmentId ); ret.append( ")" ); } if( isStartInsertDateSet() ){ ret.append( "(startInsertDate" ); ret.append( "="+startInsertDate ); ret.append( ")" ); } if( isEndInsertDateSet() ){ ret.append( "(endInsertDate" ); ret.append( "="+endInsertDate ); ret.append( ")" ); } if( isStartUpdateDateSet() ){ ret.append( "(startUpdateDate" ); ret.append( "="+startUpdateDate ); ret.append( ")" ); } if( isEndUpdateDateSet() ){ ret.append( "(endUpdateDate" ); ret.append( "="+endUpdateDate ); ret.append( ")" ); } if( isMagazineSet() ){ ret.append( "(magazine" ); ret.append( "="+magazine ); ret.append( ")" ); } customToString(ret); ret.append("}"); return ret.toString(); } // Getters and setters public boolean isNameSet(){ return nameSet; } public String getName(){ return name; } public void setName( String name ){ this.name = name; this.nameSet = true; } public void unsetName(){ this.nameSet = false; } public boolean isStartMagazineDeliveryDateSet(){ return startMagazineDeliveryDateSet; } public Date getStartMagazineDeliveryDate(){ return startMagazineDeliveryDate; } public void setStartMagazineDeliveryDate( Date startMagazineDeliveryDate ){ this.startMagazineDeliveryDate = startMagazineDeliveryDate; this.startMagazineDeliveryDateSet = true; } public void unsetStartMagazineDeliveryDate(){ this.startMagazineDeliveryDateSet = false; } public boolean isEndMagazineDeliveryDateSet(){ return endMagazineDeliveryDateSet; } public Date getEndMagazineDeliveryDate(){ return endMagazineDeliveryDate; } public void setEndMagazineDeliveryDate( Date endMagazineDeliveryDate ){ this.endMagazineDeliveryDate = endMagazineDeliveryDate; this.endMagazineDeliveryDateSet = true; } public void unsetEndMagazineDeliveryDate(){ this.endMagazineDeliveryDateSet = false; } public boolean isStartMagazinePublicationDateSet(){ return startMagazinePublicationDateSet; } public Date getStartMagazinePublicationDate(){ return startMagazinePublicationDate; } public void setStartMagazinePublicationDate( Date startMagazinePublicationDate ){ this.startMagazinePublicationDate = startMagazinePublicationDate; this.startMagazinePublicationDateSet = true; } public void unsetStartMagazinePublicationDate(){ this.startMagazinePublicationDateSet = false; } public boolean isEndMagazinePublicationDateSet(){ return endMagazinePublicationDateSet; } public Date getEndMagazinePublicationDate(){ return endMagazinePublicationDate; } public void setEndMagazinePublicationDate( Date endMagazinePublicationDate ){ this.endMagazinePublicationDate = endMagazinePublicationDate; this.endMagazinePublicationDateSet = true; } public void unsetEndMagazinePublicationDate(){ this.endMagazinePublicationDateSet = false; } public boolean isStartOwnPublicationDateSet(){ return startOwnPublicationDateSet; } public Date getStartOwnPublicationDate(){ return startOwnPublicationDate; } public void setStartOwnPublicationDate( Date startOwnPublicationDate ){ this.startOwnPublicationDate = startOwnPublicationDate; this.startOwnPublicationDateSet = true; } public void unsetStartOwnPublicationDate(){ this.startOwnPublicationDateSet = false; } public boolean isEndOwnPublicationDateSet(){ return endOwnPublicationDateSet; } public Date getEndOwnPublicationDate(){ return endOwnPublicationDate; } public void setEndOwnPublicationDate( Date endOwnPublicationDate ){ this.endOwnPublicationDate = endOwnPublicationDate; this.endOwnPublicationDateSet = true; } public void unsetEndOwnPublicationDate(){ this.endOwnPublicationDateSet = false; } public boolean isAcceptedSet(){ return acceptedSet; } public java.lang.Boolean getAccepted(){ return accepted; } public void setAccepted( java.lang.Boolean accepted ){ this.accepted = accepted; this.acceptedSet = true; } public void unsetAccepted(){ this.acceptedSet = false; } public boolean isOwnerIdSet(){ return ownerIdSet; } public Integer getOwnerId(){ return ownerId; } public void setOwnerId( Integer ownerId ){ this.ownerId = ownerId; this.ownerIdSet = true; } public void unsetOwnerId(){ this.ownerIdSet = false; } public boolean isDepartmentIdSet(){ return departmentIdSet; } public Integer getDepartmentId(){ return departmentId; } public void setDepartmentId( Integer departmentId ){ this.departmentId = departmentId; this.departmentIdSet = true; } public void unsetDepartmentId(){ this.departmentIdSet = false; } public boolean isStartInsertDateSet(){ return startInsertDateSet; } public Date getStartInsertDate(){ return startInsertDate; } public void setStartInsertDate( Date startInsertDate ){ this.startInsertDate = startInsertDate; this.startInsertDateSet = true; } public void unsetStartInsertDate(){ this.startInsertDateSet = false; } public boolean isEndInsertDateSet(){ return endInsertDateSet; } public Date getEndInsertDate(){ return endInsertDate; } public void setEndInsertDate( Date endInsertDate ){ this.endInsertDate = endInsertDate; this.endInsertDateSet = true; } public void unsetEndInsertDate(){ this.endInsertDateSet = false; } public boolean isStartUpdateDateSet(){ return startUpdateDateSet; } public Date getStartUpdateDate(){ return startUpdateDate; } public void setStartUpdateDate( Date startUpdateDate ){ this.startUpdateDate = startUpdateDate; this.startUpdateDateSet = true; } public void unsetStartUpdateDate(){ this.startUpdateDateSet = false; } public boolean isEndUpdateDateSet(){ return endUpdateDateSet; } public Date getEndUpdateDate(){ return endUpdateDate; } public void setEndUpdateDate( Date endUpdateDate ){ this.endUpdateDate = endUpdateDate; this.endUpdateDateSet = true; } public void unsetEndUpdateDate(){ this.endUpdateDateSet = false; } public boolean isMagazineSet(){ return magazineSet; } public Magazine getMagazine(){ return magazine; } public void setMagazine( Magazine magazine ){ this.magazine = magazine; this.magazineSet = true; } public void unsetMagazine(){ this.magazineSet = false; } // Fields private boolean nameSet; private String name; private boolean startMagazineDeliveryDateSet; private Date startMagazineDeliveryDate; private boolean endMagazineDeliveryDateSet; private Date endMagazineDeliveryDate; private boolean startMagazinePublicationDateSet; private Date startMagazinePublicationDate; private boolean endMagazinePublicationDateSet; private Date endMagazinePublicationDate; private boolean startOwnPublicationDateSet; private Date startOwnPublicationDate; private boolean endOwnPublicationDateSet; private Date endOwnPublicationDate; private boolean acceptedSet; private java.lang.Boolean accepted; private boolean ownerIdSet; private Integer ownerId; private boolean departmentIdSet; private Integer departmentId; private boolean startInsertDateSet; private Date startInsertDate; private boolean endInsertDateSet; private Date endInsertDate; private boolean startUpdateDateSet; private Date startUpdateDate; private boolean endUpdateDateSet; private Date endUpdateDate; private boolean magazineSet; private Magazine magazine; // Returns if there are a search condition active public boolean isSearchActive() { return customIsSearchActive()||nameSet||startMagazineDeliveryDateSet||endMagazineDeliveryDateSet||startMagazinePublicationDateSet||endMagazinePublicationDateSet||startOwnPublicationDateSet||endOwnPublicationDateSet||acceptedSet||ownerIdSet||departmentIdSet||startInsertDateSet||endInsertDateSet||startUpdateDateSet||endUpdateDateSet||magazineSet; } /* generated by stajanov (do not edit/delete) */ private void customGetHQL(StringBuilder ret, int iArgNum) { } private boolean customIsSearchActive() { return false; } private void customToString(StringBuilder ret) { } private void customReset() { } private void customGetArguments(ArrayList ret) { } }