> aclOwner) {
String html = "";
- logger.trace("Formatting "+aclOwner.size() +" ACL/s");
+ logger.trace("Formatting " + aclOwner.size() + " ACL/s");
for (ACLType type : aclOwner.keySet()) {
List listLogins = aclOwner.get(type);
- html+=""+type+": ";
- html+="";
+ html += "" + type + ": ";
+ html += "";
for (String login : listLogins) {
- logger.trace("Adding login "+login);
+ logger.trace("Adding login " + login);
String fullName = UserUtil.getUserFullName(login);
- if(fullName!=null && !fullName.isEmpty())
- html+=fullName+"; ";
+ if (fullName != null && !fullName.isEmpty())
+ html += fullName + "; ";
else
- html+=login+"; ";
+ html += login + "; ";
}
- html+="
";
+ html += "
";
}
- html+="
";
-
+ html += "";
return html;
}
@@ -2102,27 +2263,28 @@ public class GWTWorkspaceBuilder {
/**
* returns dynamically the formated size.
*
- * @param size the size
+ * @param size
+ * the size
* @return the string
*/
public static String formatFileSize(long size) {
String formattedSize = null;
double b = size;
- double k = size/1024.0;
- double m = size/1024.0/1024.0;
- double g = size/1024.0/1024.0/1024.0;
- double t = size/1024.0/1024.0/1024.0/1024.0;
+ double k = size / 1024.0;
+ double m = size / 1024.0 / 1024.0;
+ double g = size / 1024.0 / 1024.0 / 1024.0;
+ double t = size / 1024.0 / 1024.0 / 1024.0 / 1024.0;
DecimalFormat dec = new DecimalFormat("0.00");
- if ( t>1 ) {
+ if (t > 1) {
formattedSize = dec.format(t).concat(" TB");
- } else if ( g>1 ) {
+ } else if (g > 1) {
formattedSize = dec.format(g).concat(" GB");
- } else if ( m>1 ) {
+ } else if (m > 1) {
formattedSize = dec.format(m).concat(" MB");
- } else if ( k>1 ) {
+ } else if (k > 1) {
formattedSize = dec.format(k).concat(" KB");
} else {
formattedSize = dec.format(b).concat(" Bytes");
@@ -2134,53 +2296,55 @@ public class GWTWorkspaceBuilder {
/**
* Gets the item description for type by id.
*
- * @param item the item
+ * @param item
+ * the item
* @return the item description for type by id
- * @throws Exception the exception
+ * @throws Exception
+ * the exception
*/
public String getItemDescriptionForTypeById(WorkspaceItem item) throws Exception {
- if(item==null)
+ if (item == null)
throw new Exception("The item is null");
- logger.info("Getting ItemDescriptionById: "+item.getId());
+ logger.info("Getting ItemDescriptionById: " + item.getId());
try {
switch (item.getType()) {
- case FOLDER:{
+ case FOLDER: {
WorkspaceFolder theFolder = (WorkspaceFolder) item;
return theFolder.getDescription();
}
- case SHARED_FOLDER:{
+ case SHARED_FOLDER: {
WorkspaceSharedFolder theFolder = (WorkspaceSharedFolder) item;
return theFolder.getDescription();
}
- case SMART_FOLDER:{
+ case SMART_FOLDER: {
WorkspaceSmartFolder theFolder = (WorkspaceSmartFolder) item;
return theFolder.getDescription();
}
- case TRASH_FOLDER:{
- WorkspaceTrashFolder theFolder = (WorkspaceTrashFolder) item;
+ case TRASH_FOLDER: {
+ WorkspaceTrashFolder theFolder = (WorkspaceTrashFolder) item;
return "";
}
- case TRASH_ITEM:{
+ case TRASH_ITEM: {
WorkspaceTrashItem tItem = (WorkspaceTrashItem) item;
return tItem.getDescription();
}
- default:{ //IS AN ITEM
+ default: { // IS AN ITEM
return item.getDescription();
}
}
} catch (Exception e) {
logger.error("Error in server ItemDescriptionForTypeById: ", e);
- String error = ConstantsExplorer.SERVER_ERROR +" getting description for item id: "+item.getId();
+ String error = ConstantsExplorer.SERVER_ERROR + " getting description for item id: " + item.getId();
throw new Exception(error);
}
}
@@ -2188,20 +2352,23 @@ public class GWTWorkspaceBuilder {
/**
* Gets the format html gcube item properties.
*
- * @param item the item
- * @return Format HTML. A DIV HTML containing gcube item properties. If item is a GcubeItem and contains properties return HTML, null otherwise
+ * @param item
+ * the item
+ * @return Format HTML. A DIV HTML containing gcube item properties. If item
+ * is a GcubeItem and contains properties return HTML, null
+ * otherwise
*/
public String getFormatHtmlGcubeItemProperties(WorkspaceItem item) {
Map properties = getGcubeItemProperties(item);
- if(properties!=null){
+ if (properties != null) {
- if(properties.size()==0){
+ if (properties.size() == 0) {
try {
- logger.warn("Gcube Item Properties not found for item: "+item.getId());
+ logger.warn("Gcube Item Properties not found for item: " + item.getId());
} catch (InternalErrorException e) {
- //SILENT
+ // SILENT
}
return null;
}
@@ -2210,13 +2377,13 @@ public class GWTWorkspaceBuilder {
for (String key : properties.keySet()) {
String value = properties.get(key);
- logger.trace("Getting property: ["+key+","+properties.get(key)+"]");
- html+=""+key+": ";
- html+="";
- html+=value;
- html+="
";
+ logger.trace("Getting property: [" + key + "," + properties.get(key) + "]");
+ html += "" + key + ": ";
+ html += "";
+ html += value;
+ html += "
";
}
- html+="";
+ html += "";
return html;
}
@@ -2226,17 +2393,22 @@ public class GWTWorkspaceBuilder {
/**
* Gets the gcube item properties.
*
- * @param item the item
+ * @param item
+ * the item
* @return the gcube item properties
*/
public Map getGcubeItemProperties(WorkspaceItem item) {
- if(item instanceof GCubeItem){
+ if (item instanceof GCubeItem) {
GCubeItem gItem = (GCubeItem) item;
try {
- if(gItem.getProperties()!=null){
+ if (gItem.getProperties() != null) {
Map map = gItem.getProperties().getProperties();
- HashMap properties = new HashMap(map.size()); //TO PREVENT GWT SERIALIZATION ERROR
+ HashMap properties = new HashMap(map.size()); // TO
+ // PREVENT
+ // GWT
+ // SERIALIZATION
+ // ERROR
for (String key : map.keySet())
properties.put(key, map.get(key));
@@ -2253,26 +2425,30 @@ public class GWTWorkspaceBuilder {
/**
* Sets the synched thredds state for.
*
- * @param fileModel the file model
- * @param scope the scope
- * @param username the username
+ * @param fileModel
+ * the file model
+ * @param scope
+ * the scope
+ * @param username
+ * the username
* @return the file model
*/
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, String scope, String username) {
try {
- if(fileModel.isDirectory()) {
+ if (fileModel.isDirectory()) {
ScopeProvider.instance.set(scope);
- Sync_Status status = WorkspaceThreddsSynchronize.getInstance().getSynchedStatusFromItemProperty(fileModel.getIdentifier(), username);
+ Sync_Status status = WorkspaceThreddsSynchronize.getInstance()
+ .getSynchedStatusFromItemProperty(fileModel.getIdentifier(), username);
fileModel.setSyncThreddsStatus(status);
}
} catch (ItemNotSynched e) {
- //silent
- logger.trace("Item: "+fileModel.getIdentifier() + " name: "+fileModel.getName() +" is not synched");
+ // silent
+ logger.trace("Item: " + fileModel.getIdentifier() + " name: " + fileModel.getName() + " is not synched");
} catch (Exception e) {
- logger.warn("It is not possible to get synched status for item: "+fileModel.getIdentifier());
+ logger.warn("It is not possible to get synched status for item: " + fileModel.getIdentifier());
}
return fileModel;
diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/tostoragehub/StorageHubToWorkpaceConverter.java b/src/main/java/org/gcube/portlets/user/workspace/server/tostoragehub/StorageHubToWorkpaceConverter.java
index af10092..13d4121 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/server/tostoragehub/StorageHubToWorkpaceConverter.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/server/tostoragehub/StorageHubToWorkpaceConverter.java
@@ -247,7 +247,7 @@ public class StorageHubToWorkpaceConverter implements Serializable{
portalLogin = "";
}
- return new InfoContactModel(portalLogin, portalLogin, UserUtil.getUserFullName(portalLogin), false);
+ return new InfoContactModel(portalLogin, portalLogin, UserUtil.getUserFullName(portalLogin), "",false);
}
/**
diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java b/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java
index 65f074e..fcd3a5d 100644
--- a/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java
+++ b/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java
@@ -225,6 +225,18 @@ public class WsUtil {
}
+ /**
+ * utility method extract the @domain.com from an email address
+ * return @unknown-domain in case of no emails
+ */
+ private String extractDomainFromEmail(String email) {
+ int index = email.indexOf('@');
+ if (index > 0)
+ return email.substring(index);
+ else
+ return "@unknown-domain";
+ }
+
/**
* Gets the GWT workspace builder.
*
@@ -244,7 +256,7 @@ public class WsUtil {
builder = new GWTWorkspaceBuilder();
// ADDED 03/09/2013
builder.setContexInfo(
- new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), false),
+ new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), "", false),
info.getCurrentScope());
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
}