Package org.fenixedu.academic.domain.candidacy

Examples of org.fenixedu.academic.domain.candidacy.GenericApplicationLetterOfRecomentation


    }

    public ActionForward downloadRecomendationFile(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws IOException {
        final String confirmationCode = (String) getFromRequest(request, "confirmationCode");
        final GenericApplicationLetterOfRecomentation file = getDomainObject(request, "fileExternalId");
        if (file != null
                && file.getRecomentation() != null
                && file.getRecomentation().getConfirmationCode() != null
                && ((file.getRecomentation().getGenericApplication().getGenericApplicationPeriod().isCurrentUserAllowedToMange()) || file
                        .getRecomentation().getConfirmationCode().equals(confirmationCode))) {
            response.setContentType(file.getContentType());
            response.addHeader("Content-Disposition", "attachment; filename=\"" + file.getFilename() + "\"");
            response.setContentLength(file.getSize().intValue());
            final DataOutputStream dos = new DataOutputStream(response.getOutputStream());
            dos.write(file.getContent());
            dos.close();
        } else {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().write(HttpStatus.getStatusText(HttpStatus.SC_BAD_REQUEST));
            response.getWriter().close();
View Full Code Here


            if (uploadBean == null) {
                uploadBean = new GenericApplicationUploadBean();
                uploadBean.setDisplayName(BundleUtil.getString(Bundle.CANDIDATE, "label.recommendation.document"));
            } else {
                try {
                    final GenericApplicationLetterOfRecomentation file = uploadBean.uploadTo(recomentation);
                    if (file != null) {
                        RenderUtils.invalidateViewState();
                        request.setAttribute("recommendationSaved", Boolean.TRUE);
                    }
                } catch (Error e) {
View Full Code Here

            final byte[] content = readStreamContents();
            if (content != null && content.length > 0) {
                if (recomentation.getLetterOfRecomentation() != null) {
                    recomentation.getLetterOfRecomentation().delete();
                }
                return new GenericApplicationLetterOfRecomentation(recomentation, displayName, fileName, content);
            }
        } catch (final IOException ex) {
            throw new Error(ex);
        }
        return null;
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.candidacy.GenericApplicationLetterOfRecomentation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.