gt: 		if(easId == null)
context: //#############################################################################
  //#                                                                           #
  //#  Copyright (C) <2015>  <IMS MAXIMS>                                       #
  //#                                                                           #
  //#  This program is free software: you can redistribute it and/or modify     #
  //#  it under the terms of the GNU Affero General Public License as           #
  //#  published by the Free Software Foundation, either version 3 of the       #
  //#  License, or (at your option) any later version.                          # 
  //#                                                                           #
  //#  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 Affero General Public License for more details.                      #
  //#                                                                           #
  //#  You should have received a copy of the GNU Affero General Public License #
  //#  along with this program.  If not, see <http://www.gnu.org/licenses/>.    #
  //#                                                                           #
  //#  IMS MAXIMS provides absolutely NO GUARANTEE OF THE CLINICAL SAFTEY of    #
  //#  this program.  Users of this software do so entirely at their own risk.  #
  //#  IMS MAXIMS only ensures the Clinical Safety of unaltered run-time        #
  //#  software that it builds, deploys and maintains.                          #
  //#                                                                           #
  //#############################################################################
  //#EOH
  // This code was generated by Bogdan Tofei using IMS Development Environment (version 1.80 build 4828.20158)
  // Copyright (C) 1995-2013 IMS MAXIMS. All rights reserved.
  
  package ims.eas.domain.impl;
  
  import ims.core.patient.domain.objects.Patient;
  import ims.core.patient.vo.PatientRefVo;
  import ims.core.vo.PatientShort;
  import ims.core.vo.domain.PatientShortAssembler;
  import ims.domain.DomainFactory;
  import ims.domain.exceptions.StaleObjectException;
  import ims.eas.domain.base.impl.BaseElectronicActionSheetWorklistImpl;
  import ims.eas.domain.objects.ElectronicActionSheet;
  import ims.eas.vo.ElectronicActionSheetVo;
  import ims.eas.vo.domain.EasWorklistVoAssembler;
  import ims.eas.vo.domain.ElectronicActionSheetVoAssembler;
  import ims.framework.exceptions.CodingRuntimeException;
  import ims.framework.utils.Date;
  
  import java.util.ArrayList;
  
  public class ElectronicActionSheetWorklistImpl extends BaseElectronicActionSheetWorklistImpl
  {
  
  	private static final long serialVersionUID = 1L;
  
  	public ims.eas.vo.EasWorklistVoCollection getEasCollection(ims.eas.vo.EasWorklistSearchCriteriaVo searchCriteria)
  	{
  		DomainFactory factory = getDomainFactory();
  
  		StringBuffer hql = new StringBuffer(" select eas from ElectronicActionSheet as eas left join eas.priority as pri ");
  
  		StringBuffer condStr = new StringBuffer();
  		String andStr = "";
  
  		ArrayList<String> markers = new ArrayList<String>();
  		ArrayList<Object> values = new ArrayList<Object>();
  		
  		if (Boolean.TRUE.equals(searchCriteria.getActionRequired()))
  		{
  			if (condStr.length() == 0)
  				condStr.append(" where ( ");
  			
  			condStr.append(" (eas.actionRequired is not null and eas.actionRequired = :actionReq) ");
  			markers.add("actionReq");
  			values.add(searchCriteria.getActionRequired());
  		}
  
  		if (Boolean.TRUE.equals(searchCriteria.getTpCreated()))
  		{
  			if (condStr.length() == 0)
  				condStr.append(" where ( ");
  			else
  				andStr = " or ";
  			
  			condStr.append(andStr);
  			condStr.append(" (eas.tPCreated is not null and eas.tPCreated = :tpCreated) ");
  			markers.add("tpCreated");
  			values.add(searchCriteria.getTpCreated());
  		}
  		
  		if (Boolean.TRUE.equals(searchCriteria.getEasRemoved()))
  		{
  			if (condStr.length() == 0)
  				condStr.append(" where (");
  			else
  				andStr = " or ";
  			
  			condStr.append(andStr);
  			condStr.append(" (eas.removedStat is not null and eas.removedStat = :removed) ");
  			markers.add("removed");
  			values.add(searchCriteria.getEasRemoved());
  		}
  		
  		if (condStr.length() > 0)
  			condStr.append(" )");
  		
  		if (searchCriteria.getDateSeenFrom() != null)
  		{
  			Date dateFrom = new Date(searchCriteria.getDateSeenFrom());
  			
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" eas.dateSeen >= :dateSeenFrom ");
  			markers.add("dateSeenFrom");
  			values.add(dateFrom.getDate());
  		}
  		
  		if (searchCriteria.getDateSeenTo() != null)
  		{
  			Date dateTo = new Date(searchCriteria.getDateSeenTo());
  			
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" eas.dateSeen <= :dateSeenTo ");
  			markers.add("dateSeenTo");
  			values.add(dateTo.getDate());
  		}
  		
  		if (searchCriteria.getDecisionToTreatFrom() != null)
  		{
  			Date dateFrom = new Date(searchCriteria.getDecisionToTreatFrom());
  			
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" eas.dateDecisionToTreat >= :DttFrom ");
  			markers.add("DttFrom");
  			values.add(dateFrom.getDate());
  		}
  		
  		if (searchCriteria.getDecisionToTreatTo() != null)
  		{
  			Date dateTo = new Date(searchCriteria.getDecisionToTreatTo());
  			
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" eas.dateDecisionToTreat <= :DttTo ");
  			markers.add("DttTo");
  			values.add(dateTo.getDate());
  		}
  		
  		if (searchCriteria.getResponsibleHcp() != null)
  		{
  			hql.append(" left join eas.responsibleHcp as respHCP ");
  			
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" (respHCP.id = :respHCP) ");
  			markers.add("respHCP");
  			values.add(searchCriteria.getResponsibleHcp().getIMosHcpId());
  		}
  		
  		if (searchCriteria.getSeenBy() != null)
  		{
  			hql.append(" left join eas.seenBy as seenBy ");
  			
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" (seenBy.id = :seenByHCP) ");
  			markers.add("seenByHCP");
  			values.add(searchCriteria.getSeenBy().getIMosHcpId());
  		}
  		
  		if (searchCriteria.getPriority() != null)
  		{
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" (eas.priority.id = :easPriority) ");
  			markers.add("easPriority");
  			values.add(searchCriteria.getPriority().getID());
  		}
  		
  		if (searchCriteria.getTreatmentIntent() != null)
  		{
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" (eas.intent.id = :easIntent) ");
  			markers.add("easIntent");
  			values.add(searchCriteria.getTreatmentIntent().getID());
  		}
  		
  		if (searchCriteria.getPatientStatus() != null)
  		{
  			hql.append(" left join eas.patientStatus as patStatus ");
  			
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" (patStatus.id = :patStat) ");
  			markers.add("patStat");
  			values.add(searchCriteria.getPatientStatus().getID());
  		}
  		
  		if (searchCriteria.getEasStatuses() != null && searchCriteria.getEasStatuses().size() > 0)
  		{
  			hql.append(" left join eas.easStatus as easStatus left join easStatus.status as stat ");
  			
  			if (condStr.length() == 0)
  				condStr.append(" where ");
  			else
  				andStr = " and ";
  			
  			condStr.append(andStr);
  			condStr.append(" ( stat.id in (");
  
  			for (int i = 0; i < searchCriteria.getEasStatuses().size(); i++)
  			{
  				condStr.append(searchCriteria.getEasStatuses().get(i).getID());
  				
  				if (i != searchCriteria.getEasStatuses().size() - 1)
  				{
  					condStr.append(", ");
  				}
  			}
  			
  			condStr.append(")) ");
  		}
  		
  		condStr.append(" order by pri.text asc, eas.dateSeen desc");
  		hql.append(condStr);
  
  		return EasWorklistVoAssembler.createEasWorklistVoCollectionFromElectronicActionSheet(factory.find(hql.toString(), markers, values));
  	}
  
  	public ElectronicActionSheetVo getEas(Integer easId)
  	{
  