Package org.fenixedu.academic.domain

Examples of org.fenixedu.academic.domain.Person


            throw new IllegalDataAccessException(message.toString(), requester);
        }
    }

    public static <T> void check(T c, AccessControlPredicate<T> predicate) {
        Person requester = AccessControl.getPerson();
        boolean result = false;

        result |= (predicate != null && predicate.evaluate(c));

        if (!result) {
            StringBuilder message = new StringBuilder();
            message.append("User ").append(requester.getUsername()).append(" tried to execute access content instance number")
                    .append(c.toString());
            message.append("but he/she is not authorized to do so");

            throw new IllegalDataAccessException(message.toString(), requester);
        }
View Full Code Here


            throw new IllegalDataAccessException(message.toString(), requester);
        }
    }

    static public void check(AccessControlPredicate<?> predicate) {
        Person requester = AccessControl.getPerson();
        boolean result = false;

        result |= (predicate != null && predicate.evaluate(null));

        if (!result) {
            StringBuilder message = new StringBuilder();
            final String username = requester == null ? "<nobody>" : requester.getUsername();
            message.append("User ");
            message.append(username);
            message.append(" tried to execute method but he/she is not authorized to do so");
            throw new IllegalDataAccessException(message.toString(), requester);
        }
View Full Code Here

    }

    public ActionForward prepareEditPerson(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
            HttpServletResponse response) throws Exception {

        Person person = getDomainObject(request, "personID");
        request.setAttribute("person", person);
        return mapping.findForward("prepareEditPerson");
    }
View Full Code Here

    @Atomic
    private void updatePersonPhoto(final PhotographUploadBean photo) throws FileNotFoundException, IOException {
        if (photo.getUsername() == null) {
            throw new DomainException("error.operatorPhotoUpload.null.username");
        }
        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

        return mapping.findForward("search");
    }

    public ActionForward selectPerson(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        Person person = getPersonFromParameter(request);
        request.setAttribute("login", person.getUser());
        request.setAttribute("documents", person.getAddressedDocumentSet());
        return mapping.findForward("search");
    }
View Full Code Here

                            || MANAGER_PREDICATE.evaluate(domainObject) || OPERATOR_PREDICATE.evaluate(domainObject);
                };
            };

    private static boolean hasRole(final RoleType roleType) {
        final Person person = AccessControl.getPerson();
        return person != null && person.hasRole(roleType);
    }
View Full Code Here

        return hasRole(RoleType.TEACHER) || hasActiveProfessorship();
    }

    private static boolean hasActiveProfessorship() {
        final ExecutionSemester executionSemester = ExecutionSemester.readActualExecutionSemester();
        final Person person = AccessControl.getPerson();
        for (final Professorship professorship : person.getProfessorshipsSet()) {
            if (professorship.getExecutionCourse().getExecutionPeriod() == executionSemester) {
                return true;
            }
        }
        return false;
View Full Code Here

            return false;
        }

        @Override
        public boolean evaluate(PartyContact contact) {
            final Person contactPerson = (Person) contact.getParty();
            return eval(contactPerson);
        };
View Full Code Here

        return prepare(mapping, actionForm, request, response);
    }

    @Atomic
    private void sendPhysicalAddressValidationEmail(PhysicalAddressValidation physicalAddressValidation) {
        final Person person = (Person) physicalAddressValidation.getPartyContact().getParty();
        final String subject =
                BundleUtil.getString(Bundle.MANAGER, "label.contacts.validation.operator.email.subject",
                        Unit.getInstitutionAcronym());
        final String state = StringUtils.uncapitalize(physicalAddressValidation.getState().getPresentationName());
        String body =
                BundleUtil.getString(Bundle.MANAGER, "label.contacts.validation.operator.email.body", physicalAddressValidation
                        .getPartyContact().getPresentationValue(), state);
        final String description = physicalAddressValidation.getDescription();
        if (!StringUtils.isEmpty(description)) {
            body += "\n" + description;
        }
        final String sendingEmail = person.getEmailForSendingEmails();
        if (!StringUtils.isEmpty(sendingEmail)) {
            new Message(Bennu.getInstance().getSystemSender(), Collections.EMPTY_LIST, Collections.EMPTY_LIST, subject, body,
                    sendingEmail);
        }
    }
View Full Code Here

    }

    private void addParametersInformation() {

        AdministrativeOffice administrativeOffice = getAdministrativeOffice();
        Person coordinator = administrativeOffice.getCoordinator().getPerson();
        Person student = getDocumentRequest().getPerson();
        final UniversityUnit university = UniversityUnit.getInstitutionsUniversityUnit();

        String coordinatorGender = getCoordinatorGender(coordinator);

        String labelStudent;
        if (student.isMale()) {
            labelStudent = BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.of.student.male");
        } else {
            labelStudent = BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.of.student.female");
        }

        String coordinatorName = coordinator.getName();
        String adminOfficeUnitName = getI18NText(administrativeOffice.getName()).toUpperCase();
        String universityName = getMLSTextContent(university.getPartyName()).toUpperCase();

        String institutionName = getInstitutionName().toUpperCase();

        String template = BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.courseLoad.personalData.first");
        String firstPart =
                MessageFormat.format(template, coordinatorName, coordinatorGender, adminOfficeUnitName, institutionName,
                        universityName, labelStudent);
        addParameter("firstPart", firstPart);
        addParameter("secondPart", student.getName());
        addParameter("thirdPart", BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.with.number"));
        addParameter("fourthPart", getStudentNumber());
        addParameter("fifthPart", BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.of.male"));
        addParameter("sixthPart", getDegreeDescription());
        addParameter("seventhPart", BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.courseLoad.endMessage"));
View Full Code Here

TOP

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

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.