示例#1
0
  @Button(label = "Okay", validate = true, order = 3)
  public Navigation okayClick() {
    AbstractWebApplication application = (AbstractWebApplication) getApplication();
    JdbcTemplate jdbcTemplate = application.getJdbcTemplate();

    StringBuffer ddl = new StringBuffer();
    ddl.append(
        "update "
            + TableUtilities.getTableName(application.getUserEntity())
            + " set "
            + AbstractUser.PASSWORD
            + " = ?, "
            + AbstractUser.DISABLE
            + " = ? where "
            + AbstractUser.ID
            + " = ?");
    jdbcTemplate.update(ddl.toString(), this.password, this.disable, this.userId);

    jdbcTemplate.update(
        "delete from "
            + TableUtilities.getTableName(RoleUser.class)
            + " where "
            + RoleUser.USER_ID
            + " = ?",
        this.userId);

    if (roles != null && roles.length > 0) {
      SimpleJdbcInsert mapping = new SimpleJdbcInsert(jdbcTemplate);
      mapping.withTableName(TableUtilities.getTableName(RoleUser.class));
      for (Role role : roles) {
        Map<String, Object> pp = new HashMap<String, Object>();
        pp.put(RoleUser.ROLE_ID, role.getId());
        pp.put(RoleUser.USER_ID, this.userId);
        mapping.execute(pp);
      }
    }

    jdbcTemplate.update(
        "delete from "
            + TableUtilities.getTableName(UserGroup.class)
            + " where "
            + UserGroup.USER_ID
            + " = ?",
        this.userId);
    if (groups != null && groups.length > 0) {
      SimpleJdbcInsert mapping = new SimpleJdbcInsert(jdbcTemplate);
      mapping.withTableName(TableUtilities.getTableName(UserGroup.class));
      for (Group group : groups) {
        Map<String, Object> pp = new HashMap<String, Object>();
        pp.put(UserGroup.USER_ID, this.userId);
        pp.put(UserGroup.GROUP_ID, group.getId());
        mapping.execute(pp);
      }
    }
    return new Navigation(application.getUserManagementPage());
  }
示例#2
0
  public void saveRelapse(final Relapse relapse) throws Exception {
    Map<String, Object> relapseMap =
        new HashMap<String, Object>() {
          {
            put("relID", relapse.getId());
            put("RADAR_NO", relapse.getRadarNumber());
            put("DATE_ONSET_RELAP", relapse.getDateOfRelapse());
            put(
                "RELAP_TX_NAT",
                relapse.getTransplantedNative() != null
                    ? relapse.getTransplantedNative().getId()
                    : null);
            put("TRIG_VIRAL", relapse.getViralTrigger());
            put("TRIG_IMMUN", relapse.getImmunisationTrigger());
            put("TRIG_OTHER", relapse.getOtherTrigger());
            put("RELAP_DRUG_1", relapse.getDrug1());
            put("RELAP_DRUG_2", relapse.getDrug2());
            put("RELAP_DRUG_3", relapse.getDrug3());
            put(
                "REMISS_ACHIEVE",
                relapse.getRemissionAchieved() != null
                    ? relapse.getRemissionAchieved().getId()
                    : null);
            put("DATE_REMISSION", relapse.getDateOfRemission());
            put("SEQ_NO", relapse.getSequenceNumber());
          }
        };

    simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Relapse");
    simpleJdbcInsert.execute(relapseMap);
  }
示例#3
0
 /** {@inheritDoc} */
 @Override
 public void insert(Relay relay) {
   logger.debug("Inserting relay with id [{}]", relay.getId());
   Map<String, Object> valuesToInsert = new HashMap<String, Object>();
   valuesToInsert.put("id", relay.getId());
   valuesToInsert.put("name", relay.getText());
   jdbcInsert.execute(valuesToInsert);
 }
 @Override
 public void save(Guest... guests) {
   SimpleJdbcInsert insertStmt = new SimpleJdbcInsert(jdbc).withTableName("guest");
   for (Guest guest : guests) {
     BeanPropertySqlParameterSource params = new BeanPropertySqlParameterSource(guest);
     insertStmt.execute(params);
   }
 }
示例#5
0
 public void createClinPres(final Long id, final String pres) throws Exception {
   Map<String, Object> map =
       new HashMap<String, Object>() {
         {
           put("cID", id);
           put("CLIN_PRES", pres);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Clin_Pres");
   simpleJdbcInsert.execute(map);
 }
示例#6
0
 public void saveLabData(final long id, final long radarNo) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("labID", id);
           put("RADAR_NO", radarNo);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_LabData");
   simpleJdbcInsert.execute(therapMap);
 }
示例#7
0
 public void saveKarotype(final long id, final String type) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("kID", id);
           put("KARYOTYPE", type);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Karyotype");
   simpleJdbcInsert.execute(therapMap);
 }
示例#8
0
 public void savePhenotypes(final long id, final String desc) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("pID", id);
           put("pDesc", desc);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_PHENOTYPES");
   simpleJdbcInsert.execute(therapMap);
 }
示例#9
0
 public void saveTransplantModality(final long id, final String desc) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("trID", id);
           put("trDesc", desc);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_TRANSPLANT_MODALITY");
   simpleJdbcInsert.execute(therapMap);
 }
示例#10
0
 public void saveTransplantReject(final long id, final long trId) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("recID", id);
           put("trID", trId);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Transplant_Reject");
   simpleJdbcInsert.execute(therapMap);
 }
示例#11
0
 public void saveCountry(final Country country) throws Exception {
   Map<String, Object> map =
       new HashMap<String, Object>() {
         {
           put("cID", country.getId());
           put("cName", country.getName());
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Country");
   simpleJdbcInsert.execute(map);
 }
示例#12
0
 public void saveClinicalData(final ClinicalData clinicalData) throws Exception {
   Map<String, Object> clinicalDataMap =
       new HashMap<String, Object>() {
         {
           put("cID", clinicalData.getId());
           put("RADAR_NO", clinicalData.getRadarNumber());
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_clinicalData");
   simpleJdbcInsert.execute(clinicalDataMap);
 }
 @Override
 public void insert(Transaction transaction) throws SQLException {
   logger.debug("Inserting transaction with type [{}]", transaction.getFlockId());
   Map<String, Object> valuesToInsert = new HashMap<String, Object>();
   valuesToInsert.put("FlockID", transaction.getFlockId());
   valuesToInsert.put("Name", transaction.getName());
   valuesToInsert.put("Expenses", transaction.getExpenses());
   valuesToInsert.put("Revenues", transaction.getRevenues());
   jdbcInsert.setGeneratedKeyName("ID");
   jdbcInsert.execute(valuesToInsert);
 }
示例#14
0
 public void saveRRTTreatment(final long id, final long radarNo) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("tID", id);
           put("RADAR_NO", radarNo);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_RRT_TREATMENT");
   simpleJdbcInsert.execute(therapMap);
 }
示例#15
0
 public void savePlasmaLu(final long id, final String desc) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("exID", id);
           put("exDesc", desc);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_RRT_PLASMA_LU");
   simpleJdbcInsert.execute(therapMap);
 }
示例#16
0
 public void saveSex(final long id, final String type) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("sID", id);
           put("sType", type);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Sex");
   simpleJdbcInsert.execute(therapMap);
 }
示例#17
0
 public void savePrdCode(final String code, final String term) throws Exception {
   Map<String, Object> map =
       new HashMap<String, Object>() {
         {
           put("ERA_EDTA_PRD_code", code);
           put("ERA_EDTA_primaryRenalDiagnosisTerm", term);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("rdr_prd_code");
   simpleJdbcInsert.execute(map);
 }
示例#18
0
 public void saveTherapy(final Therapy therapy) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("RADAR_NO", therapy.getRadarNumber());
           put("tID", therapy.getId());
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Therapy");
   simpleJdbcInsert.execute(therapMap);
 }
示例#19
0
 public void saveTransplant(final long id, final long radarNo, final Date date) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("trID", id);
           put("RADAR_NO", radarNo);
           put("DATE_TRANSPLANT", date);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Transplant");
   simpleJdbcInsert.execute(therapMap);
 }
示例#20
0
 public void saveImmunsupTreatment(final ImmunosuppressionTreatment immunosuppressionTreatment) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("tID", immunosuppressionTreatment.getId());
           put("RADAR_NO", immunosuppressionTreatment.getRadarNumber());
           put("IMMUNSUP_DRUG", immunosuppressionTreatment.getImmunosuppression().getId());
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_IMMUNSUP_TREATMENT");
   simpleJdbcInsert.execute(therapMap);
 }
示例#21
0
 public void saveStatus(final long id, final String desc, final String sAbbrev) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("sID", id);
           put("sDesc", desc);
           put("sAbbrev", sAbbrev);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Status");
   simpleJdbcInsert.execute(therapMap);
 }
示例#22
0
  public void savePathology(final Pathology pathology) {
    Map<String, Object> pathologyMap =
        new HashMap<String, Object>() {
          {
            put("pID", pathology.getId());
            put("RADAR_NO", pathology.getRadarNumber());
          }
        };

    simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Pathology");
    simpleJdbcInsert.execute(pathologyMap);
  }
