Removed unused code and methods

Fixed issue #1332

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@120294 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-11-17 17:14:16 +00:00
parent 296fbfe95d
commit 0ded2ac486
7 changed files with 154 additions and 68 deletions

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* *
*/ */
@Deprecated
public class FileDetailsModel extends FileGridModel { public class FileDetailsModel extends FileGridModel {
/** /**
@ -24,7 +25,7 @@ public class FileDetailsModel extends FileGridModel {
setLastModified(lastModified); setLastModified(lastModified);
setDescription(description); setDescription(description);
setOwner(owner); // setOwner(owner);
} }
@ -32,10 +33,7 @@ public class FileDetailsModel extends FileGridModel {
set(ConstantsExplorer.LASTMODIFIED, lastModified); set(ConstantsExplorer.LASTMODIFIED, lastModified);
} }
// private Date getLastModified() {
// return (Date) get(ConstantsExplorer.LASTMODIFIED);
// }
//
public String getDescription(){ public String getDescription(){
return get(ConstantsExplorer.DESCRIPTION); return get(ConstantsExplorer.DESCRIPTION);
} }

View File

@ -5,10 +5,9 @@ import java.util.Date;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer; import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
/** /**
* The Class FileGridModel.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Nov 17, 2015
* @Nov 14, 2013
*
*/ */
public class FileGridModel extends FileModel { public class FileGridModel extends FileModel {
@ -17,51 +16,114 @@ public class FileGridModel extends FileModel {
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
protected FileGridModel(){ /**
* Instantiates a new file grid model.
*/
protected FileGridModel() {
} }
public FileGridModel(String identifier, String name, String path, Date lastUpdate, FileModel parent, long size, boolean isDirectory, boolean isShared) { /**
* 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); super(identifier, name, parent, isDirectory, isShared);
setLastModification(lastUpdate); setLastModification(lastUpdate);
setSize(size); setSize(size);
} }
/**
public FileGridModel(String identifier, String name, Date lastUpdate, FileModel parent, long size, boolean isDirectory, boolean isShared) { * 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); super(identifier, name, parent, isDirectory, isShared);
setLastModification(lastUpdate); setLastModification(lastUpdate);
setSize(size); setSize(size);
} }
/**
* Sets the size.
*
* @param size
* the new size
*/
private void setSize(long size) { private void setSize(long size) {
set(ConstantsExplorer.SIZE, size); set(ConstantsExplorer.SIZE, size);
} }
/**
* Gets the size.
*
* @return the size
*/
public long getSize() { public long getSize() {
return (Long) get(ConstantsExplorer.SIZE); return (Long) get(ConstantsExplorer.SIZE);
} }
// private void setCreationDate(Date creationDate) { /**
// set(ConstantsExplorer.GRIDCOLUMNCREATIONDATE, creationDate); * Sets the last modification.
// *
// } * @param lastUpdate
* the new last modification
*/
private void setLastModification(Date lastUpdate) { private void setLastModification(Date lastUpdate) {
set(ConstantsExplorer.LASTMODIFIED, lastUpdate); set(ConstantsExplorer.LASTMODIFIED, lastUpdate);
} }
/**
* Gets the last modification.
*
* @return the last modification
*/
public Date getLastModification() { public Date getLastModification() {
return (Date) get(ConstantsExplorer.LASTMODIFIED); 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 @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj != null && obj instanceof FileGridModel) { if (obj != null && obj instanceof FileGridModel) {

View File

@ -136,20 +136,17 @@ public class FileModel extends BaseModelData implements Serializable {
// set(ConstantsExplorer.ABSTRACTICON, null); // set(ConstantsExplorer.ABSTRACTICON, null);
// } // }
public void setOwner(InfoContactModel owner){ // public void setOwner(InfoContactModel owner){
set(ConstantsExplorer.OWNER, owner); // set(ConstantsExplorer.OWNER, owner);
// }
// if(owner!=null)
// set(ConstantsExplorer.OWNERFULLNAME, owner.getName());
}
public void setOwnerFullName(String fullName){ public void setOwnerFullName(String fullName){
set(ConstantsExplorer.OWNERFULLNAME, fullName); set(ConstantsExplorer.OWNERFULLNAME, fullName);
} }
public InfoContactModel getOwner(){ // public InfoContactModel getOwner(){
return (InfoContactModel) get(ConstantsExplorer.OWNER); // return (InfoContactModel) get(ConstantsExplorer.OWNER);
} // }
public String getOwnerFullName(){ public String getOwnerFullName(){
return get(ConstantsExplorer.OWNERFULLNAME); return get(ConstantsExplorer.OWNERFULLNAME);
@ -343,8 +340,6 @@ public class FileModel extends BaseModelData implements Serializable {
builder.append(isSpecialFolder); builder.append(isSpecialFolder);
builder.append(", isShareable()="); builder.append(", isShareable()=");
builder.append(isShareable()); builder.append(isShareable());
builder.append(", getOwner()=");
builder.append(getOwner());
builder.append(", isShared()="); builder.append(", isShared()=");
builder.append(isShared()); builder.append(isShared());
builder.append(", getIdentifier()="); builder.append(", getIdentifier()=");

View File

@ -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.FileTrashedModel;
import org.gcube.portlets.user.workspace.client.model.FolderModel; 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.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.ScopeModel;
import org.gcube.portlets.user.workspace.client.model.SmartFolderModel; import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
import org.gcube.portlets.user.workspace.client.model.SubTree; import org.gcube.portlets.user.workspace.client.model.SubTree;

View File

@ -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.FileTrashedModel;
import org.gcube.portlets.user.workspace.client.model.FolderModel; 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.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.ScopeModel;
import org.gcube.portlets.user.workspace.client.model.SmartFolderModel; import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
import org.gcube.portlets.user.workspace.client.model.SubTree; import org.gcube.portlets.user.workspace.client.model.SubTree;

View File

@ -782,6 +782,12 @@ public class GWTWorkspaceBuilder {
break; 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 //TODO ISSHARED IN SEARCH ITEM IN HL TO RETRIEVE SHARE ON WORKSPACEITEM
//OWNER //OWNER
if(item.isShared()){ //IS READ FROM HL ONLY IF THE ITEM IS SHARED 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()){ if(parentFileModel!=null && parentFileModel.isShared()){
fileGridModel.setShared(true); fileGridModel.setShared(true);
fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS
// fileGridModel.setShareable(true);
} }
//OWNER //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(); User owner = item.getOwner();
if(owner!=null){ if(owner!=null){
// System.out.println("++++reading owner"); // System.out.println("++++reading owner");

View File

@ -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 { public class UserUtil {
static UserManager um = new LiferayUserManager(); static UserManager um = new LiferayUserManager();
@ -21,9 +27,10 @@ public class UserUtil {
/** /**
* Gets the user full name.
* *
* @param user * @param portalLogin the portal login
* @return * @return the user full name if is available, the input parameter portalLogin otherwise
*/ */
public static String getUserFullName(String portalLogin){ public static String getUserFullName(String portalLogin){
// return user.getPortalLogin(); //for testing in eclipse // return user.getPortalLogin(); //for testing in eclipse
@ -57,10 +64,8 @@ public class UserUtil {
} }
if (curr != null){ if (curr != null){
// logger.trace("Return "+curr.getFullname() +" full name for: "+portalLogin); // logger.trace("Return "+curr.getFullname() +" full name for: "+portalLogin);
return curr.getFullname(); return curr.getFullname();
} }
}else{ }else{
logger.trace("DEVELOPEMENT MODE ON"); logger.trace("DEVELOPEMENT MODE ON");
@ -72,6 +77,12 @@ public class UserUtil {
return portalLogin; 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<String> getListLoginByInfoContactModel(List<InfoContactModel> listContacts){ public static List<String> getListLoginByInfoContactModel(List<InfoContactModel> listContacts){
List<String> listUsers = new ArrayList<String>(); List<String> listUsers = new ArrayList<String>();
@ -83,6 +94,12 @@ public class UserUtil {
return listUsers; return listUsers;
} }
/**
* Separate users names to comma.
*
* @param listContacts the list contacts
* @return the string
*/
public static String separateUsersNamesToComma(List<InfoContactModel> listContacts){ public static String separateUsersNamesToComma(List<InfoContactModel> listContacts){
String users = ""; 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<String> listLogin){ public static String separateFullNameToCommaForPortalLogin(List<String> listLogin){
String users = ""; String users = "";
@ -121,6 +144,11 @@ public class UserUtil {
return users; return users;
} }
/**
* The main method.
*
* @param args the arguments
*/
public static void main(String[] args) { public static void main(String[] args) {
List<String> login = new ArrayList<String>(); List<String> login = new ArrayList<String>();
// login.add("ale"); // login.add("ale");