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.coe.assessment.domain.objects;
  
  /**
   * 
   * @author Sinead McDermott
   * Generated.
   */
  
  
  public class AccommodationHousing extends ims.domain.DomainObject implements java.io.Serializable {
  	public static final int CLASSID = 1012100002;
  	private static final long serialVersionUID = 1012100002L;
  	public static final String CLASSVERSION = "${ClassVersion}";
  
  	@Override
  	public boolean shouldCapQuery()
  	{
  		return true;
  	}
  
  	private ims.domain.lookups.LookupInstance currentLivingArrangements;
  	private String currentLivingArrangementsNotes;
  	private ims.domain.lookups.LookupInstance accommodation;
  	private String accommodationNotes;
  	private ims.domain.lookups.LookupInstance assisstanceToOthers;
  	private String assistanceToOthersNotes;
      public AccommodationHousing (Integer id, int ver)
      {
      	super(id, ver);
      }
      public AccommodationHousing ()
      {
      	super();
      }
      public AccommodationHousing (Integer id, int ver, Boolean includeRecord)
      {
      	super(id, ver, includeRecord);
      }
  	public Class getRealDomainClass()
  	{
  		return ims.coe.assessment.domain.objects.AccommodationHousing.class;
  	}
  
  
  	public ims.domain.lookups.LookupInstance getCurrentLivingArrangements() {
  		return currentLivingArrangements;
  	}
  	public void setCurrentLivingArrangements(ims.domain.lookups.LookupInstance currentLivingArrangements) {
  		this.currentLivingArrangements = currentLivingArrangements;
  	}
  
  	public String getCurrentLivingArrangementsNotes() {
  		return currentLivingArrangementsNotes;
  	}
  	public void setCurrentLivingArrangementsNotes(String currentLivingArrangementsNotes) {
  		this.currentLivingArrangementsNotes = currentLivingArrangementsNotes;
  	}
  
  	public ims.domain.lookups.LookupInstance getAccommodation() {
  		return accommodation;
  	}
  	public void setAccommodation(ims.domain.lookups.LookupInstance accommodation) {
  		this.accommodation = accommodation;
  	}
  
  	public String getAccommodationNotes() {
  		return accommodationNotes;
  	}
  	public void setAccommodationNotes(String accommodationNotes) {
  		this.accommodationNotes = accommodationNotes;
  	}
  
  	public ims.domain.lookups.LookupInstance getAssisstanceToOthers() {
  		return assisstanceToOthers;
  	}
  	public void setAssisstanceToOthers(ims.domain.lookups.LookupInstance assisstanceToOthers) {
  		this.assisstanceToOthers = assisstanceToOthers;
  	}
  
  	public String getAssistanceToOthersNotes() {
  		return assistanceToOthersNotes;
  	}
  	public void setAssistanceToOthersNotes(String assistanceToOthersNotes) {
  		this.assistanceToOthersNotes = assistanceToOthersNotes;
  	}
  
  	/**
  	 * 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*currentLivingArrangements* :");
  		if (currentLivingArrangements != null)
  			auditStr.append(currentLivingArrangements.getText());
  	    auditStr.append("; ");
  		auditStr.append("\r\n*currentLivingArrangementsNotes* :");
  		auditStr.append(currentLivingArrangementsNotes);
  	    auditStr.append("; ");
  		auditStr.append("\r\n*accommodation* :");
  		if (accommodation != null)
  			auditStr.append(accommodation.getText());
  	    auditStr.append("; ");
  		auditStr.append("\r\n*accommodationNotes* :");
  		auditStr.append(accommodationNotes);
  	    auditStr.append("; ");
  		auditStr.append("\r\n*assisstanceToOthers* :");
  		if (assisstanceToOthers != null)
  			auditStr.append(assisstanceToOthers.getText());
  	    auditStr.append("; ");
  		auditStr.append("\r\n*assistanceToOthersNotes* :");
  		auditStr.append(assistanceToOthersNotes);
  	    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 = "AccommodationHousing";
  		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.getCurrentLivingArrangements() != null)
  		{
  			sb.append("<currentLivingArrangements>");
  			sb.append(this.getCurrentLivingArrangements().toXMLString()); 
  			sb.append("</currentLivingArrangements>");		
  		}
  		if (this.getCurrentLivingArrangementsNotes() != null)
  		{
  			sb.append("<currentLivingArrangementsNotes>");
  			sb.append(ims.framework.utils.StringUtils.encodeXML(this.getCurrentLivingArrangementsNotes().toString()));
  			sb.append("</currentLivingArrangementsNotes>");		
  		}
  		if (this.getAccommodation() != null)
  		{
  			sb.append("<accommodation>");
  			sb.append(this.getAccommodation().toXMLString()); 
  			sb.append("</accommodation>");		
  		}
  		if (this.getAccommodationNotes() != null)
  		{
  			sb.append("<accommodationNotes>");
  			sb.append(ims.framework.utils.StringUtils.encodeXML(this.getAccommodationNotes().toString()));
  			sb.append("</accommodationNotes>");		
  		}
  		if (this.getAssisstanceToOthers() != null)
  		{
  			sb.append("<assisstanceToOthers>");
  			sb.append(this.getAssisstanceToOthers().toXMLString()); 
  			sb.append("</assisstanceToOthers>");		
  		}
  		if (this.getAssistanceToOthersNotes() != null)
  		{
  			sb.append("<assistanceToOthersNotes>");
  			sb.append(ims.framework.utils.StringUtils.encodeXML(this.getAssistanceToOthersNotes().toString()));
  			sb.append("</assistanceToOthersNotes>");		
  		}
  		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);
  			AccommodationHousing domainObject = getAccommodationHousingfromXML(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();
  		
  