ref 13226:StorageHub - Update workspace-sharing-widget to SH
https://support.d4science.org/issues/13226 Updated to StorageHub git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@177242 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6cb6d82820
commit
22074fee73
|
@ -27,16 +27,12 @@ public class ExtendedInfoContactModel extends InfoContactModel {
|
||||||
super(id, login, fullName, isGroup);
|
super(id, login, fullName, isGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return use this client side
|
|
||||||
*/
|
|
||||||
public void setIcon() {
|
public void setIcon() {
|
||||||
set(ICON, getIcon());
|
set(ICON, getIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return use this client side
|
|
||||||
*/
|
|
||||||
public Image getIcon() {
|
public Image getIcon() {
|
||||||
|
|
||||||
if (!this.isGroup()) // NOT IS GROUP
|
if (!this.isGroup()) // NOT IS GROUP
|
||||||
|
|
|
@ -7,12 +7,11 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||||
* May 12, 2014
|
* May 12, 2014
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FileTrashedModel extends FileGridModel {
|
public class FileTrashedModel extends FileGridModel {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -22,34 +21,18 @@ public class FileTrashedModel extends FileGridModel {
|
||||||
private Date deleteDate;
|
private Date deleteDate;
|
||||||
private InfoContactModel deletedBy;
|
private InfoContactModel deletedBy;
|
||||||
|
|
||||||
public static enum STOREINFO {ORIGINALPATH, DELETEDATE, DELETEUSER}
|
public static enum STOREINFO {
|
||||||
|
ORIGINALPATH, DELETEDATE, DELETEUSER
|
||||||
|
}
|
||||||
|
|
||||||
public FileTrashedModel() {
|
public FileTrashedModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileTrashedModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size,
|
||||||
/**
|
boolean isDirectory, boolean isShared) {
|
||||||
*
|
|
||||||
* @param identifier
|
|
||||||
* @param name
|
|
||||||
* @param path
|
|
||||||
* @param creationDate
|
|
||||||
* @param parent
|
|
||||||
* @param size
|
|
||||||
* @param isDirectory
|
|
||||||
* @param isShared
|
|
||||||
*/
|
|
||||||
public FileTrashedModel(String identifier, String name, String path, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared) {
|
|
||||||
super(identifier, name, path, creationDate, parent, size, isDirectory, isShared);
|
super(identifier, name, path, creationDate, parent, size, isDirectory, isShared);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param orginalPath
|
|
||||||
* @param deleteDate
|
|
||||||
* @param deleteUser
|
|
||||||
*/
|
|
||||||
public FileTrashedModel(String orginalPath, Date deleteDate, InfoContactModel deleteUser) {
|
public FileTrashedModel(String orginalPath, Date deleteDate, InfoContactModel deleteUser) {
|
||||||
super();
|
super();
|
||||||
this.orginalPath = orginalPath;
|
this.orginalPath = orginalPath;
|
||||||
|
@ -57,18 +40,8 @@ public class FileTrashedModel extends FileGridModel {
|
||||||
this.deletedBy = deleteUser;
|
this.deletedBy = deleteUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileTrashedModel(String identifier, String name, Date creationDate, FileModel parent, long size,
|
||||||
/**
|
boolean isDirectory, boolean isShared) {
|
||||||
*
|
|
||||||
* @param identifier
|
|
||||||
* @param name
|
|
||||||
* @param creationDate
|
|
||||||
* @param parent
|
|
||||||
* @param size
|
|
||||||
* @param isDirectory
|
|
||||||
* @param isShared
|
|
||||||
*/
|
|
||||||
public FileTrashedModel(String identifier, String name, Date creationDate, FileModel parent, long size, boolean isDirectory, boolean isShared) {
|
|
||||||
super(identifier, name, creationDate, parent, size, isDirectory, isShared);
|
super(identifier, name, creationDate, parent, size, isDirectory, isShared);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +72,6 @@ public class FileTrashedModel extends FileGridModel {
|
||||||
set(STOREINFO.DELETEUSER.toString(), deleteUser.getName());
|
set(STOREINFO.DELETEUSER.toString(), deleteUser.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
|
@ -29,10 +29,7 @@ public class GcubeVRE extends BaseModelData implements IsSerializable{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param vreName
|
|
||||||
* @param vreScope
|
|
||||||
*/
|
|
||||||
public GcubeVRE(String vreName, String vreScope) {
|
public GcubeVRE(String vreName, String vreScope) {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -15,61 +15,96 @@ import com.extjs.gxt.ui.client.data.BaseModelData;
|
||||||
*/
|
*/
|
||||||
public class MessageModel extends BaseModelData implements Serializable {
|
public class MessageModel extends BaseModelData implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public MessageModel() {}
|
public MessageModel() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* USED IN OPEN MESSAGE
|
* USED IN OPEN MESSAGE
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
|
* id
|
||||||
* @param subject
|
* @param subject
|
||||||
|
* subject
|
||||||
* @param sender
|
* @param sender
|
||||||
|
* sender
|
||||||
* @param date
|
* @param date
|
||||||
|
* date
|
||||||
* @param text
|
* @param text
|
||||||
|
* text
|
||||||
* @param attachs
|
* @param attachs
|
||||||
|
* attachs
|
||||||
* @param listContactsToString
|
* @param listContactsToString
|
||||||
|
* contacts
|
||||||
* @param messageType
|
* @param messageType
|
||||||
|
* message type
|
||||||
* @param isRead
|
* @param isRead
|
||||||
|
* is read
|
||||||
*/
|
*/
|
||||||
public MessageModel(String id, String subject, InfoContactModel sender, Date date, String text, List<FileModel> attachs, List<String> listContactsToString, String messageType, boolean isRead) {
|
public MessageModel(String id, String subject, InfoContactModel sender, Date date, String text,
|
||||||
this(id,subject,sender,date,attachs.size(),isRead, messageType);
|
List<FileModel> attachs, List<String> listContactsToString, String messageType, boolean isRead) {
|
||||||
|
this(id, subject, sender, date, attachs.size(), isRead, messageType);
|
||||||
setListContactsToString(listContactsToString);
|
setListContactsToString(listContactsToString);
|
||||||
setListAttachments(attachs);
|
setListAttachments(attachs);
|
||||||
setText(text);
|
setText(text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BASIC CONSTRUCTOR
|
* BASIC CONSTRUCTOR
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* id
|
||||||
|
* @param subject
|
||||||
|
* subject
|
||||||
|
* @param sender
|
||||||
|
* sender
|
||||||
|
* @param date
|
||||||
|
* date
|
||||||
|
* @param numAttachs
|
||||||
|
* attachs num
|
||||||
|
* @param isRead
|
||||||
|
* is read
|
||||||
|
* @param messageType
|
||||||
|
* message type
|
||||||
*/
|
*/
|
||||||
public MessageModel(String id, String subject, InfoContactModel sender, Date date, int numAttachs, boolean isRead, String messageType) {
|
public MessageModel(String id, String subject, InfoContactModel sender, Date date, int numAttachs, boolean isRead,
|
||||||
|
String messageType) {
|
||||||
setId(id);
|
setId(id);
|
||||||
setSubject(subject);
|
setSubject(subject);
|
||||||
setFromContact(sender);
|
setFromContact(sender);
|
||||||
setDate(date);
|
setDate(date);
|
||||||
setFromLogin(sender.getLogin());
|
setFromLogin(sender.getLogin());
|
||||||
setNumAttachments(numAttachs);
|
setNumAttachments(numAttachs);
|
||||||
setRead(""+isRead);
|
setRead("" + isRead);
|
||||||
setMessageType(messageType);
|
setMessageType(messageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* USED TO VIEW MESSAGE IN GRID
|
* USED TO VIEW MESSAGE IN GRID
|
||||||
|
*
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
|
* id
|
||||||
* @param subject
|
* @param subject
|
||||||
|
* subject
|
||||||
* @param sender
|
* @param sender
|
||||||
|
* sender
|
||||||
* @param date
|
* @param date
|
||||||
|
* date
|
||||||
* @param attachsNames
|
* @param attachsNames
|
||||||
|
* attachs names
|
||||||
* @param messageType
|
* @param messageType
|
||||||
|
* message type
|
||||||
* @param isRead
|
* @param isRead
|
||||||
|
* is read
|
||||||
*/
|
*/
|
||||||
public MessageModel(String id, String subject, InfoContactModel sender, Date date, List<String> attachsNames, String messageType, boolean isRead) {
|
public MessageModel(String id, String subject, InfoContactModel sender, Date date, List<String> attachsNames,
|
||||||
|
String messageType, boolean isRead) {
|
||||||
setId(id);
|
setId(id);
|
||||||
setSubject(subject);
|
setSubject(subject);
|
||||||
setFromContact(sender);
|
setFromContact(sender);
|
||||||
|
@ -77,63 +112,60 @@ public class MessageModel extends BaseModelData implements Serializable {
|
||||||
setFromLogin(sender.getLogin());
|
setFromLogin(sender.getLogin());
|
||||||
setNumAttachments(attachsNames.size());
|
setNumAttachments(attachsNames.size());
|
||||||
setMessageType(messageType);
|
setMessageType(messageType);
|
||||||
setRead(""+isRead);
|
setRead("" + isRead);
|
||||||
// System.out.println("##################IN CONSTRUCTROR Attach size: " + attachsNames.size());
|
// System.out.println("##################IN CONSTRUCTROR Attach size: "
|
||||||
setAttachmentsNames(attachsNames);
|
// + attachsNames.size());
|
||||||
// System.out.println("##########START MESSAGE: " + id);
|
setAttachmentsNames(attachsNames);
|
||||||
//
|
// System.out.println("##########START MESSAGE: " + id);
|
||||||
// for(String mess: attachsNames){
|
//
|
||||||
// System.out.println("##################IN CONSTRUCTROR Attach: " + mess);
|
// for(String mess: attachsNames){
|
||||||
// }
|
// System.out.println("##################IN CONSTRUCTROR Attach: " +
|
||||||
//
|
// mess);
|
||||||
// System.out.println("##########END MESSAGE: " + id);
|
// }
|
||||||
|
//
|
||||||
|
// System.out.println("##########END MESSAGE: " + id);
|
||||||
setAttachmentsNamesView(attachsNames);
|
setAttachmentsNamesView(attachsNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set string with first attach name and the numbers of attachs
|
|
||||||
* @param attachsNames
|
|
||||||
*/
|
|
||||||
private void setAttachmentsNamesView(List<String> attachsNames) {
|
private void setAttachmentsNamesView(List<String> attachsNames) {
|
||||||
if(attachsNames.size()==0){
|
if (attachsNames.size() == 0) {
|
||||||
set(ConstantsExplorer.ATTACHS, "");
|
set(ConstantsExplorer.ATTACHS, "");
|
||||||
}else if(attachsNames.size() == 1){
|
} else if (attachsNames.size() == 1) {
|
||||||
set(ConstantsExplorer.ATTACHS, attachsNames.get(0));
|
set(ConstantsExplorer.ATTACHS, attachsNames.get(0));
|
||||||
}else if(attachsNames.size() > 1)
|
} else if (attachsNames.size() > 1)
|
||||||
set(ConstantsExplorer.ATTACHS, attachsNames.get(0) + " [+"+attachsNames.size() + "]");
|
set(ConstantsExplorer.ATTACHS, attachsNames.get(0) + " [+" + attachsNames.size() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setMessageType(String messageType) {
|
private void setMessageType(String messageType) {
|
||||||
set(ConstantsExplorer.MESSAGETYPE, messageType);
|
set(ConstantsExplorer.MESSAGETYPE, messageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAttachmentsNames(List<String> attachsNames) {
|
private void setAttachmentsNames(List<String> attachsNames) {
|
||||||
set(ConstantsExplorer.LISTATTACHMENTSNAMES, attachsNames);
|
set(ConstantsExplorer.LISTATTACHMENTSNAMES, attachsNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListContactsToString(List<String> listContactsToString) {
|
private void setListContactsToString(List<String> listContactsToString) {
|
||||||
set(ConstantsExplorer.LISTCONTACTSTOSTRING, listContactsToString);
|
set(ConstantsExplorer.LISTCONTACTSTOSTRING, listContactsToString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setRead(String isRead) {
|
private void setRead(String isRead) {
|
||||||
set(ConstantsExplorer.ISREAD, isRead);
|
set(ConstantsExplorer.ISREAD, isRead);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIsRead() {
|
public String getIsRead() {
|
||||||
return get(ConstantsExplorer.ISREAD);
|
return get(ConstantsExplorer.ISREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListContactsTo(List<InfoContactModel> listContactsTo) {
|
private void setListContactsTo(List<InfoContactModel> listContactsTo) {
|
||||||
set(ConstantsExplorer.LISTCONTACTSTO, listContactsTo);
|
set(ConstantsExplorer.LISTCONTACTSTO, listContactsTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setListAttachments(List<FileModel> listAttachs) {
|
private void setListAttachments(List<FileModel> listAttachs) {
|
||||||
set(ConstantsExplorer.LISTATTACHS, listAttachs);
|
set(ConstantsExplorer.LISTATTACHS, listAttachs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDate(Date date) {
|
private void setDate(Date date) {
|
||||||
set(ConstantsExplorer.DATE, date);
|
set(ConstantsExplorer.DATE, date);
|
||||||
}
|
}
|
||||||
|
@ -145,21 +177,20 @@ public class MessageModel extends BaseModelData implements Serializable {
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
set(ConstantsExplorer.ID, id);
|
set(ConstantsExplorer.ID, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setText(String text) {
|
private void setText(String text) {
|
||||||
set(ConstantsExplorer.TEXTMESS, text);
|
set(ConstantsExplorer.TEXTMESS, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setFromContact(InfoContactModel contact) {
|
private void setFromContact(InfoContactModel contact) {
|
||||||
set(ConstantsExplorer.FROM, contact);
|
set(ConstantsExplorer.FROM, contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSubject(String subject) {
|
private void setSubject(String subject) {
|
||||||
set(ConstantsExplorer.SUBJECT, subject);
|
set(ConstantsExplorer.SUBJECT, subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFromLogin(String login){
|
private void setFromLogin(String login) {
|
||||||
set(ConstantsExplorer.FROMLOGIN, login);
|
set(ConstantsExplorer.FROMLOGIN, login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,49 +201,45 @@ public class MessageModel extends BaseModelData implements Serializable {
|
||||||
public String getSubject() {
|
public String getSubject() {
|
||||||
return get(ConstantsExplorer.SUBJECT);
|
return get(ConstantsExplorer.SUBJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getDate() {
|
public Date getDate() {
|
||||||
return (Date) get(ConstantsExplorer.DATE);
|
return (Date) get(ConstantsExplorer.DATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumAttchments() {
|
public int getNumAttchments() {
|
||||||
return (Integer) get(ConstantsExplorer.NUMATTACHS);
|
return (Integer) get(ConstantsExplorer.NUMATTACHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InfoContactModel getFromContact() {
|
public InfoContactModel getFromContact() {
|
||||||
return (InfoContactModel) get(ConstantsExplorer.FROM);
|
return (InfoContactModel) get(ConstantsExplorer.FROM);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFromLogin() {
|
public String getFromLogin() {
|
||||||
return get(ConstantsExplorer.FROMLOGIN);
|
return get(ConstantsExplorer.FROMLOGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTextMessage() {
|
public String getTextMessage() {
|
||||||
return get(ConstantsExplorer.TEXTMESS);
|
return get(ConstantsExplorer.TEXTMESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* used in grid
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getAttachmentsNamesView() {
|
public String getAttachmentsNamesView() {
|
||||||
return get(ConstantsExplorer.ATTACHS);
|
return get(ConstantsExplorer.ATTACHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InfoContactModel> getListContactsTo() {
|
public List<InfoContactModel> getListContactsTo() {
|
||||||
return get(ConstantsExplorer.LISTCONTACTSTO);
|
return get(ConstantsExplorer.LISTCONTACTSTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getListContactsToString() {
|
public List<String> getListContactsToString() {
|
||||||
return get(ConstantsExplorer.LISTCONTACTSTOSTRING);
|
return get(ConstantsExplorer.LISTCONTACTSTOSTRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FileModel> getListAttachments() {
|
public List<FileModel> getListAttachments() {
|
||||||
return get(ConstantsExplorer.LISTATTACHS);
|
return get(ConstantsExplorer.LISTATTACHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMessageType(){
|
public String getMessageType() {
|
||||||
return get(ConstantsExplorer.MESSAGETYPE);
|
return get(ConstantsExplorer.MESSAGETYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,5 +275,5 @@ public class MessageModel extends BaseModelData implements Serializable {
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,7 +2,8 @@ package org.gcube.portlets.user.workspace.client.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it May 8, 2014
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||||
|
* May 8, 2014
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GroupNameUtilSeparator {
|
public class GroupNameUtilSeparator {
|
||||||
|
@ -24,6 +25,7 @@ public class GroupNameUtilSeparator {
|
||||||
* name
|
* name
|
||||||
* @param separatorStartIndex
|
* @param separatorStartIndex
|
||||||
* start
|
* start
|
||||||
|
* @return sub sequence
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* error
|
* error
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +60,6 @@ public class GroupNameUtilSeparator {
|
||||||
return displayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
GroupNameUtilSeparator filter = new GroupNameUtilSeparator("/");
|
GroupNameUtilSeparator filter = new GroupNameUtilSeparator("/");
|
||||||
|
|
|
@ -132,15 +132,16 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
/**
|
/**
|
||||||
* Gets the workspace.
|
* Gets the workspace.
|
||||||
*
|
*
|
||||||
* @return the workspace
|
*
|
||||||
|
* @return Workspace
|
||||||
* @throws InternalErrorException
|
* @throws InternalErrorException
|
||||||
* the internal error exception
|
* Internal error
|
||||||
* @throws InternalErrorException
|
|
||||||
* the internal error exception
|
|
||||||
* @throws HomeNotFoundException
|
* @throws HomeNotFoundException
|
||||||
* the home not found exception
|
* Home not found error
|
||||||
* @throws WorkspaceFolderNotFoundException
|
* @throws WorkspaceFolderNotFoundException
|
||||||
* the workspace folder not found exception
|
* Folder not found error
|
||||||
|
* @throws org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorException
|
||||||
|
* StorageHub Internal error
|
||||||
*/
|
*/
|
||||||
protected Workspace getWorkspace()
|
protected Workspace getWorkspace()
|
||||||
throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException,
|
throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException,
|
||||||
|
@ -1084,9 +1085,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Workspace workspace = getWorkspace();
|
Workspace workspace = getWorkspace();
|
||||||
// workspaceLogger.trace("######### SEND TO: ");
|
// workspaceLogger.trace("######### SEND TO: ");
|
||||||
// workspaceLogger.trace("subject " + subject);
|
// workspaceLogger.trace("subject " + subject);
|
||||||
// workspaceLogger.trace("body " + body);
|
// workspaceLogger.trace("body " + body);
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
for (String contactId : listContactsId)
|
for (String contactId : listContactsId)
|
||||||
|
@ -1168,8 +1169,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/** Gets the list parents by item identifier.
|
* Gets the list parents by item identifier.
|
||||||
*
|
*
|
||||||
* @param itemIdentifier
|
* @param itemIdentifier
|
||||||
* the item identifier
|
* the item identifier
|
||||||
|
@ -2653,7 +2654,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
org.gcube.common.storagehub.model.items.FolderItem.class);
|
org.gcube.common.storagehub.model.items.FolderItem.class);
|
||||||
|
|
||||||
for (org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem workspaceItem : children) {
|
for (org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem workspaceItem : children) {
|
||||||
workspaceLogger.trace("The ITEM: "+workspaceItem.getName() + ", is shared: "+workspaceItem.isShared() + ", is folder: "+workspaceItem.isFolder() +" the id: "+workspaceItem.getId());
|
workspaceLogger
|
||||||
|
.trace("The ITEM: " + workspaceItem.getName() + ", is shared: " + workspaceItem.isShared()
|
||||||
|
+ ", is folder: " + workspaceItem.isFolder() + " the id: " + workspaceItem.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageHubToWorkpaceConverter converter = getStorageHubToWorkpaceConverter();
|
StorageHubToWorkpaceConverter converter = getStorageHubToWorkpaceConverter();
|
||||||
|
@ -2709,10 +2712,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
* System.out.println(i++ +")"+fileModel); }
|
* System.out.println(i++ +")"+fileModel); }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// if(!WsUtil.isWithinPortal()){
|
// if(!WsUtil.isWithinPortal()){
|
||||||
// workspaceLogger.trace("Sleeping 4 sec...");
|
// workspaceLogger.trace("Sleeping 4 sec...");
|
||||||
// Thread.sleep(4000);
|
// Thread.sleep(4000);
|
||||||
// }
|
// }
|
||||||
return listFileModels;
|
return listFileModels;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -147,7 +147,6 @@ public class ObjectStorageHubToWorkpaceMapper {
|
||||||
*
|
*
|
||||||
* @param wrappedItem the wrapped item
|
* @param wrappedItem the wrapped item
|
||||||
* @param parentFolderModel the parent folder model
|
* @param parentFolderModel the parent folder model
|
||||||
* @param isParentShared the is parent shared
|
|
||||||
* @param loggedUser the logged user
|
* @param loggedUser the logged user
|
||||||
* @return the file grid model
|
* @return the file grid model
|
||||||
* @throws InternalErrorException the internal error exception
|
* @throws InternalErrorException the internal error exception
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
* Sets the synched thredds state for.
|
* Sets the synched thredds state for.
|
||||||
*
|
*
|
||||||
* @param fileModel the file model
|
* @param fileModel the file model
|
||||||
* @param wrappedItem
|
* @param wrappedItem item
|
||||||
* @return the file model
|
* @return the file model
|
||||||
*/
|
*/
|
||||||
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, WorkspaceItem wrappedItem) {
|
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, WorkspaceItem wrappedItem) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||||
* @Apr 26, 2013
|
* Apr 26, 2013
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class HttpRequestUtil {
|
public class HttpRequestUtil {
|
||||||
|
|
|
@ -21,51 +21,51 @@ import javax.imageio.ImageIO;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ThumbnailGenerator.
|
* The Class ThumbnailGenerator.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||||
* Oct 18, 2018
|
* Oct 18, 2018
|
||||||
*/
|
*/
|
||||||
public class ThumbnailGenerator {
|
public class ThumbnailGenerator {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the thumbnail.
|
* Creates the thumbnail.
|
||||||
*
|
*
|
||||||
* @param originalFile the original file
|
* @param originalFile
|
||||||
* @param thumbWidth the thumb width
|
* the original file
|
||||||
* @param thumbHeight the thumb height
|
* @param thumbWidth
|
||||||
|
* the thumb width
|
||||||
|
* @param thumbHeight
|
||||||
|
* the thumb height
|
||||||
* @return the input stream
|
* @return the input stream
|
||||||
* @throws Exception the exception
|
* @throws Exception
|
||||||
|
* the exception
|
||||||
*/
|
*/
|
||||||
public static InputStream generateThumbnail(
|
public static InputStream generateThumbnail(String originalFile, int thumbWidth, int thumbHeight) throws Exception {
|
||||||
String originalFile, int thumbWidth,
|
|
||||||
int thumbHeight)
|
|
||||||
throws Exception {
|
|
||||||
|
|
||||||
String baseName = FilenameUtils.getBaseName(originalFile);
|
String baseName = FilenameUtils.getBaseName(originalFile);
|
||||||
Image image = ImageIO.read(new File(originalFile));
|
Image image = ImageIO.read(new File(originalFile));
|
||||||
return createThumb(image, baseName, thumbWidth, thumbHeight);
|
return createThumb(image, baseName, thumbWidth, thumbHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate thumbnail.
|
* Generate thumbnail.
|
||||||
*
|
*
|
||||||
* @param originalFile the original file
|
* @param originalFile
|
||||||
* @param fileName the file name
|
* the original file
|
||||||
* @param thumbWidth the thumb width
|
* @param fileName
|
||||||
* @param thumbHeight the thumb height
|
* the file name
|
||||||
|
* @param thumbWidth
|
||||||
|
* the thumb width
|
||||||
|
* @param thumbHeight
|
||||||
|
* the thumb height
|
||||||
* @return the input stream
|
* @return the input stream
|
||||||
* @throws Exception the exception
|
* @throws Exception
|
||||||
|
* the exception
|
||||||
*/
|
*/
|
||||||
public static InputStream generateThumbnail(
|
public static InputStream generateThumbnail(InputStream originalFile, String fileName, int thumbWidth,
|
||||||
InputStream originalFile, String fileName, int thumbWidth,
|
int thumbHeight) throws Exception {
|
||||||
int thumbHeight)
|
|
||||||
throws Exception {
|
|
||||||
Image image = ImageIO.read(originalFile);
|
Image image = ImageIO.read(originalFile);
|
||||||
return createThumb(image, fileName, thumbWidth, thumbHeight);
|
return createThumb(image, fileName, thumbWidth, thumbHeight);
|
||||||
}
|
}
|
||||||
|
@ -73,30 +73,33 @@ public class ThumbnailGenerator {
|
||||||
/**
|
/**
|
||||||
* Creates the thumb.
|
* Creates the thumb.
|
||||||
*
|
*
|
||||||
* @param image the image
|
* @param image
|
||||||
* @param imageName the image name
|
* the image
|
||||||
* @param thumbWidth the thumb width
|
* @param imageName
|
||||||
* @param thumbHeight the thumb height
|
* the image name
|
||||||
|
* @param thumbWidth
|
||||||
|
* the thumb width
|
||||||
|
* @param thumbHeight
|
||||||
|
* the thumb height
|
||||||
* @return the input stream
|
* @return the input stream
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
* error
|
||||||
*/
|
*/
|
||||||
public static InputStream createThumb(Image image, String imageName, int thumbWidth,
|
public static InputStream createThumb(Image image, String imageName, int thumbWidth, int thumbHeight)
|
||||||
int thumbHeight) throws IOException{
|
throws IOException {
|
||||||
double thumbRatio = (double) thumbWidth / (double) thumbHeight;
|
double thumbRatio = (double) thumbWidth / (double) thumbHeight;
|
||||||
int imageWidth = image.getWidth(null);
|
int imageWidth = image.getWidth(null);
|
||||||
int imageHeight = image.getHeight(null);
|
int imageHeight = image.getHeight(null);
|
||||||
double imageRatio = (double) imageWidth / (double) imageHeight;
|
double imageRatio = (double) imageWidth / (double) imageHeight;
|
||||||
if (thumbRatio < imageRatio) {
|
if (thumbRatio < imageRatio) {
|
||||||
thumbHeight = (int) (thumbWidth / imageRatio);
|
thumbHeight = (int) (thumbWidth / imageRatio);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
thumbWidth = (int) (thumbHeight * imageRatio);
|
thumbWidth = (int) (thumbHeight * imageRatio);
|
||||||
}
|
}
|
||||||
if (imageWidth < thumbWidth && imageHeight < thumbHeight) {
|
if (imageWidth < thumbWidth && imageHeight < thumbHeight) {
|
||||||
thumbWidth = imageWidth;
|
thumbWidth = imageWidth;
|
||||||
thumbHeight = imageHeight;
|
thumbHeight = imageHeight;
|
||||||
}
|
} else if (imageWidth < thumbWidth)
|
||||||
else if (imageWidth < thumbWidth)
|
|
||||||
thumbWidth = imageWidth;
|
thumbWidth = imageWidth;
|
||||||
else if (imageHeight < thumbHeight)
|
else if (imageHeight < thumbHeight)
|
||||||
thumbHeight = imageHeight;
|
thumbHeight = imageHeight;
|
||||||
|
@ -107,52 +110,55 @@ public class ThumbnailGenerator {
|
||||||
graphics2D.setBackground(Color.WHITE);
|
graphics2D.setBackground(Color.WHITE);
|
||||||
graphics2D.setPaint(Color.WHITE);
|
graphics2D.setPaint(Color.WHITE);
|
||||||
graphics2D.fillRect(0, 0, thumbWidth, thumbHeight);
|
graphics2D.fillRect(0, 0, thumbWidth, thumbHeight);
|
||||||
graphics2D.setRenderingHint(
|
graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||||
RenderingHints.KEY_INTERPOLATION,
|
|
||||||
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
|
||||||
graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null);
|
graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null);
|
||||||
|
|
||||||
String ext = FilenameUtils.getExtension(imageName);
|
String ext = FilenameUtils.getExtension(imageName);
|
||||||
// String baseName = FilenameUtils.getBaseName(originalFile);
|
// String baseName = FilenameUtils.getBaseName(originalFile);
|
||||||
|
|
||||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
ImageIO.write(thumbImage, ext, os);
|
ImageIO.write(thumbImage, ext, os);
|
||||||
return new ByteArrayInputStream(os.toByteArray());
|
return new ByteArrayInputStream(os.toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stream2file.
|
* Stream2file.
|
||||||
*
|
*
|
||||||
* @param in the in
|
* @param in
|
||||||
* @param filename the filename
|
* the in
|
||||||
* @param extension the extension
|
* @param filename
|
||||||
* @return the file
|
* the filename
|
||||||
* @throws IOException Signals that an I/O exception has occurred.
|
* @param extension
|
||||||
*/
|
* the extension
|
||||||
public static File stream2file (InputStream in, String filename, String extension) throws IOException {
|
* @return the file
|
||||||
|
* @throws IOException
|
||||||
|
* Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
|
public static File stream2file(InputStream in, String filename, String extension) throws IOException {
|
||||||
|
|
||||||
extension = extension.startsWith(".")?extension:"."+extension;
|
extension = extension.startsWith(".") ? extension : "." + extension;
|
||||||
final File tempFile = File.createTempFile(filename, extension);
|
final File tempFile = File.createTempFile(filename, extension);
|
||||||
//tempFile.deleteOnExit();
|
// tempFile.deleteOnExit();
|
||||||
try (FileOutputStream out = new FileOutputStream(tempFile)) {
|
try (FileOutputStream out = new FileOutputStream(tempFile)) {
|
||||||
IOUtils.copy(in, out);
|
IOUtils.copy(in, out);
|
||||||
}
|
}
|
||||||
return tempFile;
|
return tempFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * The main method.
|
// * The main method.
|
||||||
// *
|
// *
|
||||||
// * @param args the arguments
|
// * @param args the arguments
|
||||||
// * @throws Exception the exception
|
// * @throws Exception the exception
|
||||||
// */
|
// */
|
||||||
// public static void main(String[] args) throws Exception {
|
// public static void main(String[] args) throws Exception {
|
||||||
//
|
//
|
||||||
// String originalFile = "/home/francesco-mangiacrapa/Pictures/Screenshot from 2016-04-11 10:20:43.png";
|
// String originalFile = "/home/francesco-mangiacrapa/Pictures/Screenshot
|
||||||
// int thumbWidth = 200;
|
// from 2016-04-11 10:20:43.png";
|
||||||
// int thumbHeight = 200;
|
// int thumbWidth = 200;
|
||||||
//
|
// int thumbHeight = 200;
|
||||||
// createThumbnail(originalFile, thumbWidth, thumbHeight);
|
//
|
||||||
//
|
// createThumbnail(originalFile, thumbWidth, thumbHeight);
|
||||||
// }
|
//
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,18 +34,14 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WsUtil.
|
* The Class WsUtil.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||||
* Nov 25, 2016
|
* Nov 25, 2016
|
||||||
*/
|
*/
|
||||||
public class WsUtil {
|
public class WsUtil {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static final String FOLDER_PUBLISHING_ON_THREDDS = "FolderPublishingOnThredds";
|
public static final String FOLDER_PUBLISHING_ON_THREDDS = "FolderPublishingOnThredds";
|
||||||
|
|
||||||
protected static Logger logger = Logger.getLogger(WsUtil.class);
|
protected static Logger logger = Logger.getLogger(WsUtil.class);
|
||||||
|
@ -56,7 +52,8 @@ public class WsUtil {
|
||||||
public static final String WORKSPACEBUILDER_ATTRIBUTE = "WORKSPACEBUILDER";
|
public static final String WORKSPACEBUILDER_ATTRIBUTE = "WORKSPACEBUILDER";
|
||||||
public static final String NOTIFICATION_MANAGER = "NOTIFICATION_MANAGER";
|
public static final String NOTIFICATION_MANAGER = "NOTIFICATION_MANAGER";
|
||||||
public static final String NOTIFICATION_PRODUCER = "NOTIFICATION_PRODUCER";
|
public static final String NOTIFICATION_PRODUCER = "NOTIFICATION_PRODUCER";
|
||||||
//public static final String NOTIFICATION_MANAGER_TO_STORAGEHUB = "NOTIFICATION_MANAGER_TO_STORAGEHUB";
|
// public static final String NOTIFICATION_MANAGER_TO_STORAGEHUB =
|
||||||
|
// "NOTIFICATION_MANAGER_TO_STORAGEHUB";
|
||||||
public static final String NOTIFICATION_PRODUCER_TO_STORAGEHUB = "NOTIFICATION_PRODUCER_TO_STORAGEHUB";
|
public static final String NOTIFICATION_PRODUCER_TO_STORAGEHUB = "NOTIFICATION_PRODUCER_TO_STORAGEHUB";
|
||||||
public static final String WS_RUN_IN_TEST_MODE = "WS_RUN_IN_TEST_MODE";
|
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 WORKSPACE_SCOPE_UTIL = "WORKSPACE_SCOPE_UTIL";
|
||||||
|
@ -64,7 +61,8 @@ public class WsUtil {
|
||||||
public static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
public static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
||||||
public static final String URI_RESOLVER_SERVICE = "URI_RESOLVER_SERVICE";
|
public static final String URI_RESOLVER_SERVICE = "URI_RESOLVER_SERVICE";
|
||||||
public static final String PROPERTY_SPECIAL_FOLDER = "PROPERTY_SPECIAL_FOLDER";
|
public static final String PROPERTY_SPECIAL_FOLDER = "PROPERTY_SPECIAL_FOLDER";
|
||||||
public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; //IN DEV
|
public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; // IN
|
||||||
|
// DEV
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is within portal.
|
* Checks if is within portal.
|
||||||
|
@ -75,82 +73,86 @@ public class WsUtil {
|
||||||
try {
|
try {
|
||||||
UserLocalServiceUtil.getService();
|
UserLocalServiceUtil.getService();
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
logger.trace("Development Mode ON");
|
logger.trace("Development Mode ON");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the portal context.
|
* Gets the portal context.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
|
* the http servlet request
|
||||||
* @return the portal context
|
* @return the portal context
|
||||||
*/
|
*/
|
||||||
public static PortalContextInfo getPortalContext(HttpServletRequest httpServletRequest){
|
public static PortalContextInfo getPortalContext(HttpServletRequest httpServletRequest) {
|
||||||
PortalContext pContext = PortalContext.getConfiguration();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
//USER
|
// USER
|
||||||
GCubeUser user = pContext.getCurrentUser(httpServletRequest);
|
GCubeUser user = pContext.getCurrentUser(httpServletRequest);
|
||||||
String username = user.getUsername();
|
String username = user.getUsername();
|
||||||
String fullName = user.getFullname();
|
String fullName = user.getFullname();
|
||||||
String email = user.getEmail();
|
String email = user.getEmail();
|
||||||
String avatarID = user.getUserAvatarId();
|
String avatarID = user.getUserAvatarId();
|
||||||
String avatarURL = user.getUserAvatarURL();
|
String avatarURL = user.getUserAvatarURL();
|
||||||
//SESSION
|
// SESSION
|
||||||
String currentScope = pContext.getCurrentScope(httpServletRequest);
|
String currentScope = pContext.getCurrentScope(httpServletRequest);
|
||||||
String userToken = pContext.getCurrentUserToken(httpServletRequest);
|
String userToken = pContext.getCurrentUserToken(httpServletRequest);
|
||||||
long currGroupId = pContext.getCurrentGroupId(httpServletRequest);
|
long currGroupId = pContext.getCurrentGroupId(httpServletRequest);
|
||||||
|
|
||||||
return new PortalContextInfo(username, fullName, email, avatarID, avatarURL, currentScope, userToken, currGroupId);
|
return new PortalContextInfo(username, fullName, email, avatarID, avatarURL, currentScope, userToken,
|
||||||
|
currGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the portal context.
|
* Gets the portal context.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
* @param overrideScope the override scope
|
* the http servlet request
|
||||||
|
* @param overrideScope
|
||||||
|
* the override scope
|
||||||
* @return the portal context
|
* @return the portal context
|
||||||
*/
|
*/
|
||||||
public static PortalContextInfo getPortalContext(HttpServletRequest httpServletRequest, String overrideScope){
|
public static PortalContextInfo getPortalContext(HttpServletRequest httpServletRequest, String overrideScope) {
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest);
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
info.setCurrentScope(overrideScope);
|
info.setCurrentScope(overrideScope);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is session expired.
|
* Checks if is session expired.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
|
* the http servlet request
|
||||||
* @return true, if is session expired
|
* @return true, if is session expired
|
||||||
* @throws Exception the exception
|
* @throws Exception
|
||||||
|
* the exception
|
||||||
*/
|
*/
|
||||||
public static boolean isSessionExpired(HttpServletRequest httpServletRequest) throws Exception {
|
public static boolean isSessionExpired(HttpServletRequest httpServletRequest) throws Exception {
|
||||||
logger.trace("workspace session validating...");
|
logger.trace("workspace session validating...");
|
||||||
return PortalContext.getConfiguration().getCurrentUser(httpServletRequest)==null;
|
return PortalContext.getConfiguration().getCurrentUser(httpServletRequest) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the workspace.
|
* Gets the workspace.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
* @return the workspace
|
* Servlet request
|
||||||
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
* @return Workspace
|
||||||
* @throws InternalErrorException the internal error exception
|
* @throws org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException
|
||||||
* @throws HomeNotFoundException the home not found exception
|
* Folder not found error
|
||||||
|
* @throws org.gcube.common.homelibrary.home.exceptions.InternalErrorException
|
||||||
|
* Internal error
|
||||||
|
* @throws HomeNotFoundException
|
||||||
|
* Home not found error
|
||||||
*/
|
*/
|
||||||
public static Workspace getWorkspace(HttpServletRequest httpServletRequest) throws org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException, org.gcube.common.homelibrary.home.exceptions.InternalErrorException, HomeNotFoundException
|
public static Workspace getWorkspace(HttpServletRequest httpServletRequest)
|
||||||
{
|
throws org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException,
|
||||||
|
org.gcube.common.homelibrary.home.exceptions.InternalErrorException, HomeNotFoundException {
|
||||||
|
|
||||||
logger.trace("Get Workspace");
|
logger.trace("Get Workspace");
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest);
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
logger.trace("PortalContextInfo: "+info);
|
logger.trace("PortalContextInfo: " + info);
|
||||||
|
|
||||||
ScopeProvider.instance.set(info.getCurrentScope());
|
ScopeProvider.instance.set(info.getCurrentScope());
|
||||||
logger.trace("Scope provider instancied");
|
logger.trace("Scope provider instancied");
|
||||||
|
@ -159,43 +161,54 @@ public class WsUtil {
|
||||||
return workspace;
|
return workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the workspace.
|
* Gets the workspace.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
*
|
||||||
* @param contextID the context id
|
* @param httpServletRequest
|
||||||
* @param user the user
|
* Workspace
|
||||||
* @return the workspace
|
* @param contextID
|
||||||
* @throws InternalErrorException the internal error exception
|
* contexId
|
||||||
* @throws InternalErrorException the internal error exception
|
* @param user
|
||||||
* @throws HomeNotFoundException the home not found exception
|
* user
|
||||||
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
* @return Workspace
|
||||||
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
* @throws InternalErrorException
|
||||||
|
* Internal error
|
||||||
|
* @throws HomeNotFoundException
|
||||||
|
* Home not found error
|
||||||
|
* @throws WorkspaceFolderNotFoundException
|
||||||
|
* Folder not found error
|
||||||
|
* @throws org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException
|
||||||
|
* folder not found error
|
||||||
|
* @throws org.gcube.common.homelibrary.home.exceptions.InternalErrorException
|
||||||
|
* internal error
|
||||||
*/
|
*/
|
||||||
public static Workspace getWorkspace(HttpServletRequest httpServletRequest, String contextID, GCubeUser user) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException, org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException, org.gcube.common.homelibrary.home.exceptions.InternalErrorException
|
public static Workspace getWorkspace(HttpServletRequest httpServletRequest, String contextID, GCubeUser user)
|
||||||
{
|
throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException,
|
||||||
logger.info("Get workspace using contextID: "+contextID +", current user: "+user.getUsername());
|
org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException,
|
||||||
|
org.gcube.common.homelibrary.home.exceptions.InternalErrorException {
|
||||||
|
logger.info("Get workspace using contextID: " + contextID + ", current user: " + user.getUsername());
|
||||||
String currentScope;
|
String currentScope;
|
||||||
|
|
||||||
if(isWithinPortal())
|
if (isWithinPortal())
|
||||||
currentScope = PortalContext.getConfiguration().getCurrentScope(contextID);
|
currentScope = PortalContext.getConfiguration().getCurrentScope(contextID);
|
||||||
else{
|
else {
|
||||||
currentScope = PortalContext.getConfiguration().getCurrentScope(httpServletRequest);
|
currentScope = PortalContext.getConfiguration().getCurrentScope(httpServletRequest);
|
||||||
logger.warn("STARTING IN TEST MODE!!!! USING SCOPE: "+currentScope);
|
logger.warn("STARTING IN TEST MODE!!!! USING SCOPE: " + currentScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("For ContextID: "+contextID +", read scope from Portal Context: "+currentScope);
|
logger.info("For ContextID: " + contextID + ", read scope from Portal Context: " + currentScope);
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest, currentScope);
|
PortalContextInfo info = getPortalContext(httpServletRequest, currentScope);
|
||||||
logger.trace("PortalContextInfo: "+info);
|
logger.trace("PortalContextInfo: " + info);
|
||||||
|
|
||||||
ScopeProvider.instance.set(info.getCurrentScope());
|
ScopeProvider.instance.set(info.getCurrentScope());
|
||||||
logger.trace("Scope provider instancied");
|
logger.trace("Scope provider instancied");
|
||||||
|
|
||||||
String username = null;
|
String username = null;
|
||||||
try {
|
try {
|
||||||
if(user.getUsername().compareTo(info.getUsername())!=0){
|
if (user.getUsername().compareTo(info.getUsername()) != 0) {
|
||||||
logger.debug("Gcube user read from Portal Context "+user.getUsername()+" is different by GCubeUser passed, using the second one: "+info.getUsername());
|
logger.debug("Gcube user read from Portal Context " + user.getUsername()
|
||||||
|
+ " is different by GCubeUser passed, using the second one: " + info.getUsername());
|
||||||
username = user.getUsername();
|
username = user.getUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +216,7 @@ public class WsUtil {
|
||||||
logger.error("Error comparing username read from input parameter and Portal context");
|
logger.error("Error comparing username read from input parameter and Portal context");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(username!=null)
|
if (username != null)
|
||||||
info.setUsername(username);
|
info.setUsername(username);
|
||||||
|
|
||||||
Workspace workspace = HomeLibrary.getUserWorkspace(info.getUsername());
|
Workspace workspace = HomeLibrary.getUserWorkspace(info.getUsername());
|
||||||
|
@ -214,83 +227,88 @@ public class WsUtil {
|
||||||
/**
|
/**
|
||||||
* Gets the GWT workspace builder.
|
* Gets the GWT workspace builder.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
|
* the http servlet request
|
||||||
* @return the GWT workspace builder
|
* @return the GWT workspace builder
|
||||||
*/
|
*/
|
||||||
public static GWTWorkspaceBuilder getGWTWorkspaceBuilder(HttpServletRequest httpServletRequest)
|
public static GWTWorkspaceBuilder getGWTWorkspaceBuilder(HttpServletRequest httpServletRequest) {
|
||||||
{
|
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest);
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
logger.trace("PortalContextInfo: "+info);
|
logger.trace("PortalContextInfo: " + info);
|
||||||
|
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
|
||||||
GWTWorkspaceBuilder builder = (GWTWorkspaceBuilder) session.getAttribute(WORKSPACEBUILDER_ATTRIBUTE);
|
GWTWorkspaceBuilder builder = (GWTWorkspaceBuilder) session.getAttribute(WORKSPACEBUILDER_ATTRIBUTE);
|
||||||
if (builder == null){
|
if (builder == null) {
|
||||||
logger.info("Initializing the workspace area builder");
|
logger.info("Initializing the workspace area builder");
|
||||||
builder = new GWTWorkspaceBuilder();
|
builder = new GWTWorkspaceBuilder();
|
||||||
//ADDED 03/09/2013
|
// ADDED 03/09/2013
|
||||||
builder.setContexInfo(new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), false), info.getCurrentScope());
|
builder.setContexInfo(
|
||||||
|
new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), false),
|
||||||
|
info.getCurrentScope());
|
||||||
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
|
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the notification manager.
|
* Gets the notification manager.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
|
* the http servlet request
|
||||||
* @return the notification manager
|
* @return the notification manager
|
||||||
*/
|
*/
|
||||||
public static NotificationsManager getNotificationManager(HttpServletRequest httpServletRequest)
|
public static NotificationsManager getNotificationManager(HttpServletRequest httpServletRequest) {
|
||||||
{
|
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest);
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER);
|
NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER);
|
||||||
|
|
||||||
if (notifMng == null) {
|
if (notifMng == null) {
|
||||||
try{
|
try {
|
||||||
logger.trace("Create new NotificationsManager for user: "+info.getUsername());
|
logger.trace("Create new NotificationsManager for user: " + info.getUsername());
|
||||||
logger.trace("New ApplicationNotificationsManager with portlet class name: "+NOTIFICATION_PORTLET_CLASS_ID);
|
logger.trace("New ApplicationNotificationsManager with portlet class name: "
|
||||||
|
+ NOTIFICATION_PORTLET_CLASS_ID);
|
||||||
SocialNetworkingSite site = new SocialNetworkingSite(httpServletRequest);
|
SocialNetworkingSite site = new SocialNetworkingSite(httpServletRequest);
|
||||||
SocialNetworkingUser curser = new SocialNetworkingUser(info.getUsername(), info.getUserEmail(), info.getUserFullName(), info.getUserAvatarID());
|
SocialNetworkingUser curser = new SocialNetworkingUser(info.getUsername(), info.getUserEmail(),
|
||||||
notifMng = new ApplicationNotificationsManager(site, info.getCurrentScope(), curser, NOTIFICATION_PORTLET_CLASS_ID);
|
info.getUserFullName(), info.getUserAvatarID());
|
||||||
|
notifMng = new ApplicationNotificationsManager(site, info.getCurrentScope(), curser,
|
||||||
|
NOTIFICATION_PORTLET_CLASS_ID);
|
||||||
session.setAttribute(NOTIFICATION_MANAGER, notifMng);
|
session.setAttribute(NOTIFICATION_MANAGER, notifMng);
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("An error occurred instancing ApplicationNotificationsManager for user: "+info.getUsername(),e);
|
logger.error(
|
||||||
|
"An error occurred instancing ApplicationNotificationsManager for user: " + info.getUsername(),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return notifMng;
|
return notifMng;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the notification producer.
|
* Gets the notification producer.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
|
* the http servlet request
|
||||||
* @return the notification producer
|
* @return the notification producer
|
||||||
*/
|
*/
|
||||||
public static NotificationsProducer getNotificationProducer(HttpServletRequest httpServletRequest)
|
public static NotificationsProducer getNotificationProducer(HttpServletRequest httpServletRequest) {
|
||||||
{
|
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest);
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
NotificationsProducer notifProducer = (NotificationsProducer) session.getAttribute(NOTIFICATION_PRODUCER);
|
NotificationsProducer notifProducer = (NotificationsProducer) session.getAttribute(NOTIFICATION_PRODUCER);
|
||||||
|
|
||||||
if (notifProducer == null) {
|
if (notifProducer == null) {
|
||||||
logger.trace("Create new Notification Producer for user: "+info.getUsername());
|
logger.trace("Create new Notification Producer for user: " + info.getUsername());
|
||||||
notifProducer = new NotificationsProducer(httpServletRequest);
|
notifProducer = new NotificationsProducer(httpServletRequest);
|
||||||
session.setAttribute(NOTIFICATION_PRODUCER, notifProducer);
|
session.setAttribute(NOTIFICATION_PRODUCER, notifProducer);
|
||||||
}
|
}
|
||||||
return notifProducer;
|
return notifProducer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the user id.
|
* Gets the user id.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
|
* the http servlet request
|
||||||
* @return the user id
|
* @return the user id
|
||||||
*/
|
*/
|
||||||
public static String getUserId(HttpServletRequest httpServletRequest) {
|
public static String getUserId(HttpServletRequest httpServletRequest) {
|
||||||
|
@ -302,14 +320,15 @@ public class WsUtil {
|
||||||
/**
|
/**
|
||||||
* Checks if is vre.
|
* Checks if is vre.
|
||||||
*
|
*
|
||||||
* @param scope the scope
|
* @param scope
|
||||||
|
* the scope
|
||||||
* @return true, if is vre
|
* @return true, if is vre
|
||||||
*/
|
*/
|
||||||
public static boolean isVRE(String scope){
|
public static boolean isVRE(String scope) {
|
||||||
|
|
||||||
int slashCount = StringUtils.countMatches(scope, "/");
|
int slashCount = StringUtils.countMatches(scope, "/");
|
||||||
|
|
||||||
if(slashCount < 3){
|
if (slashCount < 3) {
|
||||||
logger.trace("currentScope is not VRE");
|
logger.trace("currentScope is not VRE");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -322,33 +341,34 @@ public class WsUtil {
|
||||||
/**
|
/**
|
||||||
* Gets the scope util filter.
|
* Gets the scope util filter.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
|
* the http servlet request
|
||||||
* @return the scope util filter
|
* @return the scope util filter
|
||||||
*/
|
*/
|
||||||
public static ScopeUtilFilter getScopeUtilFilter(HttpServletRequest httpServletRequest){
|
public static ScopeUtilFilter getScopeUtilFilter(HttpServletRequest httpServletRequest) {
|
||||||
|
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest);
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
ScopeUtilFilter scopeUtil = null;
|
ScopeUtilFilter scopeUtil = null;
|
||||||
try{
|
try {
|
||||||
scopeUtil = (ScopeUtilFilter) session.getAttribute(WsUtil.WORKSPACE_SCOPE_UTIL);
|
scopeUtil = (ScopeUtilFilter) session.getAttribute(WsUtil.WORKSPACE_SCOPE_UTIL);
|
||||||
|
|
||||||
if(scopeUtil==null){
|
if (scopeUtil == null) {
|
||||||
scopeUtil = new ScopeUtilFilter(info.getCurrentScope(),true);
|
scopeUtil = new ScopeUtilFilter(info.getCurrentScope(), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("an error occurred in getscope filter "+e);
|
logger.error("an error occurred in getscope filter " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return scopeUtil;
|
return scopeUtil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the url shortener.
|
* Gets the url shortener.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
|
* the http servlet request
|
||||||
* @return the url shortener
|
* @return the url shortener
|
||||||
*/
|
*/
|
||||||
public static UrlShortener getUrlShortener(HttpServletRequest httpServletRequest) {
|
public static UrlShortener getUrlShortener(HttpServletRequest httpServletRequest) {
|
||||||
|
@ -356,26 +376,26 @@ public class WsUtil {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest);
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
UrlShortener shortener = null;
|
UrlShortener shortener = null;
|
||||||
try{
|
try {
|
||||||
shortener = (UrlShortener) session.getAttribute(WsUtil.URL_SHORTENER_SERVICE);
|
shortener = (UrlShortener) session.getAttribute(WsUtil.URL_SHORTENER_SERVICE);
|
||||||
|
|
||||||
if(shortener==null){
|
if (shortener == null) {
|
||||||
shortener = new UrlShortener();
|
shortener = new UrlShortener();
|
||||||
session.setAttribute(URL_SHORTENER_SERVICE, shortener);
|
session.setAttribute(URL_SHORTENER_SERVICE, shortener);
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("an error occurred in instancing url shortener ",e);
|
logger.error("an error occurred in instancing url shortener ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return shortener;
|
return shortener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the uri resolver.
|
* Gets the uri resolver.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
|
* the http servlet request
|
||||||
* @return the uri resolver
|
* @return the uri resolver
|
||||||
*/
|
*/
|
||||||
public static UriResolverReaderParameterForResolverIndex getUriResolver(HttpServletRequest httpServletRequest) {
|
public static UriResolverReaderParameterForResolverIndex getUriResolver(HttpServletRequest httpServletRequest) {
|
||||||
|
@ -383,16 +403,18 @@ public class WsUtil {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest);
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
UriResolverReaderParameterForResolverIndex uriResolver = null;
|
UriResolverReaderParameterForResolverIndex uriResolver = null;
|
||||||
try{
|
try {
|
||||||
uriResolver = (UriResolverReaderParameterForResolverIndex) session.getAttribute(WsUtil.URI_RESOLVER_SERVICE);
|
uriResolver = (UriResolverReaderParameterForResolverIndex) session
|
||||||
|
.getAttribute(WsUtil.URI_RESOLVER_SERVICE);
|
||||||
|
|
||||||
if(uriResolver==null){
|
if (uriResolver == null) {
|
||||||
uriResolver = new UriResolverReaderParameterForResolverIndex(info.getCurrentScope(),RESOLVER_TYPE.SMP_ID);
|
uriResolver = new UriResolverReaderParameterForResolverIndex(info.getCurrentScope(),
|
||||||
|
RESOLVER_TYPE.SMP_ID);
|
||||||
session.setAttribute(URI_RESOLVER_SERVICE, uriResolver);
|
session.setAttribute(URI_RESOLVER_SERVICE, uriResolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("an error occurred instancing URI Resolver ",e);
|
logger.error("an error occurred instancing URI Resolver ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return uriResolver;
|
return uriResolver;
|
||||||
|
@ -401,24 +423,27 @@ public class WsUtil {
|
||||||
/**
|
/**
|
||||||
* Gets the property special folder reader.
|
* Gets the property special folder reader.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
* @param pathProperty the path property
|
* the http servlet request
|
||||||
|
* @param pathProperty
|
||||||
|
* the path property
|
||||||
* @return the property special folder reader
|
* @return the property special folder reader
|
||||||
*/
|
*/
|
||||||
public static PropertySpecialFolderReader getPropertySpecialFolderReader(HttpServletRequest httpServletRequest, String pathProperty) {
|
public static PropertySpecialFolderReader getPropertySpecialFolderReader(HttpServletRequest httpServletRequest,
|
||||||
|
String pathProperty) {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
|
||||||
PropertySpecialFolderReader psFolderReader = null;
|
PropertySpecialFolderReader psFolderReader = null;
|
||||||
try{
|
try {
|
||||||
psFolderReader = (PropertySpecialFolderReader) session.getAttribute(WsUtil.PROPERTY_SPECIAL_FOLDER);
|
psFolderReader = (PropertySpecialFolderReader) session.getAttribute(WsUtil.PROPERTY_SPECIAL_FOLDER);
|
||||||
|
|
||||||
if(psFolderReader==null){
|
if (psFolderReader == null) {
|
||||||
psFolderReader = new PropertySpecialFolderReader(pathProperty);
|
psFolderReader = new PropertySpecialFolderReader(pathProperty);
|
||||||
session.setAttribute(PROPERTY_SPECIAL_FOLDER, psFolderReader);
|
session.setAttribute(PROPERTY_SPECIAL_FOLDER, psFolderReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("an error occurred instancing PropertySpecialFolderReader ",e);
|
logger.error("an error occurred instancing PropertySpecialFolderReader ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return psFolderReader;
|
return psFolderReader;
|
||||||
|
@ -427,66 +452,75 @@ public class WsUtil {
|
||||||
/**
|
/**
|
||||||
* Gets the storage hub wrapper.
|
* Gets the storage hub wrapper.
|
||||||
*
|
*
|
||||||
* @param request the request
|
* @param request
|
||||||
* @param scopeGroupId the scope group id. If scopeGroupId is null the scope is read by using the request else by using the scopeGroupId
|
* the request
|
||||||
* @param user the user
|
* @param scopeGroupId
|
||||||
|
* the scope group id. If scopeGroupId is null the scope is read
|
||||||
|
* by using the request else by using the scopeGroupId
|
||||||
|
* @param user
|
||||||
|
* the user
|
||||||
* @return the storage hub wrapper
|
* @return the storage hub wrapper
|
||||||
* @throws Exception the exception
|
* @throws Exception
|
||||||
|
* the exception
|
||||||
*/
|
*/
|
||||||
public static StorageHubWrapper getStorageHubWrapper(final HttpServletRequest request, String scopeGroupId, GCubeUser user) throws Exception{
|
public static StorageHubWrapper getStorageHubWrapper(final HttpServletRequest request, String scopeGroupId,
|
||||||
|
GCubeUser user) throws Exception {
|
||||||
|
|
||||||
if(user==null || user.getUsername().isEmpty())
|
if (user == null || user.getUsername().isEmpty())
|
||||||
throw new Exception("Session expired");
|
throw new Exception("Session expired");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String scope;
|
String scope;
|
||||||
PortalContext pContext = PortalContext.getConfiguration();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
if(WsUtil.isWithinPortal() && scopeGroupId!=null){
|
if (WsUtil.isWithinPortal() && scopeGroupId != null) {
|
||||||
scope = pContext.getCurrentScope(scopeGroupId);
|
scope = pContext.getCurrentScope(scopeGroupId);
|
||||||
logger.debug(scope+" has retrieved by using the scopeGroupId="+scopeGroupId);
|
logger.debug(scope + " has retrieved by using the scopeGroupId=" + scopeGroupId);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
scope = pContext.getCurrentScope(request);
|
scope = pContext.getCurrentScope(request);
|
||||||
|
|
||||||
logger.debug("Getting "+StorageHubWrapper.class.getSimpleName()+" for user: "+user.getUsername() +" by using the scope: "+scope);
|
logger.debug("Getting " + StorageHubWrapper.class.getSimpleName() + " for user: " + user.getUsername()
|
||||||
|
+ " by using the scope: " + scope);
|
||||||
String token = pContext.getCurrentUserToken(scope, user.getUsername());
|
String token = pContext.getCurrentUserToken(scope, user.getUsername());
|
||||||
return new StorageHubWrapper(scope, token, false, false, true);
|
return new StorageHubWrapper(scope, token, false, false, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error during getting storageHub wrapper", e);
|
logger.error("Error during getting storageHub wrapper", e);
|
||||||
throw new Exception("Error on gettig the StorageHub wrapper for userId: "+user);
|
throw new Exception("Error on gettig the StorageHub wrapper for userId: " + user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the storage hub to workpace converter.
|
* Gets the storage hub to workpace converter.
|
||||||
*
|
*
|
||||||
* @param request the request
|
* @param request
|
||||||
* @param scopeGroupId the scope group id
|
* the request
|
||||||
* @param user the user
|
* @param scopeGroupId
|
||||||
|
* the scope group id
|
||||||
|
* @param user
|
||||||
|
* the user
|
||||||
* @return the storage hub to workpace converter
|
* @return the storage hub to workpace converter
|
||||||
* @throws Exception the exception
|
* @throws Exception
|
||||||
|
* the exception
|
||||||
*/
|
*/
|
||||||
public static StorageHubToWorkpaceConverter getStorageHubToWorkpaceConverter(final HttpServletRequest request, String scopeGroupId, GCubeUser user) throws Exception {
|
public static StorageHubToWorkpaceConverter getStorageHubToWorkpaceConverter(final HttpServletRequest request,
|
||||||
|
String scopeGroupId, GCubeUser user) throws Exception {
|
||||||
|
|
||||||
if(user==null || user.getUsername().isEmpty())
|
if (user == null || user.getUsername().isEmpty())
|
||||||
throw new Exception("Session expired");
|
throw new Exception("Session expired");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
StorageHubToWorkpaceConverter converter = (StorageHubToWorkpaceConverter) session.getAttribute(WORKSPACE_STORAGE_HUB_CONVERTER);
|
StorageHubToWorkpaceConverter converter = (StorageHubToWorkpaceConverter) session
|
||||||
|
.getAttribute(WORKSPACE_STORAGE_HUB_CONVERTER);
|
||||||
|
|
||||||
String scope;
|
String scope;
|
||||||
PortalContext pContext = PortalContext.getConfiguration();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
if(WsUtil.isWithinPortal() && scopeGroupId!=null){
|
if (WsUtil.isWithinPortal() && scopeGroupId != null) {
|
||||||
scope = pContext.getCurrentScope(scopeGroupId);
|
scope = pContext.getCurrentScope(scopeGroupId);
|
||||||
logger.debug(scope+" has retrieved by using the scopeGroupId="+scopeGroupId);
|
logger.debug(scope + " has retrieved by using the scopeGroupId=" + scopeGroupId);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
scope = pContext.getCurrentScope(request);
|
scope = pContext.getCurrentScope(request);
|
||||||
|
|
||||||
if(converter==null){
|
if (converter == null) {
|
||||||
converter = new StorageHubToWorkpaceConverter(scope, user);
|
converter = new StorageHubToWorkpaceConverter(scope, user);
|
||||||
session.setAttribute(WORKSPACE_STORAGE_HUB_CONVERTER, converter);
|
session.setAttribute(WORKSPACE_STORAGE_HUB_CONVERTER, converter);
|
||||||
}
|
}
|
||||||
|
@ -494,79 +528,87 @@ public class WsUtil {
|
||||||
return converter;
|
return converter;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error during getting storageHub conveter", e);
|
logger.error("Error during getting storageHub conveter", e);
|
||||||
throw new Exception("Error on gettig the StorageHub conveter for user: "+user);
|
throw new Exception("Error on gettig the StorageHub conveter for user: " + user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is root folder.
|
* Checks if is root folder.
|
||||||
*
|
*
|
||||||
* @param folder the folder
|
* @param folder
|
||||||
* @param converter the converter
|
* the folder
|
||||||
|
* @param converter
|
||||||
|
* the converter
|
||||||
* @return true, if is root folder
|
* @return true, if is root folder
|
||||||
*/
|
*/
|
||||||
public static boolean isRootFolder(FileModel folder, StorageHubToWorkpaceConverter converter){
|
public static boolean isRootFolder(FileModel folder, StorageHubToWorkpaceConverter converter) {
|
||||||
|
|
||||||
if(folder==null)
|
if (folder == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(folder.getIdentifier().compareTo(converter.getWorkspaceRootId())==0)
|
if (folder.getIdentifier().compareTo(converter.getWorkspaceRootId()) == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
// /**
|
// * Gets the notification manager to storage hub.
|
||||||
// * Gets the notification manager to storage hub.
|
// *
|
||||||
// *
|
// * @param httpServletRequest the http servlet request
|
||||||
// * @param httpServletRequest the http servlet request
|
// * @return the notification manager to storage hub
|
||||||
// * @return the notification manager to storage hub
|
// */
|
||||||
// */
|
// public static NotificationsManager
|
||||||
// public static NotificationsManager getNotificationManagerToStorageHub(HttpServletRequest httpServletRequest)
|
// getNotificationManagerToStorageHub(HttpServletRequest httpServletRequest)
|
||||||
// {
|
// {
|
||||||
// PortalContextInfo info = getPortalContext(httpServletRequest);
|
// PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
// HttpSession session = httpServletRequest.getSession();
|
// HttpSession session = httpServletRequest.getSession();
|
||||||
// NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER_TO_STORAGEHUB);
|
// NotificationsManager notifMng = (NotificationsManager)
|
||||||
//
|
// session.getAttribute(NOTIFICATION_MANAGER_TO_STORAGEHUB);
|
||||||
// if (notifMng == null) {
|
//
|
||||||
// try{
|
// if (notifMng == null) {
|
||||||
// logger.trace("Create new NotificationsManager for user: "+info.getUsername());
|
// try{
|
||||||
// logger.trace("New ApplicationNotificationsManager with portlet class name: "+NOTIFICATION_PORTLET_CLASS_ID);
|
// logger.trace("Create new NotificationsManager for user:
|
||||||
// SocialNetworkingSite site = new SocialNetworkingSite(httpServletRequest);
|
// "+info.getUsername());
|
||||||
// SocialNetworkingUser curser = new SocialNetworkingUser(info.getUsername(), info.getUserEmail(), info.getUserFullName(), info.getUserAvatarID());
|
// logger.trace("New ApplicationNotificationsManager with portlet class
|
||||||
// notifMng = new ApplicationNotificationsManager(site, info.getCurrentScope(), curser, NOTIFICATION_PORTLET_CLASS_ID);
|
// name: "+NOTIFICATION_PORTLET_CLASS_ID);
|
||||||
// session.setAttribute(NOTIFICATION_MANAGER_TO_STORAGEHUB, notifMng);
|
// SocialNetworkingSite site = new SocialNetworkingSite(httpServletRequest);
|
||||||
// }catch (Exception e) {
|
// SocialNetworkingUser curser = new
|
||||||
// logger.error("An error occurred instancing ApplicationNotificationsManager for user: "+info.getUsername(),e);
|
// SocialNetworkingUser(info.getUsername(), info.getUserEmail(),
|
||||||
// }
|
// info.getUserFullName(), info.getUserAvatarID());
|
||||||
// }
|
// notifMng = new ApplicationNotificationsManager(site,
|
||||||
//
|
// info.getCurrentScope(), curser, NOTIFICATION_PORTLET_CLASS_ID);
|
||||||
// return notifMng;
|
// session.setAttribute(NOTIFICATION_MANAGER_TO_STORAGEHUB, notifMng);
|
||||||
// }
|
// }catch (Exception e) {
|
||||||
|
// logger.error("An error occurred instancing
|
||||||
|
// ApplicationNotificationsManager for user: "+info.getUsername(),e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return notifMng;
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the notification producer to storage hub.
|
* Gets the notification producer to storage hub.
|
||||||
*
|
*
|
||||||
* @param httpServletRequest the http servlet request
|
* @param httpServletRequest
|
||||||
* @return the notification producer to storage hub
|
* the http servlet request
|
||||||
*/
|
* @return the notification producer to storage hub
|
||||||
public static NotificationsProducerToStorageHub getNotificationProducerToStorageHub(HttpServletRequest httpServletRequest)
|
*/
|
||||||
{
|
public static NotificationsProducerToStorageHub getNotificationProducerToStorageHub(
|
||||||
|
HttpServletRequest httpServletRequest) {
|
||||||
PortalContextInfo info = getPortalContext(httpServletRequest);
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
NotificationsProducerToStorageHub notifProducer = (NotificationsProducerToStorageHub) session.getAttribute(NOTIFICATION_PRODUCER_TO_STORAGEHUB);
|
NotificationsProducerToStorageHub notifProducer = (NotificationsProducerToStorageHub) session
|
||||||
|
.getAttribute(NOTIFICATION_PRODUCER_TO_STORAGEHUB);
|
||||||
|
|
||||||
if (notifProducer == null) {
|
if (notifProducer == null) {
|
||||||
logger.trace("Create new Notification Producer for user: "+info.getUsername());
|
logger.trace("Create new Notification Producer for user: " + info.getUsername());
|
||||||
notifProducer = new NotificationsProducerToStorageHub(httpServletRequest);
|
notifProducer = new NotificationsProducerToStorageHub(httpServletRequest);
|
||||||
session.setAttribute(NOTIFICATION_PRODUCER_TO_STORAGEHUB, notifProducer);
|
session.setAttribute(NOTIFICATION_PRODUCER_TO_STORAGEHUB, notifProducer);
|
||||||
}
|
}
|
||||||
return notifProducer;
|
return notifProducer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,146 +8,143 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
public class ScopeUtilFilter {
|
public class ScopeUtilFilter {
|
||||||
|
|
||||||
private static final String SCOPE_SEPARATOR = "/";
|
private static final String SCOPE_SEPARATOR = "/";
|
||||||
private String scopeRoot = null;
|
private String scopeRoot = null;
|
||||||
public static Logger logger = Logger.getLogger(ScopeUtilFilter.class);
|
public static Logger logger = Logger.getLogger(ScopeUtilFilter.class);
|
||||||
public Map<String, String> hashScopesFiltered = new HashMap<String, String>();
|
public Map<String, String> hashScopesFiltered = new HashMap<String, String>();
|
||||||
|
|
||||||
public static final String ALLSCOPE = "All spaces";
|
public static final String ALLSCOPE = "All spaces";
|
||||||
public static final String IDALLSCOPE = "ID All spaces";
|
public static final String IDALLSCOPE = "ID All spaces";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param scopeName
|
* @param scopeName
|
||||||
* @param addIdAllSpaces if true add "ID All spaces" - "All spaces" pair into map
|
* scope name
|
||||||
|
* @param addIdAllSpaces
|
||||||
|
* if true add "ID All spaces" - "All spaces" pair into map
|
||||||
*/
|
*/
|
||||||
public ScopeUtilFilter(String scopeName, boolean addIdAllSpaces) {
|
public ScopeUtilFilter(String scopeName, boolean addIdAllSpaces) {
|
||||||
|
|
||||||
if(scopeName!=null){
|
if (scopeName != null) {
|
||||||
String[] scopes = scopeName.split(SCOPE_SEPARATOR);
|
String[] scopes = scopeName.split(SCOPE_SEPARATOR);
|
||||||
|
|
||||||
if(scopes!=null && scopes.length>1){
|
if (scopes != null && scopes.length > 1) {
|
||||||
scopeRoot = SCOPE_SEPARATOR+scopes[1];
|
scopeRoot = SCOPE_SEPARATOR + scopes[1];
|
||||||
logger.trace("found root "+scopeRoot);
|
logger.trace("found root " + scopeRoot);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
logger.warn("root scope not found!");
|
logger.warn("root scope not found!");
|
||||||
scopeRoot = SCOPE_SEPARATOR;
|
scopeRoot = SCOPE_SEPARATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addIdAllSpaces)
|
if (addIdAllSpaces)
|
||||||
hashScopesFiltered.put(ALLSCOPE, IDALLSCOPE); //PUT DEFAULT ID ALL SCOPE
|
hashScopesFiltered.put(ALLSCOPE, IDALLSCOPE); // PUT DEFAULT ID
|
||||||
|
// ALL SCOPE
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> convertListScopeToPortlet(List<String> listScopes){
|
public List<String> convertListScopeToPortlet(List<String> listScopes) {
|
||||||
|
|
||||||
logger.trace("List Scope converting..."+listScopes);
|
logger.trace("List Scope converting..." + listScopes);
|
||||||
|
|
||||||
List<String> scopesConverted = new ArrayList<String>();
|
List<String> scopesConverted = new ArrayList<String>();
|
||||||
scopesConverted.add(ALLSCOPE);
|
scopesConverted.add(ALLSCOPE);
|
||||||
|
|
||||||
if(scopeRoot.compareTo(SCOPE_SEPARATOR)==0){
|
if (scopeRoot.compareTo(SCOPE_SEPARATOR) == 0) {
|
||||||
|
|
||||||
logger.warn("root scope is '"+SCOPE_SEPARATOR+"' return list scopes passed in input");
|
logger.warn("root scope is '" + SCOPE_SEPARATOR + "' return list scopes passed in input");
|
||||||
return listScopes;
|
return listScopes;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String scope : listScopes) {
|
for (String scope : listScopes) {
|
||||||
|
|
||||||
if(scope.compareTo(scopeRoot)==0){ //CASE SCOPE IS ROOT
|
if (scope.compareTo(scopeRoot) == 0) { // CASE SCOPE IS ROOT
|
||||||
logger.trace("found scope root "+scope+" added to list without converting");
|
logger.trace("found scope root " + scope + " added to list without converting");
|
||||||
hashScopesFiltered.put(scopeRoot, scopeRoot);
|
hashScopesFiltered.put(scopeRoot, scopeRoot);
|
||||||
scopesConverted.add(scopeRoot);
|
scopesConverted.add(scopeRoot);
|
||||||
|
|
||||||
} else{
|
} else {
|
||||||
|
|
||||||
int index = scope.indexOf(scopeRoot,0);
|
int index = scope.indexOf(scopeRoot, 0);
|
||||||
int start = index+scopeRoot.length();
|
int start = index + scopeRoot.length();
|
||||||
int end = scope.length();
|
int end = scope.length();
|
||||||
//DEBUG
|
// DEBUG
|
||||||
// System.out.println("\n\n ");
|
// System.out.println("\n\n ");
|
||||||
// System.out.println("index "+index);
|
// System.out.println("index "+index);
|
||||||
// System.out.println("start "+start);
|
// System.out.println("start "+start);
|
||||||
// System.out.println("end "+end);
|
// System.out.println("end "+end);
|
||||||
|
|
||||||
if(index!=-1){ //CASE SCOPE ROOT IS FOUND
|
if (index != -1) { // CASE SCOPE ROOT IS FOUND
|
||||||
String filerString = scope.substring(index+start, scope.length());
|
String filerString = scope.substring(index + start, scope.length());
|
||||||
hashScopesFiltered.put(filerString, scope);
|
hashScopesFiltered.put(filerString, scope);
|
||||||
scopesConverted.add(filerString);
|
scopesConverted.add(filerString);
|
||||||
logger.trace("scope "+scope+ " is converted in: "+filerString);
|
logger.trace("scope " + scope + " is converted in: " + filerString);
|
||||||
|
|
||||||
}else{ //CASE SCOPE ROOT NOT IS FOUND
|
} else { // CASE SCOPE ROOT NOT IS FOUND
|
||||||
logger.warn("scope "+scope + " was reject from filter");
|
logger.warn("scope " + scope + " was reject from filter");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.trace("Scope converting was completed");
|
logger.trace("Scope converting was completed");
|
||||||
return scopesConverted;
|
return scopesConverted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPortalScopeFromFilteredScope(String scope) {
|
||||||
public String getPortalScopeFromFilteredScope(String scope){
|
|
||||||
|
|
||||||
String portalScope = hashScopesFiltered.get(scope);
|
String portalScope = hashScopesFiltered.get(scope);
|
||||||
|
|
||||||
if(portalScope==null){
|
if (portalScope == null) {
|
||||||
logger.warn("scope not found in scope fiter, return root scope "+scopeRoot);
|
logger.warn("scope not found in scope fiter, return root scope " + scopeRoot);
|
||||||
return scopeRoot;
|
return scopeRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
return portalScope;
|
return portalScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getHashScopesFiltered() {
|
public Map<String, String> getHashScopesFiltered() {
|
||||||
return hashScopesFiltered;
|
return hashScopesFiltered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TEST
|
||||||
//TEST
|
private void printScopeName(String scopeName) {
|
||||||
private void printScopeName(String scopeName){
|
|
||||||
|
|
||||||
String[] scopes = scopeName.split(SCOPE_SEPARATOR);
|
String[] scopes = scopeName.split(SCOPE_SEPARATOR);
|
||||||
|
|
||||||
for (String scope : scopes) {
|
for (String scope : scopes) {
|
||||||
System.out.println("scope split: "+scope);
|
System.out.println("scope split: " + scope);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void printScopes() {
|
||||||
private void printScopes(){
|
|
||||||
|
|
||||||
for (String key : hashScopesFiltered.keySet()) {
|
for (String key : hashScopesFiltered.keySet()) {
|
||||||
|
|
||||||
System.out.println("Scope found: "+ hashScopesFiltered.get(key) +" with key: "+ key);
|
System.out.println("Scope found: " + hashScopesFiltered.get(key) + " with key: " + key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScopeRoot() {
|
public String getScopeRoot() {
|
||||||
return scopeRoot;
|
return scopeRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String scope = "/gcube";
|
String scope = "/gcube";
|
||||||
|
|
||||||
List<String> listTest = Arrays.asList(new String[]{"/gcube/devsec/devre", "/gcube/devsec","/gcube/devsec/devNEXT", "/", "/gcub", "/gcube"});
|
List<String> listTest = Arrays.asList(new String[] { "/gcube/devsec/devre", "/gcube/devsec",
|
||||||
|
"/gcube/devsec/devNEXT", "/", "/gcub", "/gcube" });
|
||||||
|
|
||||||
ScopeUtilFilter filter = new ScopeUtilFilter(scope, false);
|
ScopeUtilFilter filter = new ScopeUtilFilter(scope, false);
|
||||||
|
|
||||||
System.out.println("scope root is: "+filter.getScopeRoot());
|
System.out.println("scope root is: " + filter.getScopeRoot());
|
||||||
|
|
||||||
filter.convertListScopeToPortlet(listTest);
|
filter.convertListScopeToPortlet(listTest);
|
||||||
|
|
||||||
|
System.out.println("get portal scope for /devsec: " + filter.getPortalScopeFromFilteredScope("/devsec"));
|
||||||
System.out.println("get portal scope for /devsec: "+filter.getPortalScopeFromFilteredScope("/devsec"));
|
|
||||||
|
|
||||||
filter.printScopes();
|
filter.printScopes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,25 +15,16 @@ import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
|
||||||
*/
|
*/
|
||||||
public class TrashContent implements Serializable{
|
public class TrashContent implements Serializable{
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -7428752149892396573L;
|
private static final long serialVersionUID = -7428752149892396573L;
|
||||||
|
|
||||||
|
|
||||||
List<FileTrashedModel> trashContent;
|
List<FileTrashedModel> trashContent;
|
||||||
List<FileTrashedModel> listErrors;
|
List<FileTrashedModel> listErrors;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public TrashContent() {
|
public TrashContent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param trashContent
|
|
||||||
* @param listErrors
|
|
||||||
*/
|
|
||||||
public TrashContent(List<FileTrashedModel> trashContent, List<FileTrashedModel> listErrors) {
|
public TrashContent(List<FileTrashedModel> trashContent, List<FileTrashedModel> listErrors) {
|
||||||
this.trashContent = trashContent;
|
this.trashContent = trashContent;
|
||||||
this.listErrors = listErrors;
|
this.listErrors = listErrors;
|
||||||
|
|
|
@ -12,25 +12,14 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class TrashOperationContent extends TrashContent{
|
public class TrashOperationContent extends TrashContent{
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 3089944053784656200L;
|
private static final long serialVersionUID = 3089944053784656200L;
|
||||||
|
|
||||||
private List<String> listTrashIds;
|
private List<String> listTrashIds;
|
||||||
private WorkspaceTrashOperation operation;
|
private WorkspaceTrashOperation operation;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public TrashOperationContent() {
|
public TrashOperationContent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param trashContent
|
|
||||||
* @param listErrors
|
|
||||||
*/
|
|
||||||
public TrashOperationContent(WorkspaceTrashOperation operation, List<String> listTrashIds) {
|
public TrashOperationContent(WorkspaceTrashOperation operation, List<String> listTrashIds) {
|
||||||
this.listTrashIds = listTrashIds;
|
this.listTrashIds = listTrashIds;
|
||||||
this.operation = operation;
|
this.operation = operation;
|
||||||
|
|
|
@ -4,9 +4,7 @@ import java.io.Serializable;
|
||||||
|
|
||||||
public class UserBean implements Serializable {
|
public class UserBean implements Serializable {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 6779963164440480883L;
|
private static final long serialVersionUID = 6779963164440480883L;
|
||||||
|
|
||||||
private String username;
|
private String username;
|
||||||
|
@ -25,36 +23,25 @@ public class UserBean implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the username
|
|
||||||
*/
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
|
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the firstName
|
|
||||||
*/
|
|
||||||
public String getFirstName() {
|
public String getFirstName() {
|
||||||
|
|
||||||
return firstName;
|
return firstName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
public String getLastName() {
|
||||||
* @return the lastName
|
|
||||||
*/
|
|
||||||
public String getLastName() {
|
|
||||||
|
|
||||||
return lastName;
|
return lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the email
|
|
||||||
*/
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
|
|
||||||
return email;
|
return email;
|
||||||
|
|
|
@ -12,10 +12,6 @@ import java.io.Serializable;
|
||||||
*/
|
*/
|
||||||
public class WorkspaceUserQuote implements Serializable{
|
public class WorkspaceUserQuote implements Serializable{
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -5363340286390074157L;
|
private static final long serialVersionUID = -5363340286390074157L;
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,11 +24,6 @@ public class WorkspaceUserQuote implements Serializable{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param diskSpace
|
|
||||||
* @param diskSpaceFormatted
|
|
||||||
* @param totalItems
|
|
||||||
*/
|
|
||||||
public WorkspaceUserQuote(Long diskSpace, String diskSpaceFormatted,
|
public WorkspaceUserQuote(Long diskSpace, String diskSpaceFormatted,
|
||||||
Long totalItems) {
|
Long totalItems) {
|
||||||
this.diskSpace = diskSpace;
|
this.diskSpace = diskSpace;
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspace.shared.accounting;
|
package org.gcube.portlets.user.workspace.shared.accounting;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum GxtAccountingEntryType.
|
* The Enum GxtAccountingEntryType.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||||
* Sep 28, 2016
|
* Sep 28, 2016
|
||||||
*/
|
*/
|
||||||
public enum GxtAccountingEntryType {
|
public enum GxtAccountingEntryType {
|
||||||
|
|
||||||
|
@ -36,9 +35,9 @@ public enum GxtAccountingEntryType {
|
||||||
|
|
||||||
RESTORE("Restored", "restored"),
|
RESTORE("Restored", "restored"),
|
||||||
|
|
||||||
DISABLED_PUBLIC_ACCESS("DisabledPublicAccess","disabled public access"),
|
DISABLED_PUBLIC_ACCESS("DisabledPublicAccess", "disabled public access"),
|
||||||
|
|
||||||
ENABLED_PUBLIC_ACCESS("EnabledPublicAccess","enabled public access"),
|
ENABLED_PUBLIC_ACCESS("EnabledPublicAccess", "enabled public access"),
|
||||||
|
|
||||||
ALLWITHOUTREAD("allwithoutread", "allwithoutread");
|
ALLWITHOUTREAD("allwithoutread", "allwithoutread");
|
||||||
|
|
||||||
|
@ -48,8 +47,10 @@ public enum GxtAccountingEntryType {
|
||||||
/**
|
/**
|
||||||
* Instantiates a new gxt accounting entry type.
|
* Instantiates a new gxt accounting entry type.
|
||||||
*
|
*
|
||||||
* @param id the id
|
* @param id
|
||||||
* @param name the name
|
* the id
|
||||||
|
* @param name
|
||||||
|
* the name
|
||||||
*/
|
*/
|
||||||
GxtAccountingEntryType(String id, String name) {
|
GxtAccountingEntryType(String id, String name) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -69,7 +70,8 @@ public enum GxtAccountingEntryType {
|
||||||
/**
|
/**
|
||||||
* Sets the id.
|
* Sets the id.
|
||||||
*
|
*
|
||||||
* @param id the new id
|
* @param id
|
||||||
|
* the new id
|
||||||
*/
|
*/
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -87,7 +89,8 @@ public enum GxtAccountingEntryType {
|
||||||
/**
|
/**
|
||||||
* Sets the name.
|
* Sets the name.
|
||||||
*
|
*
|
||||||
* @param name the new name
|
* @param name
|
||||||
|
* the new name
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -15,9 +15,6 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel
|
||||||
*/
|
*/
|
||||||
public class GxtAccountingField implements Serializable {
|
public class GxtAccountingField implements Serializable {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -2114527164447302004L;
|
private static final long serialVersionUID = -2114527164447302004L;
|
||||||
|
|
||||||
private InfoContactModel user;
|
private InfoContactModel user;
|
||||||
|
@ -29,12 +26,6 @@ public class GxtAccountingField implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param description
|
|
||||||
* @param user
|
|
||||||
* @param date
|
|
||||||
* @param operation
|
|
||||||
*/
|
|
||||||
public GxtAccountingField(String description, InfoContactModel user,
|
public GxtAccountingField(String description, InfoContactModel user,
|
||||||
Date date, GxtAccountingEntryType operation) {
|
Date date, GxtAccountingEntryType operation) {
|
||||||
setUser(user);
|
setUser(user);
|
||||||
|
|
Loading…
Reference in New Issue