You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
871 B

package siprp.database.cayenne.objects;
import siprp.database.cayenne.objects.auto._HsArea;
public class HsArea extends _HsArea {
private static final long serialVersionUID = 1L;
@Override
public String getDescription()
{
return parseFromUnicode( super.getDescription() );
}
@Override
public void setDescription( String nome )
{
super.setDescription( parseToUnicode( nome ) );
}
@Override
public void save() throws Exception
{
Empresas empresa = getToEmpresas();
if( empresa != null )
{
Integer maxOrder = 0;
for( HsArea area : empresa.getHsAreaArray() )
{
Integer currentOrder = area.getOrder();
if( currentOrder != null )
{
maxOrder = Math.max( currentOrder, maxOrder );
}
}
this.setOrder( maxOrder + 1 );
}
super.save();
}
@Override
public String toString()
{
return getDescription();
}
}