/**
* 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 BulletinBoard objects
* @author stajanov code generator
*/
public class BulletinBoardSearch extends SearchCriteria
{
/* generated by stajanov (do not edit/delete) */
@Override
public String getHQL() {
StringBuilder ret = new StringBuilder();
int iArgNum = 0;
if( isStartCreationDateSet() ){
ret.append( (ret.length()==0) ? "WHERE " : " AND " );
if( startCreationDate == null ){
ret.append( "creationDate=:arg"+(iArgNum++) );
} else {
ret.append( "creationDate>=:arg"+(iArgNum++) );
}
}
if( isEndCreationDateSet() ){
ret.append( (ret.length()==0) ? "WHERE " : " AND " );
if( endCreationDate == null ){
ret.append( "creationDate=:arg"+(iArgNum++) );
} else {
ret.append( "creationDate<=:arg"+(iArgNum++) );
}
}
if( isTitleSet() ){
ret.append( (ret.length()==0) ? "WHERE " : " AND " );
if( getTitle()==null ){
ret.append( "title is NULL" );
} else {
ret.append( "title like :arg"+(iArgNum++) );
}
}
if( isMessageSet() ){
ret.append( (ret.length()==0) ? "WHERE " : " AND " );
if( getMessage()==null ){
ret.append( "message is NULL" );
} else {
ret.append( "message = :arg"+(iArgNum++) );
}
}
if( isDocumentPathSet() ){
ret.append( (ret.length()==0) ? "WHERE " : " AND " );
if( getDocumentPath()==null ){
ret.append( "documentPath is NULL" );
} else {
ret.append( "documentPath = :arg"+(iArgNum++) );
}
}
if( isDocumentContentTypeSet() ){
ret.append( (ret.length()==0) ? "WHERE " : " AND " );
if( getDocumentContentType()==null ){
ret.append( "documentContentType is NULL" );
} else {
ret.append( "documentContentType = :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( isCategorySet() ){
ret.append( (ret.length()==0) ? "WHERE " : " AND " );
if( getCategory()==null ){
ret.append( "category is NULL" );
} else {
ret.append( "category = :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++) );
}
}
customGetHQL(ret,iArgNum);
return ret.toString();
}
@Override
public Object[] getArguments(){
ArrayList<Object> ret = new ArrayList<Object>();
if( isStartCreationDateSet() ){
ret.add( startCreationDate );
}
if( isEndCreationDateSet() ){
ret.add( endCreationDate );
}
if( isTitleSet() && getTitle()!=null ){
ret.add( title );
}
if( isMessageSet() && getMessage()!=null ){
ret.add( message );
}
if( isDocumentPathSet() && getDocumentPath()!=null ){
ret.add( documentPath );
}
if( isDocumentContentTypeSet() && getDocumentContentType()!=null ){
ret.add( documentContentType );
}
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( isCategorySet() && getCategory()!=null ){
ret.add( category );
}
if( isUserSet() && getUser()!=null ){
ret.add( user );
}
customGetArguments(ret);
return ret.toArray();
}
@Override
public void reset(){
unsetStartCreationDate();
unsetEndCreationDate();
unsetTitle();
unsetMessage();
unsetDocumentPath();
unsetDocumentContentType();
unsetDepartmentId();
unsetStartInsertDate();
unsetEndInsertDate();
unsetStartUpdateDate();
unsetEndUpdateDate();
unsetCategory();
unsetUser();
customReset();
}
@Override
public String toString() {
StringBuilder ret = new StringBuilder();
ret.append("BulletinBoardSearch{");
if( isStartCreationDateSet() ){
ret.append( "(startCreationDate" );
ret.append( "="+startCreationDate );
ret.append( ")" );
}
if( isEndCreationDateSet() ){
ret.append( "(endCreationDate" );
ret.append( "="+endCreationDate );
ret.append( ")" );
}
if( isTitleSet() ){
ret.append( "(title" );
ret.append( "="+title );
ret.append( ")" );
}
if( isMessageSet() ){
ret.append( "(message" );
ret.append( "="+message );
ret.append( ")" );
}
if( isDocumentPathSet() ){
ret.append( "(documentPath" );
ret.append( "="+documentPath );
ret.append( ")" );
}
if( isDocumentContentTypeSet() ){
ret.append( "(documentContentType" );
ret.append( "="+documentContentType );
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( isCategorySet() ){
ret.append( "(category" );
ret.append( "="+category );
ret.append( ")" );
}
if( isUserSet() ){
ret.append( "(user" );
ret.append( "="+user );
ret.append( ")" );
}
customToString(ret);
ret.append("}");
return ret.toString();
}
// Getters and setters
public boolean isStartCreationDateSet(){
return startCreationDateSet;
}
public Date getStartCreationDate(){
return startCreationDate;
}
public void setStartCreationDate( Date startCreationDate ){
this.startCreationDate = startCreationDate;
this.startCreationDateSet = true;
}
public void unsetStartCreationDate(){
this.startCreationDateSet = false;
}
public boolean isEndCreationDateSet(){
return endCreationDateSet;
}
public Date getEndCreationDate(){
return endCreationDate;
}
public void setEndCreationDate( Date endCreationDate ){
this.endCreationDate = endCreationDate;
this.endCreationDateSet = true;
}
public void unsetEndCreationDate(){
this.endCreationDateSet = false;
}
public boolean isTitleSet(){
return titleSet;
}
public String getTitle(){
return title;
}
public void setTitle( String title ){
this.title = title;
this.titleSet = true;
}
public void unsetTitle(){
this.titleSet = false;
}
public boolean isMessageSet(){
return messageSet;
}
public String getMessage(){
return message;
}
public void setMessage( String message ){
this.message = message;
this.messageSet = true;
}
public void unsetMessage(){
this.messageSet = false;
}
public boolean isDocumentPathSet(){
return documentPathSet;
}
public String getDocumentPath(){
return documentPath;
}
public void setDocumentPath( String documentPath ){
this.documentPath = documentPath;
this.documentPathSet = true;
}
public void unsetDocumentPath(){
this.documentPathSet = false;
}
public boolean isDocumentContentTypeSet(){
return documentContentTypeSet;
}
public String getDocumentContentType(){
return documentContentType;
}
public void setDocumentContentType( String documentContentType ){
this.documentContentType = documentContentType;
this.documentContentTypeSet = true;
}
public void unsetDocumentContentType(){
this.documentContentTypeSet = 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 isCategorySet(){
return categorySet;
}
public BulletinBoardCategory getCategory(){
return category;
}
public void setCategory( BulletinBoardCategory category ){
this.category = category;
this.categorySet = true;
}
public void unsetCategory(){
this.categorySet = 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;
}
// Fields
private boolean startCreationDateSet;
private Date startCreationDate;
private boolean endCreationDateSet;
private Date endCreationDate;
private boolean titleSet;
private String title;
private boolean messageSet;
private String message;
private boolean documentPathSet;
private String documentPath;
private boolean documentContentTypeSet;
private String documentContentType;
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 categorySet;
private BulletinBoardCategory category;
private boolean userSet;
private User user;
// Returns if there are a search condition active
public boolean isSearchActive() {
return customIsSearchActive()||startCreationDateSet||endCreationDateSet||titleSet||messageSet||documentPathSet||documentContentTypeSet||departmentIdSet||startInsertDateSet||endInsertDateSet||startUpdateDateSet||endUpdateDateSet||categorySet||userSet;
}
/* generated by stajanov (do not edit/delete) */
private void customGetHQL(StringBuilder ret, int iArgNum)
{
}
private void customGetArguments(ArrayList ret)
{
}
private void customReset()
{
}
private void customToString(StringBuilder ret)
{
}
private boolean customIsSearchActive()
{
return false;
}
}