コード例 #1
0
ファイル: Candidacy.java プロジェクト: afesteves/fenix
 protected boolean checkIfDataIsFilled() {
   Person person = getPerson();
   return (person.getGender() != null
       && person.getEmissionDateOfDocumentIdYearMonthDay() != null
       && person.getEmissionLocationOfDocumentId() != null
       && person.getExpirationDateOfDocumentIdYearMonthDay() != null
       && person.getSocialSecurityNumber() != null
       && person.getProfession() != null
       && person.getMaritalStatus() != null
       && person.getDateOfBirthYearMonthDay() != null
       && person.getCountry() != null
       && person.getParishOfBirth() != null
       && person.getDistrictSubdivisionOfBirth() != null
       && person.getDistrictOfBirth() != null
       && person.getCountryOfBirth() != null
       && person.getNameOfFather() != null
       && person.getNameOfMother() != null
       && person.hasDefaultPhysicalAddress()
       && person.getInstitutionalOrDefaultEmailAddressValue() != null);
 }
コード例 #2
0
  @SuppressWarnings("unchecked")
  private ByteArrayOutputStream createAcademicAdminProcessSheet(Person person) throws JRException {
    InputStream istream = getClass().getResourceAsStream(ACADEMIC_ADMIN_SHEET_REPORT_PATH);
    JasperReport report = (JasperReport) JRLoader.loadObject(istream);

    @SuppressWarnings("rawtypes")
    HashMap map = new HashMap();

    try {
      final Student student = person.getStudent();
      final Registration registration = findRegistration(student);

      map.put("executionYear", ExecutionYear.readCurrentExecutionYear().getYear());
      if (registration != null) {
        map.put("course", registration.getDegree().getNameI18N().toString());
      }
      map.put("studentNumber", student.getNumber().toString());
      map.put("fullName", person.getName());

      try {
        map.put(
            "photo",
            new ByteArrayInputStream(person.getPersonalPhotoEvenIfPending().getDefaultAvatar()));
      } catch (Exception e) {
        // nothing; print everything else
      }

      map.put(
          "sex",
          BundleUtil.getStringFromResourceBundle(
              "resources/EnumerationResources", person.getGender().name()));
      map.put("maritalStatus", person.getMaritalStatus().getPresentationName());
      map.put("profession", person.getProfession());
      map.put("idDocType", person.getIdDocumentType().getLocalizedName());
      map.put("idDocNumber", person.getDocumentIdNumber());

      YearMonthDay emissionDate = person.getEmissionDateOfDocumentIdYearMonthDay();
      if (emissionDate != null) {
        map.put(
            "idDocEmissionDate", emissionDate.toString(DateTimeFormat.forPattern("dd/MM/yyyy")));
      }

      map.put(
          "idDocExpirationDate",
          person
              .getExpirationDateOfDocumentIdYearMonthDay()
              .toString(DateTimeFormat.forPattern("dd/MM/yyyy")));
      map.put("idDocEmissionLocation", person.getEmissionLocationOfDocumentId());

      String nif = person.getSocialSecurityNumber();
      if (nif != null) {
        map.put("NIF", nif);
      }

      map.put(
          "birthDate",
          person.getDateOfBirthYearMonthDay().toString(DateTimeFormat.forPattern("dd/MM/yyyy")));
      map.put("nationality", person.getCountryOfBirth().getCountryNationality().toString());
      map.put("parishOfBirth", person.getParishOfBirth());
      map.put("districtSubdivisionOfBirth", person.getDistrictSubdivisionOfBirth());
      map.put("districtOfBirth", person.getDistrictOfBirth());
      map.put("countryOfBirth", person.getCountryOfBirth().getName());
      map.put("fathersName", person.getNameOfFather());
      map.put("mothersName", person.getNameOfMother());
      map.put("address", person.getAddress());
      map.put("postalCode", person.getPostalCode());
      map.put("locality", person.getAreaOfAreaCode());
      map.put("cellphoneNumber", person.getDefaultMobilePhoneNumber());
      map.put("telephoneNumber", person.getDefaultPhoneNumber());
      map.put("emailAddress", getMail(person));
      map.put(
          "currentDate",
          new java.text.SimpleDateFormat(
                  "'Lisboa, 'dd' de 'MMMM' de 'yyyy", new java.util.Locale("PT", "pt"))
              .format(new java.util.Date()));
    } catch (NullPointerException e) {
      // nothing; will cause printing of incomplete form
      // better than no form at all
    }

    JasperPrint print = JasperFillManager.fillReport(report, map);
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    JasperExportManager.exportReportToPdfStream(print, output);
    return output;
  }
コード例 #3
0
  private static void drawPersonalInformation(
      final Page page, final PhdProgramPublicCandidacyHashCode hashCode, final String folderName)
      throws IOException {

    final Person person = hashCode.getPerson();

    page.h(3, "Personal Information", "mtop2");
    page.tableStart("tstyle2 thwhite thnowrap thlight thleft thtop ulnomargin ");

    page.rowStart("tdbold")
        .headerStartWithStyle("width: 125px;")
        .write("Name:")
        .headerEnd()
        .column(person.getName())
        .rowEnd();
    page.rowStart()
        .header("Gender:")
        .column(person.getGender().toLocalizedString(Locale.ENGLISH))
        .rowEnd();
    page.rowStart()
        .header("Identity card type:")
        .column(person.getIdDocumentType().getLocalizedName())
        .rowEnd();
    page.rowStart().header("Identity card #:").column(person.getDocumentIdNumber()).rowEnd();
    page.rowStart().header("Issued by:").column(person.getEmissionLocationOfDocumentId()).rowEnd();
    page.rowStart()
        .header("Fiscal number:")
        .column(string(person.getSocialSecurityNumber()))
        .rowEnd();
    page.rowStart()
        .header("Date of birth:")
        .column(person.getDateOfBirthYearMonthDay().toString("dd/MM/yyyy"))
        .rowEnd();
    page.rowStart().header("Birthplace:").column(person.getDistrictSubdivisionOfBirth()).rowEnd();
    page.rowStart()
        .header("Nationality:")
        .column(person.getCountry().getCountryNationality().getContent())
        .rowEnd();
    page.rowStart().header("Address:").column(person.getAddress()).rowEnd();
    page.rowStart().header("City:").column(person.getArea()).rowEnd();
    page.rowStart().header("Zip code:").column(person.getAreaCode()).rowEnd();
    page.rowStart()
        .header("Country:")
        .column(
            (person.getCountryOfResidence() != null
                ? person.getCountryOfResidence().getName()
                : "-"))
        .rowEnd();
    page.rowStart().header("Phone:").column(person.getDefaultPhoneNumber()).rowEnd();
    page.rowStart().header("Mobile:").column(person.getDefaultMobilePhoneNumber()).rowEnd();
    page.rowStart().header("Email:").column(person.getDefaultEmailAddressValue()).rowEnd();

    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);
  }