diff --git a/distro/README b/distro/README index f3dba90..ffee114 100644 --- a/distro/README +++ b/distro/README @@ -16,7 +16,7 @@ Author Version and Release Date ------------------------ -v. 6.11.0 January 2016 +v. 6.11.1 February 2016 Description diff --git a/distro/changelog.xml b/distro/changelog.xml index 608caf8..800a369 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,9 @@ + + Added icons for: .odt, .ods, .ott, .odg, .odp + + [Feature #1925] Added, new public link format: diff --git a/pom.xml b/pom.xml index b63112e..5fc1ab0 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.portlets.user workspace-tree-widget - 6.11.0-SNAPSHOT + 6.11.1-SNAPSHOT gCube Workspace Tree Widget gCube Workspace Tree Widget. diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java index 89e1c0e..5c0c759 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java @@ -4,58 +4,58 @@ import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ImageResource; public interface Icons extends ClientBundle { - + @Source("icons/cloud-drive.png") ImageResource cloudDrive(); - + @Source("icons/table.png") ImageResource table(); - + @Source("icons/close.gif") ImageResource close(); - + @Source("icons/mime/gif.gif") ImageResource gif(); - + @Source("icons/mime/pdf.gif") ImageResource pdf(); - + @Source("icons/mime/jpeg.gif") ImageResource jpeg(); - + @Source("icons/mime/png.gif") ImageResource png(); - + @Source("icons/mime/tiff.gif") ImageResource tiff(); - + @Source("icons/mime/svg.png") ImageResource svg(); @Source("icons/mime/xml.gif") ImageResource xml(); - + @Source("icons/mime/ico_htm.gif") ImageResource html(); - + @Source("icons/mime/doc.gif") ImageResource doc(); - + @Source("icons/mime/txt.gif") ImageResource txt(); - + @Source("icons/mime/movie.png") ImageResource movie(); - + @Source("icons/new-folder.png") ImageResource addFolder(); - + @Source("icons/mime/deletefolder.jpg") ImageResource deleteFolder(); @Source("icons/mime/delete.png") ImageResource deleteItem(); - + @Source("icons/rename2.png") ImageResource renameItem(); @@ -82,13 +82,13 @@ public interface Icons extends ClientBundle { @Source("icons/mime/download.png") ImageResource download(); - + @Source("icons/mime/forward.png") ImageResource separatorPath(); @Source("icons/mime/search16.png") ImageResource search(); - + @Source("icons/mime/search.png") ImageResource search2(); @@ -103,10 +103,10 @@ public interface Icons extends ClientBundle { @Source("icons/mime/togglelist.png") ImageResource toggleList(); - + @Source("icons/mime/togglegroup.png") ImageResource toggleGroup(); - + @Source("icons/mime/toggleicon.png") ImageResource toggleIcon(); @@ -121,13 +121,13 @@ public interface Icons extends ClientBundle { @Source("icons/report.png") ImageResource report(); - + @Source("icons/timeseries.png") ImageResource timeSeries(); @Source("icons/document.png") ImageResource documents(); - + @Source("icons/mime/save.gif") ImageResource save(); @@ -142,10 +142,10 @@ public interface Icons extends ClientBundle { @Source("icons/link.gif") ImageResource openUrl(); - + @Source("icons/linkadd.png") ImageResource addUrl(); - + @Source("icons/send.png") ImageResource sendTo(); @@ -187,19 +187,31 @@ public interface Icons extends ClientBundle { @Source("icons/paste.png") ImageResource paste(); - - @Source("icons/icon-odp.gif") + + @Source("icons/odp.png") ImageResource odp(); + @Source("icons/odt.png") + ImageResource odt(); + + @Source("icons/ods.png") + ImageResource ods(); + + @Source("icons/odg.png") + ImageResource odg(); + + @Source("icons/ott.png") + ImageResource ott(); + @Source("icons/refresh.gif") ImageResource refresh(); @Source("icons/loading.gif") ImageResource loading(); - + @Source("icons/loading-off.gif") ImageResource loadingOff(); - + @Source("icons/loading2.gif") ImageResource loading2(); @@ -226,112 +238,112 @@ public interface Icons extends ClientBundle { @Source("icons/workflowtemplate.png") ImageResource workflowTemplate(); - + @Source("icons/webdav.png") ImageResource webDav(); - + @Source("icons/mail-reply.png") ImageResource replyMail(); - + @Source("icons/mail-reply-all.png") ImageResource replyAllMail(); - + @Source("icons/application-link.png") ImageResource resourceLink(); - + @Source("icons/sharingFolder.png") ImageResource shareFolder(); - + @Source("icons/sharedFolder4.png") ImageResource sharedFolder(); - + @Source("icons/unSharingFolder.gif") ImageResource unShareFolder(); - + @Source("icons/unShareUsers.png") ImageResource unShareUser(); - + @Source("icons/categorize2.png") ImageResource gridView(); - + @Source("icons/users.png") ImageResource users(); - + @Source("icons/info-icon.png") ImageResource info(); - + @Source("icons/mime/csv.gif") ImageResource csv(); - + @Source("icons/excel.gif") ImageResource excel(); - + @Source("icons/ppt.gif") ImageResource ppt(); - + @Source("icons/read.png") ImageResource read(); - + @Source("icons/notread.png") ImageResource notread(); - + @Source("icons/history.png") ImageResource history(); - + @Source("icons/cut.png") ImageResource cut(); - + @Source("icons/new_create.png") ImageResource createNew(); - + @Source("icons/get-link.png") ImageResource refreshFolder(); - + @Source("icons/link-try.png") ImageResource shareLink(); - - + + @Source("icons/openURL.png") ImageResource extLink(); - + @Source("icons/sharelink.png") ImageResource publicLink(); - + // @Source("icons/user_trash_full.png") @Source("icons/full_trash.png") ImageResource trash_full(); - + // @Source("icons/user_trash.png") @Source("icons/empty_trash.png") ImageResource trash_empty(); - + @Source("icons/readonly.png") ImageResource readonly(); - + @Source("icons/writeown.png") ImageResource writeown(); - + @Source("icons/writeall.png") ImageResource writeall(); - + @Source("icons/specialfolder2.png") ImageResource vreFolder(); - + @Source("icons/admin.png") ImageResource administrator(); - + @Source("icons/add_admin.png") ImageResource addAdmin(); - + @Source("icons/admin_keys.png") ImageResource manageAdmin(); - + @Source("icons/specialfolder2.png") ImageResource specialFolder(); - + @Source("icons/shareuser.png") ImageResource user(); - + @Source("icons/sharegroup.png") ImageResource groupusers(); @@ -346,64 +358,64 @@ public interface Icons extends ClientBundle { */ @Source("icons/aoneleft.png") ImageResource selectedLeft(); - + /** * @return */ @Source("icons/aoneright.png") ImageResource selectedRight(); - + /** * @return */ @Source("icons/amoreleft.png") ImageResource allLeft(); - + /** * @return */ @Source("icons/amoreright.png") ImageResource allRight(); - + /** * @return */ @Source("icons/recycle.png") ImageResource recycle(); - + /** * @return */ @Source("icons/edit-permissions.png") ImageResource permissions(); - + @Source("icons/pencil16.png") ImageResource pencil(); - + @Source("icons/edit16.png") ImageResource edit(); - + @Source("icons/gcubeItem.jpeg") ImageResource gcubeItem(); - + @Source("icons/dvi.gif") ImageResource dvi(); - + @Source("icons/ps.gif") ImageResource postscript(); - + @Source("icons/shell-script.png") ImageResource shell(); - + @Source("icons/tex.png") ImageResource tex(); - + @Source("icons/zip.gif") ImageResource zip(); - + @Source("icons/archive-icon.png") ImageResource archive(); - + @Source("icons/java.png") ImageResource java(); @@ -412,7 +424,7 @@ public interface Icons extends ClientBundle { */ @Source("icons/hand.gif") ImageResource hand(); - + @Source("icons/about.png") ImageResource about(); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java index 7748449..60de396 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java @@ -12,9 +12,9 @@ import com.google.gwt.user.client.ui.AbstractImagePrototype; * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it */ public class Resources { - + public static final Icons ICONS = GWT.create(Icons.class); - + private static final String XML = "xml"; private static final String JAVA = "java"; private static final String HTML = "html"; @@ -35,11 +35,15 @@ public class Resources { private static final String SWF = "swf"; private static final String FLV = "flv"; private static final String AVI = "avi"; - private static final String CSV = "csv"; + private static final String CSV = "csv"; private static final String PPT = "vnd.ms-powerpoint"; private static final String PPTX = "vnd.openxmlformats-officedocument.presentationml.presentation"; - private static final String XSLX = "vnd.openxmlformats-officedocument.spreadsheetml.sheet"; - private static final String ODP = "vnd.oasis.opendocument.presentation"; + private static final String XSLX = "vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + private static final String ODP = "vnd.oasis.opendocument.presentation"; + private static final String ODT = "vnd.oasis.opendocument.text"; + private static final String ODS = "vnd.oasis.opendocument.spreadsheet"; + private static final String OTT = "vnd.oasis.opendocument.text-template"; + private static final String ODG = "application/vnd.oasis.opendocument.graphics"; private static final String XTEX = "x-tex"; private static final String ZIP = "zip"; private static final String SEVEN_ZIP = "x-7z-compressed"; @@ -47,53 +51,53 @@ public class Resources { private static final String DVI = "x-dvi"; private static final String X_SH = "x-sh"; private static final String X_SHELLSCRIPT = "x-shellscript"; - + private static final String X_BZIP = "x-bzip"; private static final String RAR = "x-rar-compressed"; private static final String GZIP = "gzip"; - + private static final String WAR ="x-tika-java-web-archive"; - + /** * Gets the cloud drive icon. * * @return the cloud drive icon */ public static AbstractImagePrototype getCloudDriveIcon(){ - - return AbstractImagePrototype.create(ICONS.cloudDrive()); + + return AbstractImagePrototype.create(ICONS.cloudDrive()); } - + /** * Gets the icon x tex. * * @return the icon x tex */ public static AbstractImagePrototype getIconXTex(){ - - return AbstractImagePrototype.create(ICONS.tex()); + + return AbstractImagePrototype.create(ICONS.tex()); } - + /** * Gets the icon postscript. * * @return the icon postscript */ public static AbstractImagePrototype getIconPostscript(){ - - return AbstractImagePrototype.create(ICONS.postscript()); + + return AbstractImagePrototype.create(ICONS.postscript()); } - + /** * Gets the icon dvi. * * @return the icon dvi */ public static AbstractImagePrototype getIconDvi(){ - - return AbstractImagePrototype.create(ICONS.dvi()); + + return AbstractImagePrototype.create(ICONS.dvi()); } - + /** * Gets the icon information. @@ -101,69 +105,111 @@ public class Resources { * @return the icon information */ public static AbstractImagePrototype getIconInformation(){ - - return AbstractImagePrototype.create(ICONS.information()); + + return AbstractImagePrototype.create(ICONS.information()); } - + /** * Gets the icon information. * * @return the icon information */ public static AbstractImagePrototype getIconAbout(){ - - return AbstractImagePrototype.create(ICONS.about()); + + return AbstractImagePrototype.create(ICONS.about()); } - + /** * Gets the icon shell. * * @return the icon shell */ public static AbstractImagePrototype getIconShell(){ - - return AbstractImagePrototype.create(ICONS.shell()); + + return AbstractImagePrototype.create(ICONS.shell()); } - + /** * Gets the icon zip. * * @return the icon zip */ public static AbstractImagePrototype getIconZip(){ - - return AbstractImagePrototype.create(ICONS.zip()); + + return AbstractImagePrototype.create(ICONS.zip()); } - - + + /** * Gets the icon odp. * * @return the icon odp */ public static AbstractImagePrototype getIconOdp(){ - - return AbstractImagePrototype.create(ICONS.odp()); + + return AbstractImagePrototype.create(ICONS.odp()); } - + + /** + * Gets the icon odp. + * + * @return the icon odp + */ + public static AbstractImagePrototype getIconOds(){ + + return AbstractImagePrototype.create(ICONS.ods()); + } + + + /** + * Gets the icon odp. + * + * @return the icon odp + */ + public static AbstractImagePrototype getIconOdg(){ + + return AbstractImagePrototype.create(ICONS.odg()); + } + + + /** + * Gets the icon odp. + * + * @return the icon odp + */ + public static AbstractImagePrototype getIconOtt(){ + + return AbstractImagePrototype.create(ICONS.ott()); + } + + /** + * Gets the icon odp. + * + * @return the icon odp + */ + public static AbstractImagePrototype getIconOdt(){ + + return AbstractImagePrototype.create(ICONS.odt()); + } + /** * Gets the icon table. * * @return the icon table */ public static AbstractImagePrototype getIconTable(){ - - return AbstractImagePrototype.create(ICONS.table()); + + return AbstractImagePrototype.create(ICONS.table()); } - + /** * Gets the icon recycle. * * @return the icon recycle */ public static AbstractImagePrototype getIconRecycle(){ - - return AbstractImagePrototype.create(ICONS.recycle()); + + return AbstractImagePrototype.create(ICONS.recycle()); } /** @@ -172,10 +218,10 @@ public class Resources { * @return the icon undo */ public static AbstractImagePrototype getIconUndo(){ - - return AbstractImagePrototype.create(ICONS.undo()); + + return AbstractImagePrototype.create(ICONS.undo()); } - + /** * Gets the icon archive. @@ -183,207 +229,207 @@ public class Resources { * @return the icon archive */ public static AbstractImagePrototype getIconArchive(){ - - return AbstractImagePrototype.create(ICONS.archive()); + + return AbstractImagePrototype.create(ICONS.archive()); } - + /** * Gets the icon link. * * @return the icon link */ public static AbstractImagePrototype getIconLink(){ - return AbstractImagePrototype.create(ICONS.extLink()); + return AbstractImagePrototype.create(ICONS.extLink()); } - + /** * Gets the icon share link. * * @return the icon share link */ public static AbstractImagePrototype getIconShareLink(){ - - return AbstractImagePrototype.create(ICONS.shareLink()); + + return AbstractImagePrototype.create(ICONS.shareLink()); } - + /** * Gets the trash full. * * @return the trash full */ public static AbstractImagePrototype getTrashFull(){ - - return AbstractImagePrototype.create(ICONS.trash_full()); + + return AbstractImagePrototype.create(ICONS.trash_full()); } - + /** * Gets the trash empty. * * @return the trash empty */ public static AbstractImagePrototype getTrashEmpty(){ - - return AbstractImagePrototype.create(ICONS.trash_empty()); + + return AbstractImagePrototype.create(ICONS.trash_empty()); } - + /** * Gets the icon create new. * * @return the icon create new */ public static AbstractImagePrototype getIconCreateNew(){ - - return AbstractImagePrototype.create(ICONS.createNew()); + + return AbstractImagePrototype.create(ICONS.createNew()); } - + /** * Gets the icon vre folder. * * @return the icon vre folder */ public static AbstractImagePrototype getIconVREFolder(){ - - return AbstractImagePrototype.create(ICONS.vreFolder()); + + return AbstractImagePrototype.create(ICONS.vreFolder()); } - + /** * Gets the icon ppt. * * @return the icon ppt */ public static AbstractImagePrototype getIconPpt(){ - - return AbstractImagePrototype.create(ICONS.ppt()); + + return AbstractImagePrototype.create(ICONS.ppt()); } - + /** * Gets the icon excel. * * @return the icon excel */ public static AbstractImagePrototype getIconExcel(){ - - return AbstractImagePrototype.create(ICONS.excel()); + + return AbstractImagePrototype.create(ICONS.excel()); } - + /** * Gets the icon users. * * @return the icon users */ public static AbstractImagePrototype getIconUsers(){ - - return AbstractImagePrototype.create(ICONS.users()); + + return AbstractImagePrototype.create(ICONS.users()); } - + /** * Gets the icon gcube item. * * @return the icon gcube item */ public static AbstractImagePrototype getIconGcubeItem(){ - - return AbstractImagePrototype.create(ICONS.gcubeItem()); + + return AbstractImagePrototype.create(ICONS.gcubeItem()); } - + /** * Gets the icon share user. * * @return the icon share user */ public static AbstractImagePrototype getIconShareUser(){ - - return AbstractImagePrototype.create(ICONS.user()); + + return AbstractImagePrototype.create(ICONS.user()); } - + /** * Gets the icon share group. * * @return the icon share group */ public static AbstractImagePrototype getIconShareGroup(){ - - return AbstractImagePrototype.create(ICONS.groupusers()); + + return AbstractImagePrototype.create(ICONS.groupusers()); } - + /** * Gets the icon special folder. * * @return the icon special folder */ public static AbstractImagePrototype getIconSpecialFolder(){ - - return AbstractImagePrototype.create(ICONS.specialFolder()); + + return AbstractImagePrototype.create(ICONS.specialFolder()); } - + /** * Gets the icon administrator. * * @return the icon administrator */ public static AbstractImagePrototype getIconAdministrator(){ - - return AbstractImagePrototype.create(ICONS.administrator()); + + return AbstractImagePrototype.create(ICONS.administrator()); } - + /** * Gets the icon cut. * * @return the icon cut */ public static AbstractImagePrototype getIconCut(){ - - return AbstractImagePrototype.create(ICONS.cut()); + + return AbstractImagePrototype.create(ICONS.cut()); } - + /** * Gets the icon info. * * @return the icon info */ public static AbstractImagePrototype getIconInfo(){ - - return AbstractImagePrototype.create(ICONS.info()); + + return AbstractImagePrototype.create(ICONS.info()); } - + /** * Gets the icon shared folder. * * @return the icon shared folder */ public static AbstractImagePrototype getIconSharedFolder(){ - - return AbstractImagePrototype.create(ICONS.sharedFolder()); + + return AbstractImagePrototype.create(ICONS.sharedFolder()); } - + /** * Gets the icon csv. * * @return the icon csv */ public static AbstractImagePrototype getIconCsv(){ - - return AbstractImagePrototype.create(ICONS.csv()); + + return AbstractImagePrototype.create(ICONS.csv()); } - + /** * Gets the icon read. * * @return the icon read */ public static AbstractImagePrototype getIconRead(){ - - return AbstractImagePrototype.create(ICONS.read()); + + return AbstractImagePrototype.create(ICONS.read()); } - + /** * Gets the icon not read. * * @return the icon not read */ public static AbstractImagePrototype getIconNotRead(){ - - return AbstractImagePrototype.create(ICONS.notread()); + + return AbstractImagePrototype.create(ICONS.notread()); } @@ -393,320 +439,320 @@ public class Resources { * @return the close icon */ public static AbstractImagePrototype getCloseIcon(){ - - return AbstractImagePrototype.create(ICONS.close()); + + return AbstractImagePrototype.create(ICONS.close()); } - + /** * Gets the icon gif. * * @return the icon gif */ public static AbstractImagePrototype getIconGif(){ - - return AbstractImagePrototype.create(ICONS.gif()); - } - + + return AbstractImagePrototype.create(ICONS.gif()); + } + /** * Gets the icon jpeg. * * @return the icon jpeg */ public static AbstractImagePrototype getIconJpeg(){ - - return AbstractImagePrototype.create(ICONS.jpeg()); - } - + + return AbstractImagePrototype.create(ICONS.jpeg()); + } + /** * Gets the icon svg. * * @return the icon svg */ public static AbstractImagePrototype getIconSvg(){ - - return AbstractImagePrototype.create(ICONS.svg()); - } - + + return AbstractImagePrototype.create(ICONS.svg()); + } + /** * Gets the icon png. * * @return the icon png */ public static AbstractImagePrototype getIconPng(){ - - return AbstractImagePrototype.create(ICONS.png()); - } - + + return AbstractImagePrototype.create(ICONS.png()); + } + /** * Gets the icon tiff. * * @return the icon tiff */ public static AbstractImagePrototype getIconTiff(){ - - return AbstractImagePrototype.create(ICONS.tiff()); - } - + + return AbstractImagePrototype.create(ICONS.tiff()); + } + /** * Gets the icon pdf. * * @return the icon pdf */ public static AbstractImagePrototype getIconPdf(){ - - return AbstractImagePrototype.create(ICONS.pdf()); + + return AbstractImagePrototype.create(ICONS.pdf()); } - + /** * Gets the icon xml. * * @return the icon xml */ public static AbstractImagePrototype getIconXml(){ - - return AbstractImagePrototype.create(ICONS.xml()); - } - + + return AbstractImagePrototype.create(ICONS.xml()); + } + /** * Gets the icon html. * * @return the icon html */ public static AbstractImagePrototype getIconHtml(){ - - return AbstractImagePrototype.create(ICONS.html()); - } - + + return AbstractImagePrototype.create(ICONS.html()); + } + /** * Gets the icon java. * * @return the icon java */ public static AbstractImagePrototype getIconJava(){ - - return AbstractImagePrototype.create(ICONS.java()); - } - + + return AbstractImagePrototype.create(ICONS.java()); + } + /** * Gets the icon doc. * * @return the icon doc */ public static AbstractImagePrototype getIconDoc(){ - - return AbstractImagePrototype.create(ICONS.doc()); - } - + + return AbstractImagePrototype.create(ICONS.doc()); + } + /** * Gets the icon txt. * * @return the icon txt */ public static AbstractImagePrototype getIconTxt(){ - - return AbstractImagePrototype.create(ICONS.txt()); - } - + + return AbstractImagePrototype.create(ICONS.txt()); + } + /** * Gets the icon movie. * * @return the icon movie */ public static AbstractImagePrototype getIconMovie(){ - - return AbstractImagePrototype.create(ICONS.movie()); - } - + + return AbstractImagePrototype.create(ICONS.movie()); + } + /** * Gets the icon add folder. * * @return the icon add folder */ public static AbstractImagePrototype getIconAddFolder(){ - - return AbstractImagePrototype.create(ICONS.addFolder()); - } - + + return AbstractImagePrototype.create(ICONS.addFolder()); + } + /** * Gets the icon add folder32. * * @return the icon add folder32 */ public static AbstractImagePrototype getIconAddFolder32(){ - - return AbstractImagePrototype.create(ICONS.addFolder32()); - } - + + return AbstractImagePrototype.create(ICONS.addFolder32()); + } + /** * Gets the icon rename item. * * @return the icon rename item */ public static AbstractImagePrototype getIconRenameItem(){ - - return AbstractImagePrototype.create(ICONS.renameItem()); - } - + + return AbstractImagePrototype.create(ICONS.renameItem()); + } + /** * Gets the icon rename item32. * * @return the icon rename item32 */ public static AbstractImagePrototype getIconRenameItem32(){ - - return AbstractImagePrototype.create(ICONS.renameItem32()); - } - + + return AbstractImagePrototype.create(ICONS.renameItem32()); + } + /** * Gets the icon file upload. * * @return the icon file upload */ public static AbstractImagePrototype getIconFileUpload(){ - - return AbstractImagePrototype.create(ICONS.uploadFile()); - } - + + return AbstractImagePrototype.create(ICONS.uploadFile()); + } + /** * Gets the icon file upload32. * * @return the icon file upload32 */ public static AbstractImagePrototype getIconFileUpload32(){ - - return AbstractImagePrototype.create(ICONS.uploadFile32()); - } - + + return AbstractImagePrototype.create(ICONS.uploadFile32()); + } + /** * Gets the icon delete folder. * * @return the icon delete folder */ public static AbstractImagePrototype getIconDeleteFolder(){ - - return AbstractImagePrototype.create(ICONS.deleteFolder()); - } - + + return AbstractImagePrototype.create(ICONS.deleteFolder()); + } + /** * Gets the icon delete item. * * @return the icon delete item */ public static AbstractImagePrototype getIconDeleteItem(){ - - return AbstractImagePrototype.create(ICONS.deleteItem()); - } - + + return AbstractImagePrototype.create(ICONS.deleteItem()); + } + /** * Gets the icon delete item32. * * @return the icon delete item32 */ public static AbstractImagePrototype getIconDeleteItem32(){ - - return AbstractImagePrototype.create(ICONS.deleteItem32()); - } - + + return AbstractImagePrototype.create(ICONS.deleteItem32()); + } + /** * Gets the icon folder. * * @return the icon folder */ public static AbstractImagePrototype getIconFolder(){ - - return AbstractImagePrototype.create(ICONS.folder()); - } - + + return AbstractImagePrototype.create(ICONS.folder()); + } + /** * Gets the icon audio. * * @return the icon audio */ public static AbstractImagePrototype getIconAudio(){ - - return AbstractImagePrototype.create(ICONS.audio()); - } - + + return AbstractImagePrototype.create(ICONS.audio()); + } + /** * Gets the icon archive upload. * * @return the icon archive upload */ public static AbstractImagePrototype getIconArchiveUpload(){ - - return AbstractImagePrototype.create(ICONS.archiveUpload()); - } - + + return AbstractImagePrototype.create(ICONS.archiveUpload()); + } + /** * Gets the icon biodiversity. * * @return the icon biodiversity */ public static AbstractImagePrototype getIconBiodiversity(){ - - return AbstractImagePrototype.create(ICONS.biodiversity()); - } - + + return AbstractImagePrototype.create(ICONS.biodiversity()); + } + /** * Gets the icon images. * * @return the icon images */ public static AbstractImagePrototype getIconImages(){ - - return AbstractImagePrototype.create(ICONS.images()); - } - + + return AbstractImagePrototype.create(ICONS.images()); + } + /** * Gets the icon documents. * * @return the icon documents */ public static AbstractImagePrototype getIconDocuments(){ - - return AbstractImagePrototype.create(ICONS.documents()); - } - + + return AbstractImagePrototype.create(ICONS.documents()); + } + /** * Gets the icon pencil. * * @return the icon pencil */ public static AbstractImagePrototype getIconPencil(){ - - return AbstractImagePrototype.create(ICONS.pencil()); - } - + + return AbstractImagePrototype.create(ICONS.pencil()); + } + /** * Gets the icon edit. * * @return the icon edit */ public static AbstractImagePrototype getIconEdit(){ - - return AbstractImagePrototype.create(ICONS.edit()); - } - + + return AbstractImagePrototype.create(ICONS.edit()); + } + /** * Gets the icon history. * * @return the icon history */ public static AbstractImagePrototype getIconHistory(){ - - return AbstractImagePrototype.create(ICONS.history()); - } - + + return AbstractImagePrototype.create(ICONS.history()); + } + /** * Gets the icon search. * * @return the icon search */ public static AbstractImagePrototype getIconSearch() { - - return AbstractImagePrototype.create(ICONS.search()); + + return AbstractImagePrototype.create(ICONS.search()); } - + /** * Gets the icon search ws. @@ -714,46 +760,46 @@ public class Resources { * @return the icon search ws */ public static AbstractImagePrototype getIconSearchWs() { - - return AbstractImagePrototype.create(ICONS.search2()); + + return AbstractImagePrototype.create(ICONS.search2()); } - - + + /** * Gets the icon links. * * @return the icon links */ public static AbstractImagePrototype getIconLinks(){ - - return AbstractImagePrototype.create(ICONS.links()); - } - + + return AbstractImagePrototype.create(ICONS.links()); + } + /** * Gets the icon report. * * @return the icon report */ public static AbstractImagePrototype getIconReport(){ - return AbstractImagePrototype.create(ICONS.report()); - } - + return AbstractImagePrototype.create(ICONS.report()); + } + /** * Gets the icon grid view. * * @return the icon grid view */ public static AbstractImagePrototype getIconGridView(){ - return AbstractImagePrototype.create(ICONS.gridView()); - } - + return AbstractImagePrototype.create(ICONS.gridView()); + } + /** * Gets the icon report template. * * @return the icon report template */ private static AbstractImagePrototype getIconReportTemplate() { - return AbstractImagePrototype.create(ICONS.reportTemplate()); + return AbstractImagePrototype.create(ICONS.reportTemplate()); } /** @@ -762,133 +808,133 @@ public class Resources { * @return the icon time series */ public static AbstractImagePrototype getIconTimeSeries(){ - return AbstractImagePrototype.create(ICONS.timeSeries()); - } - + return AbstractImagePrototype.create(ICONS.timeSeries()); + } + /** * Gets the icon download. * * @return the icon download */ public static AbstractImagePrototype getIconDownload(){ - return AbstractImagePrototype.create(ICONS.download()); - } - + return AbstractImagePrototype.create(ICONS.download()); + } + /** * Gets the icon cancel. * * @return the icon cancel */ public static AbstractImagePrototype getIconCancel(){ - return AbstractImagePrototype.create(ICONS.cancel()); - } - + return AbstractImagePrototype.create(ICONS.cancel()); + } + /** * Gets the icon toggle list. * * @return the icon toggle list */ public static AbstractImagePrototype getIconToggleList() { - return AbstractImagePrototype.create(ICONS.toggleList()); + return AbstractImagePrototype.create(ICONS.toggleList()); } - + /** * Gets the icon toggle group. * * @return the icon toggle group */ public static AbstractImagePrototype getIconToggleGroup() { - return AbstractImagePrototype.create(ICONS.toggleGroup()); + return AbstractImagePrototype.create(ICONS.toggleGroup()); } - + /** * Gets the icon toggle icon. * * @return the icon toggle icon */ public static AbstractImagePrototype getIconToggleIcon() { - return AbstractImagePrototype.create(ICONS.toggleIcon()); + return AbstractImagePrototype.create(ICONS.toggleIcon()); } - + /** * Gets the icon save. * * @return the icon save */ public static AbstractImagePrototype getIconSave() { - return AbstractImagePrototype.create(ICONS.save()); + return AbstractImagePrototype.create(ICONS.save()); } - + /** * Gets the icon star. * * @return the icon star */ public static AbstractImagePrototype getIconStar() { - return AbstractImagePrototype.create(ICONS.star()); + return AbstractImagePrototype.create(ICONS.star()); } - + /** * Gets the icon preview. * * @return the icon preview */ public static AbstractImagePrototype getIconPreview() { - return AbstractImagePrototype.create(ICONS.preview()); + return AbstractImagePrototype.create(ICONS.preview()); } - + /** * Gets the icon show. * * @return the icon show */ public static AbstractImagePrototype getIconShow() { - return AbstractImagePrototype.create(ICONS.show()); + return AbstractImagePrototype.create(ICONS.show()); } - + /** * Gets the icon open url. * * @return the icon open url */ public static AbstractImagePrototype getIconOpenUrl() { - return AbstractImagePrototype.create(ICONS.openUrl()); + return AbstractImagePrototype.create(ICONS.openUrl()); } - + /** * Gets the icon add url. * * @return the icon add url */ public static AbstractImagePrototype getIconAddUrl() { - return AbstractImagePrototype.create(ICONS.addUrl()); + return AbstractImagePrototype.create(ICONS.addUrl()); } - + /** * Gets the icon send to. * * @return the icon send to */ public static AbstractImagePrototype getIconSendTo() { - return AbstractImagePrototype.create(ICONS.sendTo()); + return AbstractImagePrototype.create(ICONS.sendTo()); } - + /** * Gets the icon check user. * * @return the icon check user */ public static AbstractImagePrototype getIconCheckUser() { - return AbstractImagePrototype.create(ICONS.checkUser()); + return AbstractImagePrototype.create(ICONS.checkUser()); } - + /** * Gets the icon messages received. * * @return the icon messages received */ public static AbstractImagePrototype getIconMessagesReceived() { - return AbstractImagePrototype.create(ICONS.inboxReceived()); + return AbstractImagePrototype.create(ICONS.inboxReceived()); } /** @@ -897,25 +943,25 @@ public class Resources { * @return the icon messages sent */ public static AbstractImagePrototype getIconMessagesSent() { - return AbstractImagePrototype.create(ICONS.inboxSent()); + return AbstractImagePrototype.create(ICONS.inboxSent()); } - + /** * Gets the icon email. * * @return the icon email */ public static AbstractImagePrototype getIconEmail() { - return AbstractImagePrototype.create(ICONS.email()); + return AbstractImagePrototype.create(ICONS.email()); } - + /** * Gets the icon open email. * * @return the icon open email */ public static AbstractImagePrototype getIconOpenEmail() { - return AbstractImagePrototype.create(ICONS.openEmail()); + return AbstractImagePrototype.create(ICONS.openEmail()); } /** @@ -924,25 +970,25 @@ public class Resources { * @return the icon hand */ public static AbstractImagePrototype getIconHand() { - return AbstractImagePrototype.create(ICONS.hand()); + return AbstractImagePrototype.create(ICONS.hand()); } - + /** * Gets the icon save attachments. * * @return the icon save attachments */ public static AbstractImagePrototype getIconSaveAttachments() { - return AbstractImagePrototype.create(ICONS.saveAttachs()); + return AbstractImagePrototype.create(ICONS.saveAttachs()); } - + /** * Gets the icon download emails. * * @return the icon download emails */ public static AbstractImagePrototype getIconDownloadEmails() { - return AbstractImagePrototype.create(ICONS.downloadEmail()); + return AbstractImagePrototype.create(ICONS.downloadEmail()); } /** @@ -951,7 +997,7 @@ public class Resources { * @return the icon email read */ public static AbstractImagePrototype getIconEmailRead() { - return AbstractImagePrototype.create(ICONS.emailRead()); + return AbstractImagePrototype.create(ICONS.emailRead()); } /** @@ -960,18 +1006,18 @@ public class Resources { * @return the icon email not read */ public static AbstractImagePrototype getIconEmailNotRead() { - return AbstractImagePrototype.create(ICONS.emailNotRead()); + return AbstractImagePrototype.create(ICONS.emailNotRead()); } - + /** * Gets the icon delete message. * * @return the icon delete message */ public static AbstractImagePrototype getIconDeleteMessage() { - return AbstractImagePrototype.create(ICONS.emailDelete()); + return AbstractImagePrototype.create(ICONS.emailDelete()); } - + /** * Gets the icon email forward. * @@ -980,7 +1026,7 @@ public class Resources { public static AbstractImagePrototype getIconEmailForward() { return AbstractImagePrototype.create(ICONS.emailForward()); } - + /** * Gets the icon copy. * @@ -998,7 +1044,7 @@ public class Resources { public static AbstractImagePrototype getIconPaste() { return AbstractImagePrototype.create(ICONS.paste()); } - + /** * Gets the icon refresh. * @@ -1007,7 +1053,7 @@ public class Resources { public static AbstractImagePrototype getIconRefresh() { return AbstractImagePrototype.create(ICONS.refreshFolder()); } - + /** * Gets the icon bulk update. * @@ -1016,7 +1062,7 @@ public class Resources { public static AbstractImagePrototype getIconBulkUpdate() { return AbstractImagePrototype.create(ICONS.loading2()); } - + /** * Gets the icon loading. * @@ -1034,7 +1080,7 @@ public class Resources { public static AbstractImagePrototype getIconLoadingOff() { return AbstractImagePrototype.create(ICONS.loadingOff()); } - + /** * Gets the icon loading2. * @@ -1043,7 +1089,7 @@ public class Resources { public static AbstractImagePrototype getIconLoading2() { return AbstractImagePrototype.create(ICONS.loading2()); } - + /** * Gets the icon delete2. * @@ -1061,7 +1107,7 @@ public class Resources { public static AbstractImagePrototype getIconUrlWebDav() { return AbstractImagePrototype.create(ICONS.urlWebDav()); } - + /** * Gets the icon remove filter. * @@ -1070,7 +1116,7 @@ public class Resources { public static AbstractImagePrototype getIconRemoveFilter() { return AbstractImagePrototype.create(ICONS.removeFilter()); } - + /** * Gets the icon new mail. * @@ -1079,7 +1125,7 @@ public class Resources { public static AbstractImagePrototype getIconNewMail() { return AbstractImagePrototype.create(ICONS.createNewMail()); } - + /** * Gets the icon reply mail. * @@ -1088,7 +1134,7 @@ public class Resources { public static AbstractImagePrototype getIconReplyMail() { return AbstractImagePrototype.create(ICONS.replyMail()); } - + /** * Gets the icon public link. * @@ -1097,7 +1143,7 @@ public class Resources { public static AbstractImagePrototype getIconPublicLink() { return AbstractImagePrototype.create(ICONS.publicLink()); } - + /** * Gets the icon reply all mail. * @@ -1106,7 +1152,7 @@ public class Resources { public static AbstractImagePrototype getIconReplyAllMail() { return AbstractImagePrototype.create(ICONS.replyAllMail()); } - + /** * Gets the icon workflow report. * @@ -1133,7 +1179,7 @@ public class Resources { public static AbstractImagePrototype getIconWebDav() { return AbstractImagePrototype.create(ICONS.webDav()); } - + /** * Gets the icon resource link. * @@ -1151,7 +1197,7 @@ public class Resources { public static AbstractImagePrototype getIconShareFolder() { return AbstractImagePrototype.create(ICONS.shareFolder()); } - + /** * Gets the icon un share folder. * @@ -1160,7 +1206,7 @@ public class Resources { public static AbstractImagePrototype getIconUnShareFolder() { return AbstractImagePrototype.create(ICONS.unShareFolder()); } - + /** * Gets the icon un share user. * @@ -1169,7 +1215,7 @@ public class Resources { public static AbstractImagePrototype getIconUnShareUser() { return AbstractImagePrototype.create(ICONS.unShareUser()); } - + /** * Gets the icon write own. * @@ -1178,7 +1224,7 @@ public class Resources { public static AbstractImagePrototype getIconWriteOwn() { return AbstractImagePrototype.create(ICONS.writeown()); } - + /** * Gets the icon write all. * @@ -1187,7 +1233,7 @@ public class Resources { public static AbstractImagePrototype getIconWriteAll() { return AbstractImagePrototype.create(ICONS.writeall()); } - + /** * Gets the icon read only. * @@ -1196,7 +1242,7 @@ public class Resources { public static AbstractImagePrototype getIconReadOnly() { return AbstractImagePrototype.create(ICONS.readonly()); } - + /** * Gets the all left. * @@ -1205,7 +1251,7 @@ public class Resources { public static AbstractImagePrototype getAllLeft() { return AbstractImagePrototype.create(ICONS.allLeft()); } - + /** * Gets the all right. * @@ -1214,7 +1260,7 @@ public class Resources { public static AbstractImagePrototype getAllRight() { return AbstractImagePrototype.create(ICONS.allRight()); } - + /** * Gets the selected left. * @@ -1223,7 +1269,7 @@ public class Resources { public static AbstractImagePrototype getSelectedLeft() { return AbstractImagePrototype.create(ICONS.selectedLeft()); } - + /** * Gets the selected right. * @@ -1232,7 +1278,7 @@ public class Resources { public static AbstractImagePrototype getSelectedRight() { return AbstractImagePrototype.create(ICONS.selectedRight()); } - + /** * Gets the icon permissions. * @@ -1241,8 +1287,8 @@ public class Resources { public static AbstractImagePrototype getIconPermissions() { return AbstractImagePrototype.create(ICONS.permissions()); } - - + + /** * Gets the icon add administrator. * @@ -1251,7 +1297,7 @@ public class Resources { public static AbstractImagePrototype getIconAddAdministrator() { return AbstractImagePrototype.create(ICONS.addAdmin()); } - + /** * Gets the icon manage administrator. * @@ -1270,7 +1316,7 @@ public class Resources { public static ImageResource getImagePathSeparator(){ return ICONS.separatorPath(); } - + /** * Gets the image loading. * @@ -1288,7 +1334,7 @@ public class Resources { public static ImageResource getImageHardDisk(){ return ICONS.hardDisk(); } - + /** * Gets the image search. * @@ -1297,7 +1343,7 @@ public class Resources { public static ImageResource getImageSearch(){ return ICONS.search(); } - + /** * Gets the image folder. * @@ -1306,7 +1352,7 @@ public class Resources { public static ImageResource getImageFolder(){ return ICONS.folder(); } - + /** * Gets the image cancel. * @@ -1315,7 +1361,7 @@ public class Resources { public static ImageResource getImageCancel() { return ICONS.cancel(); } - + /** * Gets the image delete. * @@ -1324,17 +1370,15 @@ public class Resources { public static ImageResource getImageDelete() { return ICONS.delete2(); } - + /** * Gets the image attachs. * * @return the image attachs */ public static ImageResource getImageAttachs() { - return ICONS.attach(); + return ICONS.attach(); } - - /** * Gets the icon by media type name. @@ -1377,6 +1421,14 @@ public class Resources { return Resources.getIconPpt(); } else if(mediaTypeName.contains(ODP)){ return Resources.getIconOdp(); + } else if(mediaTypeName.contains(ODS)){ + return Resources.getIconOds(); + } else if(mediaTypeName.contains(ODG)){ + return Resources.getIconOdg(); + } else if(mediaTypeName.contains(OTT)){ + return Resources.getIconOtt(); + }else if(mediaTypeName.contains(ODT)){ + return Resources.getIconOdt(); }else if (mediaTypeName.contains(EXCEL) || mediaTypeName.contains(XSLX)) { return Resources.getIconExcel(); }else if (mediaTypeName.contains(ZIP) || mediaTypeName.contains(SEVEN_ZIP)) { @@ -1384,7 +1436,7 @@ public class Resources { String fileExtension = name.substring(fe+1, name.length()); if(fileExtension.compareTo("jar")==0) return Resources.getIconJava(); - + return Resources.getIconZip(); }else if (mediaTypeName.contains(DVI)) { return Resources.getIconDvi(); @@ -1402,7 +1454,6 @@ public class Resources { return Resources.getIconTable(); } - /** * Gets the icon by folder item type. * @@ -1410,9 +1461,9 @@ public class Resources { * @return the icon by folder item type */ public static AbstractImagePrototype getIconByFolderItemType(GXTFolderItemTypeEnum itemType){ - + if(itemType!=null){ - + if(itemType.equals(GXTFolderItemTypeEnum.ANNOTATION)){ return Resources.getIconTxt(); }else if(itemType.equals(GXTFolderItemTypeEnum.DOCUMENT)){ @@ -1465,15 +1516,15 @@ public class Resources { * @return the icon by type */ public static AbstractImagePrototype getIconByType(String name, String type){ - + if(type.equals(GXTFolderItemTypeEnum.FOLDER.toString())) return Resources.getIconFolder(); - + //RECOVERING "media type name" from type / media type name [+suffix] int sl = type.indexOf("/"); String mediaTypeName = type.substring(sl+1, type.length()); - + return Resources.getIconByMediaTypeName(name, mediaTypeName); } - + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/icon-odp.gif b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/icon-odp.gif deleted file mode 100644 index 1f6dcb4..0000000 Binary files a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/icon-odp.gif and /dev/null differ diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/odg.png b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/odg.png new file mode 100644 index 0000000..a276693 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/odg.png differ diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/odp.png b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/odp.png new file mode 100644 index 0000000..19dd11e Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/odp.png differ diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/ods.png b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/ods.png new file mode 100644 index 0000000..59cc457 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/ods.png differ diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/odt.png b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/odt.png new file mode 100644 index 0000000..95e16fa Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/odt.png differ diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/ott.png b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/ott.png new file mode 100644 index 0000000..21987b3 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/ott.png differ diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/DownloadServlet.java b/src/main/java/org/gcube/portlets/user/workspace/server/DownloadServlet.java index eb16e58..f25e658 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/DownloadServlet.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/DownloadServlet.java @@ -1,5 +1,5 @@ /** - * + * */ package org.gcube.portlets.user.workspace.server; @@ -64,16 +64,16 @@ public class DownloadServlet extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { String itemId = req.getParameter("id"); - boolean viewContent = (req.getParameter("viewContent")==null)?false:req.getParameter("viewContent").equals("true"); - boolean isValidItem = (req.getParameter(ConstantsExplorer.VALIDATEITEM)==null)?false:req.getParameter(ConstantsExplorer.VALIDATEITEM).equals("true"); - boolean urlRedirectOnError = (req.getParameter(ConstantsExplorer.REDIRECTONERROR)==null)?false:req.getParameter(ConstantsExplorer.REDIRECTONERROR).equals("true"); + boolean viewContent = req.getParameter("viewContent")==null?false:req.getParameter("viewContent").equals("true"); + boolean isValidItem = req.getParameter(ConstantsExplorer.VALIDATEITEM)==null?false:req.getParameter(ConstantsExplorer.VALIDATEITEM).equals("true"); + boolean urlRedirectOnError = req.getParameter(ConstantsExplorer.REDIRECTONERROR)==null?false:req.getParameter(ConstantsExplorer.REDIRECTONERROR).equals("true"); logger.trace("Input Params [id: "+itemId + ", viewContent: "+viewContent+", "+ConstantsExplorer.VALIDATEITEM +": " +isValidItem+", urlRedirectOnError:" +urlRedirectOnError+"]"); if(itemId==null || itemId.isEmpty()){ sendError(resp,HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Item id is null"); return; } - + logger.trace("FILE DOWNLOAD REQUEST "+itemId); Workspace wa = null; try { @@ -84,12 +84,12 @@ public class DownloadServlet extends HttpServlet{ wa = WsUtil.getWorkspace(session); } catch (Exception e) { - + if (e instanceof SessionExpiredException){ sendErrorForStatus(resp, HttpServletResponse.SC_UNAUTHORIZED +": Session expired", HttpServletResponse.SC_UNAUTHORIZED); return; } - + handleError(urlRedirectOnError, req, resp, itemId, HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Error during workspace retrieving"); return; } @@ -101,7 +101,7 @@ public class DownloadServlet extends HttpServlet{ WorkspaceItem item; try { - + item = wa.getItem(itemId); if(isValidItem){ //ADDED 25/06/2013 - THIS CODE RETURN A SC_ACCEPT IS ITEM EXIST String message = HttpServletResponse.SC_ACCEPTED+ ": The resource is available"; @@ -109,10 +109,10 @@ public class DownloadServlet extends HttpServlet{ logger.trace("response return: "+message); return; } - + try{ //ACCOUNTING - item.markAsRead(true); + item.markAsRead(true); } catch (InternalErrorException e) { logger.error("Requested item "+itemId+" has thrown an internal error exception",e); } @@ -124,7 +124,7 @@ public class DownloadServlet extends HttpServlet{ } switch (item.getType()) { - + case SHARED_FOLDER: case FOLDER:{ try { @@ -133,11 +133,11 @@ public class DownloadServlet extends HttpServlet{ resp.setContentType("application/zip"); resp = setContentLength(resp, tmpZip.length()); OutputStream out = resp.getOutputStream(); - + FileInputStream fileTmpZip = new FileInputStream(tmpZip); IOUtils.copy(fileTmpZip, resp.getOutputStream()); fileTmpZip.close(); - + out.close(); tmpZip.delete(); return; @@ -152,30 +152,30 @@ public class DownloadServlet extends HttpServlet{ FolderItem folderItem = (FolderItem) item; switch (folderItem.getFolderItemType()) { - + case REPORT_TEMPLATE:{ try{ ReportTemplate reportTemplate = (ReportTemplate)folderItem; String extension = FilenameUtils.getExtension(item.getName()); String itemName = item.getName(); logger.trace("case REPORT_TEMPLATE extension is" +extension); - + if(extension.compareToIgnoreCase(Extensions.REPORT_TEMPLATE.getName())!=0) //ADD EXTENSION? itemName = "." + Extensions.REPORT_TEMPLATE.getName(); - + logger.trace("case REPORT_TEMPLATE itemName is" +extension); - String contentDisposition = (viewContent)?"inline":"attachment"; + String contentDisposition = viewContent?"inline":"attachment"; resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" ); resp.setContentType("application/zip"); resp = setContentLength(resp, reportTemplate.getLength()); OutputStream out = resp.getOutputStream(); - + //MODIFIED 22-05-2013 CLOSE STREAM InputStream is = reportTemplate.getData(); IOUtils.copy(is, resp.getOutputStream()); is.close(); - + out.close(); } catch (Exception e) { logger.error("Error during external item sending "+itemId,e); @@ -191,23 +191,23 @@ public class DownloadServlet extends HttpServlet{ String extension = FilenameUtils.getExtension(item.getName()); String itemName = item.getName(); logger.trace("case REPORT extension is" +extension); - + if(extension.compareToIgnoreCase(Extensions.REPORT.getName())!=0) //ADD EXTENSION? itemName = "." + Extensions.REPORT.getName(); logger.trace("case REPORT itemName is" +extension); - String contentDisposition = (viewContent)?"inline":"attachment"; + String contentDisposition = viewContent?"inline":"attachment"; resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" ); resp.setContentType("application/zip"); resp = setContentLength(resp, report.getLength()); OutputStream out = resp.getOutputStream(); - + //MODIFIED 22-05-2013 CLOSE STREAM InputStream is = report.getData(); IOUtils.copy(is, resp.getOutputStream()); is.close(); - + out.close(); } catch (Exception e) { logger.error("Error during external item sending "+itemId,e); @@ -219,23 +219,23 @@ public class DownloadServlet extends HttpServlet{ } case EXTERNAL_PDF_FILE: case EXTERNAL_FILE:{ - + InputStream is = null; OutputStream out = null; try{ ExternalFile externalFile = (ExternalFile)folderItem; String mimeType = externalFile.getMimeType(); - + logger.trace("EXTERNAL_FILE DOWNLOAD FOR "+externalFile.getId()); - String contentDisposition = (viewContent)?"inline":"attachment"; + String contentDisposition = viewContent?"inline":"attachment"; resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + item.getName() + "\"" ); resp.setContentType(mimeType); resp = setContentLength(resp, externalFile.getLength()); is = externalFile.getData(); out = resp.getOutputStream(); IOUtils.copy(is, out); - + is.close(); out.close(); @@ -248,14 +248,14 @@ public class DownloadServlet extends HttpServlet{ } case EXTERNAL_IMAGE:{ - + try{ ExternalImage externalImage = (ExternalImage)folderItem; String mimeType = externalImage.getMimeType(); String itemName = MimeTypeUtil.getNameWithExtension(item.getName(), mimeType); - String contentDisposition = (viewContent)?"inline":"attachment"; + String contentDisposition = viewContent?"inline":"attachment"; resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" ); resp.setContentType(externalImage.getMimeType()); resp = setContentLength(resp, externalImage.getLength()); @@ -263,7 +263,7 @@ public class DownloadServlet extends HttpServlet{ InputStream is = externalImage.getData(); IOUtils.copy(is, out); is.close(); - + out.close(); return; } catch (Exception e) { @@ -275,18 +275,18 @@ public class DownloadServlet extends HttpServlet{ case EXTERNAL_URL:{ try{ ExternalUrl externalUrl = (ExternalUrl)folderItem; - + String itemName = MimeTypeUtil.getNameWithExtension(externalUrl.getName(), "text/uri-list"); - String contentDisposition = (viewContent)?"inline":"attachment"; + String contentDisposition = viewContent?"inline":"attachment"; resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" ); resp.setContentType("text/uri-list"); resp = setContentLength(resp, externalUrl.getLength()); - + //MODIFIED 22-05-2013 CLOSE STREAM StringReader sr = new StringReader(externalUrl.getUrl()); OutputStream out = resp.getOutputStream(); IOUtils.copy(sr, out); - + sr.close(); out.close(); return; @@ -307,13 +307,13 @@ public class DownloadServlet extends HttpServlet{ handleError(urlRedirectOnError, req, resp, itemId, HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Error during data retrieving: "+e.getMessage()); return; } - + //MODIFIED 22-05-2013 CLOSE STREAM OutputStream out = resp.getOutputStream(); StringReader sr = new StringReader(query.getQuery()); IOUtils.copy(sr, out); sr.close(); - + out.close(); return; @@ -323,17 +323,17 @@ public class DownloadServlet extends HttpServlet{ TimeSeries ts = (TimeSeries)folderItem; File tmpZip = ZipUtil.zipTimeSeries(ts); - String contentDisposition = (viewContent)?"inline":"attachment"; + String contentDisposition = viewContent?"inline":"attachment"; resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + item.getName() + ".zip\"" ); resp.setContentType("application/zip"); resp = setContentLength(resp, tmpZip.length()); - + //MODIFIED 22-05-2013 CLOSE STREAM OutputStream out = resp.getOutputStream(); FileInputStream fileTmpZip = new FileInputStream(tmpZip); IOUtils.copy(fileTmpZip, out); fileTmpZip.close(); - + out.close(); tmpZip.delete(); return; @@ -357,13 +357,13 @@ public class DownloadServlet extends HttpServlet{ resp.setHeader( "Content-Disposition", "attachment; filename=\"" + item.getName() + ".zip\"" ); resp.setContentType("application/zip"); resp = setContentLength(resp, tmpZip.length()); - + //MODIFIED 22-05-2013 CLOSE STREAM OutputStream out = resp.getOutputStream(); FileInputStream fileTmpZip = new FileInputStream(tmpZip); IOUtils.copy(fileTmpZip, out); fileTmpZip.close(); - + out.close(); tmpZip.delete(); } @@ -378,7 +378,7 @@ public class DownloadServlet extends HttpServlet{ InputStream is = document.getData(); IOUtils.copy(is, out); is.close(); - + out.close(); } return; @@ -393,10 +393,10 @@ public class DownloadServlet extends HttpServlet{ try{ // Metadata document = (Metadata)item; GCubeItem metadata = (GCubeItem) item; //Cast GCubeItem - + resp.setContentType("text/html"); resp = setContentLength(resp, metadata.getLength()); - + //MODIFIED 22-05-2013 CLOSE STREAM OutputStream out = resp.getOutputStream(); InputStream is = metadata.getData(); @@ -415,11 +415,11 @@ public class DownloadServlet extends HttpServlet{ } } - + handleError(urlRedirectOnError, req, resp, itemId,HttpServletResponse.SC_INTERNAL_SERVER_ERROR +": Error during data retrieving"); return; } - + /** * Method to manage HttpServletResponse content length also to big data * @param resp @@ -437,20 +437,20 @@ public class DownloadServlet extends HttpServlet{ } return resp; } - + protected void handleError(boolean urlRedirectOnError, HttpServletRequest req, HttpServletResponse resp, String itemId, String message) throws IOException{ - + logger.warn("Handle error occurred: "+message); logger.trace("urlRedirectOnError is active: "+urlRedirectOnError); if(urlRedirectOnError){ urlRedirect(req, resp, itemId); }else sendError(resp,message); - + } - + protected void sendError(HttpServletResponse response, String message) throws IOException - { + { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); HandlerResultMessage resultMessage = HandlerResultMessage.errorResult(message); logger.trace("error message: "+resultMessage); @@ -461,10 +461,10 @@ public class DownloadServlet extends HttpServlet{ logger.trace("response writed"); response.flushBuffer(); } - - + + protected void sendErrorForStatus(HttpServletResponse response, String message, int status) throws IOException - { + { response.setStatus(status); HandlerResultMessage resultMessage = HandlerResultMessage.errorResult(message); logger.trace("error message: "+resultMessage); @@ -475,7 +475,7 @@ public class DownloadServlet extends HttpServlet{ logger.trace("response writed"); response.flushBuffer(); } - + protected void sendMessage(HttpServletResponse response, String message) throws IOException { response.setStatus(HttpServletResponse.SC_ACCEPTED); @@ -483,15 +483,15 @@ public class DownloadServlet extends HttpServlet{ response.getWriter().write(resultMessage.toString()); response.flushBuffer(); } - - protected void sendMessageResourceAvailable(HttpServletResponse response, String message) throws IOException + + protected void sendMessageResourceAvailable(HttpServletResponse response, String message) throws IOException { response.setStatus(HttpServletResponse.SC_ACCEPTED); HandlerResultMessage resultMessage = HandlerResultMessage.okResult(message); response.getWriter().write(resultMessage.toString()); response.flushBuffer(); } - + protected void sendWarnMessage(HttpServletResponse response, String message) throws IOException { response.setStatus(HttpServletResponse.SC_ACCEPTED); @@ -499,7 +499,7 @@ public class DownloadServlet extends HttpServlet{ response.getWriter().write(resultMessage.toString()); response.flushBuffer(); } - + protected void urlRedirect(HttpServletRequest req, HttpServletResponse response, String fakePath) throws IOException { String requestUrl = getRequestURL(req) +fakePath; @@ -508,7 +508,7 @@ public class DownloadServlet extends HttpServlet{ response.sendRedirect(response.encodeRedirectURL(requestUrl)); return; } - + public static String getRequestURL(HttpServletRequest req) { String scheme = req.getScheme(); // http @@ -523,7 +523,7 @@ public class DownloadServlet extends HttpServlet{ StringBuffer url = new StringBuffer(); url.append(scheme).append("://").append(serverName); - if ((serverPort != 80) && (serverPort != 443)) { + if (serverPort != 80 && serverPort != 443) { url.append(":").append(serverPort); } @@ -531,50 +531,50 @@ public class DownloadServlet extends HttpServlet{ logger.trace("omitted contextPath: "+contextPath); // logger.trace("servletPath: "+servletPath); // url.append(contextPath).append(servletPath); - + // if (pathInfo != null) { // url.append(pathInfo); // } // if (queryString != null) { // url.append("?").append(queryString); // } - + PortalUrlGroupGatewayProperty p = new PortalUrlGroupGatewayProperty(); - + int lenght = p.getPath().length(); - + String groupgatewaypath = "/"; - + if(lenght>1){ - + String lastChar = p.getPath().substring(lenght-1, lenght-1); - + groupgatewaypath+= lastChar.compareTo("/")!=0?p.getPath()+"/":p.getPath(); } - + url.append(groupgatewaypath); - + return url.toString(); } - + /* public static void main(String[] args) { - + InputStream is = null; - + logger.trace("start"); - + // is = GCUBEStorage.getRemoteFile("/Home/test.user/Workspace3d660604-03ef-49eb-89c3-4c73f8a47914"); - + try{ - + Workspace ws = HomeLibrary.getHomeManagerFactory().getHomeManager().getHome("francesco.mangiacrapa").getWorkspace(); -// +// // ExternalFile f = (ExternalFile) ws.getItem("907ce8ef-5c0b-4601-83ac-215d1f432f6b"); - + WorkspaceItem wsItem = ws.getItem("907ce8ef-5c0b-4601-83ac-215d1f432f6b"); - - + + logger.trace("metadata info recovered from HL: [ID: "+wsItem.getId() +", name: "+wsItem.getName()+"]"); FileOutputStream out = new FileOutputStream(new File("/tmp/bla")); @@ -583,21 +583,21 @@ public class DownloadServlet extends HttpServlet{ // while ((len = is.read(buffer)) != -1) { // out.write(buffer, 0, len); // } - + logger.trace("cast as external file"); ExternalFile f = (ExternalFile) wsItem; - + is = f.getData(); - + IOUtils.copy(is, out); is.close(); - + out.close(); - + // logger.trace("Sleeping"); // Thread.sleep(20000); // logger.trace("Alive"); - + logger.trace("end"); }catch (Exception e) { e.printStackTrace(); diff --git a/src/test/java/org/gcube/portlets/user/workspace/ItemRetrieve.java b/src/test/java/org/gcube/portlets/user/workspace/ItemRetrieve.java index e46f07d..a46df25 100644 --- a/src/test/java/org/gcube/portlets/user/workspace/ItemRetrieve.java +++ b/src/test/java/org/gcube/portlets/user/workspace/ItemRetrieve.java @@ -31,9 +31,9 @@ public class ItemRetrieve { // public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps"; //PRODUCTION public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV - public static String TEST_USER = "giancarlo.panichi"; + public static String TEST_USER = "francesco.mangiacrapa"; // public static String ITEMID = "63832213-098d-42d1-8774-89b6349764c0"; //Activity T3.4 working drafts/T2-EC-IMAR-HO-14-015 iMarine Sustainability WP - Business Model tools.pdf - public static String ITEMID = "79b2490b-43aa-40b0-98ec-e073cf7d4887"; +// public static String ITEMID = "79b2490b-43aa-40b0-98ec-e073cf7d4887"; // d81d3a64-603f-4907-ae74-be8353211807 protected static Logger logger = Logger.getLogger(ItemRetrieve.class); @@ -48,14 +48,14 @@ public class ItemRetrieve { Workspace ws = getWorkspace(); -// retrieveFirstLevel(ws, null); + retrieveFirstLevel(ws, null); - retrieveFirstLevel(ws, ITEMID); +// retrieveFirstLevel(ws, ITEMID); System.out.println("get workspace -> OK"); - WorkspaceItem item = ws.getItem(ITEMID); - System.out.println("get item id: "+item.getId()+", name: "+item.getName() +", parent: "+item.getParent()); - System.out.println(item); +// WorkspaceItem item = ws.getItem(ITEMID); +// System.out.println("get item id: "+item.getId()+", name: "+item.getName() +", parent: "+item.getParent()); +// System.out.println(item); }catch(Exception e){ e.printStackTrace(); } @@ -100,9 +100,14 @@ public class ItemRetrieve { startTime = System.currentTimeMillis(); System.out.println("Start foundFolder at time: "+startTime); // WorkspaceItem root = ws.getItem(ITEMID); - WorkspaceItem fd = ws.getItem(foundFolder); - System.out.println("foundFolder id: "+foundFolder); - System.out.println("start get children"); + WorkspaceItem fd; + if(foundFolder!=null){ + fd = ws.getItem(foundFolder); + System.out.println("foundFolder id: "+foundFolder); + System.out.println("start get children"); + }else + fd = ws.getRoot(); + List children = fd.getChildren(); System.out.println("tree getChildren() returning "+children.size()+" elements in " + time); diff --git a/src/test/java/org/gcube/portlets/user/workspace/UploadServletTest.java b/src/test/java/org/gcube/portlets/user/workspace/UploadServletTest.java index 645355e..ce99c63 100644 --- a/src/test/java/org/gcube/portlets/user/workspace/UploadServletTest.java +++ b/src/test/java/org/gcube/portlets/user/workspace/UploadServletTest.java @@ -1,9 +1,8 @@ /** - * + * */ package org.gcube.portlets.user.workspace; -import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -22,7 +21,6 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistEx import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException; import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; -import org.gcube.common.homelibrary.util.MimeTypeUtil; import org.gcube.common.homelibrary.util.WorkspaceUtil; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.impl.ScopeBean; @@ -30,7 +28,7 @@ import org.gcube.common.scope.impl.ScopeBean; /** * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @Jun 20, 2013 - * + * */ public class UploadServletTest { @@ -48,7 +46,7 @@ public class UploadServletTest { String filePath = "/home/francesco-mangiacrapa"; - String fileName = "ASFIS 6 languages_2013.csv"; + String fileName = "Geo Explorer 2016-01-15 18-51-51.png"; String fullPath = filePath + "/" + fileName; @@ -65,16 +63,16 @@ public class UploadServletTest { // ExternalImage file = (ExternalImage) root.find(name); // UPLOAD FILE - String contentType = MimeTypeUtil.getMimeType(fileName, new BufferedInputStream( - new FileInputStream(new File(fullPath)))); +// String contentType = MimeTypeUtil.getMimeType(fileName, new BufferedInputStream( +// new FileInputStream(new File(fullPath)))); String itemName = WorkspaceUtil.getUniqueName(fileName, root); System.out.println("Storing data...."); - System.out.println("content type " + contentType); + System.out.println("content type " + null); System.out.println("itemName " + itemName); ExternalFile file = (ExternalFile) WorkspaceUtil.createExternalFile( - root, itemName, "", contentType, new FileInputStream(new File( + root, itemName, "", null, new FileInputStream(new File( fullPath))); System.out.println("Storing data - OK" + "File [id: " + file.getId() @@ -95,7 +93,7 @@ public class UploadServletTest { InputStream inputStream = file.getData(); // write the inputStream to a FileOutputStream OutputStream out = new FileOutputStream(new File( - "/home/francesco-mangiacrapa/Desktop/result")); + "/home/francesco-mangiacrapa/Desktop/download/"+fileName)); int read = 0; byte[] bytes = new byte[1024];