private StudyBean createStudyBean(FormProcessor fp) {
    StudyBean newStudy = study;
    newStudy.setId(fp.getInt("studyId"));
    newStudy.setName(fp.getString("name"));
    newStudy.setOfficialTitle(fp.getString("officialTitle"));
    newStudy.setIdentifier(fp.getString("uniqueProId"));
    newStudy.setSecondaryIdentifier(fp.getString("secondProId"));
    newStudy.setPrincipalInvestigator(fp.getString("prinInvestigator"));

    newStudy.setSummary(fp.getString("description"));
    newStudy.setProtocolDescription(fp.getString("protocolDescription"));

    newStudy.setSponsor(fp.getString("sponsor"));
    newStudy.setCollaborators(fp.getString("collaborators"));
    return newStudy;
  }
  /**
   * Constructs study bean from request-first section
   *
   * @param request
   * @return
   */
  private StudyBean createStudyBean() {
    FormProcessor fp = new FormProcessor(request);
    StudyBean newStudy = (StudyBean) session.getAttribute("newStudy");
    newStudy.setName(fp.getString("name"));
    newStudy.setOfficialTitle(fp.getString("officialTitle"));
    newStudy.setIdentifier(fp.getString("uniqueProId"));
    newStudy.setSecondaryIdentifier(fp.getString("secondProId"));
    newStudy.setPrincipalInvestigator(fp.getString("prinInvestigator"));

    newStudy.setSummary(fp.getString("description"));
    newStudy.setProtocolDescription(fp.getString("protocolDescription"));

    newStudy.setSponsor(fp.getString("sponsor"));
    newStudy.setCollaborators(fp.getString("collaborators"));

    return newStudy;
  }
  public void testRewardForDining() {
    initializeLocale();
    // create a new dining of 100.00 charged to credit card '1234123412341234' by merchant
    // '123457890' as test input
    StudyBean studyBean = new StudyBean();
    studyBean.setIdentifier("default-study");

    SubjectBean subjectBean = new SubjectBean();
    subjectBean.setUniqueIdentifier("krikor");

    // Dining dining = Dining.createDining("100.00", "1234123412341234", "1234567890");

    // call the 'rewardNetwork' to test its rewardAccountFor(Dining) method
    // RewardConfirmation confirmation = rewardNetwork.rewardAccountFor(dining);
    String result = rewardNetwork.createSubject(subjectBean, studyBean, null);

    System.out.println(result);
    assertNotNull(result);
  }
  /**
   * Constructs study bean from request
   *
   * @param request
   * @return
   */
  private StudyBean createStudyBean() {
    FormProcessor fp = new FormProcessor(request);
    StudyBean study = (StudyBean) session.getAttribute("newStudy");
    study.setName(fp.getString("name"));
    study.setIdentifier(fp.getString("uniqueProId"));
    study.setSecondaryIdentifier(fp.getString("secondProId"));
    study.setSummary(fp.getString("description"));
    study.setPrincipalInvestigator(fp.getString("prinInvestigator"));
    study.setExpectedTotalEnrollment(fp.getInt("expectedTotalEnrollment"));
    java.util.Date startDate = null;
    java.util.Date endDate = null;
    try {
      local_df.setLenient(false);
      startDate = local_df.parse(fp.getString("startDate"));

    } catch (ParseException fe) {
      startDate = study.getDatePlannedStart();
      logger.info(fe.getMessage());
    }
    study.setDatePlannedStart(startDate);

    try {
      local_df.setLenient(false);
      endDate = local_df.parse(fp.getString("endDate"));

    } catch (ParseException fe) {
      endDate = study.getDatePlannedEnd();
    }
    study.setDatePlannedEnd(endDate);

    study.setFacilityCity(fp.getString("facCity"));
    study.setFacilityContactDegree(fp.getString("facConDrgree"));
    study.setFacilityName(fp.getString("facName"));
    study.setFacilityContactEmail(fp.getString("facConEmail"));
    study.setFacilityContactPhone(fp.getString("facConPhone"));
    study.setFacilityContactName(fp.getString("facConName"));
    study.setFacilityContactDegree(fp.getString("facConDegree"));
    study.setFacilityCountry(fp.getString("facCountry"));
    // study.setFacilityRecruitmentStatus(fp.getString("facRecStatus"));
    study.setFacilityState(fp.getString("facState"));
    study.setFacilityZip(fp.getString("facZip"));
    study.setStatus(Status.get(fp.getInt("statusId")));

    ArrayList parameters = study.getStudyParameters();

    for (int i = 0; i < parameters.size(); i++) {
      StudyParamsConfig scg = (StudyParamsConfig) parameters.get(i);
      String value = fp.getString(scg.getParameter().getHandle());
      logger.info("get value:" + value);
      scg.getValue().setParameter(scg.getParameter().getHandle());
      scg.getValue().setValue(value);
    }

    // YW 10-12-2007 <<
    study
        .getStudyParameterConfig()
        .setInterviewerNameRequired(fp.getString("interviewerNameRequired"));
    study
        .getStudyParameterConfig()
        .setInterviewerNameDefault(fp.getString("interviewerNameDefault"));
    study.getStudyParameterConfig().setInterviewDateRequired(fp.getString("interviewDateRequired"));
    study.getStudyParameterConfig().setInterviewDateDefault(fp.getString("interviewDateDefault"));
    // YW >>

    return study;
  }