コード例 #1
0
  @Override
  public List<SeekerAimsTO> buildParticipants() throws Exception {
    boolean mark = false;
    List<Row> participantRows = new ArrayList<Row>();
    for (int i = 0; i < sheetParticipants.getLastRowNum(); i++) {
      Row row = sheetParticipants.getRow(i);
      if (mark) {
        if (row != null) {
          participantRows.add(row);
        }
      }
      if (row != null && row.getCell(ParticipantCols.NAME.getColumn()) != null) {
        String string = row.getCell(ParticipantCols.NAME.getColumn()).toString();
        if (string.contains(ParticipantCols.NAME.getHeader())) {
          mark = true;
        }

        if (mark) {
          if (row == null
              || (row.getCell(ParticipantCols.NAME.getColumn()) == null)
              || row.getCell(ParticipantCols.NAME.getColumn()).toString().isEmpty()) {
            mark = false;
          }
        }
      }
    }
    ProgramHeaderTO buildProgramDetails = buildProgramDetails();
    List<SeekerAimsTO> processRows = processRows(participantRows);
    for (SeekerAimsTO seekerAims : processRows) {
      seekerAims.setCountry(buildProgramDetails.getCountry());
    }
    sLogger.info("Participant list:" + participantRows.size());
    return processRows;
  }
コード例 #2
0
 /**
  * @param header
  * @param cellPhone
  */
 private void populateOrgContactMobile(ProgramHeaderTO header, Cell cellPhone) {
   if (cellPhone != null) {
     try {
       Double parseDouble = Double.parseDouble(cellPhone.toString());
       header.setOrgContactMobile(String.valueOf(parseDouble.longValue()));
     } catch (Exception e) {
       header.setOrgContactMobile(cellPhone.toString());
     }
   }
 }
コード例 #3
0
 /**
  * @param header
  * @param codateRow
  */
 private void populateStartDate(ProgramHeaderTO header, Row codateRow) {
   if (codateRow.getCell(ProgramCols.EVENT_DATE.getCell() + 1) != null) {
     String string = codateRow.getCell(ProgramCols.EVENT_DATE.getCell() + 1).toString();
     SimpleDateFormat format = new SimpleDateFormat(DD_MMM_YYYY);
     try {
       Date date = format.parse(string);
       header.setProgramStartDate(date);
     } catch (ParseException e) {
       header.setProgramRawStartDate(string);
     }
   }
 }
