}
}
public ActionForward changeDeclaration(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Thesis thesis = getThesis(request);
boolean confirmation = request.getParameter("confirmReject") != null;
if (confirmation) {
RejectThesisDeclaration.runRejectThesisDeclaration(thesis);
} else {
DeclarationBean bean = getRenderedObject("declarationBean");
boolean accepted = request.getParameter("accept") != null;
if (accepted) {
if (bean.getVisibility() != null) {
AcceptThesisDeclaration.runAcceptThesisDeclaration(thesis, bean.getVisibility(), bean.getAvailableAfter());
} else {
if (bean.getVisibility() == null) {
addActionMessage("error", request, "error.student.thesis.declaration.visibility.required");
}
return mapping.findForward("thesis-declaration");
}
} else {
if (thesis.getDissertation() != null || thesis.getExtendedAbstract() != null) {
request.setAttribute("confirmRejectWithFiles", true);
return mapping.findForward("thesis-declaration");
} else {
RejectThesisDeclaration.runRejectThesisDeclaration(thesis);
}