enhancements
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@92500 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b1c8621cbe
commit
bdd8ef6518
7
pom.xml
7
pom.xml
|
@ -91,7 +91,6 @@
|
|||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<!-- END FWS -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-encryption</artifactId>
|
||||
|
@ -114,12 +113,18 @@
|
|||
<artifactId>gcube-widgets</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>accesslogger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- HOME LIBRARY -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
|
|
|
@ -14,17 +14,16 @@ import com.google.gwt.user.client.ui.RootPanel;
|
|||
*/
|
||||
public class WorkspaceSharingWidget implements EntryPoint {
|
||||
|
||||
public static String ITEMID = "56a9aa27-2150-4409-b5da-cc96c5c4eb70";
|
||||
public static String ITEMID = "3f461fcf-c60f-4243-9212-4f7c89dbf7bc";
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
*/
|
||||
public void onModuleLoad() {
|
||||
System.out.println("quiiiiiiiiiiii");
|
||||
|
||||
try {
|
||||
|
||||
WorkspaceSharingController controller = new WorkspaceSharingController(
|
||||
ITEMID, true, ACL_TYPE.READ_ONLY);
|
||||
WorkspaceSharingController controller = new WorkspaceSharingController(ITEMID, true, ACL_TYPE.READ_ONLY);
|
||||
|
||||
final Window sharingWindow = controller.getSharingWindow();
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
|||
*/
|
||||
@RemoteServiceRelativePath("workspacesharing")
|
||||
public interface WorkspaceSharingService extends RemoteService {
|
||||
String greetServer(String name) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* @return
|
||||
|
|
|
@ -12,13 +12,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
public interface WorkspaceSharingServiceAsync
|
||||
{
|
||||
|
||||
/**
|
||||
* GWT-RPC service asynchronous (client-side) interface
|
||||
* @see org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingService
|
||||
*/
|
||||
void greetServer( java.lang.String name, AsyncCallback<java.lang.String> callback );
|
||||
|
||||
|
||||
/**
|
||||
* Utility class to get the RPC Async interface from client-side code
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.gcube.common.homelibrary.home.workspace.WorkspaceItemType;
|
|||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.accessmanager.ACLType;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingService;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.server.notifications.NotificationsProducer;
|
||||
|
@ -66,12 +65,6 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
|||
return WsUtil.withoutPortal;
|
||||
}
|
||||
|
||||
public String greetServer(String input) throws IllegalArgumentException {
|
||||
|
||||
return "Hello";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<InfoContactModel> getAllContacts() throws Exception {
|
||||
|
||||
|
@ -241,7 +234,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
|
|||
//BUILD ITEM
|
||||
return builder.buildGXTFileModelItem(wsItem, parent);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in server during item retrieving, getItemForFileGrid", e);
|
||||
logger.error("Error in server during item retrieving, getFileModelByWorkpaceItemId", e);
|
||||
String error = ConstantsSharing.SERVER_ERROR + " retrieving the item from workspace, "+e.getMessage();
|
||||
throw new Exception(error);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNot
|
|||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.server.GWTWorkspaceSharingBuilder;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.server.WorkspaceSharingServiceImpl;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.server.notifications.NotificationsProducer;
|
||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||
|
||||
|
@ -32,17 +33,11 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel
|
|||
public class WsUtil {
|
||||
|
||||
public static final String USERNAME_ATTRIBUTE = ScopeHelper.USERNAME_ATTRIBUTE;
|
||||
public static final String FOLDERIMPORTER_ATTRIBUTE = "FOLDER_IMPORTER";
|
||||
public static final String METADATACONVERTER_ATTRIBUTE = "METADATA_CONVERTER";
|
||||
public static final String WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE = "EVENT_COLLECTOR";
|
||||
public static final String WORKSPACEBUILDER_ATTRIBUTE = "WORKSPACEBUILDER";
|
||||
public static final String NOTIFICATION_MANAGER = "NOTIFICATION_MANAGER";
|
||||
public static final String NOTIFICATION_PRODUCER = "NOTIFICATION_PRODUCER";
|
||||
public static final String WS_RUN_IN_TEST_MODE = "WS_RUN_IN_TEST_MODE";
|
||||
public static final String WORKSPACE_SCOPE_UTIL = "WORKSPACE_SCOPE_UTIL";
|
||||
public static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
||||
public static final String URI_RESOLVER_SERVICE = "URI_RESOLVER_SERVICE";
|
||||
public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; //IN DEV
|
||||
public static final String WORKSPACEBUILDER_ATTRIBUTE = "WORKSPACE_SHARING_BUILDER_ATTRIBUTE";
|
||||
public static final String NOTIFICATION_MANAGER = "NOTIFICATION_SHARING_MANAGER";
|
||||
public static final String NOTIFICATION_PRODUCER = "NOTIFICATION_SHARING_PRODUCER";
|
||||
public static final String WORKSPACE_SCOPE_UTIL = "WORKSPACE__SHARING_SCOPE_UTIL";
|
||||
public static final String NOTIFICATION_PORTLET_CLASS_ID = WorkspaceSharingServiceImpl.class.getName(); //IN DEV
|
||||
|
||||
// public static final String TEST_SCOPE = "/gcube/devsec";
|
||||
// public static final String TEST_USER = "pasquale.pagano";
|
||||
|
@ -51,12 +46,12 @@ public class WsUtil {
|
|||
// public static final String TEST_USER = "federico.defaveri";
|
||||
// public static final String TEST_USER = "massimiliano.assante";
|
||||
// public static final String TEST_USER = "pasquale.pagano";
|
||||
// public static final String TEST_USER = "francesco.mangiacrapa";
|
||||
// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
||||
public static final String TEST_USER = "francesco.mangiacrapa";
|
||||
public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
||||
// public static final String TEST_USER = "aureliano.gentile";
|
||||
public static final String TEST_USER = "test.user";
|
||||
// public static final String TEST_USER = "test.user";
|
||||
// public static final String TEST_USER = "antonio.gioia";
|
||||
public static final String TEST_USER_FULL_NAME = "Test User";
|
||||
// public static final String TEST_USER_FULL_NAME = "Test User";
|
||||
|
||||
|
||||
protected static Logger logger = Logger.getLogger(WsUtil.class);
|
||||
|
|
|
@ -1,32 +1,51 @@
|
|||
<!doctype html>
|
||||
<!-- The DOCTYPE declaration above will set the -->
|
||||
<!-- browser's rendering engine into -->
|
||||
<!-- "Standards Mode". Replacing this declaration -->
|
||||
<!-- with a "Quirks Mode" doctype may lead to some -->
|
||||
<!-- differences in layout. -->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="workspacesharingwidget.css">
|
||||
|
||||
<link rel='stylesheet' type='text/css' href='gxt2/css/gxt-all.css' />
|
||||
<!-- -->
|
||||
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||
<!-- -->
|
||||
<link type="text/css" rel="stylesheet" href="workspacesharingwidget.css">
|
||||
<script language='javascript' src='gxt2/flash/swfobject.js'></script>
|
||||
<script type="text/javascript" language="javascript" src="workspacesharingwidget/workspacesharingwidget.nocache.js" />
|
||||
<!-- -->
|
||||
<!-- Any title is fine -->
|
||||
<!-- -->
|
||||
<title>Web Application Starter Project</title>
|
||||
|
||||
<title>Workspace Sharing Widget</title>
|
||||
<!-- -->
|
||||
<!-- This script loads your compiled module. -->
|
||||
<!-- If you add any GWT meta tags, they must -->
|
||||
<!-- be added before this line. -->
|
||||
<!-- -->
|
||||
<script type="text/javascript" language="javascript" src="workspacesharingwidget/workspacesharingwidget.nocache.js"></script>
|
||||
</head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- -->
|
||||
<!-- The body can have arbitrary html, or -->
|
||||
<!-- you can leave the body empty if you want -->
|
||||
<!-- to create a completely dynamic UI. -->
|
||||
<!-- -->
|
||||
<body>
|
||||
|
||||
<!-- OPTIONAL: include this if you want history support -->
|
||||
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
|
||||
style="position: absolute; width: 0; height: 0; border: 0"></iframe>
|
||||
<!-- OPTIONAL: include this if you want history support -->
|
||||
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
|
||||
|
||||
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||
<noscript>
|
||||
<div
|
||||
style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||
Your web browser must have JavaScript enabled in order for this
|
||||
application to display correctly.</div>
|
||||
</noscript>
|
||||
|
||||
<div id="workpacesharingwidget"></div>
|
||||
</body>
|
||||
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||
<noscript>
|
||||
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||
Your web browser must have JavaScript enabled
|
||||
in order for this application to display correctly.
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<div id="workpacesharingwidget"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.workspacesharingwidget.client;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* @Jan 29, 2014
|
||||
*
|
||||
*/
|
||||
public class ItemRetrieving {
|
||||
|
||||
|
||||
// public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps"; //PRODUCTION
|
||||
public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV
|
||||
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 = "56a9aa27-2150-4409-b5da-cc96c5c4eb70";
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
|
||||
ScopeBean scope = new ScopeBean(DEFAULT_SCOPE);
|
||||
ScopeProvider.instance.set(scope.toString());
|
||||
|
||||
System.out.println("init HL");
|
||||
Workspace ws = HomeLibrary
|
||||
.getHomeManagerFactory()
|
||||
.getHomeManager()
|
||||
.getHome(TEST_USER)
|
||||
.getWorkspace();
|
||||
//
|
||||
|
||||
|
||||
//TEST TIME
|
||||
Long startTime = System.currentTimeMillis();
|
||||
Long endTime = System.currentTimeMillis() - startTime;
|
||||
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
||||
|
||||
startTime = System.currentTimeMillis();
|
||||
System.out.println("Start get root at time: "+startTime);
|
||||
// WorkspaceItem root = ws.getItem(ITEMID);
|
||||
WorkspaceItem root = ws.getRoot();
|
||||
|
||||
System.out.println("start get children");
|
||||
List<? extends WorkspaceItem> children = root.getChildren();
|
||||
System.out.println("tree getChildren() returning "+children.size()+" elements in " + time);
|
||||
|
||||
System.out.println("children size: "+children.size());
|
||||
|
||||
int i=0;
|
||||
int foldersCounter = 0;
|
||||
int sharedFoldersCounter = 0;
|
||||
int folderItemCounter = 0;
|
||||
int othersCounter = 0;
|
||||
for (WorkspaceItem workspaceItem : children) {
|
||||
|
||||
switch (workspaceItem.getType()) {
|
||||
|
||||
case FOLDER:
|
||||
|
||||
WorkspaceFolder folder = (WorkspaceFolder) workspaceItem;
|
||||
|
||||
System.out.println(++i+") folder name: "+folder.getName() + " owner "+folder.getOwner().getPortalLogin());
|
||||
foldersCounter++;
|
||||
|
||||
break;
|
||||
|
||||
case SHARED_FOLDER:
|
||||
|
||||
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) workspaceItem;
|
||||
|
||||
System.out.println(++i+") shared folder name: "+shared.getName() + " owner "+shared.getOwner().getPortalLogin() +" isVRE "+shared.isVreFolder());
|
||||
|
||||
// System.out.println(++i+") shared folder name: "+shared.getName() + " owner "+shared.getOwner().getPortalLogin());
|
||||
sharedFoldersCounter++;
|
||||
|
||||
break;
|
||||
|
||||
case FOLDER_ITEM:
|
||||
|
||||
FolderItem folderItem = (FolderItem) workspaceItem;
|
||||
|
||||
System.out.println(++i+") folderItem id: "+folderItem.getId() +", name: "+folderItem.getName() + ", own: "+folderItem.getOwner().getPortalLogin());
|
||||
folderItemCounter++;
|
||||
|
||||
break;
|
||||
default:
|
||||
System.out.println(++i+") DEFAULT - item id: "+workspaceItem.getId() +", name: "+workspaceItem.getName() + ", own: "+workspaceItem.getOwner().getPortalLogin());
|
||||
othersCounter++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//TEST TIME
|
||||
endTime = System.currentTimeMillis();
|
||||
long difference = endTime - startTime;
|
||||
time = String.format("%d msc %d sec", difference, TimeUnit.MILLISECONDS.toSeconds(difference));
|
||||
System.out.println("End time is "+endTime+ " difference is "+time);
|
||||
System.out.println("Folders are: "+foldersCounter);
|
||||
System.out.println("Shared Folders are: "+sharedFoldersCounter);
|
||||
System.out.println("Folder Item are: "+folderItemCounter);
|
||||
System.out.println("Others are: "+othersCounter);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue