/** * 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 Activity objects * @author stajanov code generator */ public class ActivitySearch extends SearchCriteria { /* generated by stajanov (do not edit/delete) */ @Override public String getHQL() { StringBuilder ret = new StringBuilder(); int iArgNum = 0; if( isStartStartDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( startStartDate == null ){ ret.append( "startDate=:arg"+(iArgNum++) ); } else { ret.append( "startDate>=:arg"+(iArgNum++) ); } } if( isEndStartDateSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( endStartDate == null ){ ret.append( "startDate=:arg"+(iArgNum++) ); } else { ret.append( "startDate<=:arg"+(iArgNum++) ); } } if( isDurationSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getDuration()==null ){ ret.append( "duration is NULL" ); } else { ret.append( "duration = :arg"+(iArgNum++) ); } } if( isDescriptionSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getDescription()==null ){ ret.append( "description is NULL" ); } else { ret.append( "description = :arg"+(iArgNum++) ); } } if( isBillableSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getBillable()==null ){ ret.append( "billable is NULL" ); } else { ret.append( "billable = :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( isUserSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getUser()==null ){ ret.append( "user is NULL" ); } else { ret.append( "user = :arg"+(iArgNum++) ); } } if( isRoleSet() ){ ret.append( (ret.length()==0) ? "WHERE " : " AND " ); if( getRole()==null ){ ret.append( "role is NULL" ); } else { ret.append( "role = :arg"+(iArgNum++) ); } } customGetHQL(ret,iArgNum); return ret.toString(); } @Override public Object[] getArguments(){ ArrayList<Object> ret = new ArrayList<Object>(); if( isStartStartDateSet() ){ ret.add( startStartDate ); } if( isEndStartDateSet() ){ ret.add( endStartDate ); } if( isDurationSet() && getDuration()!=null ){ ret.add( duration ); } if( isDescriptionSet() && getDescription()!=null ){ ret.add( description ); } if( isBillableSet() && getBillable()!=null ){ ret.add( billable ); } 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( isUserSet() && getUser()!=null ){ ret.add( user ); } if( isRoleSet() && getRole()!=null ){ ret.add( role ); } customGetArguments(ret); return ret.toArray(); } @Override public void reset(){ unsetStartStartDate(); unsetEndStartDate(); unsetDuration(); unsetDescription(); unsetBillable(); unsetDepartmentId(); unsetStartInsertDate(); unsetEndInsertDate(); unsetStartUpdateDate(); unsetEndUpdateDate(); unsetUser(); unsetRole(); customReset(); } @Override public String toString() { StringBuilder ret = new StringBuilder(); ret.append("ActivitySearch{"); if( isStartStartDateSet() ){ ret.append( "(startStartDate" ); ret.append( "="+startStartDate ); ret.append( ")" ); } if( isEndStartDateSet() ){ ret.append( "(endStartDate" ); ret.append( "="+endStartDate ); ret.append( ")" ); } if( isDurationSet() ){ ret.append( "(duration" ); ret.append( "="+duration ); ret.append( ")" ); } if( isDescriptionSet() ){ ret.append( "(description" ); ret.append( "="+description ); ret.append( ")" ); } if( isBillableSet() ){ ret.append( "(billable" ); ret.append( "="+billable ); 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( isUserSet() ){ ret.append( "(user" ); ret.append( "="+user ); ret.append( ")" ); } if( isRoleSet() ){ ret.append( "(role" ); ret.append( "="+role ); ret.append( ")" ); } customToString(ret); ret.append("}"); return ret.toString(); } // Getters and setters public boolean isStartStartDateSet(){ return startStartDateSet; } public Date getStartStartDate(){ return startStartDate; } public void setStartStartDate( Date startStartDate ){ this.startStartDate = startStartDate; this.startStartDateSet = true; } public void unsetStartStartDate(){ this.startStartDateSet = false; } public boolean isEndStartDateSet(){ return endStartDateSet; } public Date getEndStartDate(){ return endStartDate; } public void setEndStartDate( Date endStartDate ){ this.endStartDate = endStartDate; this.endStartDateSet = true; } public void unsetEndStartDate(){ this.endStartDateSet = false; } public boolean isDurationSet(){ return durationSet; } public java.lang.Integer getDuration(){ return duration; } public void setDuration( java.lang.Integer duration ){ this.duration = duration; this.durationSet = true; } public void unsetDuration(){ this.durationSet = false; } public boolean isDescriptionSet(){ return descriptionSet; } public String getDescription(){ return description; } public void setDescription( String description ){ this.description = description; this.descriptionSet = true; } public void unsetDescription(){ this.descriptionSet = false; } public boolean isBillableSet(){ return billableSet; } public java.lang.Boolean getBillable(){ return billable; } public void setBillable( java.lang.Boolean billable ){ this.billable = billable; this.billableSet = true; } public void unsetBillable(){ this.billableSet = 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 isUserSet(){ return userSet; } public User getUser(){ return user; } public void setUser( User user ){ this.user = user; this.userSet = true; } public void unsetUser(){ this.userSet = false; } public boolean isRoleSet(){ return roleSet; } public ProjectRole getRole(){ return role; } public void setRole( ProjectRole role ){ this.role = role; this.roleSet = true; } public void unsetRole(){ this.roleSet = false; } // Fields private boolean startStartDateSet; private Date startStartDate; private boolean endStartDateSet; private Date endStartDate; private boolean durationSet; private java.lang.Integer duration; private boolean descriptionSet; private String description; private boolean billableSet; private java.lang.Boolean billable; 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 userSet; private User user; private boolean roleSet; private ProjectRole role; // Returns if there are a search condition active public boolean isSearchActive() { return customIsSearchActive()||startStartDateSet||endStartDateSet||durationSet||descriptionSet||billableSet||departmentIdSet||startInsertDateSet||endInsertDateSet||startUpdateDateSet||endUpdateDateSet||userSet||roleSet; } /* 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) { } }