Rev 1404 | Rev 1413 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1404 | Rev 1412 | ||
---|---|---|---|
Line 159... | Line 159... | ||
159 | questionarioCleared.setStateClass(QuestionarioImpl.1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State.ASSIGNED_ANSWERS); |
159 | questionarioCleared.setStateClass(QuestionarioImpl.1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State.ASSIGNED_ANSWERS); |
160 | } |
160 | } |
161 | return questionarioCleared; |
161 | return questionarioCleared; |
162 | } |
162 | } |
163 | 163 | ||
- | 164 | public void salvarResposta(QuestionarioResposta resposta,1.5.0/docs/api/java/lang/Long.html">Long alunoRequisitadoId,UserSession userSession) throws NotAuthorizedException { |
|
- | 165 | Questionario q = DaoFactory.getQuestionarioDaoImpl().load(resposta.getQuestionario().getId()); |
|
- | 166 | QuestionarioImpl questionario = (QuestionarioImpl) DaoFactory.getQuestionarioDaoImpl().narrow(q); |
|
- | 167 | QuestionarioPedagogicoAlunoRequisitado alunoRequisitado = DaoFactory.getQuestionarioPedagogicoAlunoRequisitadoDaoImpl().load(alunoRequisitadoId); |
|
- | 168 | if(questionario.getStateEnum() != QuestionarioImpl.1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State.PROCESSING && questionario.getStateEnum() != QuestionarioImpl.1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State.PROCESSING_WITH_ANSWERS ) |
|
- | 169 | { |
|
- | 170 | throw new NotAuthorizedException("O questionário interrompido por razões administrativas, por favor tente mais tarde"); |
|
- | 171 | } |
|
- | 172 | if(!((alunoRequisitado.getRespostaRequisitada().getQuestionario().getId() == questionario.getId()) |
|
- | 173 | && |
|
- | 174 | alunoRequisitado.getRespostaRequisitada().getResposta() == null |
|
- | 175 | && |
|
- | 176 | alunoRequisitado.getAluno().getId() == userSession.getUser().getId())) |
|
- | 177 | { |
|
- | 178 | throw new NotAuthorizedException("Não está autorizado a submeter esta resposta."); |
|
- | 179 | } |
|
- | 180 | ||
- | 181 | resposta.setId(0); |
|
- | 182 | resposta.setQuestionario(questionario); |
|
- | 183 | resposta.setUser(alunoRequisitado.getAluno()); |
|
- | 184 | alunoRequisitado.getRespostaRequisitada().setResposta(resposta); |
|
- | 185 | DaoFactory.getQuestionarioRespostaDaoImpl().save(resposta); |
|
- | 186 | questionario.setStateClass(QuestionarioImpl.1.5.0/docs/api/org/omg/PortableServer/POAManagerPackage/State.html">State.PROCESSING_WITH_ANSWERS); |
|
- | 187 | } |
|
- | 188 | ||
164 | 189 | ||
165 | 190 | ||
166 | } |
191 | } |