/FileExtraction/Java_unseen/IMS-MAXIMS_openMAXIMS/Source Library/openmaxims_workspace/ValueObjects/src/ims/spinalinjuries/vo/NurAssessmentSkinVo.java
//#############################################################################
//#                                                                           #
//#  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 Barbara Worwood using IMS Development Environment (version 1.80 build 5589.25814)
// Copyright (C) 1995-2015 IMS MAXIMS. All rights reserved.
// WARNING: DO NOT MODIFY the content of this file

package ims.spinalinjuries.vo;

/**
 * Linked to nursing.assessment.Assessment Component business object (ID: 1015100001).
 */
public class NurAssessmentSkinVo extends ims.nursing.vo.AssessmentComponent implements ims.vo.ImsCloneable, Comparable
{
	private static final long serialVersionUID = 1L;

	public NurAssessmentSkinVo()
	{
	}
	public NurAssessmentSkinVo(Integer id, int version)
	{
		super(id, version);
	}
	public NurAssessmentSkinVo(ims.spinalinjuries.vo.beans.NurAssessmentSkinVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.iscomplete = bean.getIsComplete();
		this.assessmentinfo = ims.nursing.vo.AssessmentInfoCollection.buildFromBeanCollection(bean.getAssessmentInfo());
		this.copy = bean.getCopy();
		this.componenttype = bean.getComponentType() == null ? null : ims.nursing.vo.lookups.AssessmentComponentType.buildLookup(bean.getComponentType());
		this.lastassessmentinfo = bean.getLastAssessmentInfo() == null ? null : bean.getLastAssessmentInfo().buildVo();
		this.careplantemplate = ims.nursing.vo.CarePlanTemplateCollection.buildFromBeanCollection(bean.getCarePlanTemplate());
		this.careplans = ims.nursing.vo.CarePlanCollection.buildFromBeanCollection(bean.getCarePlans());
		this.bedtype = bean.getBedType() == null ? null : ims.nursing.vo.lookups.BedType.buildLookup(bean.getBedType());
		this.mattresstype = bean.getMattressType() == null ? null : ims.nursing.vo.lookups.MattressType.buildLookup(bean.getMattressType());
		this.chairtype = bean.getChairType() == null ? null : ims.nursing.vo.lookups.ChairType.buildLookup(bean.getChairType());
		this.cushiontype = bean.getCushionType() == null ? null : ims.nursing.vo.lookups.CushionType.buildLookup(bean.getCushionType());
		this.turnsperformedby = bean.getTurnsPerformedBy() == null ? null : ims.nursing.vo.lookups.TurnsPerformedBy.buildLookup(bean.getTurnsPerformedBy());
		this.turntype = bean.getTurnType() == null ? null : ims.nursing.vo.lookups.TurnType.buildLookup(bean.getTurnType());
		this.turns = ims.nursing.vo.PatientTurnsVoCollection.buildFromBeanCollection(bean.getTurns());
		this.notes = bean.getNotes();
		this.skinassessment = bean.getSkinAssessment() == null ? null : bean.getSkinAssessment().buildVo();
		this.waterlow = bean.getWaterlow() == null ? null : bean.getWaterlow().buildVo();
		this.waterlowscore = bean.getWaterlowScore();
		this.bradenscale = bean.getBradenScale() == null ? null : bean.getBradenScale().buildVo();
	}
	public void populate(ims.vo.ValueObjectBeanMap map, ims.spinalinjuries.vo.beans.NurAssessmentSkinVoBean bean)
	{
		this.id = bean.getId();
		this.version = bean.getVersion();
		this.iscomplete = bean.getIsComplete();
		this.assessmentinfo = ims.nursing.vo.AssessmentInfoCollection.buildFromBeanCollection(bean.getAssessmentInfo());
		this.copy = bean.getCopy();
		this.componenttype = bean.getComponentType() == null ? null : ims.nursing.vo.lookups.AssessmentComponentType.buildLookup(bean.getComponentType());
		this.lastassessmentinfo = bean.getLastAssessmentInfo() == null ? null : bean.getLastAssessmentInfo().buildVo(map);
		this.careplantemplate = ims.nursing.vo.CarePlanTemplateCollection.buildFromBeanCollection(bean.getCarePlanTemplate());
		this.careplans = ims.nursing.vo.CarePlanCollection.buildFromBeanCollection(bean.getCarePlans());
		this.bedtype = bean.getBedType() == null ? null : ims.nursing.vo.lookups.BedType.buildLookup(bean.getBedType());
		this.mattresstype = bean.getMattressType() == null ? null : ims.nursing.vo.lookups.MattressType.buildLookup(bean.getMattressType());
		this.chairtype = bean.getChairType() == null ? null : ims.nursing.vo.lookups.ChairType.buildLookup(bean.getChairType());
		this.cushiontype = bean.getCushionType() == null ? null : ims.nursing.vo.lookups.CushionType.buildLookup(bean.getCushionType());
		this.turnsperformedby = bean.getTurnsPerformedBy() == null ? null : ims.nursing.vo.lookups.TurnsPerformedBy.buildLookup(bean.getTurnsPerformedBy());
		this.turntype = bean.getTurnType() == null ? null : ims.nursing.vo.lookups.TurnType.buildLookup(bean.getTurnType());
		this.turns = ims.nursing.vo.PatientTurnsVoCollection.buildFromBeanCollection(bean.getTurns());
		this.notes = bean.getNotes();
		this.skinassessment = bean.getSkinAssessment() == null ? null : bean.getSkinAssessment().buildVo(map);
		this.waterlow = bean.getWaterlow() == null ? null : bean.getWaterlow().buildVo(map);
		this.waterlowscore = bean.getWaterlowScore();
		this.bradenscale = bean.getBradenScale() == null ? null : bean.getBradenScale().buildVo(map);
	}
	public ims.vo.ValueObjectBean getBean()
	{
		return this.getBean(new ims.vo.ValueObjectBeanMap());
	}
	public ims.vo.ValueObjectBean getBean(ims.vo.ValueObjectBeanMap map)
	{
		ims.spinalinjuries.vo.beans.NurAssessmentSkinVoBean bean = null;
		if(map != null)
			bean = (ims.spinalinjuries.vo.beans.NurAssessmentSkinVoBean)map.getValueObjectBean(this);
		if (bean == null)
		{
			bean = new ims.spinalinjuries.vo.beans.NurAssessmentSkinVoBean();
			map.addValueObjectBean(this, bean);
			bean.populate(map, this);
		}
		return bean;
	}
	public Object getFieldValueByFieldName(String fieldName)
	{
		if(fieldName == null)
			throw new ims.framework.exceptions.CodingRuntimeException("Invalid field name");
		fieldName = fieldName.toUpperCase();
		if(fieldName.equals("BEDTYPE"))
			return getBedType();
		if(fieldName.equals("MATTRESSTYPE"))
			return getMattressType();
		if(fieldName.equals("CHAIRTYPE"))
			return getChairType();
		if(fieldName.equals("CUSHIONTYPE"))
			return getCushionType();
		if(fieldName.equals("TURNSPERFORMEDBY"))
			return getTurnsPerformedBy();
		if(fieldName.equals("TURNTYPE"))
			return getTurnType();
		if(fieldName.equals("TURNS"))
			return getTurns();
		if(fieldName.equals("NOTES"))
			return getNotes();
		if(fieldName.equals("SKINASSESSMENT"))
			return getSkinAssessment();
		if(fieldName.equals("WATERLOW"))
			return getWaterlow();
		if(fieldName.equals("WATERLOWSCORE"))
			return getWaterlowScore();
		if(fieldName.equals("BRADENSCALE"))
			return getBradenScale();
		return super.getFieldValueByFieldName(fieldName);
	}
	public boolean getBedTypeIsNotNull()
	{
		return this.bedtype != null;
	}
	public ims.nursing.vo.lookups.BedType getBedType()
	{
		return this.bedtype;
	}
	public void setBedType(ims.nursing.vo.lookups.BedType value)
	{
		this.isValidated = false;
		this.bedtype = value;
	}
	public boolean getMattressTypeIsNotNull()
	{
		return this.mattresstype != null;
	}
	public ims.nursing.vo.lookups.MattressType getMattressType()
	{
		return this.mattresstype;
	}
	public void setMattressType(ims.nursing.vo.lookups.MattressType value)
	{
		this.isValidated = false;
		this.mattresstype = value;
	}
	public boolean getChairTypeIsNotNull()
	{
		return this.chairtype != null;
	}
	public ims.nursing.vo.lookups.ChairType getChairType()
	{
		return this.chairtype;
	}
	public void setChairType(ims.nursing.vo.lookups.ChairType value)
	{
		this.isValidated = false;
		this.chairtype = value;
	}
	public boolean getCushionTypeIsNotNull()
	{
		return this.cushiontype != null;
	}
	public ims.nursing.vo.lookups.CushionType getCushionType()
	{
		return this.cushiontype;
	}
	public void setCushionType(ims.nursing.vo.lookups.CushionType value)
	{
		this.isValidated = false;
		this.cushiontype = value;
	}
	public boolean getTurnsPerformedByIsNotNull()
	{
		return this.turnsperformedby != null;
	}
	public ims.nursing.vo.lookups.TurnsPerformedBy getTurnsPerformedBy()
	{
		return this.turnsperformedby;
	}
	public void setTurnsPerformedBy(ims.nursing.vo.lookups.TurnsPerformedBy value)
	{
		this.isValidated = false;
		this.turnsperformedby = value;
	}
	public boolean getTurnTypeIsNotNull()
	{
		return this.turntype != null;
	}
	public ims.nursing.vo.lookups.TurnType getTurnType()
	{
		return this.turntype;
	}
	public void setTurnType(ims.nursing.vo.lookups.TurnType value)
	{
		this.isValidated = false;
		this.turntype = value;
	}
	public boolean getTurnsIsNotNull()
	{
		return this.turns != null;
	}
	public ims.nursing.vo.PatientTurnsVoCollection getTurns()
	{
		return this.turns;
	}
	public void setTurns(ims.nursing.vo.PatientTurnsVoCollection value)
	{
		this.isValidated = false;
		this.turns = value;
	}
	public boolean getNotesIsNotNull()
	{
		return this.notes != null;
	}
	public String getNotes()
	{
		return this.notes;
	}
	public static int getNotesMaxLength()
	{
		return 500;
	}
	public void setNotes(String value)
	{
		this.isValidated = false;
		this.notes = value;
	}
	public boolean getSkinAssessmentIsNotNull()
	{
		return this.skinassessment != null;
	}
	public ims.nursing.vo.SkinAssessment getSkinAssessment()
	{
		return this.skinassessment;
	}
	public void setSkinAssessment(ims.nursing.vo.SkinAssessment value)
	{
		this.isValidated = false;
		this.skinassessment = value;
	}
	public boolean getWaterlowIsNotNull()
	{
		return this.waterlow != null;
	}
	public ims.nursing.vo.WaterlowAssessmentVo getWaterlow()
	{
		return this.waterlow;
	}
	public void setWaterlow(ims.nursing.vo.WaterlowAssessmentVo value)
	{
		this.isValidated = false;
		this.waterlow = value;
	}
	public boolean getWaterlowScoreIsNotNull()
	{
		return this.waterlowscore != null;
	}
	public Integer getWaterlowScore()
	{
		return this.waterlowscore;
	}
	public void setWaterlowScore(Integer value)
	{
		this.isValidated = false;
		this.waterlowscore = value;
	}
	public boolean getBradenScaleIsNotNull()
	{
		return this.bradenscale != null;
	}
	public ims.nursing.vo.BradenScale getBradenScale()
	{
		return this.bradenscale;
	}
	public void setBradenScale(ims.nursing.vo.BradenScale value)
	{
		this.isValidated = false;
		this.bradenscale = value;
	}
	public boolean isValidated()
	{
		if(this.isBusy)
			return true;
		this.isBusy = true;
	
		if(!this.isValidated)
		{
			this.isBusy = false;
			return false;
		}
		if(this.assessmentinfo != null)
		{
			if(!this.assessmentinfo.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.lastassessmentinfo != null)
		{
			if(!this.lastassessmentinfo.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.careplantemplate != null)
		{
			if(!this.careplantemplate.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.careplans != null)
		{
			if(!this.careplans.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.turns != null)
		{
			if(!this.turns.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.skinassessment != null)
		{
			if(!this.skinassessment.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.waterlow != null)
		{
			if(!this.waterlow.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		if(this.bradenscale != null)
		{
			if(!this.bradenscale.isValidated())
			{
				this.isBusy = false;
				return false;
			}
		}
		this.isBusy = false;
		return true;
	}
	public String[] validate()
	{
		return validate(null);
	}
	public String[] validate(String[] existingErrors)
	{
		if(this.isBusy)
			return null;
		this.isBusy = true;
	
		java.util.ArrayList<String> listOfErrors = new java.util.ArrayList<String>();
		if(existingErrors != null)
		{
			for(int x = 0; x < existingErrors.length; x++)
			{
				listOfErrors.add(existingErrors[x]);
			}
		}
		if(this.assessmentinfo != null)
		{
			String[] listOfOtherErrors = this.assessmentinfo.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.lastassessmentinfo != null)
		{
			String[] listOfOtherErrors = this.lastassessmentinfo.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.careplantemplate != null)
		{
			String[] listOfOtherErrors = this.careplantemplate.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.careplans != null)
		{
			String[] listOfOtherErrors = this.careplans.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.turns != null)
		{
			String[] listOfOtherErrors = this.turns.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.notes != null)
			if(this.notes.length() > 500)
				listOfErrors.add("The length of the field [notes] in the value object [ims.spinalinjuries.vo.NurAssessmentSkinVo] is too big. It should be less or equal to 500");
		if(this.skinassessment != null)
		{
			String[] listOfOtherErrors = this.skinassessment.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.waterlow != null)
		{
			String[] listOfOtherErrors = this.waterlow.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		if(this.bradenscale != null)
		{
			String[] listOfOtherErrors = this.bradenscale.validate();
			if(listOfOtherErrors != null)
			{
				for(int x = 0; x < listOfOtherErrors.length; x++)
				{
					listOfErrors.add(listOfOtherErrors[x]);
				}
			}
		}
		int errorCount = listOfErrors.size();
		if(errorCount == 0)
		{
			this.isBusy = false;
			this.isValidated = true;
			return null;
		}
		String[] result = new String[errorCount];
		for(int x = 0; x < errorCount; x++)
			result[x] = (String)listOfErrors.get(x);
		this.isBusy = false;
		this.isValidated = false;
		return result;
	}
	public void clearIDAndVersion()
	{
		this.id = null;
		this.version = 0;
	}
	public Object clone()
	{
		if(this.isBusy)
			return this;
		this.isBusy = true;
	
		NurAssessmentSkinVo clone = new NurAssessmentSkinVo(this.id, this.version);
		
		clone.iscomplete = this.iscomplete;
		if(this.assessmentinfo == null)
			clone.assessmentinfo = null;
		else
			clone.assessmentinfo = (ims.nursing.vo.AssessmentInfoCollection)this.assessmentinfo.clone();
		clone.copy = this.copy;
		if(this.componenttype == null)
			clone.componenttype = null;
		else
			clone.componenttype = (ims.nursing.vo.lookups.AssessmentComponentType)this.componenttype.clone();
		if(this.lastassessmentinfo == null)
			clone.lastassessmentinfo = null;
		else
			clone.lastassessmentinfo = (ims.nursing.vo.AssessmentInfo)this.lastassessmentinfo.clone();
		if(this.careplantemplate == null)
			clone.careplantemplate = null;
		else
			clone.careplantemplate = (ims.nursing.vo.CarePlanTemplateCollection)this.careplantemplate.clone();
		if(this.careplans == null)
			clone.careplans = null;
		else
			clone.careplans = (ims.nursing.vo.CarePlanCollection)this.careplans.clone();
		if(this.bedtype == null)
			clone.bedtype = null;
		else
			clone.bedtype = (ims.nursing.vo.lookups.BedType)this.bedtype.clone();
		if(this.mattresstype == null)
			clone.mattresstype = null;
		else
			clone.mattresstype = (ims.nursing.vo.lookups.MattressType)this.mattresstype.clone();
		if(this.chairtype == null)
			clone.chairtype = null;
		else
			clone.chairtype = (ims.nursing.vo.lookups.ChairType)this.chairtype.clone();
		if(this.cushiontype == null)
			clone.cushiontype = null;
		else
			clone.cushiontype = (ims.nursing.vo.lookups.CushionType)this.cushiontype.clone();
		if(this.turnsperformedby == null)
			clone.turnsperformedby = null;
		else
			clone.turnsperformedby = (ims.nursing.vo.lookups.TurnsPerformedBy)this.turnsperformedby.clone();
		if(this.turntype == null)
			clone.turntype = null;
		else
			clone.turntype = (ims.nursing.vo.lookups.TurnType)this.turntype.clone();
		if(this.turns == null)
			clone.turns = null;
		else
			clone.turns = (ims.nursing.vo.PatientTurnsVoCollection)this.turns.clone();
		clone.notes = this.notes;
		if(this.skinassessment == null)
			clone.skinassessment = null;
		else
			clone.skinassessment = (ims.nursing.vo.SkinAssessment)this.skinassessment.clone();
		if(this.waterlow == null)
			clone.waterlow = null;
		else
			clone.waterlow = (ims.nursing.vo.WaterlowAssessmentVo)this.waterlow.clone();
		clone.waterlowscore = this.waterlowscore;
		if(this.bradenscale == null)
			clone.bradenscale = null;
		else
			clone.bradenscale = (ims.nursing.vo.BradenScale)this.bradenscale.clone();
		clone.isValidated = this.isValidated;
		
		this.isBusy = false;
		return clone;
	}
	public int compareTo(Object obj)
	{
		return compareTo(obj, true);
	}
	public int compareTo(Object obj, boolean caseInsensitive)
	{
		if (obj == null)
		{
			return -1;
		}
		if(caseInsensitive); // this is to avoid eclipse warning only.
		if (!(NurAssessmentSkinVo.class.isAssignableFrom(obj.getClass())))
		{
			throw new ClassCastException("A NurAssessmentSkinVo object cannot be compared an Object of type " + obj.getClass().getName());
		}
		NurAssessmentSkinVo compareObj = (NurAssessmentSkinVo)obj;
		int retVal = 0;
		if (retVal == 0)
		{
			if(this.getID_AssessmentComponent() == null && compareObj.getID_AssessmentComponent() != null)
				return -1;
			if(this.getID_AssessmentComponent() != null && compareObj.getID_AssessmentComponent() == null)
				return 1;
			if(this.getID_AssessmentComponent() != null && compareObj.getID_AssessmentComponent() != null)
				retVal = this.getID_AssessmentComponent().compareTo(compareObj.getID_AssessmentComponent());
		}
		return retVal;
	}
	public synchronized static int generateValueObjectUniqueID()
	{
		return ims.vo.ValueObject.generateUniqueID();
	}
	public int countFieldsWithValue()
	{
		int count = super.countFieldsWithValue();
		if(this.bedtype != null)
			count++;
		if(this.mattresstype != null)
			count++;
		if(this.chairtype != null)
			count++;
		if(this.cushiontype != null)
			count++;
		if(this.turnsperformedby != null)
			count++;
		if(this.turntype != null)
			count++;
		if(this.turns != null)
			count++;
		if(this.notes != null)
			count++;
		if(this.skinassessment != null)
			count++;
		if(this.waterlow != null)
			count++;
		if(this.waterlowscore != null)
			count++;
		if(this.bradenscale != null)
			count++;
		return count;
	}
	public int countValueObjectFields()
	{
		return super.countValueObjectFields() + 12;
	}
	protected ims.nursing.vo.lookups.BedType bedtype;
	protected ims.nursing.vo.lookups.MattressType mattresstype;
	protected ims.nursing.vo.lookups.ChairType chairtype;
	protected ims.nursing.vo.lookups.CushionType cushiontype;
	protected ims.nursing.vo.lookups.TurnsPerformedBy turnsperformedby;
	protected ims.nursing.vo.lookups.TurnType turntype;
	protected ims.nursing.vo.PatientTurnsVoCollection turns;
	protected String notes;
	protected ims.nursing.vo.SkinAssessment skinassessment;
	protected ims.nursing.vo.WaterlowAssessmentVo waterlow;
	protected Integer waterlowscore;
	protected ims.nursing.vo.BradenScale bradenscale;
	private boolean isValidated = false;
	private boolean isBusy = false;
}