示例#23
0
 public void saveDiagnosisMapping(final String group, final String code, final int ordering)
     throws Exception {
   Map<String, Object> map =
       new HashMap<String, Object>() {
         {
           put("workingGroup", group);
           put("PRDCode", code);
           put("ordering", ordering);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("rdr_diagnosis_mapping");
   simpleJdbcInsert.execute(map);
 }
示例#24
0
 public void saveConsultant(final Consultant consultant) throws Exception {
   Map<String, Object> consultantMap =
       new HashMap<String, Object>() {
         {
           put("cSNAME", consultant.getSurname());
           put("cFNAME", consultant.getForename());
           put("cCentre", consultant.getCentre() == null ? null : consultant.getCentre().getId());
           put("cID", consultant.getId());
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Consultants");
   simpleJdbcInsert.execute(consultantMap);
 }
示例#25
0
 public void saveDiagCode(final long id, final String dcDesc, final String dcAbbr)
     throws Exception {
   Map<String, Object> consultantMap =
       new HashMap<String, Object>() {
         {
           put("dcID", id);
           put("dcDesc", dcDesc);
           put("dcAbbr", dcAbbr);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_DiagCode");
   simpleJdbcInsert.execute(consultantMap);
 }
示例#26
0
 public void saveSpecialty(
     final long id, final String context, final String name, final String description) {
   Map<String, Object> therapMap =
       new HashMap<String, Object>() {
         {
           put("id", id);
           put("context", context);
           put("description", description);
           put("name", name);
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("specialty");
   simpleJdbcInsert.execute(therapMap);
 }
示例#27
0
 public void saveHospitalisation(final Hospitalisation hospitalisation) throws Exception {
   Map<String, Object> consultantMap =
       new HashMap<String, Object>() {
         {
           put("hID", hospitalisation.getId());
           put("RADAR_NO", hospitalisation.getRadarNumber());
           put("DATE_ADMIT", hospitalisation.getDateOfAdmission());
           put("DATE_DISCHARGE", hospitalisation.getDateOfDischarge());
           put("REASON_ADMIT", hospitalisation.getReason());
           put("COMMENT", hospitalisation.getComments());
         }
       };
   simpleJdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("tbl_Hospitalisation");
   simpleJdbcInsert.execute(consultantMap);
 }
  /**
   * Add a new TournamentEnrollment to the database
   *
   * @param enrollment the enrollment to be added
   */
  public void addEnrollment(TournamentEnrollment enrollment) {
    SimpleJdbcInsert insertEnrollment =
        new SimpleJdbcInsert(getDataSource()).withTableName("tournament_enrollments");

    Map<String, Object> parameters = new HashMap<String, Object>(3);
    parameters.put("tournamentId", enrollment.getTournamentid());
    parameters.put("fantasy_teamId", enrollment.getTeamId());
    parameters.put("score", enrollment.getScore());

    try {
      insertEnrollment.execute(parameters);
    } catch (DataIntegrityViolationException divx) {
      String msg = "Duplicate entry";
      log.warning(msg);
    }
  }
示例#29
0
  public void addTeam(Team team) {
    SimpleJdbcInsert insertTeam = new SimpleJdbcInsert(getDataSource()).withTableName("teams");

    Map<String, Object> teamParameters = new HashMap<String, Object>(5);
    teamParameters.put("teamid", team.getTeamId());
    teamParameters.put("location", team.getLocation());
    teamParameters.put("abbreviation", team.getAbbreviation());
    teamParameters.put("displayname", team.getDisplayName());
    teamParameters.put("venueid", team.getVenue().getVenueId());

    try {
      insertTeam.execute(teamParameters);
    } catch (DataIntegrityViolationException divex) {
      log.warning("Duplicate entry");
    }
  }
示例#30
0
  public void addGame(Game game) throws GameServiceException {
    SimpleJdbcInsert insertGame = new SimpleJdbcInsert(getDataSource()).withTableName("games");
    Map<String, Object> gameParameters = new HashMap<String, Object>(5);
    gameParameters.put("gameid", game.getGameId());
    gameParameters.put("startTime", game.getStartTime());
    gameParameters.put("teamHomeid", game.getTeamHome().getTeamId());
    gameParameters.put("teamAwayid", game.getTeamAway().getTeamId());
    gameParameters.put("venueid", game.getVenue().getVenueId());

    try {
      insertGame.execute(gameParameters);
    } catch (DataIntegrityViolationException divex) {
      log.warning("Duplicate entry");
      throw new GameServiceException(divex.getMessage(), divex);
    }
  }