Migrated to Liferay 6.2
Updated pom version at 1.4.0 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@128922 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
471ac76beb
commit
77a34755ab
|
@ -1,4 +1,8 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets-widgets.workspace-uploader.1-4-0"
|
||||
date="2016-05-31">
|
||||
<Change>[Feature #4128] Migration to Liferay 6.2</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-widgets.workspace-uploader.1-3-0"
|
||||
date="2016-05-18">
|
||||
<Change>[Feature #4055] DnD multiple instances</Change>
|
||||
|
|
22
pom.xml
22
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>workspace-uploader</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.3.0-SNAPSHOT</version>
|
||||
<version>1.4.0-SNAPSHOT</version>
|
||||
<name>Workspace Uploader Widget</name>
|
||||
<description>Workspace Uploader Widget allows your application to upload file/s in the gCube Workspace</description>
|
||||
<scm>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>2.6.0-SNAPSHOT</version>
|
||||
<version>LATEST</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -59,13 +59,6 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<!-- UNCOMMENT THIS TO RUN IN DEVO MODE -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>xerces</groupId> -->
|
||||
<!-- <artifactId>xerces</artifactId> -->
|
||||
<!-- <version>2.4.0</version> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
<!-- Google Web Toolkit (GWT) -->
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
|
@ -87,6 +80,7 @@
|
|||
<artifactId>gcube-widgets</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- FWS -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
|
@ -100,9 +94,18 @@
|
|||
</dependency>
|
||||
<!-- END FWS -->
|
||||
|
||||
<!-- TO USE LIFERAY 6.2 -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- TO USE LIFERAY 6.2 -->
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -181,6 +184,7 @@
|
|||
<artifactId>social-networking-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslsocial</artifactId>
|
||||
|
|
|
@ -364,13 +364,16 @@ public class WorkspaceUploadServlet extends HttpServlet {
|
|||
|
||||
|
||||
/**
|
||||
* Notify upload in shared folder.
|
||||
*
|
||||
* @param httpSession
|
||||
* @param workspace
|
||||
* @param itemId
|
||||
* @param destinationFolderId
|
||||
* @param request the request
|
||||
* @param httpSession the http session
|
||||
* @param workspace the workspace
|
||||
* @param itemId the item id
|
||||
* @param destinationFolderId the destination folder id
|
||||
* @param isOverwrite the is overwrite
|
||||
*/
|
||||
public static void notifyUploadInSharedFolder(final HttpSession httpSession, final Workspace workspace, final String itemId, final String destinationFolderId, final boolean isOverwrite){
|
||||
public static void notifyUploadInSharedFolder(final HttpServletRequest request, final HttpSession httpSession, final Workspace workspace, final String itemId, final String destinationFolderId, final boolean isOverwrite){
|
||||
|
||||
new Thread(){
|
||||
public void run() {
|
||||
|
@ -379,7 +382,7 @@ public class WorkspaceUploadServlet extends HttpServlet {
|
|||
sourceItem = workspace.getItem(itemId);
|
||||
String sourceSharedId = sourceItem.getIdSharedFolder();
|
||||
WorkspaceItem folderDestinationItem = workspace.getItem(destinationFolderId);
|
||||
NotificationsWorkspaceUploader.checkSendNotifyChangedItemToShare(httpSession, sourceItem, sourceSharedId, folderDestinationItem,isOverwrite);
|
||||
NotificationsWorkspaceUploader.checkSendNotifyChangedItemToShare(request, httpSession, sourceItem, sourceSharedId, folderDestinationItem,isOverwrite);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in notifyUploadInSharedFolder", e);
|
||||
}
|
||||
|
@ -421,7 +424,7 @@ public class WorkspaceUploadServlet extends HttpServlet {
|
|||
}
|
||||
|
||||
|
||||
private void createReport(HttpSession httpSession, Workspace wa, String itemName, File file, WorkspaceFolder destinationFolder, HttpServletResponse response, boolean isOverwrite) throws InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, IOException{
|
||||
private void createReport(final HttpServletRequest request, HttpSession httpSession, Workspace wa, String itemName, File file, WorkspaceFolder destinationFolder, HttpServletResponse response, boolean isOverwrite) throws InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, IOException{
|
||||
|
||||
try {
|
||||
|
||||
|
@ -431,7 +434,7 @@ public class WorkspaceUploadServlet extends HttpServlet {
|
|||
itemName = WorkspaceUtil.getUniqueName(itemName, destinationFolder);
|
||||
report = wa.createReport(itemName, "", Calendar.getInstance(), Calendar.getInstance(), "", "", "", 0, "", StreamUtils.openInputStream(file), destinationFolder.getId());
|
||||
|
||||
notifyUploadInSharedFolder(httpSession,wa,report.getId(),destinationFolder.getId(), isOverwrite);
|
||||
notifyUploadInSharedFolder(request, httpSession,wa,report.getId(),destinationFolder.getId(), isOverwrite);
|
||||
sendMessage(response, "File "+report.getName()+" imported correctly in "+destinationFolder.getPath());
|
||||
}
|
||||
else{ //CASE OVERWRITE
|
||||
|
@ -439,7 +442,7 @@ public class WorkspaceUploadServlet extends HttpServlet {
|
|||
|
||||
if(rep!=null){
|
||||
|
||||
notifyUploadInSharedFolder(httpSession,wa,rep.getId(),destinationFolder.getId(), isOverwrite);
|
||||
notifyUploadInSharedFolder(request, httpSession,wa,rep.getId(),destinationFolder.getId(), isOverwrite);
|
||||
sendMessage(response, "File "+rep.getName()+" imported correctly in "+destinationFolder.getPath());
|
||||
}
|
||||
else
|
||||
|
@ -461,7 +464,7 @@ public class WorkspaceUploadServlet extends HttpServlet {
|
|||
|
||||
}
|
||||
|
||||
private void createTemplate(HttpSession httpSession, Workspace wa, String itemName, File file, WorkspaceFolder destinationFolder, HttpServletResponse response, boolean isOverwrite) throws InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, IOException{
|
||||
private void createTemplate(final HttpServletRequest request, HttpSession httpSession, Workspace wa, String itemName, File file, WorkspaceFolder destinationFolder, HttpServletResponse response, boolean isOverwrite) throws InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, IOException{
|
||||
|
||||
try {
|
||||
|
||||
|
@ -471,7 +474,7 @@ public class WorkspaceUploadServlet extends HttpServlet {
|
|||
itemName = WorkspaceUtil.getUniqueName(itemName, destinationFolder);
|
||||
template = wa.createReportTemplate(itemName, "", Calendar.getInstance(), Calendar.getInstance(), "", "", 0, "", StreamUtils.openInputStream(file), destinationFolder.getId());
|
||||
|
||||
notifyUploadInSharedFolder(httpSession,wa,template.getId(),destinationFolder.getId(), isOverwrite);
|
||||
notifyUploadInSharedFolder(request, httpSession,wa,template.getId(),destinationFolder.getId(), isOverwrite);
|
||||
sendMessage(response, "File "+template.getName()+" imported correctly in "+destinationFolder.getPath());
|
||||
|
||||
}else{ //CASE OVERWRITE
|
||||
|
@ -479,7 +482,7 @@ public class WorkspaceUploadServlet extends HttpServlet {
|
|||
|
||||
if(rep!=null){
|
||||
|
||||
notifyUploadInSharedFolder(httpSession,wa,rep.getId(),destinationFolder.getId(), isOverwrite);
|
||||
notifyUploadInSharedFolder(request, httpSession,wa,rep.getId(),destinationFolder.getId(), isOverwrite);
|
||||
sendMessage(response, "File "+rep.getName()+" imported correctly in "+destinationFolder.getPath());
|
||||
}
|
||||
else
|
||||
|
|
|
@ -459,16 +459,16 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
String newItemName = itemName;
|
||||
logger.debug("createTemplate: "+newItemName);
|
||||
|
||||
createTemplate(workspaceUploader, request.getSession(), wa, newItemName, inputStream, destinationFolder, response, isOverwrite);
|
||||
createTemplate(request, workspaceUploader, request.getSession(), wa, newItemName, inputStream, destinationFolder, response, isOverwrite);
|
||||
|
||||
}else if(isZipFile && extension.compareToIgnoreCase(D4SR)==0){ //Create REPORT
|
||||
|
||||
String newItemName = itemName;
|
||||
logger.debug("createReport: "+newItemName);
|
||||
createReport(workspaceUploader, request.getSession(), wa, newItemName, inputStream, destinationFolder, response, isOverwrite);
|
||||
createReport(request, workspaceUploader, request.getSession(), wa, newItemName, inputStream, destinationFolder, response, isOverwrite);
|
||||
}else{ //CREATE AN EXTERNAL FILE
|
||||
|
||||
workspaceUploader = WorkspaceUploaderMng.uploadFile(workspaceUploader, request.getSession(), wa, itemName, inputStream, destinationFolder, contentType, isOverwrite, size);
|
||||
workspaceUploader = WorkspaceUploaderMng.uploadFile(request, workspaceUploader, request.getSession(), wa, itemName, inputStream, destinationFolder, contentType, isOverwrite, size);
|
||||
|
||||
if(workspaceUploader==null)
|
||||
throw new Exception("Error when creating uploader, it is null!");
|
||||
|
@ -489,7 +489,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
|
||||
sendMessage(response, workspaceUploader.getIdentifier());
|
||||
} else{
|
||||
workspaceUploader = WorkspaceUploaderMng.uploadFile(workspaceUploader, request.getSession(), wa, itemName, inputStream, destinationFolder, contentType, isOverwrite, size);
|
||||
workspaceUploader = WorkspaceUploaderMng.uploadFile(request, workspaceUploader, request.getSession(), wa, itemName, inputStream, destinationFolder, contentType, isOverwrite, size);
|
||||
|
||||
if(workspaceUploader==null)
|
||||
throw new Exception("Error when creating uploader, it is null!");
|
||||
|
@ -630,13 +630,14 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
/**
|
||||
* Notify upload in shared folder.
|
||||
*
|
||||
* @param request the request
|
||||
* @param httpSession the http session
|
||||
* @param workspace the workspace
|
||||
* @param itemId the item id
|
||||
* @param destinationFolderId the destination folder id
|
||||
* @param isOverwrite the is overwrite
|
||||
*/
|
||||
public static void notifyUploadInSharedFolder(final HttpSession httpSession, final Workspace workspace, final String itemId, final String destinationFolderId, final boolean isOverwrite){
|
||||
public static void notifyUploadInSharedFolder(final HttpServletRequest request, final HttpSession httpSession, final Workspace workspace, final String itemId, final String destinationFolderId, final boolean isOverwrite){
|
||||
|
||||
new Thread(){
|
||||
public void run() {
|
||||
|
@ -645,7 +646,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
sourceItem = workspace.getItem(itemId);
|
||||
String sourceSharedId = sourceItem.getIdSharedFolder();
|
||||
WorkspaceItem folderDestinationItem = workspace.getItem(destinationFolderId);
|
||||
NotificationsWorkspaceUploader.checkSendNotifyChangedItemToShare(httpSession, sourceItem, sourceSharedId, folderDestinationItem,isOverwrite);
|
||||
NotificationsWorkspaceUploader.checkSendNotifyChangedItemToShare(request, httpSession, sourceItem, sourceSharedId, folderDestinationItem,isOverwrite);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in notifyUploadInSharedFolder", e);
|
||||
}
|
||||
|
@ -698,6 +699,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
/**
|
||||
* Creates the report.
|
||||
*
|
||||
* @param request the request
|
||||
* @param workspaceUploader the workspace uploader
|
||||
* @param httpSession the http session
|
||||
* @param wa the wa
|
||||
|
@ -711,7 +713,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
* @throws InternalErrorException the internal error exception
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
private void createReport(WorkspaceUploaderItem workspaceUploader, HttpSession httpSession, Workspace wa, String itemName, InputStream fileInputStream, WorkspaceFolder destinationFolder, HttpServletResponse response, boolean isOverwrite) throws InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, IOException{
|
||||
private void createReport(final HttpServletRequest request, WorkspaceUploaderItem workspaceUploader, HttpSession httpSession, Workspace wa, String itemName, InputStream fileInputStream, WorkspaceFolder destinationFolder, HttpServletResponse response, boolean isOverwrite) throws InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, IOException{
|
||||
|
||||
try {
|
||||
|
||||
|
@ -721,7 +723,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
itemName = WorkspaceUtil.getUniqueName(itemName, destinationFolder);
|
||||
report = wa.createReport(itemName, "", Calendar.getInstance(), Calendar.getInstance(), "", "", "", 0, "",fileInputStream, destinationFolder.getId());
|
||||
|
||||
notifyUploadInSharedFolder(httpSession,wa,report.getId(),destinationFolder.getId(), isOverwrite);
|
||||
notifyUploadInSharedFolder(request, httpSession,wa,report.getId(),destinationFolder.getId(), isOverwrite);
|
||||
sendMessage(response, "File "+report.getName()+" imported correctly in "+destinationFolder.getPath());
|
||||
}
|
||||
else{ //CASE OVERWRITE
|
||||
|
@ -729,7 +731,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
|
||||
if(rep!=null){
|
||||
|
||||
notifyUploadInSharedFolder(httpSession,wa,rep.getId(),destinationFolder.getId(), isOverwrite);
|
||||
notifyUploadInSharedFolder(request, httpSession,wa,rep.getId(),destinationFolder.getId(), isOverwrite);
|
||||
sendMessage(response, "File "+rep.getName()+" imported correctly in "+destinationFolder.getPath());
|
||||
}
|
||||
else
|
||||
|
@ -772,7 +774,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
* @throws InternalErrorException the internal error exception
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
private void createTemplate(WorkspaceUploaderItem workspaceUploader, HttpSession httpSession, Workspace wa, String itemName, InputStream fileInputStream, WorkspaceFolder destinationFolder, HttpServletResponse response, boolean isOverwrite) throws InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, IOException{
|
||||
private void createTemplate(final HttpServletRequest request, WorkspaceUploaderItem workspaceUploader, HttpSession httpSession, Workspace wa, String itemName, InputStream fileInputStream, WorkspaceFolder destinationFolder, HttpServletResponse response, boolean isOverwrite) throws InsufficientPrivilegesException, ItemAlreadyExistException, InternalErrorException, IOException{
|
||||
|
||||
try {
|
||||
|
||||
|
@ -782,7 +784,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
itemName = WorkspaceUtil.getUniqueName(itemName, destinationFolder);
|
||||
template = wa.createReportTemplate(itemName, "", Calendar.getInstance(), Calendar.getInstance(), "", "", 0, "", fileInputStream, destinationFolder.getId());
|
||||
|
||||
notifyUploadInSharedFolder(httpSession,wa,template.getId(),destinationFolder.getId(), isOverwrite);
|
||||
notifyUploadInSharedFolder(request, httpSession,wa,template.getId(),destinationFolder.getId(), isOverwrite);
|
||||
sendMessage(response, "File "+template.getName()+" imported correctly in "+destinationFolder.getPath());
|
||||
|
||||
}else{ //CASE OVERWRITE
|
||||
|
@ -790,7 +792,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
|
||||
if(rep!=null){
|
||||
|
||||
notifyUploadInSharedFolder(httpSession,wa,rep.getId(),destinationFolder.getId(), isOverwrite);
|
||||
notifyUploadInSharedFolder(request, httpSession,wa,rep.getId(),destinationFolder.getId(), isOverwrite);
|
||||
sendMessage(response, "File "+rep.getName()+" imported correctly in "+destinationFolder.getPath());
|
||||
}
|
||||
else
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.gcube.portlets.widgets.workspaceuploader.server.notification;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -34,7 +35,7 @@ public class NotificationsWorkspaceUploader {
|
|||
* @param sourceSharedId
|
||||
* @param folderDestinationItem
|
||||
*/
|
||||
public static void checkSendNotifyChangedItemToShare(HttpSession httpSession, final WorkspaceItem sourceItem, final String sourceSharedId, final WorkspaceItem folderDestinationItem, boolean isOverwrite) {
|
||||
public static void checkSendNotifyChangedItemToShare(HttpServletRequest request, HttpSession httpSession, final WorkspaceItem sourceItem, final String sourceSharedId, final WorkspaceItem folderDestinationItem, boolean isOverwrite) {
|
||||
|
||||
logger.trace("checkSendNotifyAddItemToShare");
|
||||
|
||||
|
@ -61,7 +62,7 @@ public class NotificationsWorkspaceUploader {
|
|||
|
||||
WorkspaceItem destinationSharedFolder = workspace.getItem(folderDestinationItem.getIdSharedFolder());
|
||||
|
||||
NotificationsWorkspaceUploaderProducer np = new NotificationsWorkspaceUploaderProducer(WsUtil.getAslSession(httpSession));
|
||||
NotificationsWorkspaceUploaderProducer np = new NotificationsWorkspaceUploaderProducer(WsUtil.getAslSession(httpSession),request);
|
||||
|
||||
if(destinationSharedFolder instanceof WorkspaceSharedFolder){
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ package org.gcube.portlets.widgets.workspaceuploader.server.notification;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.application.framework.core.session.ASLSession;
|
||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||
|
@ -35,9 +37,10 @@ public class NotificationsWorkspaceUploaderProducer {
|
|||
* Instantiates a new notifications producer.
|
||||
*
|
||||
* @param aslSession the asl session
|
||||
* @param request the request
|
||||
*/
|
||||
public NotificationsWorkspaceUploaderProducer(ASLSession aslSession) {
|
||||
this.notificationsMng = WsUtil.getNotificationManager(aslSession);
|
||||
public NotificationsWorkspaceUploaderProducer(ASLSession aslSession, HttpServletRequest request) {
|
||||
this.notificationsMng = WsUtil.getNotificationManager(aslSession, request);
|
||||
this.aslSession = aslSession;
|
||||
this.userId = aslSession.getUsername();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.gcube.portlets.widgets.workspaceuploader.server.upload;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
|
@ -49,6 +50,7 @@ public class WorkspaceUploaderMng {
|
|||
/**
|
||||
* Creates the workspace uploader file.
|
||||
*
|
||||
* @param request the request
|
||||
* @param workspaceUploader the workspace uploader
|
||||
* @param httpSession the http session
|
||||
* @param isOvewrite the is ovewrite
|
||||
|
@ -62,7 +64,7 @@ public class WorkspaceUploaderMng {
|
|||
* @throws InternalErrorException the internal error exception
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
private static WorkspaceUploaderItem createWorkspaceUploaderFile(final WorkspaceUploaderItem workspaceUploader, final HttpSession httpSession, final boolean isOvewrite, final Workspace wa, final InputStream uploadFile, final String itemName, final WorkspaceFolder destinationFolder, final String contentType, final long totalBytes) throws InternalErrorException, IOException{
|
||||
private static WorkspaceUploaderItem createWorkspaceUploaderFile(HttpServletRequest request, final WorkspaceUploaderItem workspaceUploader, final HttpSession httpSession, final boolean isOvewrite, final Workspace wa, final InputStream uploadFile, final String itemName, final WorkspaceFolder destinationFolder, final String contentType, final long totalBytes) throws InternalErrorException, IOException{
|
||||
logger.debug("Creating WorkspaceUploaderFile...");
|
||||
|
||||
workspaceUploader.setUploadStatus(UPLOAD_STATUS.IN_PROGRESS);
|
||||
|
@ -86,7 +88,7 @@ public class WorkspaceUploaderMng {
|
|||
workspaceUploader.getFile().setParentId(createdItem.getParent().getId());//SET PARENT ID
|
||||
workspaceUploader.setStatusDescription("File \""+createdItem.getName()+"\" uploaded correctly in "+destinationFolder.getPath());
|
||||
workspaceUploader.setUploadStatus(UPLOAD_STATUS.COMPLETED);
|
||||
WorkspaceUploadServletStream.notifyUploadInSharedFolder(httpSession, wa, createdItem.getId(), createdItem.getParent().getId(), isOvewrite);
|
||||
WorkspaceUploadServletStream.notifyUploadInSharedFolder(request, httpSession, wa, createdItem.getId(), createdItem.getParent().getId(), isOvewrite);
|
||||
}else{
|
||||
workspaceUploader.setStatusDescription("An error occurred during upload: \""+itemName + "\". Try again");
|
||||
workspaceUploader.setUploadStatus(UPLOAD_STATUS.FAILED);
|
||||
|
@ -205,6 +207,7 @@ public class WorkspaceUploaderMng {
|
|||
/**
|
||||
* Upload file.
|
||||
*
|
||||
* @param request the request
|
||||
* @param workspaceUploader the workspace uploader
|
||||
* @param httpSession the http session
|
||||
* @param wa the wa
|
||||
|
@ -217,10 +220,10 @@ public class WorkspaceUploaderMng {
|
|||
* @return the workspace uploader item
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static WorkspaceUploaderItem uploadFile(WorkspaceUploaderItem workspaceUploader, HttpSession httpSession, Workspace wa, String itemName, InputStream file, WorkspaceFolder destinationFolder, String contentType, boolean isOverwrite, long totolaBytes) throws Exception {
|
||||
public static WorkspaceUploaderItem uploadFile(HttpServletRequest request, WorkspaceUploaderItem workspaceUploader, HttpSession httpSession, Workspace wa, String itemName, InputStream file, WorkspaceFolder destinationFolder, String contentType, boolean isOverwrite, long totolaBytes) throws Exception {
|
||||
|
||||
try {
|
||||
return createWorkspaceUploaderFile(workspaceUploader, httpSession, isOverwrite, wa, file, itemName, destinationFolder, contentType, totolaBytes);
|
||||
return createWorkspaceUploaderFile(request, workspaceUploader, httpSession, isOverwrite, wa, file, itemName, destinationFolder, contentType, totolaBytes);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error when uploading file to HL : ",e);
|
||||
throw new Exception("An error occurred during upload: "+itemName+". Try again");
|
||||
|
|
|
@ -6,11 +6,10 @@ import java.util.List;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.shared.ContactModel;
|
||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
|
||||
import org.gcube.vomanagement.usermanagement.model.UserModel;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
|
||||
|
||||
|
||||
|
@ -38,23 +37,21 @@ public class UserUtil {
|
|||
|
||||
if (WsUtil.isWithinPortal()) { //INTO PORTAL
|
||||
|
||||
UserModel curr = null;
|
||||
GCubeUser curr = null;
|
||||
|
||||
try {
|
||||
try {
|
||||
curr = um.getUserByScreenName(portalLogin);
|
||||
curr = um.getUserByUsername(portalLogin);
|
||||
|
||||
} catch (UserManagementSystemException e) {
|
||||
|
||||
logger.error("An error occurred in getUserFullName "+e,e);
|
||||
logger.error("An error occurred in getUserByUsername "+e,e);
|
||||
} catch (UserRetrievalFault e) {
|
||||
|
||||
logger.error("An error occurred in getUserFullName "+e,e);
|
||||
logger.error("An error occurred in getUserByUsername "+e,e);
|
||||
}
|
||||
} catch (UserManagementPortalException ume) {
|
||||
logger.error("An error occurred in getUserFullName "+ume,ume);
|
||||
}catch (Exception e) {
|
||||
logger.error("An error occurred in getUserFullName "+e,e);
|
||||
logger.error("An error occurred in getUserByUsername "+e,e);
|
||||
logger.warn("Return portal login "+portalLogin);
|
||||
return portalLogin;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
package org.gcube.portlets.widgets.workspaceuploader.server.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -10,6 +11,7 @@ import org.gcube.application.framework.core.session.ASLSession;
|
|||
import org.gcube.application.framework.core.session.SessionManager;
|
||||
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||
|
@ -162,9 +164,10 @@ public class WsUtil {
|
|||
* Gets the notification manager.
|
||||
*
|
||||
* @param session the session
|
||||
* @param request the request
|
||||
* @return the notification manager
|
||||
*/
|
||||
public static NotificationsManager getNotificationManager(ASLSession session)
|
||||
public static NotificationsManager getNotificationManager(ASLSession session, HttpServletRequest request)
|
||||
{
|
||||
|
||||
NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER);
|
||||
|
@ -173,7 +176,8 @@ public class WsUtil {
|
|||
try{
|
||||
logger.trace("Create new NotificationsManager for user: "+session.getUsername());
|
||||
logger.trace("New ApplicationNotificationsManager with portlet class name: "+NOTIFICATION_PORTLET_CLASS_ID);
|
||||
notifMng = new ApplicationNotificationsManager(session, NOTIFICATION_PORTLET_CLASS_ID);
|
||||
SocialNetworkingSite site = new SocialNetworkingSite(request);
|
||||
notifMng = new ApplicationNotificationsManager(site, session.getScope(), null, NOTIFICATION_PORTLET_CLASS_ID);
|
||||
session.setAttribute(NOTIFICATION_MANAGER, notifMng);
|
||||
}catch (Exception e) {
|
||||
logger.error("An error occurred instancing ApplicationNotificationsManager for user: "+session.getUsername(),e);
|
||||
|
@ -187,16 +191,17 @@ public class WsUtil {
|
|||
* Gets the notification producer.
|
||||
*
|
||||
* @param session the session
|
||||
* @param request the request
|
||||
* @return the notification producer
|
||||
*/
|
||||
public static NotificationsWorkspaceUploaderProducer getNotificationProducer(ASLSession session)
|
||||
public static NotificationsWorkspaceUploaderProducer getNotificationProducer(ASLSession session, HttpServletRequest request)
|
||||
{
|
||||
|
||||
NotificationsWorkspaceUploaderProducer notifProducer = (NotificationsWorkspaceUploaderProducer) session.getAttribute(NOTIFICATION_PRODUCER);
|
||||
|
||||
if (notifProducer == null) {
|
||||
logger.trace("Create new Notification Producer for user: "+session.getUsername());
|
||||
notifProducer = new NotificationsWorkspaceUploaderProducer(session);
|
||||
notifProducer = new NotificationsWorkspaceUploaderProducer(session, request);
|
||||
session.setAttribute(NOTIFICATION_PRODUCER, notifProducer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue