コード例 #1
0
 public CodeSet getCodeSetById(long codesetId) {
   CodeSet codeset = null;
   try {
     codeset =
         getExtendedJdbcTemplate()
             .queryForObject(
                 getBoundSql("COMPETENCY_ACCESSMENT.SELECT_CODESET_BY_ID").getSql(),
                 codesetMapper,
                 new SqlParameterValue(Types.NUMERIC, codesetId));
     codeset.setProperties(getCodesetProperties(codesetId));
   } catch (IncorrectResultSizeDataAccessException e) {
     if (e.getActualSize() > 1) {
       log.warn(
           (new StringBuilder())
               .append("Multiple occurrances of the same codeset ID found: ")
               .append(codesetId)
               .toString());
       throw e;
     }
   } catch (DataAccessException e) {
     String message =
         (new StringBuilder())
             .append("Failure attempting to load codeset by ID : ")
             .append(codesetId)
             .append(".")
             .toString();
     log.fatal(message, e);
   }
   return codeset;
 }
コード例 #2
0
 public void saveOrUpdateCodeSet(List<CodeSet> codesets) {
   List<CodeSet> updates = new ArrayList<CodeSet>();
   List<CodeSet> inserts = new ArrayList<CodeSet>();
   for (CodeSet codeSet : codesets) {
     if (codeSet.getCodeSetId() < 1) {
       long codeSetId = getNextId(sequencerName);
       codeSet.setCodeSetId(codeSetId);
       inserts.add(codeSet);
     } else {
       updates.add(codeSet);
     }
   }
   batchUpdateCodeSet(updates);
   batchInsertCodeSet(inserts);
 }
コード例 #3
0
 public CodeSet mapRow(ResultSet rs, int rowNum) throws SQLException {
   CodeSet g = new DefaultCodeSet();
   g.setCodeSetId(rs.getLong("CODESET_ID"));
   g.setObjectType(rs.getInt("OBJECT_TYPE"));
   g.setObjectId(rs.getLong("OBJECT_ID"));
   g.setParentCodeSetId(rs.getLong("PARENT_CODESET_ID"));
   g.setName(rs.getString("NAME"));
   g.setCode(rs.getString("CODE"));
   g.setGroupCode(rs.getString("GROUP_CODE"));
   g.setDescription(rs.getString("DESCRIPTION"));
   g.setCreationDate(rs.getDate("CREATION_DATE"));
   g.setModifiedDate(rs.getDate("MODIFIED_DATE"));
   return g;
 }
コード例 #4
0
 public void saveOrUpdateCodeSet(CodeSet codeset) {
   if (codeset.getCodeSetId() == -1L) {
     long codeSetId = getNextId(sequencerName);
     codeset.setCodeSetId(codeSetId);
     getJdbcTemplate()
         .update(
             getBoundSql("COMPETENCY_ACCESSMENT.INSERT_CODESET").getSql(),
             new SqlParameterValue(Types.NUMERIC, codeset.getCodeSetId()),
             new SqlParameterValue(Types.NUMERIC, codeset.getObjectType()),
             new SqlParameterValue(Types.NUMERIC, codeset.getObjectId()),
             new SqlParameterValue(Types.NUMERIC, codeset.getParentCodeSetId()),
             new SqlParameterValue(Types.VARCHAR, codeset.getName()),
             new SqlParameterValue(Types.VARCHAR, codeset.getGroupCode()),
             new SqlParameterValue(Types.VARCHAR, codeset.getCode()),
             new SqlParameterValue(Types.VARCHAR, codeset.getDescription()),
             new SqlParameterValue(Types.TIMESTAMP, codeset.getCreationDate()),
             new SqlParameterValue(Types.TIMESTAMP, codeset.getModifiedDate()));
     if (codeset.getProperties().size() > 0) {
       setCodesetProperties(codeset.getCodeSetId(), codeset.getProperties());
     }
   } else {
     getJdbcTemplate()
         .update(
             getBoundSql("COMPETENCY_ACCESSMENT.UPDATE_CODESET").getSql(),
             new SqlParameterValue(Types.NUMERIC, codeset.getParentCodeSetId()),
             new SqlParameterValue(Types.VARCHAR, codeset.getName()),
             new SqlParameterValue(Types.VARCHAR, codeset.getGroupCode()),
             new SqlParameterValue(Types.VARCHAR, codeset.getCode()),
             new SqlParameterValue(Types.VARCHAR, codeset.getDescription()),
             new SqlParameterValue(Types.TIMESTAMP, codeset.getModifiedDate()),
             new SqlParameterValue(Types.NUMERIC, codeset.getCodeSetId()));
     deleteCodesetProperties(codeset.getCodeSetId());
     setCodesetProperties(codeset.getCodeSetId(), codeset.getProperties());
   }
 }