diff options
author | Simon Rettberg | 2015-06-19 18:07:41 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-06-19 18:07:41 +0200 |
commit | 3fba1e1e9d046598683a790074ee183c0f1176e6 (patch) | |
tree | 073b1df936d4252e0bdefd7bd085f43ffe32fbad /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java | |
parent | [server] Implemented getUsers call, more permission checking methods (diff) | |
download | tutor-module-3fba1e1e9d046598683a790074ee183c0f1176e6.tar.gz tutor-module-3fba1e1e9d046598683a790074ee183c0f1176e6.tar.xz tutor-module-3fba1e1e9d046598683a790074ee183c0f1176e6.zip |
Add flag to lecture that decides whether the lecture will automatically link to a new image version when one is uploaded; implement some more functionality
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java index 37baf447..51daed49 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbImage.java @@ -31,19 +31,6 @@ public class DbImage { } } - public static ImageSummaryRead getImageSummaryFromVersionId(UserInfo user, String imageVersionId) - throws TNotFoundException, SQLException { - try (MysqlConnection connection = Database.getConnection()) { - final String imageBaseId = getBaseIdForVersionId(connection, imageVersionId); - if (imageBaseId == null) - throw new TNotFoundException(); - return getImageSummary(connection, user, imageBaseId); - } catch (SQLException e) { - LOGGER.error("Query failed in DbImage.getImageSummaryFromVersionId()", e); - throw e; - } - } - /** * Get list of all images visible to the given user, optionally filtered by * the given list of tags. @@ -181,6 +168,31 @@ public class DbImage { return versionList; } + /** + * Get the UUID of the image base belonging to the given image version UUID. + * Returns <code>null</code> if the UUID does not exist. + * + * @param imageVersionId + * @return + * @throws SQLException + */ + public static String getBaseIdForVersionId(String imageVersionId) throws SQLException { + try (MysqlConnection connection = Database.getConnection()) { + return getBaseIdForVersionId(connection, imageVersionId); + } catch (SQLException e) { + LOGGER.error("Query failed in DbImage.getBaseIdForVersionId()", e); + throw e; + } + } + + /** + * Get the UUID of the image base belonging to the given image version UUID. + * Returns <code>null</code> if the UUID does not exist. + * + * @param imageVersionId + * @return + * @throws SQLException + */ private static String getBaseIdForVersionId(MysqlConnection connection, String imageVersionId) throws SQLException { MysqlStatement stmt = connection.prepareStatement("SELECT imagebaseid FROM imageversion" |