forked from Coded/SIPRP
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.
30 lines
729 B
30 lines
729 B
package siprp.database.cayenne.objects;
|
|
|
|
import siprp.database.cayenne.objects.auto._HsLegislacaoEstabelecimento;
|
|
|
|
public class HsLegislacaoEstabelecimento extends _HsLegislacaoEstabelecimento {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@Override
|
|
public void save() throws Exception
|
|
{
|
|
Estabelecimentos estabelecimento = getToHsEstabelecimento();
|
|
if( estabelecimento != null )
|
|
{
|
|
Integer maxOrder = 0;
|
|
for( HsLegislacaoEstabelecimento rel : estabelecimento.getHsLegislacaoEstabelecimentoArray() )
|
|
{
|
|
Integer currentOrder = rel.getOrdem();
|
|
if( currentOrder != null )
|
|
{
|
|
maxOrder = Math.max( currentOrder, maxOrder );
|
|
}
|
|
}
|
|
this.setOrdem( maxOrder + 1 );
|
|
}
|
|
super.save();
|
|
}
|
|
|
|
}
|