diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileDetailsModel.java b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileDetailsModel.java index 1ba59a1..982de7a 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileDetailsModel.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileDetailsModel.java @@ -9,6 +9,7 @@ import org.gcube.portlets.user.workspace.client.ConstantsExplorer; * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * */ +@Deprecated public class FileDetailsModel extends FileGridModel { /** @@ -24,18 +25,15 @@ public class FileDetailsModel extends FileGridModel { setLastModified(lastModified); setDescription(description); - setOwner(owner); +// setOwner(owner); } public void setLastModified(Date lastModified) { set(ConstantsExplorer.LASTMODIFIED, lastModified); } - -// private Date getLastModified() { -// return (Date) get(ConstantsExplorer.LASTMODIFIED); -// } -// + + public String getDescription(){ return get(ConstantsExplorer.DESCRIPTION); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileGridModel.java b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileGridModel.java index deab992..e2c37f3 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileGridModel.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileGridModel.java @@ -5,10 +5,9 @@ import java.util.Date; import org.gcube.portlets.user.workspace.client.ConstantsExplorer; /** - * - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * @Nov 14, 2013 + * The Class FileGridModel. * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Nov 17, 2015 */ public class FileGridModel extends FileModel { @@ -16,52 +15,115 @@ public class FileGridModel extends FileModel { * */ private static final long serialVersionUID = 1L; - - protected FileGridModel(){ - } - - public FileGridModel(String identifier, String name, String path, Date lastUpdate, FileModel parent, long size, boolean isDirectory, boolean isShared) { - super(identifier, name, parent, isDirectory, isShared); - - setLastModification(lastUpdate); - setSize(size); - } - - - public FileGridModel(String identifier, String name, Date lastUpdate, FileModel parent, long size, boolean isDirectory, boolean isShared) { - super(identifier, name, parent, isDirectory, isShared); - - setLastModification(lastUpdate); - setSize(size); - } - - private void setSize(long size) { - set(ConstantsExplorer.SIZE, size); - } - - public long getSize() { - return (Long) get(ConstantsExplorer.SIZE); + + /** + * Instantiates a new file grid model. + */ + protected FileGridModel() { } -// private void setCreationDate(Date creationDate) { -// set(ConstantsExplorer.GRIDCOLUMNCREATIONDATE, creationDate); -// -// } - - private void setLastModification(Date lastUpdate) { - set(ConstantsExplorer.LASTMODIFIED, lastUpdate); - + /** + * Instantiates a new file grid model. + * + * @param identifier + * the identifier + * @param name + * the name + * @param path + * the path + * @param lastUpdate + * the last update + * @param parent + * the parent + * @param size + * the size + * @param isDirectory + * the is directory + * @param isShared + * the is shared + */ + public FileGridModel(String identifier, String name, String path, + Date lastUpdate, FileModel parent, long size, boolean isDirectory, + boolean isShared) { + super(identifier, name, parent, isDirectory, isShared); + + setLastModification(lastUpdate); + setSize(size); } - + + /** + * Instantiates a new file grid model. + * + * @param identifier + * the identifier + * @param name + * the name + * @param lastUpdate + * the last update + * @param parent + * the parent + * @param size + * the size + * @param isDirectory + * the is directory + * @param isShared + * the is shared + */ + public FileGridModel(String identifier, String name, Date lastUpdate, + FileModel parent, long size, boolean isDirectory, boolean isShared) { + super(identifier, name, parent, isDirectory, isShared); + + setLastModification(lastUpdate); + setSize(size); + } + + /** + * Sets the size. + * + * @param size + * the new size + */ + private void setSize(long size) { + set(ConstantsExplorer.SIZE, size); + } + + /** + * Gets the size. + * + * @return the size + */ + public long getSize() { + return (Long) get(ConstantsExplorer.SIZE); + } + + /** + * Sets the last modification. + * + * @param lastUpdate + * the new last modification + */ + private void setLastModification(Date lastUpdate) { + set(ConstantsExplorer.LASTMODIFIED, lastUpdate); + + } + + /** + * Gets the last modification. + * + * @return the last modification + */ public Date getLastModification() { return (Date) get(ConstantsExplorer.LASTMODIFIED); - + } -// public Date getCreationDate(){ -// return (Date) get(ConstantsExplorer.GRIDCOLUMNCREATIONDATE); -// } - + /* + * (non-Javadoc) + * + * @see + * org.gcube.portlets.user.workspace.client.model.FileModel#equals(java. + * lang.Object) + */ @Override public boolean equals(Object obj) { if (obj != null && obj instanceof FileGridModel) { diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileModel.java b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileModel.java index 0a62786..c6a299f 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/model/FileModel.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/model/FileModel.java @@ -136,20 +136,17 @@ public class FileModel extends BaseModelData implements Serializable { // set(ConstantsExplorer.ABSTRACTICON, null); // } - public void setOwner(InfoContactModel owner){ - set(ConstantsExplorer.OWNER, owner); - -// if(owner!=null) -// set(ConstantsExplorer.OWNERFULLNAME, owner.getName()); - } +// public void setOwner(InfoContactModel owner){ +// set(ConstantsExplorer.OWNER, owner); +// } public void setOwnerFullName(String fullName){ set(ConstantsExplorer.OWNERFULLNAME, fullName); } - public InfoContactModel getOwner(){ - return (InfoContactModel) get(ConstantsExplorer.OWNER); - } +// public InfoContactModel getOwner(){ +// return (InfoContactModel) get(ConstantsExplorer.OWNER); +// } public String getOwnerFullName(){ return get(ConstantsExplorer.OWNERFULLNAME); @@ -343,8 +340,6 @@ public class FileModel extends BaseModelData implements Serializable { builder.append(isSpecialFolder); builder.append(", isShareable()="); builder.append(isShareable()); - builder.append(", getOwner()="); - builder.append(getOwner()); builder.append(", isShared()="); builder.append(isShared()); builder.append(", getIdentifier()="); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java index a15edb0..1bfa9c8 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceService.java @@ -11,7 +11,6 @@ import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.client.model.FileTrashedModel; import org.gcube.portlets.user.workspace.client.model.FolderModel; import org.gcube.portlets.user.workspace.client.model.InfoContactModel; -import org.gcube.portlets.user.workspace.client.model.MessageModel; import org.gcube.portlets.user.workspace.client.model.ScopeModel; import org.gcube.portlets.user.workspace.client.model.SmartFolderModel; import org.gcube.portlets.user.workspace.client.model.SubTree; diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java index 73207f4..77b9292 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/rpc/GWTWorkspaceServiceAsync.java @@ -11,7 +11,6 @@ import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.client.model.FileTrashedModel; import org.gcube.portlets.user.workspace.client.model.FolderModel; import org.gcube.portlets.user.workspace.client.model.InfoContactModel; -import org.gcube.portlets.user.workspace.client.model.MessageModel; import org.gcube.portlets.user.workspace.client.model.ScopeModel; import org.gcube.portlets.user.workspace.client.model.SmartFolderModel; import org.gcube.portlets.user.workspace.client.model.SubTree; diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java index 41263d9..a9c2e44 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java @@ -782,6 +782,12 @@ public class GWTWorkspaceBuilder { break; } + + if(parentFileModel!=null && parentFileModel.isShared()){ + fileGridModel.setShared(true); + fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS + } + //TODO ISSHARED IN SEARCH ITEM IN HL TO RETRIEVE SHARE ON WORKSPACEITEM //OWNER if(item.isShared()){ //IS READ FROM HL ONLY IF THE ITEM IS SHARED @@ -877,11 +883,10 @@ public class GWTWorkspaceBuilder { if(parentFileModel!=null && parentFileModel.isShared()){ fileGridModel.setShared(true); fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS -// fileGridModel.setShareable(true); } //OWNER - if(fileGridModel.isShared()){ //IS READ FROM HL ONLY IF THE ITEM IS SHARED + if(item.isShared()){ //IS READ FROM HL ONLY IF THE ITEM IS SHARED User owner = item.getOwner(); if(owner!=null){ // System.out.println("++++reading owner"); diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/util/UserUtil.java b/src/main/java/org/gcube/portlets/user/workspace/server/util/UserUtil.java index 0045b61..f6489ff 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/util/UserUtil.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/util/UserUtil.java @@ -14,6 +14,12 @@ import org.gcube.vomanagement.usermanagement.model.UserModel; +/** + * The Class UserUtil. + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Nov 17, 2015 + */ public class UserUtil { static UserManager um = new LiferayUserManager(); @@ -21,9 +27,10 @@ public class UserUtil { /** - * - * @param user - * @return + * Gets the user full name. + * + * @param portalLogin the portal login + * @return the user full name if is available, the input parameter portalLogin otherwise */ public static String getUserFullName(String portalLogin){ // return user.getPortalLogin(); //for testing in eclipse @@ -57,10 +64,8 @@ public class UserUtil { } if (curr != null){ - // logger.trace("Return "+curr.getFullname() +" full name for: "+portalLogin); return curr.getFullname(); - } }else{ logger.trace("DEVELOPEMENT MODE ON"); @@ -72,6 +77,12 @@ public class UserUtil { return portalLogin; } + /** + * Gets the list login by info contact model. + * + * @param listContacts the list contacts + * @return the list login by info contact model + */ public static List getListLoginByInfoContactModel(List listContacts){ List listUsers = new ArrayList(); @@ -83,6 +94,12 @@ public class UserUtil { return listUsers; } + /** + * Separate users names to comma. + * + * @param listContacts the list contacts + * @return the string + */ public static String separateUsersNamesToComma(List listContacts){ String users = ""; @@ -98,6 +115,12 @@ public class UserUtil { } + /** + * Separate full name to comma for portal login. + * + * @param listLogin the list login + * @return the string + */ public static String separateFullNameToCommaForPortalLogin(List listLogin){ String users = ""; @@ -121,6 +144,11 @@ public class UserUtil { return users; } + /** + * The main method. + * + * @param args the arguments + */ public static void main(String[] args) { List login = new ArrayList(); // login.add("ale");