9,6 → 9,7 |
import pt.estgp.estgweb.domain.ConfigurationGradesStatusEpoca; |
import pt.estgp.estgweb.domain.DomainObjectFactory; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.web.UserSessionProxy; |
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController; |
import pt.estgp.estgweb.web.form.configuration.ConfigurationGradesForm; |
|
36,7 → 37,38 |
throws ServletException |
{ |
|
return mapping.findForward("save"); |
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services")) |
{ |
return mapping.findForward("error401"); |
} |
|
ConfigurationGradesForm f = (ConfigurationGradesForm) form; |
AbstractDao.getCurrentSession().beginTransaction(); |
for(ConfigurationGradesEpocaAvaliacao a: f.getConfigurationGrades().getEpocasAvaliacao()) |
{ |
if(a.getId() > 0) |
{ |
ConfigurationGradesEpocaAvaliacao persist = DaoFactory.getConfigurationGradesEpocaAvaliacaoDaoImpl().load(a.getId()); |
persist.setCodigoEpoca(a.getCodigoEpoca()); |
persist.setCodigoMomento(a.getCodigoMomento()); |
persist.setObs(a.getObs()); |
persist.setDescricao(a.getDescricao()); |
} |
} |
|
for(ConfigurationGradesStatusEpoca a: f.getConfigurationGrades().getStatusEpocas()) |
{ |
if(a.getId() > 0) |
{ |
ConfigurationGradesStatusEpoca persist = DaoFactory.getConfigurationGradesStatusEpocaDaoImpl().load(a.getId()); |
persist.setStatus(a.getStatus()); |
persist.setObs(a.getObs()); |
persist.setDescricao(a.getDescricao()); |
} |
} |
AbstractDao.getCurrentSession().getTransaction().commit(); |
|
return mapping.findForward("grades"); |
} |
|
public ActionForward addEpocaAvaliacao(ActionMapping mapping, |
46,8 → 78,12 |
throws ServletException |
{ |
|
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services")) |
{ |
return mapping.findForward("error401"); |
} |
AbstractDao.getCurrentSession().beginTransaction(); |
|
AbstractDao.getCurrentSession().beginTransaction(); |
ConfigurationGradesEpocaAvaliacao epoca = DomainObjectFactory.createConfigurationGradesEpocaAvaliacaoImpl(); |
DaoFactory.getConfigurationDaoImpl().load().getConfigurationGrades().getEpocasAvaliacao().add(epoca); |
DaoFactory.getConfigurationGradesEpocaAvaliacaoDaoImpl().save(epoca); |
63,6 → 99,10 |
{ |
|
|
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services")) |
{ |
return mapping.findForward("error401"); |
} |
AbstractDao.getCurrentSession().beginTransaction(); |
ConfigurationGradesStatusEpoca status = DomainObjectFactory.createConfigurationGradesStatusEpocaImpl(); |
DaoFactory.getConfigurationDaoImpl().load().getConfigurationGrades().getStatusEpoca().add(status); |
78,6 → 118,10 |
throws ServletException |
{ |
|
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services")) |
{ |
return mapping.findForward("error401"); |
} |
ConfigurationGradesForm f = (ConfigurationGradesForm) form; |
AbstractDao.getCurrentSession().beginTransaction(); |
DaoFactory.getConfigurationGradesEpocaAvaliacaoDaoImpl().delete(f.getId()); |
92,6 → 136,10 |
throws ServletException |
{ |
|
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services")) |
{ |
return mapping.findForward("error401"); |
} |
ConfigurationGradesForm f = (ConfigurationGradesForm) form; |
|
AbstractDao.getCurrentSession().beginTransaction(); |