Package org.fenixedu.academic.domain.candidacy

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


        final String confirmationCode = (String) getFromRequest(request, "confirmationCode");

        if (application != null && confirmationCode != null && application.getConfirmationCode() != null
                && application.getConfirmationCode().equals(confirmationCode)) {
            try {
                final GenericApplicationFile file = uploadBean.uploadTo(application);
                if (file != null) {
                    RenderUtils.invalidateViewState();
                } else {
                    request.setAttribute("hasUploadFileError", Boolean.TRUE);
                }
View Full Code Here


    public ActionForward downloadFile(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws IOException {
        final GenericApplication application = getDomainObject(request, "applicationExternalId");
        final String confirmationCode = (String) getFromRequest(request, "confirmationCode");
        final GenericApplicationFile file = getDomainObject(request, "fileExternalId");
        if (application != null
                && file != null
                && file.getGenericApplication() == application
                && ((confirmationCode != null && application.getConfirmationCode() != null && application.getConfirmationCode()
                        .equals(confirmationCode)) || application.getGenericApplicationPeriod().isCurrentUserAllowedToMange())) {
            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

    public ActionForward deleteFile(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws IOException {
        final GenericApplication application = getDomainObject(request, "applicationExternalId");
        final String confirmationCode = (String) getFromRequest(request, "confirmationCode");
        final GenericApplicationFile file = getDomainObject(request, "fileExternalId");
        if (application != null && confirmationCode != null && application.getConfirmationCode() != null
                && application.getConfirmationCode().equals(confirmationCode) && file != null
                && file.getGenericApplication() == application) {
            file.deleteFromApplication();
        } else {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().write(HttpStatus.getStatusText(HttpStatus.SC_BAD_REQUEST));
            response.getWriter().close();
        }
View Full Code Here

    @Atomic
    public GenericApplicationFile uploadTo(final GenericApplication application) {
        try {
            final byte[] content = readStreamContents();
            if (content != null && content.length > 0) {
                return new GenericApplicationFile(application, displayName, fileName, content);
            }
        } catch (final IOException ex) {
            throw new Error(ex);
        }
View Full Code Here

TOP

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

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.