コード例 #4
0
  /*
   * (non-Javadoc)
   *
   * @see org.srcm.pmp.utility.ExcelDataProcessor#buildProgramDetails()
   */
  @Override
  public ProgramHeaderTO buildProgramDetails() throws Exception {
    if (sheetEvent == null || sheetParticipants == null) {
      throw new Exception("Invalid V2");
    }
    ProgramHeaderTO header = new ProgramHeaderTO();

    Row programEventRow = sheetEvent.getRow(ProgramCols.EVENT_TYPE.getRow());
    Row programOther = sheetEvent.getRow(ProgramCols.OTHER.getRow());
    Row programEventPlace = sheetEvent.getRow(ProgramCols.EVENT_PLACE.getRow());
    Row programEventDate = sheetEvent.getRow(ProgramCols.EVENT_DATE.getRow());
    Row programCountry = sheetEvent.getRow(ProgramCols.EVENT_COUNTRY.getRow());
    Row programState = sheetEvent.getRow(ProgramCols.EVENT_STATE.getRow());
    Row programCity = sheetEvent.getRow(ProgramCols.EVENT_CITY.getRow());
    Row programCoordinator = sheetEvent.getRow(ProgramCols.EVENT_COORDINATORNAME.getRow());
    Row programCoordinatorMobile = sheetEvent.getRow(ProgramCols.EVENT_COORDINATOR_MOBILE.getRow());
    Row programCoordinatorMail = sheetEvent.getRow(ProgramCols.EVENT_COORDINATOR_MAIL.getRow());
    Row organizationName = sheetEvent.getRow(ProgramCols.ORGANIZATION_NAME.getRow());
    Row orgContactPerson = sheetEvent.getRow(ProgramCols.ORGANIZATION_CONTACT_PERSON.getRow());
    Row orgWebSite = sheetEvent.getRow(ProgramCols.ORGANIZATION_WEBSITE.getRow());
    Row orgContactMailId = sheetEvent.getRow(ProgramCols.ORGANIZATION_CONTACT_MAILID.getRow());
    Row orgContactMobile = sheetEvent.getRow(ProgramCols.ORGANIZATION_CONTACT_MOBILE.getRow());

    Row preceptorName = sheetEvent.getRow(ProgramCols.PRECEPTOR_NAME.getRow());
    Row preceptorId = sheetEvent.getRow(ProgramCols.PRECEPTOR_ID.getRow());
    Row welcomeCardSignedBy = sheetEvent.getRow(ProgramCols.WELCOME_CARD_SIGNEDBY.getRow());
    Row welcomeCardSignedID = sheetEvent.getRow(ProgramCols.WELCOME_CARD_SIGNER_ID.getRow());

    Row remarks = sheetEvent.getRow(ProgramCols.REMARKS.getRow() + 1);

    header.setEmail(
        validateNull(
            programCoordinatorMail.getCell(ProgramCols.EVENT_COORDINATOR_MAIL.getCell() + 1)));
    header.setChannelName(
        programEventRow.getCell(ProgramCols.EVENT_TYPE.getCell() + 1).getStringCellValue());
    header.setCenter(
        programEventPlace.getCell(ProgramCols.EVENT_PLACE.getCell() + 1).getStringCellValue());
    header.setCoordinatorName(
        validateNull(programCoordinator.getCell(ProgramCols.EVENT_COORDINATORNAME.getCell() + 1)));
    header.setInstituteName(
        organizationName.getCell(ProgramCols.ORGANIZATION_NAME.getCell() + 1).toString());
    header.setWebsite(
        validateNull(orgWebSite.getCell(ProgramCols.ORGANIZATION_WEBSITE.getCell() + 1)));
    header.setCountry(
        validateNull(programCountry.getCell(ProgramCols.EVENT_COUNTRY.getCell() + 1)));
    header.setState(validateNull(programState.getCell(ProgramCols.EVENT_STATE.getCell() + 1)));
    populateStartDate(header, programEventDate);

    header.setOther(validateNull(programOther.getCell(ProgramCols.OTHER.getCell() + 1)));
    header.setEventCity(validateNull(programCity.getCell(ProgramCols.EVENT_CITY.getCell() + 1)));
    populateCoordnatorMobile(
        header,
        programCoordinatorMobile.getCell(ProgramCols.EVENT_COORDINATOR_MOBILE.getCell() + 1));
    populateOrgContactMobile(
        header, orgContactMobile.getCell(ProgramCols.ORGANIZATION_CONTACT_MOBILE.getCell() + 1));
    header.setOrgContactPerson(
        validateNull(
            orgContactPerson.getCell(ProgramCols.ORGANIZATION_CONTACT_PERSON.getCell() + 1)));

    header.setOrgContactEmail(
        validateNull(
            orgContactMailId.getCell(ProgramCols.ORGANIZATION_CONTACT_MAILID.getCell() + 1)));
    header.setPreceptorName(
        validateNull(preceptorName.getCell(ProgramCols.PRECEPTOR_NAME.getCell() + 1)));
    header.setPreceptorId(
        validateNull(preceptorId.getCell(ProgramCols.PRECEPTOR_ID.getCell() + 1)));
    header.setWelcomeCardSignedBy(
        validateNull(welcomeCardSignedBy.getCell(ProgramCols.WELCOME_CARD_SIGNEDBY.getCell() + 1)));
    header.setWelcomeCardSignedID(
        validateNull(
            welcomeCardSignedID.getCell(ProgramCols.WELCOME_CARD_SIGNER_ID.getCell() + 1)));

    header.setRemarks(validateNull(remarks.getCell(ProgramCols.REMARKS.getCell())));
    return header;
  }