/*
* HsAreaData.java
*
* Generated by com.evutils.codegen.EntityObjectGenerator
*
* Edit at will
*/
package siprp.data.outer;

import com.evolute.entity.evo.EvoDataException;

public final class HsAreaData extends siprp.data.inner.HsArea
{

	public HsAreaData()
	{
		super();
	}
	
	@Override
	public void save() throws EvoDataException
	{
		EmpresasData empresa = toEmpresa_id();
		if( empresa != null )
		{
			Integer maxOrder = 0;
			for( HsAreaData area : empresa.fromHsArea_empresa_id() )
			{
				Integer currentOrder = area.getOrdem();
				if( currentOrder != null )
				{
					maxOrder = Math.max( currentOrder, maxOrder );
				}
			}
			this.setOrdem( maxOrder + 1 );
		}
		super.save();
	}
	
	@Override
	public String toString()
	{
		return getDescription();
	}
	
}
