forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@762 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
d644cfc5d3
commit
7007cd475a
@ -0,0 +1,10 @@
|
|||||||
|
package siprp.database.cayenne.objects;
|
||||||
|
|
||||||
|
import siprp.database.cayenne.objects.auto._ExamesPortaria;
|
||||||
|
|
||||||
|
public class ExamesPortaria extends _ExamesPortaria {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
package siprp.database.cayenne.objects.auto;
|
||||||
|
|
||||||
|
import siprp.database.cayenne.objects.BaseObject;
|
||||||
|
import siprp.database.cayenne.objects.TiposExamesComp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class _ExamesPerfis was generated by Cayenne.
|
||||||
|
* It is probably a good idea to avoid changing this class manually,
|
||||||
|
* since it may be overwritten next time code is regenerated.
|
||||||
|
* If you need to make any customizations, please use subclass.
|
||||||
|
*/
|
||||||
|
public abstract class _ExamesPerfis extends BaseObject {
|
||||||
|
|
||||||
|
public static final String ID_PROPERTY = "id";
|
||||||
|
public static final String MULTIPLICADOR_PROPERTY = "multiplicador";
|
||||||
|
public static final String PERFIL_PROPERTY = "perfil";
|
||||||
|
public static final String TO_TIPOS_EXAMES_COMP_PROPERTY = "toTiposExamesComp";
|
||||||
|
|
||||||
|
public static final String ID_PK_COLUMN = "id";
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
writeProperty("id", id);
|
||||||
|
}
|
||||||
|
public Integer getId() {
|
||||||
|
return (Integer)readProperty("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplicador(Integer multiplicador) {
|
||||||
|
writeProperty("multiplicador", multiplicador);
|
||||||
|
}
|
||||||
|
public Integer getMultiplicador() {
|
||||||
|
return (Integer)readProperty("multiplicador");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPerfil(Integer perfil) {
|
||||||
|
writeProperty("perfil", perfil);
|
||||||
|
}
|
||||||
|
public Integer getPerfil() {
|
||||||
|
return (Integer)readProperty("perfil");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToTiposExamesComp(TiposExamesComp toTiposExamesComp) {
|
||||||
|
setToOneTarget("toTiposExamesComp", toTiposExamesComp, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TiposExamesComp getToTiposExamesComp() {
|
||||||
|
return (TiposExamesComp)readProperty("toTiposExamesComp");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,236 @@
|
|||||||
|
package siprp.database.cayenne.providers;
|
||||||
|
|
||||||
|
import org.apache.cayenne.CayenneDataObject;
|
||||||
|
import org.apache.cayenne.DataObjectUtils;
|
||||||
|
|
||||||
|
import siprp.MedicinaConstants;
|
||||||
|
import siprp.database.cayenne.objects.EmailPlanoDeActuacao;
|
||||||
|
import siprp.database.cayenne.objects.Estabelecimentos;
|
||||||
|
|
||||||
|
public class PlanoActuacaoDAO extends MainDAO implements MedicinaConstants
|
||||||
|
{
|
||||||
|
|
||||||
|
public Estabelecimentos getEstabelecimentoByID( Integer id )
|
||||||
|
{
|
||||||
|
return (Estabelecimentos) DataObjectUtils.objectForPK( context, Estabelecimentos.class, id );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void commit()
|
||||||
|
{
|
||||||
|
context.commitChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete( CayenneDataObject object )
|
||||||
|
{
|
||||||
|
if( object != null )
|
||||||
|
{
|
||||||
|
context.deleteObject( object );
|
||||||
|
context.commitChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEmailToEstabelecimento( String email, Estabelecimentos estabelecimento )
|
||||||
|
{
|
||||||
|
EmailPlanoDeActuacao emailObject = (EmailPlanoDeActuacao) context.newObject( EmailPlanoDeActuacao.class );
|
||||||
|
emailObject.setDescription( email );
|
||||||
|
emailObject.setToEstabelecimentos( estabelecimento );
|
||||||
|
context.commitChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
// public Legislacao createNovaLegislacao( Legislacao parent )
|
||||||
|
// {
|
||||||
|
// Legislacao legislacaoObject = (Legislacao) context.newObject( Legislacao.class );
|
||||||
|
// legislacaoObject.setToLegislacao( parent );
|
||||||
|
// legislacaoObject.setDescription( "" );
|
||||||
|
// return legislacaoObject;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public PostoDeTrabalho createPostoTrabalho( String postoTrabalho )
|
||||||
|
// {
|
||||||
|
// PostoDeTrabalho postoTrabalhoObject = (PostoDeTrabalho) context.newObject( PostoDeTrabalho.class );
|
||||||
|
// postoTrabalhoObject.setDescription( postoTrabalho );
|
||||||
|
// context.commitChanges();
|
||||||
|
// return postoTrabalhoObject;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void addLegislacaoToEstabelecimento( Legislacao legislacao, Estabelecimentos estabelecimento )
|
||||||
|
// {
|
||||||
|
// LegislacaoEstabelecimento rel = (LegislacaoEstabelecimento) context.newObject( LegislacaoEstabelecimento.class );
|
||||||
|
// rel.setToEstabelecimentos( estabelecimento );
|
||||||
|
// rel.setToLegislacao( legislacao );
|
||||||
|
// context.commitChanges();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void addPostoTrabalhoToEstabelecimento( PostoDeTrabalho postoTrabalho, Estabelecimentos estabelecimento )
|
||||||
|
// {
|
||||||
|
// PostoDeTrabalhoEstabelecimento rel = (PostoDeTrabalhoEstabelecimento) context.newObject( PostoDeTrabalhoEstabelecimento.class );
|
||||||
|
// rel.setToEstabelecimentos( estabelecimento );
|
||||||
|
// rel.setToPostoDeTrabalho( postoTrabalho );
|
||||||
|
// context.commitChanges();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private boolean containsPostoTrabalho( List<PostoDeTrabalhoEstabelecimento> rels, Estabelecimentos estabelecimento )
|
||||||
|
// {
|
||||||
|
// boolean result = false;
|
||||||
|
// for( PostoDeTrabalhoEstabelecimento rel : rels )
|
||||||
|
// {
|
||||||
|
// if( rel.getToEstabelecimentos().equals( estabelecimento ) )
|
||||||
|
// {
|
||||||
|
// result = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private boolean containsLegislacao( List<LegislacaoEstabelecimento> rels, Estabelecimentos estabelecimento )
|
||||||
|
// {
|
||||||
|
// boolean result = false;
|
||||||
|
// for( LegislacaoEstabelecimento rel : rels )
|
||||||
|
// {
|
||||||
|
// if( rel.getToEstabelecimentos().equals( estabelecimento ) )
|
||||||
|
// {
|
||||||
|
// result = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public PostoDeTrabalho [] getAllPostosNotInEstabelecimento( Estabelecimentos estabelecimento )
|
||||||
|
// {
|
||||||
|
// List<PostoDeTrabalho> result = new LinkedList<PostoDeTrabalho>();
|
||||||
|
// SelectQuery query = new SelectQuery( PostoDeTrabalho.class );
|
||||||
|
// List<PostoDeTrabalho> res = context.performQuery( query );
|
||||||
|
// if( res != null )
|
||||||
|
// {
|
||||||
|
// for( PostoDeTrabalho posto : res )
|
||||||
|
// {
|
||||||
|
// if( !containsPostoTrabalho( posto.getPostoDeTrabalhoEstabelecimentoArray() , estabelecimento ) )
|
||||||
|
// {
|
||||||
|
// result.add( posto );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Collections.sort( result, new Comparator<PostoDeTrabalho>()
|
||||||
|
// {
|
||||||
|
// @Override
|
||||||
|
// public int compare( PostoDeTrabalho o1, PostoDeTrabalho o2 )
|
||||||
|
// {
|
||||||
|
// return o1.getDescription().compareTo( o2.getDescription() );
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// return result.toArray( new PostoDeTrabalho[ result.size() ] );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Legislacao [] getAllLegislacoesNotInEstabelecimento( Estabelecimentos estabelecimento )
|
||||||
|
// {
|
||||||
|
// List<Legislacao> result = new LinkedList<Legislacao>();
|
||||||
|
// SelectQuery query = new SelectQuery( Legislacao.class );
|
||||||
|
// query.andQualifier( ExpressionFactory.matchExp( Legislacao.TO_LEGISLACAO_PROPERTY, null ) );
|
||||||
|
// List<Legislacao> res = context.performQuery( query );
|
||||||
|
// if( res != null )
|
||||||
|
// {
|
||||||
|
// for( Legislacao legislacao : res )
|
||||||
|
// {
|
||||||
|
// if( !containsLegislacao( legislacao.getLegislacaoEstabelecimentoArray(), estabelecimento ) )
|
||||||
|
// {
|
||||||
|
// result.add( legislacao );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Collections.sort( result, new Comparator<Legislacao>()
|
||||||
|
// {
|
||||||
|
// @Override
|
||||||
|
// public int compare( Legislacao o1, Legislacao o2 )
|
||||||
|
// {
|
||||||
|
// return o1.getDescription().compareTo( o2.getDescription() );
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// return result.toArray( new Legislacao[ result.size() ] );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Medida createMedida( String medida )
|
||||||
|
// {
|
||||||
|
// Medida medidaObject = (Medida) context.newObject( Medida.class );
|
||||||
|
// medidaObject.setDescription( medida );
|
||||||
|
// context.commitChanges();
|
||||||
|
// return medidaObject;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private boolean containsMedidas( List<RiscoMedida> rels, Risco risco )
|
||||||
|
// {
|
||||||
|
// boolean result = false;
|
||||||
|
// for( RiscoMedida rel : rels )
|
||||||
|
// {
|
||||||
|
// if( rel.getToRisco().equals( risco ) )
|
||||||
|
// {
|
||||||
|
// result = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Medida[] getAllMedidasNotInRisco( Risco risco )
|
||||||
|
// {
|
||||||
|
// List<Medida> result = new LinkedList<Medida>();
|
||||||
|
// SelectQuery query = new SelectQuery( Medida.class );
|
||||||
|
// List<Medida> res = context.performQuery( query );
|
||||||
|
// if( res != null )
|
||||||
|
// {
|
||||||
|
// for( Medida medida : res )
|
||||||
|
// {
|
||||||
|
// if( !containsMedidas( medida.getRiscoMedidaArray(), risco ) )
|
||||||
|
// {
|
||||||
|
// result.add( medida );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Collections.sort( result, new Comparator<Medida>()
|
||||||
|
// {
|
||||||
|
// @Override
|
||||||
|
// public int compare( Medida o1, Medida o2 )
|
||||||
|
// {
|
||||||
|
// return o1.getDescription().compareTo( o2.getDescription() );
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// return result.toArray( new Medida[ result.size() ] );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<Risco> getAllRiscos()
|
||||||
|
// {
|
||||||
|
// SelectQuery query = new SelectQuery(Risco.class);
|
||||||
|
// query.addOrdering( Risco.DESCRIPTION_PROPERTY, true );
|
||||||
|
// List<Risco> result = context.performQuery( query );
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void addMedidaToRisco( Medida medida, Risco risco )
|
||||||
|
// {
|
||||||
|
// RiscoMedida rel = (RiscoMedida) context.newObject( RiscoMedida.class );
|
||||||
|
// rel.setToMedida( medida );
|
||||||
|
// rel.setToRisco( risco );
|
||||||
|
// context.commitChanges();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void createRisco( String risco, Integer valorInt )
|
||||||
|
// {
|
||||||
|
// Risco riscoObject = (Risco) context.newObject( Risco.class );
|
||||||
|
// riscoObject.setDescription( risco );
|
||||||
|
// riscoObject.setValue( valorInt );
|
||||||
|
// context.commitChanges();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<Legislacao> getAllLegislacoes( Legislacao parent )
|
||||||
|
// {
|
||||||
|
// SelectQuery query = new SelectQuery( Legislacao.class );
|
||||||
|
// query.andQualifier( ExpressionFactory.matchExp( Legislacao.TO_LEGISLACAO_PROPERTY, parent ) );
|
||||||
|
// if( parent == null )
|
||||||
|
// {
|
||||||
|
// query.addOrdering( Legislacao.DESCRIPTION_PROPERTY, true );
|
||||||
|
// }
|
||||||
|
// return context.performQuery( query );
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue