Ignore:
Timestamp:
08/14/13 16:34:29 (11 years ago)
Author:
olhsha
Message:

"put updated body" is implemented and tested. Big refactring: simplifying DAO's and pushing their composition to rest methods. add-methods in DAO return now not the classes but internalID-s of the added resources. Still 2 test errors and 2 test failures.

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  
    7070            result.setTool(rs.getString(tool));
    7171            result.setType(rs.getString(type_));
    72             // TODO add where is the file when the schem is updated!!!!s
     72            // TODO add "where is the file when the schema" is updated!!!!s
    7373            return result;
    7474        }
     
    9393     
    9494      ////////////////////////////////////////////////////////////////////////////
    95       @Override
    96     public CachedRepresentationInfo addCachedRepresentationInfo(CachedRepresentationInfo cached) {
     95    @Override
     96    public Number addCachedRepresentationInfo(CachedRepresentationInfo cached) {
    9797
    9898        CachedRepresentationIdentifier externalIdentifier = new CachedRepresentationIdentifier();
     
    105105        String sql = "INSERT INTO " + cachedRepresentationTableName + "(" + external_id + "," + mime_type + "," + tool + "," + type_ + " ) VALUES (:externalId, :mime_type,  :tool, :type)";
    106106        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);
    115108    }
    116109
     
    139132    };
    140133
    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    
    151134}
Note: See TracChangeset for help on using the changeset viewer.