gt: 		for(int i=0; i<size; i++) 
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
   * Copyright (C) 1995-2004 IMS MAXIMS plc. All rights reserved.
   * IMS Development Environment (version 1.80 build 5589.25814)
   * WARNING: DO NOT MODIFY the content of this file
   * Generated: 12/10/2015, 13:28
   *
   */
  package ims.choose_book.domain.objects;
  
  /**
   * 
   * @author Barbara Worwood
   * Generated.
   */
  
  
  public class ActionRequest extends ims.domain.DomainObject implements java.io.Serializable {
  	public static final int CLASSID = 1069100000;
  	private static final long serialVersionUID = 1069100000L;
  	public static final String CLASSVERSION = "${ClassVersion}";
  
  	@Override
  	public boolean shouldCapQuery()
  	{
  		return true;
  	}
  
  	/** Request Type */
  	private ims.domain.lookups.LookupInstance requestType;
  	/** Date the request was made */
  	private java.util.Date requestDate;
  	/** ConversationID */
  	private String convId;
  	private String cpaId;
  	/** Contains the Message Details to Action agains */
  	private String msgDetails;
  	/** Is this an active action request */
  	private Boolean active;
  	/** Various comment - reason status is set to false etc.. */
  	private String statComment;
  	/** Comment with details of progress ie. error or processed successfully */
  	private String progressComment;
      public ActionRequest (Integer id, int ver)
      {
      	super(id, ver);
      }
      public ActionRequest ()
      {
      	super();
      }
      public ActionRequest (Integer id, int ver, Boolean includeRecord)
      {
      	super(id, ver, includeRecord);
      }
  	public Class getRealDomainClass()
  	{
  		return ims.choose_book.domain.objects.ActionRequest.class;
  	}
  
  
  	public ims.domain.lookups.LookupInstance getRequestType() {
  		return requestType;
  	}
  	public void setRequestType(ims.domain.lookups.LookupInstance requestType) {
  		this.requestType = requestType;
  	}
  
  	public java.util.Date getRequestDate() {
  		return requestDate;
  	}
  	public void setRequestDate(java.util.Date requestDate) {
  		this.requestDate = requestDate;
  	}
  
  	public String getConvId() {
  		return convId;
  	}
  	public void setConvId(String convId) {
  		if ( null != convId && convId.length() > 100 ) {
  			throw new ims.domain.exceptions.DomainRuntimeException("MaxLength ($MaxLength) exceeded for convId. Tried to set value: "+
  				convId);
  		}
  		this.convId = convId;
  	}
  
  	public String getCpaId() {
  		return cpaId;
  	}
  	public void setCpaId(String cpaId) {
  		if ( null != cpaId && cpaId.length() > 100 ) {
  			throw new ims.domain.exceptions.DomainRuntimeException("MaxLength ($MaxLength) exceeded for cpaId. Tried to set value: "+
  				cpaId);
  		}
  		this.cpaId = cpaId;
  	}
  
  	public String getMsgDetails() {
  		return msgDetails;
  	}
  	public void setMsgDetails(String msgDetails) {
  		if ( null != msgDetails && msgDetails.length() > 2000 ) {
  			throw new ims.domain.exceptions.DomainRuntimeException("MaxLength ($MaxLength) exceeded for msgDetails. Tried to set value: "+
  				msgDetails);
  		}
  		this.msgDetails = msgDetails;
  	}
  
  	public Boolean isActive() {
  		return active;
  	}
  	public void setActive(Boolean active) {
  		this.active = active;
  	}
  
  	public String getStatComment() {
  		return statComment;
  	}
  	public void setStatComment(String statComment) {
  		if ( null != statComment && statComment.length() > 255 ) {
  			throw new ims.domain.exceptions.DomainRuntimeException("MaxLength ($MaxLength) exceeded for statComment. Tried to set value: "+
  				statComment);
  		}
  		this.statComment = statComment;
  	}
  
  	public String getProgressComment() {
  		return progressComment;
  	}
  	public void setProgressComment(String progressComment) {
  		if ( null != progressComment && progressComment.length() > 255 ) {
  			throw new ims.domain.exceptions.DomainRuntimeException("MaxLength ($MaxLength) exceeded for progressComment. Tried to set value: "+
  				progressComment);
  		}
  		this.progressComment = progressComment;
  	}
  
  	/**
  	 * isConfigurationObject
  	 * Taken from the Usage property of the business object, this method will return
  	 * a boolean indicating whether this is a configuration object or not
  	 * Configuration = true, Instantiation = false
  	 */
  	public static boolean isConfigurationObject()
  	{
  		if ( "Instantiation".equals("Configuration") )
  			return true;
  		else
  			return false;
  	}
  
  
  
  
  
  	public int getClassId() {
  		return CLASSID;
  	}
  
  	public String getClassVersion()
  	{
  		return CLASSVERSION;
  	}
  
  	public String toAuditString()
  	{
  		StringBuffer auditStr = new StringBuffer();
  		
  		auditStr.append("\r\n*requestType* :");
  		if (requestType != null)
  			auditStr.append(requestType.getText());
  	    auditStr.append("; ");
  		auditStr.append("\r\n*requestDate* :");
  		auditStr.append(requestDate);
  	    auditStr.append("; ");
  		auditStr.append("\r\n*convId* :");
  		auditStr.append(convId);
  	    auditStr.append("; ");
  		auditStr.append("\r\n*cpaId* :");
  		auditStr.append(cpaId);
  	    auditStr.append("; ");
  		auditStr.append("\r\n*msgDetails* :");
  		auditStr.append(msgDetails);
  	    auditStr.append("; ");
  		auditStr.append("\r\n*active* :");
  		auditStr.append(active);
  	    auditStr.append("; ");
  		auditStr.append("\r\n*statComment* :");
  		auditStr.append(statComment);
  	    auditStr.append("; ");
  		auditStr.append("\r\n*progressComment* :");
  		auditStr.append(progressComment);
  	    auditStr.append("; ");
  		return auditStr.toString();
  	}
  	
  	public String toXMLString()
  	{
  		return toXMLString(new java.util.HashMap());
  	}
  	
  	public String toXMLString(java.util.HashMap domMap)
  	{
  		StringBuffer sb = new StringBuffer();
  		sb.append("<class type=\"" + this.getClass().getName() + "\" ");		
  		sb.append(" id=\"" + this.getId() + "\""); 
  		sb.append(" source=\"" + ims.configuration.EnvironmentConfig.getImportExportSourceName() + "\" ");
  		sb.append(" classVersion=\"" + this.getClassVersion() + "\" ");
  		sb.append(" component=\"" + this.getIsComponentClass() + "\" >");
  		
  		if (domMap.get(this) == null)
  		{
  			domMap.put(this, this);
  			sb.append(this.fieldsToXMLString(domMap));
  		}
  		sb.append("</class>");
  		
  		String keyClassName = "ActionRequest";
  		String externalSource = ims.configuration.EnvironmentConfig.getImportExportSourceName();
  		ims.configuration.ImportedObject impObj = (ims.configuration.ImportedObject)domMap.get(keyClassName + "_" + externalSource + "_" + this.getId());
  		if (impObj == null)
  		{
      		impObj = new ims.configuration.ImportedObject();
      		impObj.setExternalId(this.getId());
      		impObj.setExternalSource(externalSource);
      		impObj.setDomainObject(this);
  			impObj.setLocalId(this.getId()); 
      		impObj.setClassName(keyClassName); 
  			domMap.put(keyClassName + "_" + externalSource + "_" + this.getId(), impObj);
  		}
  		
  		return sb.toString();
  	}
  
  	public String fieldsToXMLString(java.util.HashMap domMap)
  	{
  		StringBuffer sb = new StringBuffer();
  		if (this.getRequestType() != null)
  		{
  			sb.append("<requestType>");
  			sb.append(this.getRequestType().toXMLString()); 
  			sb.append("</requestType>");		
  		}
  		if (this.getRequestDate() != null)
  		{
  			sb.append("<requestDate>");
  			sb.append(new ims.framework.utils.DateTime(this.getRequestDate()).toString(ims.framework.utils.DateTimeFormat.MILLI));
  			sb.append("</requestDate>");		
  		}
  		if (this.getConvId() != null)
  		{
  			sb.append("<convId>");
  			sb.append(ims.framework.utils.StringUtils.encodeXML(this.getConvId().toString()));
  			sb.append("</convId>");		
  		}
  		if (this.getCpaId() != null)
  		{
  			sb.append("<cpaId>");
  			sb.append(ims.framework.utils.StringUtils.encodeXML(this.getCpaId().toString()));
  			sb.append("</cpaId>");		
  		}
  		if (this.getMsgDetails() != null)
  		{
  			sb.append("<msgDetails>");
  			sb.append(ims.framework.utils.StringUtils.encodeXML(this.getMsgDetails().toString()));
  			sb.append("</msgDetails>");		
  		}
  		if (this.isActive() != null)
  		{
  			sb.append("<active>");
  			sb.append(ims.framework.utils.StringUtils.encodeXML(this.isActive().toString()));
  			sb.append("</active>");		
  		}
  		if (this.getStatComment() != null)
  		{
  			sb.append("<statComment>");
  			sb.append(ims.framework.utils.StringUtils.encodeXML(this.getStatComment().toString()));
  			sb.append("</statComment>");		
  		}
  		if (this.getProgressComment() != null)
  		{
  			sb.append("<progressComment>");
  			sb.append(ims.framework.utils.StringUtils.encodeXML(this.getProgressComment().toString()));
  			sb.append("</progressComment>");		
  		}
  		return sb.toString();
  	}
  		
  	public static java.util.List fromListXMLString(org.dom4j.Element el, ims.domain.DomainFactory factory, java.util.List list, java.util.HashMap domMap) throws Exception
  	{
  		if (list == null)
  		 list = new java.util.ArrayList();
  		fillListFromXMLString(list, el, factory, domMap);
  		return list;
  	}
  	
  	public static java.util.Set fromSetXMLString(org.dom4j.Element el, ims.domain.DomainFactory factory, java.util.Set set, java.util.HashMap domMap) throws Exception
  	{
  		if (set == null)
  			 set = new java.util.HashSet();
  		fillSetFromXMLString(set, el, factory, domMap);
  		return set;
  	}
  	
  	private static void fillSetFromXMLString(java.util.Set set, org.dom4j.Element el, ims.domain.DomainFactory factory, java.util.HashMap domMap) throws Exception
  	{
  		if (el == null)
  			return;
  		
  		java.util.List cl = el.elements("class");
  		int size = cl.size();
  		
  		java.util.Set newSet = new java.util.HashSet();
  		for(int i=0; i<size; i++) 
  		{
  			org.dom4j.Element itemEl = (org.dom4j.Element)cl.get(i);
  			ActionRequest domainObject = getActionRequestfromXML(itemEl, factory, domMap);
  
  			if (domainObject == null)
  			{
  				continue;
  			}
  			
  			//Trying to avoid the hibernate collection being marked as dirty via its public interface methods. (like add)
  			if (!set.contains(domainObject)) 
  				set.add(domainObject);
  			newSet.add(domainObject);			
  		}
  		
  		java.util.Set removedSet = new java.util.HashSet();
  		java.util.Iterator iter = set.iterator();
  		//Find out which objects need to be removed
  		while (iter.hasNext())
  		{
  			ims.domain.DomainObject o = (ims.domain.DomainObject)iter.next();			
  			if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue()) && !newSet.contains(o))
  			{
  				removedSet.add(o);
  			}
  		}
  		iter = removedSet.iterator();
  		//Remove the unwanted objects
  		while (iter.hasNext())
  		{
  			set.remove(iter.next());
  		}		
  	}
  	
  	private static void fillListFromXMLString(java.util.List list, org.dom4j.Element el, ims.domain.DomainFactory factory, java.util.HashMap domMap) throws Exception
  	{
  		if (el == null)
  			return;
  		
  		java.util.List cl = el.elements("class");
  		int size = cl.size();
  		
  