Changeset 3380 for DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcCachedRepresentationDao.java
- Timestamp:
- 08/14/13 16:34:29 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcCachedRepresentationDao.java
r3372 r3380 70 70 result.setTool(rs.getString(tool)); 71 71 result.setType(rs.getString(type_)); 72 // TODO add where is the file when the schemis updated!!!!s72 // TODO add "where is the file when the schema" is updated!!!!s 73 73 return result; 74 74 } … … 93 93 94 94 //////////////////////////////////////////////////////////////////////////// 95 96 public CachedRepresentationInfoaddCachedRepresentationInfo(CachedRepresentationInfo cached) {95 @Override 96 public Number addCachedRepresentationInfo(CachedRepresentationInfo cached) { 97 97 98 98 CachedRepresentationIdentifier externalIdentifier = new CachedRepresentationIdentifier(); … … 105 105 String sql = "INSERT INTO " + cachedRepresentationTableName + "(" + external_id + "," + mime_type + "," + tool + "," + type_ + " ) VALUES (:externalId, :mime_type, :tool, :type)"; 106 106 final int affectedRows = getSimpleJdbcTemplate().update(sql, params); 107 108 if (affectedRows == 1) { 109 CachedRepresentationInfo cachedNew = makeFreshCopy(cached); 110 cachedNew.setRef(externalIdentifier.toString()); 111 return cachedNew; 112 } else { 113 return null; 114 } 107 return getInternalID(externalIdentifier); 115 108 } 116 109 … … 139 132 }; 140 133 141 ////////// Helpers ///////////////////142 private CachedRepresentationInfo makeFreshCopy(CachedRepresentationInfo cached) {143 CachedRepresentationInfo result = new CachedRepresentationInfo();144 result.setMimeType(cached.getMimeType());145 result.setRef(cached.getRef());146 result.setTool(cached.getTool());147 result.setType(cached.getType());148 return result;149 }150 151 134 }
Note: See TracChangeset
for help on using the changeset viewer.