Package org.fenixedu.academic.domain

Examples of org.fenixedu.academic.domain.Photograph


        }
        final Person person = Person.readPersonByUsername(photo.getUsername());
        if (person == null) {
            throw new DomainException("error.operatorPhotoUpload.invalid.username");
        }
        person.setPersonalPhoto(new Photograph(PhotoType.INSTITUTIONAL, ContentType.getContentType(photo.getContentType()),
                ByteStreams.toByteArray(photo.getFileInputStream())));
    }
View Full Code Here


                final IndividualCandidacyDocumentFileType type = file.getCandidacyFileType();
                if (type == IndividualCandidacyDocumentFileType.PHOTO) {
                    final Registration registration = candidacy.getRegistration();
                    if (registration != null) {
                        final Person person = registration.getPerson();
                        final Photograph personalPhotoEvenIfPending = person.getPersonalPhotoEvenIfPending();
                        if (personalPhotoEvenIfPending == null) {
                            missing++;
                            final byte[] content = file.getContent();
                            if (content != null && content.length > 0) {
                                withContent++;
                                final ContentType contentType = ContentType.getContentType(file.getContentType());
                                if (contentType != null) {
                                    withContentType++;
                                    if (chew(content)) {
                                        final Photograph p = new Photograph(PhotoType.INSTITUTIONAL, contentType, content);
                                        p.setState(PhotoState.APPROVED);
                                        person.setPersonalPhoto(p);
                                        fixed++;
                                    } else {
                                        unableToProcessImage++;
                                    }
View Full Code Here

        writer.println(addTabs(3) + "</gps>");

        writer.println(addTabs(3) + String.format(" <detail type=\"URL_IST-EPFL\">%s</detail>", getUrlForProcess(process)));
        writer.println(addTabs(3)
                + String.format(" <detail type=\"URL_IST-EPFL_DOCUMENTS\">%s</detail>", getUrlForProcessDocs(process)));
        final Photograph photo = person.getPersonalPhotoEvenIfPending();
        if (photo != null) {
            writer.println(addTabs(3) + String.format(" <detail type=\"URL_IST-EPFL_PHOTO\">%s</detail>", getUrlForPhoto(photo)));
        }

        if (process.getExternalPhdProgram() != null) {
View Full Code Here

        page.tableEnd();

        page.h(3, "Photo");
        String photoUrl = APPLICATION_PREFIX_LINK + "/phd/epfl/applications/photo";
        final Photograph photo = person.getPersonalPhotoEvenIfPending();
        if (photo != null) {
            photoUrl += "?photoOid=" + photo.getExternalId();
        }
        page.photo(photoUrl);
    }
View Full Code Here

    private void displayPhoto(final HttpServletRequest request, final HttpServletResponse response) {
        final String photoOid = request.getParameter("photoOid");
        if (photoOid == null || photoOid.isEmpty()) {
            RetrievePersonalPhotoAction.writeUnavailablePhoto(response, getServlet());
        } else {
            final Photograph photo = FenixFramework.getDomainObject(photoOid);
            RetrievePersonalPhotoAction.writePhoto(response, photo);
        }
    }
View Full Code Here

        return mapping.findForward("visualizePersonalInformation");
    }

    public ActionForward cancelSubmission(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        Photograph photo = AccessControl.getPerson().getPersonalPhotoEvenIfRejected();
        if (photo != null) {
            photo.cancelSubmission();
        }
        request.setAttribute("personBean", new PersonBean(AccessControl.getPerson()));
        request.setAttribute("emergencyContactBean", new EmergencyContactBean(AccessControl.getPerson()));
        return mapping.findForward("visualizePersonalInformation");
    }
View Full Code Here

    }

    public ActionForward retrieveOwnPhoto(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {
        final User userView = Authenticate.getUser();
        final Photograph personalPhoto = userView.getPerson().getPersonalPhotoEvenIfPending();
        if (personalPhoto != null) {
            writePhoto(response, personalPhoto);
            return null;
        }
        writeUnavailablePhoto(response);
View Full Code Here

    }

    public ActionForward retrievePendingByID(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws FenixServiceException {
        final String photoID = request.getParameter("photoCode");
        Photograph photo = FenixFramework.getDomainObject(photoID);
        if (photo != null) {
            writePhoto(response, photo);
            return null;
        }
        writeUnavailablePhoto(response);
View Full Code Here

        RoleType.grant(RoleType.PERSON, person.getUser());
        RoleType.grant(RoleType.STUDENT, person.getUser());
        RoleType.grant(RoleType.RESEARCHER, person.getUser());

        if (person.getPersonalPhoto() == null) {
            final Photograph photograph = person.getPersonalPhotoEvenIfPending();
            if (photograph != null) {
                photograph.setState(PhotoState.APPROVED);
            }
        }
    }
View Full Code Here

    }

    private FenixPhoto getPhoto(final Person person) {
        FenixPhoto photo = null;
        try {
            final Photograph personalPhoto = person.getPersonalPhoto();
            if (person.isPhotoAvailableToCurrentUser()) {
                final byte[] avatar = personalPhoto.getDefaultAvatar();
                String type = ContentType.PNG.getMimeType();
                String data = Base64.getEncoder().encodeToString(avatar);
                photo = new FenixPhoto(type, data);
            }
        } catch (Exception npe) {
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.Photograph

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.