X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/f3f7bdf3df56b4fcea3dac6f35f7a7d3d9b199c2..daadfde6f22a79b23e74fd095f6ef8a38e846b96:/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java diff --git a/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java b/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java index 6d9caef..b6b90b8 100644 --- a/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java +++ b/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java @@ -264,7 +264,7 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { } @Override - public void createFolder(Long userId, Long parentId, String name) + public FolderDTO createFolder(Long userId, Long parentId, String name) throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException { // Validate. if (userId == null) @@ -291,7 +291,7 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { " to write to this folder"); // Do the actual work. - createFolder(name, parent, creator); + return createFolder(name, parent, creator); } /** @@ -300,8 +300,9 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { * @param name * @param parent * @param creator + * @return the new folder */ - private void createFolder(String name, Folder parent, User creator) { + private FolderDTO createFolder(String name, Folder parent, User creator) { Folder folder = new Folder(); folder.setName(name); if (parent != null) { @@ -337,6 +338,7 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { folder.addPermission(permission); } dao.create(folder); + return folder.getDTO(); } /* @@ -406,7 +408,7 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { } @Override - public void modifyFolder(Long userId, Long folderId, String folderName) + public FolderDTO modifyFolder(Long userId, Long folderId, String folderName) throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException { // Validate. @@ -430,6 +432,7 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { // Do the actual modification. folder.setName(folderName); dao.update(folder); + return folder.getDTO(); } /* @@ -1081,7 +1084,7 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { } @Override - public void moveFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException, InsufficientPermissionsException, DuplicateNameException, GSSIOException, QuotaExceededException { + public void moveFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException, InsufficientPermissionsException, QuotaExceededException { if (userId == null) throw new ObjectNotFoundException("No user specified"); if (ownerId == null) @@ -1798,7 +1801,7 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { * @see gr.ebs.gss.server.ejb.ExternalAPI#moveFiles(java.lang.Long, java.util.List, java.lang.Long) */ @Override - public void moveFiles(Long userId, List fileIds, Long destId) throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException, GSSIOException, QuotaExceededException { + public void moveFiles(Long userId, List fileIds, Long destId) throws InsufficientPermissionsException, ObjectNotFoundException, QuotaExceededException { for(Long l : fileIds){ FileHeader file = dao.getEntityById(FileHeader.class, l); moveFile(userId, l, destId, file.getName()); @@ -2298,6 +2301,16 @@ public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote { return "application/vnd.ms-powerpoint"; else if (".pdf".equals(extension)) return "application/pdf"; + else if (".gif".equals(extension)) + return "image/gif"; + else if (".jpg".equals(extension) || ".jpeg".equals(extension) || ".jpe".equals(extension)) + return "image/jpeg"; + else if (".tiff".equals(extension) || ".tif".equals(extension)) + return "image/tiff"; + else if (".png".equals(extension)) + return "image/png"; + else if (".bmp".equals(extension)) + return "image/bmp"; } // when all else fails assign the default mime type return DEFAULT_MIME_TYPE;