Skip to content

Commit

Permalink
Rooms API: upload / delete a room picture
Browse files Browse the repository at this point in the history
- update the room after a picture has been added, updated, or deleted
  - this seems to fix an issue with some pictures not being uploaded / deleted when the API is called multiple times in a sequence for a particular room
  • Loading branch information
tomas-muller committed Jul 26, 2016
1 parent f8628e6 commit 1592ce8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public void doDelete(ApiHelper helper) throws IOException {

picture.getLocation().getPictures().remove(picture);
helper.getHibSession().delete(picture);
helper.getHibSession().saveOrUpdate(picture.getLocation());
helper.getHibSession().flush();

helper.setResponse(new RoomPictureInterface(picture.getUniqueId(), picture.getFileName(), picture.getContentType(), picture.getTimeStamp().getTime(), RoomPicturesBackend.getPictureType(picture.getType())));
Expand Down Expand Up @@ -232,6 +233,7 @@ protected void updatePicture(ApiHelper helper, Location location, BinaryFile fil
picture.setTimeStamp(new Date());
picture.setDataFile(file.getBytes());
helper.getHibSession().saveOrUpdate(picture);
helper.getHibSession().saveOrUpdate(location);
helper.getHibSession().flush();
helper.setResponse(new RoomPictureInterface(picture.getUniqueId(), picture.getFileName(), picture.getContentType(), picture.getTimeStamp().getTime(), RoomPicturesBackend.getPictureType(picture.getType())));
}
Expand Down
1 change: 1 addition & 0 deletions WebContent/help/Release-Notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<name>Room Pictures</name>
<description>
<line>Rooms, Room Detail: added a mouse-over which shows a bigger picture (limited to 800 x 600 pixels).</line>
<line>Rooms API: fixed an issue with some pictures not being uploaded / deleted when the API is called multiple times in a sequence for a particular room.</line>
</description>
</item>
</category>
Expand Down

0 comments on commit 1592ce8

Please sign in to comment.