in progress on #21388
This commit is contained in:
parent
fd6d1570e8
commit
cc17be1761
|
@ -9,7 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
#### Enhancements
|
#### Enhancements
|
||||||
|
|
||||||
[#21388] Integrated with new workspace to new workflow to interact with ws-thredds 1.x
|
[#21388] Integrated with new workflow to interact with ws-thredds 1.x
|
||||||
|
|
||||||
## [v6.32.0] - 2021-04-12
|
## [v6.32.0] - 2021-04-12
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.gcube.common.storagehubwrapper.shared.tohl.items.URLItem;
|
||||||
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
import org.gcube.portal.wssynclibrary.shared.ItemNotSynched;
|
||||||
import org.gcube.portal.wssynclibrary.shared.WorkspaceFolderLocked;
|
import org.gcube.portal.wssynclibrary.shared.WorkspaceFolderLocked;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||||
|
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||||
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
|
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
|
||||||
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
|
@ -77,6 +78,7 @@ import org.gcube.portlets.widgets.workspacesharingwidget.server.notifications.No
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
|
import org.gcube.usecases.ws.thredds.faults.WorkspaceNotSynchedException;
|
||||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||||
|
@ -228,24 +230,35 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
/**
|
/**
|
||||||
* Checks if is item under sync.
|
* Checks if is item under sync.
|
||||||
*
|
*
|
||||||
* @param itemId
|
* @param itemId the item id
|
||||||
* the item id
|
|
||||||
* @return true, if is item under sync
|
* @return true, if is item under sync
|
||||||
* @throws Exception
|
* @throws Exception the exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean isItemUnderSync(String itemId) throws Exception {
|
public Boolean isItemUnderSync(String itemId) throws Exception {
|
||||||
|
|
||||||
|
ThSyncFolderDescriptor theConfig = null;
|
||||||
try {
|
try {
|
||||||
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
|
|
||||||
try {
|
try {
|
||||||
Sync_Status status = WorkspaceThreddsSynchronize.getInstance().getSynchedStatusFromItemProperty(itemId,
|
theConfig = WorkspaceThreddsSynchronize.getInstance().getConfiguration(itemId);
|
||||||
user.getUsername());
|
} catch (WorkspaceNotSynchedException e) {
|
||||||
|
workspaceLogger
|
||||||
|
.debug("WorkspaceNotSynchedException catched, the item with id: " + itemId + " is not synched");
|
||||||
|
return false;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
workspaceLogger.debug("Error on getting configuration for the item id: " + itemId
|
||||||
|
+ ", returning null (means not synched)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// HERE THE ITEM IS SYNCHED SO CHECK IF IT IS LOCKED
|
|
||||||
|
if (theConfig == null) {
|
||||||
|
workspaceLogger.debug(
|
||||||
|
"No ws-thredds config found the item with id:" + itemId + ", returning item is not synched");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// HERE THE ITEM IS SYNCHED SO CHECKING IF IT IS LOCKED
|
||||||
checkItemLocked(itemId);
|
checkItemLocked(itemId);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspace.server.tostoragehub;
|
package org.gcube.portlets.user.workspace.server.tostoragehub;
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -34,6 +33,7 @@ import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.GCubeItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.GCubeItem;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap;
|
import org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap;
|
||||||
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
|
||||||
|
import org.gcube.portal.wssynclibrary.shared.thredds.ThSyncFolderDescriptor;
|
||||||
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
|
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||||
|
@ -45,13 +45,11 @@ import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
|
import org.gcube.usecases.ws.thredds.faults.WorkspaceNotSynchedException;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class StorageHubToWorkpaceConverter.
|
* The Class StorageHubToWorkpaceConverter.
|
||||||
*
|
*
|
||||||
|
@ -60,7 +58,6 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class StorageHubToWorkpaceConverter implements Serializable {
|
public class StorageHubToWorkpaceConverter implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -71,8 +68,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
private GCubeUser loggedUser;
|
private GCubeUser loggedUser;
|
||||||
private String workspaceRootId;
|
private String workspaceRootId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new storage hub to workpace converter.
|
* Instantiates a new storage hub to workpace converter.
|
||||||
*/
|
*/
|
||||||
|
@ -80,68 +75,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************************************
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* TESTING MODE METHODS
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
***********************************************************************************************************************************************/
|
|
||||||
protected static HashMap<String, InfoContactModel> hashTestUser = null;
|
|
||||||
/**
|
|
||||||
* Used in test mode.
|
|
||||||
*
|
|
||||||
* @return the hash test users
|
|
||||||
*/
|
|
||||||
public static HashMap<String, InfoContactModel> getHashTestUsers(){
|
|
||||||
|
|
||||||
if(hashTestUser==null){
|
|
||||||
hashTestUser = new HashMap<String, InfoContactModel>();
|
|
||||||
|
|
||||||
//USERS
|
|
||||||
hashTestUser.put("federico.defaveri", new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri",null, false));
|
|
||||||
hashTestUser.put("antonio.gioia", new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia",null, false));
|
|
||||||
hashTestUser.put("fabio.sinibaldi", new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",null, false));
|
|
||||||
hashTestUser.put("pasquale.pagano", new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",null, false));
|
|
||||||
hashTestUser.put("valentina.marioli", new InfoContactModel("valentina.marioli", "valentina.marioli", "Valentina Marioli",null, false));
|
|
||||||
hashTestUser.put("roberto.cirillo", new InfoContactModel("roberto.cirillo", "roberto.cirillo", "Roberto Cirillo",null, false));
|
|
||||||
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa",null, false));
|
|
||||||
hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante",null, false));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return hashTestUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static List<InfoContactModel> buildGxtInfoContactFromPortalLoginTestMode(List<String> listPortalLogin){
|
|
||||||
|
|
||||||
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
|
|
||||||
|
|
||||||
for (String portalLogin : listPortalLogin)
|
|
||||||
listContact.add(getHashTestUsers().get(portalLogin));
|
|
||||||
|
|
||||||
return listContact;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************************************************************************************
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* END TESTING MODE
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
***********************************************************************************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To version history.
|
* To version history.
|
||||||
*
|
*
|
||||||
|
@ -158,14 +91,14 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
List<FileVersionModel> listVersions = new ArrayList<FileVersionModel>(versions.size());
|
List<FileVersionModel> listVersions = new ArrayList<FileVersionModel>(versions.size());
|
||||||
for (WorkspaceFileVersion wsVersion : versions) {
|
for (WorkspaceFileVersion wsVersion : versions) {
|
||||||
String user = UserUtil.getUserFullName(wsVersion.getOwner());
|
String user = UserUtil.getUserFullName(wsVersion.getOwner());
|
||||||
FileVersionModel file = new FileVersionModel(wsVersion.getId(), wsVersion.getName(), wsVersion.getRemotePath(), user, FormatterUtil.toDate(wsVersion.getCreated()), wsVersion.isCurrentVersion());
|
FileVersionModel file = new FileVersionModel(wsVersion.getId(), wsVersion.getName(),
|
||||||
|
wsVersion.getRemotePath(), user, FormatterUtil.toDate(wsVersion.getCreated()),
|
||||||
|
wsVersion.isCurrentVersion());
|
||||||
listVersions.add(file);
|
listVersions.add(file);
|
||||||
}
|
}
|
||||||
return listVersions;
|
return listVersions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new storage hub to workpace converter.
|
* Instantiates a new storage hub to workpace converter.
|
||||||
*
|
*
|
||||||
|
@ -177,7 +110,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
this.loggedUser = loggedUser;
|
this.loggedUser = loggedUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To root folder.
|
* To root folder.
|
||||||
*
|
*
|
||||||
|
@ -185,7 +117,8 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
* @return the folder model
|
* @return the folder model
|
||||||
* @throws InternalErrorException the internal error exception
|
* @throws InternalErrorException the internal error exception
|
||||||
*/
|
*/
|
||||||
public FolderModel toRootFolder(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder folder) throws InternalErrorException{
|
public FolderModel toRootFolder(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder folder)
|
||||||
|
throws InternalErrorException {
|
||||||
|
|
||||||
return ObjectStorageHubToWorkpaceMapper.toRootFolder(folder);
|
return ObjectStorageHubToWorkpaceMapper.toRootFolder(folder);
|
||||||
|
|
||||||
|
@ -200,14 +133,14 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
* @return the file model
|
* @return the file model
|
||||||
* @throws InternalErrorException the internal error exception
|
* @throws InternalErrorException the internal error exception
|
||||||
*/
|
*/
|
||||||
public FileModel toTreeFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, Boolean isParentShared) throws InternalErrorException{
|
public FileModel toTreeFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
|
||||||
|
FileModel parentFolderModel, Boolean isParentShared) throws InternalErrorException {
|
||||||
|
|
||||||
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared);
|
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel,
|
||||||
|
isParentShared);
|
||||||
return setSynchedThreddsStateFor(fileModel, wrappedItem);
|
return setSynchedThreddsStateFor(fileModel, wrappedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To grid file model.
|
* To grid file model.
|
||||||
*
|
*
|
||||||
|
@ -216,13 +149,14 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
* @return the file grid model
|
* @return the file grid model
|
||||||
* @throws InternalErrorException the internal error exception
|
* @throws InternalErrorException the internal error exception
|
||||||
*/
|
*/
|
||||||
public FileGridModel toGridFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel) throws InternalErrorException{
|
public FileGridModel toGridFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
|
||||||
|
FileModel parentFolderModel) throws InternalErrorException {
|
||||||
|
|
||||||
FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem, parentFolderModel, loggedUser);
|
FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem,
|
||||||
|
parentFolderModel, loggedUser);
|
||||||
return (FileGridModel) setSynchedThreddsStateFor(fileGridModel, wrappedItem);
|
return (FileGridModel) setSynchedThreddsStateFor(fileGridModel, wrappedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the synched thredds state for.
|
* Sets the synched thredds state for.
|
||||||
*
|
*
|
||||||
|
@ -231,33 +165,25 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
* @return the file model
|
* @return the file model
|
||||||
*/
|
*/
|
||||||
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, WorkspaceItem wrappedItem) {
|
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, WorkspaceItem wrappedItem) {
|
||||||
|
logger.debug("called setSynchedThreddsStateFor item id: " + wrappedItem.getId());
|
||||||
Sync_Status status = null;
|
Sync_Status status = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(wrappedItem.getPropertyMap()!=null) {
|
status = WorkspaceThreddsSynchronize.getInstance().getInfo(wrappedItem.getId());
|
||||||
String wsSyncStatus = null;
|
logger.debug("item id: " + wrappedItem.getId() + " has ws-thredds sync status: " + status);
|
||||||
try{
|
} catch (WorkspaceNotSynchedException e) {
|
||||||
|
|
||||||
PropertyMap map = wrappedItem.getPropertyMap();
|
logger.debug("WorkspaceNotSynchedException catched, the item with id: " + wrappedItem.getId()
|
||||||
logger.debug("Property Map for folder: "+fileModel.getName()+" has value: "+map.getValues());
|
+ " is not synched");
|
||||||
wsSyncStatus = (String) map.getValues().get(WorkspaceThreddsSynchronize.WS_SYNCH_SYNCH_STATUS);
|
|
||||||
logger.debug("Item id: "+wrappedItem.getId()+" read from Shub has current: "+WorkspaceThreddsSynchronize.WS_SYNCH_SYNCH_STATUS +" value at: "+wsSyncStatus);
|
|
||||||
if(wsSyncStatus!=null)
|
|
||||||
status = Sync_Status.valueOf(wsSyncStatus);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn(wsSyncStatus + " is not value of "+Sync_Status.values()+", returning null");
|
logger.info(
|
||||||
}
|
"Error on getting configuration for the item id: " + wrappedItem.getId() + ", (means not synched)");
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.warn("It is not possible to get synched status for item: "+fileModel.getIdentifier());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileModel.setSyncThreddsStatus(status);
|
fileModel.setSyncThreddsStatus(status);
|
||||||
return fileModel;
|
return fileModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To file trashed model.
|
* To file trashed model.
|
||||||
*
|
*
|
||||||
|
@ -301,13 +227,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
fileTrashModel.setShared(trashItem.isShared());
|
fileTrashModel.setShared(trashItem.isShared());
|
||||||
|
|
||||||
logger.debug("Converting return trash item: "+fileTrashModel.getName() +" id: "+fileTrashModel.getIdentifier());
|
logger.debug("Converting return trash item: " + fileTrashModel.getName() + " id: "
|
||||||
|
+ fileTrashModel.getIdentifier());
|
||||||
|
|
||||||
logger.trace("Returning trash item: " + fileTrashModel);
|
logger.trace("Returning trash item: " + fileTrashModel);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
logger.debug("Error into toFileTrashedModel for item: "+fileTrashModel.getName() +" id: "+fileTrashModel.getIdentifier());
|
logger.debug("Error into toFileTrashedModel for item: " + fileTrashModel.getName() + " id: "
|
||||||
|
+ fileTrashModel.getIdentifier());
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -316,7 +244,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the gxt info contact from portal login.
|
* Builds the gxt info contact from portal login.
|
||||||
*
|
*
|
||||||
|
@ -345,8 +272,9 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO ********TEMPORARY SOLUTION HL MUST MANAGE SPECIAL FOLDER AS WORKSPACESPECIALFOLDER****
|
* TODO ********TEMPORARY SOLUTION HL MUST MANAGE SPECIAL FOLDER AS
|
||||||
* REMOVE THIS METHOD AND ADDING INSTANCE OF AT buildGXTFolderModelItem.
|
* WORKSPACESPECIALFOLDER**** REMOVE THIS METHOD AND ADDING INSTANCE OF AT
|
||||||
|
* buildGXTFolderModelItem.
|
||||||
*
|
*
|
||||||
* @param wsFolder the ws folder
|
* @param wsFolder the ws folder
|
||||||
* @param parent the parent
|
* @param parent the parent
|
||||||
|
@ -354,7 +282,10 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
* @return the folder model
|
* @return the folder model
|
||||||
* @throws InternalErrorException the internal error exception
|
* @throws InternalErrorException the internal error exception
|
||||||
*/
|
*/
|
||||||
public FolderModel buildGXTFolderModelItemHandleSpecialFolder(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wsFolder, org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem parent, String specialFolderName) throws InternalErrorException {
|
public FolderModel buildGXTFolderModelItemHandleSpecialFolder(
|
||||||
|
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wsFolder,
|
||||||
|
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem parent, String specialFolderName)
|
||||||
|
throws InternalErrorException {
|
||||||
|
|
||||||
String name = "";
|
String name = "";
|
||||||
|
|
||||||
|
@ -371,7 +302,8 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
name = shared.getName();
|
name = shared.getName();
|
||||||
|
|
||||||
// MANAGEMENT SPECIAL FOLDER
|
// MANAGEMENT SPECIAL FOLDER
|
||||||
}else if(wsFolder.getName().compareTo(ConstantsExplorer.MY_SPECIAL_FOLDERS)==0 && parent!=null && parent.isRoot()){
|
} else if (wsFolder.getName().compareTo(ConstantsExplorer.MY_SPECIAL_FOLDERS) == 0 && parent != null
|
||||||
|
&& parent.isRoot()) {
|
||||||
// MANAGEMENT SPECIAL FOLDER
|
// MANAGEMENT SPECIAL FOLDER
|
||||||
logger.debug("MANAGEMENT SPECIAL FOLDER NAME REWRITING AS: " + specialFolderName);
|
logger.debug("MANAGEMENT SPECIAL FOLDER NAME REWRITING AS: " + specialFolderName);
|
||||||
if (specialFolderName != null && !specialFolderName.isEmpty())
|
if (specialFolderName != null && !specialFolderName.isEmpty())
|
||||||
|
@ -384,12 +316,14 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Name is: " + name);
|
logger.debug("Name is: " + name);
|
||||||
boolean isPublicDir = ((org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder) wsFolder).isPublicFolder(); //TODO
|
boolean isPublicDir = ((org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder) wsFolder)
|
||||||
|
.isPublicFolder(); // TODO
|
||||||
FileModel parentModel = null;
|
FileModel parentModel = null;
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared());
|
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared());
|
||||||
|
|
||||||
FolderModel folder = new FolderModel(wsFolder.getId(), name, parentModel, true, wsFolder.isShared(), false, isPublicDir);
|
FolderModel folder = new FolderModel(wsFolder.getId(), name, parentModel, true, wsFolder.isShared(), false,
|
||||||
|
isPublicDir);
|
||||||
folder.setShareable(true);
|
folder.setShareable(true);
|
||||||
folder.setIsRoot(wsFolder.isRoot());
|
folder.setIsRoot(wsFolder.isRoot());
|
||||||
folder.setDescription(wsFolder.getDescription());
|
folder.setDescription(wsFolder.getDescription());
|
||||||
|
@ -402,7 +336,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the workspace root id.
|
* Gets the workspace root id.
|
||||||
*
|
*
|
||||||
|
@ -413,7 +346,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
return workspaceRootId;
|
return workspaceRootId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the workspace root id.
|
* Sets the workspace root id.
|
||||||
*
|
*
|
||||||
|
@ -424,8 +356,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
this.workspaceRootId = workspaceRootId;
|
this.workspaceRootId = workspaceRootId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To simple map.
|
* To simple map.
|
||||||
*
|
*
|
||||||
|
@ -459,7 +389,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the GXT accounting item.
|
* Builds the GXT accounting item.
|
||||||
*
|
*
|
||||||
|
@ -467,7 +396,8 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
* @param gxtEntryType the gxt entry type
|
* @param gxtEntryType the gxt entry type
|
||||||
* @return the list
|
* @return the list
|
||||||
*/
|
*/
|
||||||
public List<GxtAccountingField> buildGXTAccountingItem(List<AccountEntry> accoutings, GxtAccountingEntryType gxtEntryType) {
|
public List<GxtAccountingField> buildGXTAccountingItem(List<AccountEntry> accoutings,
|
||||||
|
GxtAccountingEntryType gxtEntryType) {
|
||||||
|
|
||||||
List<GxtAccountingField> listAccFields = new ArrayList<GxtAccountingField>();
|
List<GxtAccountingField> listAccFields = new ArrayList<GxtAccountingField>();
|
||||||
|
|
||||||
|
@ -492,20 +422,25 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
case CREATE:
|
case CREATE:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CREATE)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.CREATE)) {
|
||||||
AccountEntryCreate create = (AccountEntryCreate) shubAccEntry;
|
AccountEntryCreate create = (AccountEntryCreate) shubAccEntry;
|
||||||
af.setOperation(GxtAccountingEntryType.CREATE);
|
af.setOperation(GxtAccountingEntryType.CREATE);
|
||||||
|
|
||||||
// af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by "+user.getName());
|
// af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by
|
||||||
|
// "+user.getName());
|
||||||
String msg = "";
|
String msg = "";
|
||||||
if (create.getItemName() == null || create.getItemName().isEmpty())
|
if (create.getItemName() == null || create.getItemName().isEmpty())
|
||||||
msg = GxtAccountingEntryType.CREATE.getId() + " by " + user.getName();
|
msg = GxtAccountingEntryType.CREATE.getId() + " by " + user.getName();
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (create.getVersion() == null)
|
if (create.getVersion() == null)
|
||||||
msg = create.getItemName() + " " + GxtAccountingEntryType.CREATE.getName() + " by "+user.getName();
|
msg = create.getItemName() + " " + GxtAccountingEntryType.CREATE.getName() + " by "
|
||||||
|
+ user.getName();
|
||||||
else
|
else
|
||||||
msg = create.getItemName() + " v. "+create.getVersion()+" "+ GxtAccountingEntryType.CREATE.getName() + " by "+user.getName();
|
msg = create.getItemName() + " v. " + create.getVersion() + " "
|
||||||
|
+ GxtAccountingEntryType.CREATE.getName() + " by " + user.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
|
@ -515,11 +450,13 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
case READ:
|
case READ:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.READ)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.READ)) {
|
||||||
|
|
||||||
AccountEntryRead read = (AccountEntryRead) shubAccEntry;
|
AccountEntryRead read = (AccountEntryRead) shubAccEntry;
|
||||||
af.setOperation(GxtAccountingEntryType.READ);
|
af.setOperation(GxtAccountingEntryType.READ);
|
||||||
af.setDescription(read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName());
|
af.setDescription(read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "
|
||||||
|
+ user.getName());
|
||||||
|
|
||||||
String msg = "";
|
String msg = "";
|
||||||
if (read.getItemName() == null || read.getItemName().isEmpty())
|
if (read.getItemName() == null || read.getItemName().isEmpty())
|
||||||
|
@ -527,9 +464,11 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (read.getVersion() == null)
|
if (read.getVersion() == null)
|
||||||
msg = read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName();
|
msg = read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "
|
||||||
|
+ user.getName();
|
||||||
else
|
else
|
||||||
msg = read.getItemName() + " v."+read.getVersion() +" "+ GxtAccountingEntryType.READ.getName() + " by "+user.getName();
|
msg = read.getItemName() + " v." + read.getVersion() + " "
|
||||||
|
+ GxtAccountingEntryType.READ.getName() + " by " + user.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
|
@ -539,7 +478,9 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
case CUT:
|
case CUT:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CUT)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.CUT)) {
|
||||||
|
|
||||||
af.setOperation(GxtAccountingEntryType.CUT);
|
af.setOperation(GxtAccountingEntryType.CUT);
|
||||||
|
|
||||||
|
@ -552,14 +493,18 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
msg = GxtAccountingEntryType.CUT.getName() + " by " + user.getName();
|
msg = GxtAccountingEntryType.CUT.getName() + " by " + user.getName();
|
||||||
else {
|
else {
|
||||||
if (cut.getVersion() == null)
|
if (cut.getVersion() == null)
|
||||||
msg = cut.getItemName()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName();
|
msg = cut.getItemName() + " " + GxtAccountingEntryType.CUT.getName() + " by "
|
||||||
|
+ user.getName();
|
||||||
else
|
else
|
||||||
msg = cut.getItemName()+" v."+cut.getVersion()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName();
|
msg = cut.getItemName() + " v." + cut.getVersion() + " "
|
||||||
|
+ GxtAccountingEntryType.CUT.getName() + " by " + user.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryCut.class.getSimpleName());
|
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind "
|
||||||
|
+ shubAccEntry.getType() + " not castable to (instance of) "
|
||||||
|
+ AccountFolderEntryCut.class.getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,91 +512,118 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
case PASTE:
|
case PASTE:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.PASTE)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.PASTE)) {
|
||||||
|
|
||||||
af.setOperation(GxtAccountingEntryType.PASTE);
|
af.setOperation(GxtAccountingEntryType.PASTE);
|
||||||
AccountEntryPaste paste = (AccountEntryPaste) shubAccEntry;
|
AccountEntryPaste paste = (AccountEntryPaste) shubAccEntry;
|
||||||
|
|
||||||
if (paste.getVersion() == null)
|
if (paste.getVersion() == null)
|
||||||
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " from "+paste.getFromPath()+" by "+user.getName());
|
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " from " + paste.getFromPath()
|
||||||
|
+ " by " + user.getName());
|
||||||
else
|
else
|
||||||
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " v. "+paste.getVersion()+" from "+paste.getFromPath()+" by "+user.getName());
|
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " v. " + paste.getVersion()
|
||||||
|
+ " from " + paste.getFromPath() + " by " + user.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REMOVAL:
|
case REMOVAL:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.REMOVE)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.REMOVE)) {
|
||||||
|
|
||||||
if (shubAccEntry instanceof AccountFolderEntryRemoval) {
|
if (shubAccEntry instanceof AccountFolderEntryRemoval) {
|
||||||
af.setOperation(GxtAccountingEntryType.REMOVE);
|
af.setOperation(GxtAccountingEntryType.REMOVE);
|
||||||
AccountFolderEntryRemoval rem = (AccountFolderEntryRemoval) shubAccEntry;
|
AccountFolderEntryRemoval rem = (AccountFolderEntryRemoval) shubAccEntry;
|
||||||
String msg = rem.getItemName()==null || rem.getItemName().isEmpty()?"":rem.getItemName()+" ";
|
String msg = rem.getItemName() == null || rem.getItemName().isEmpty() ? ""
|
||||||
|
: rem.getItemName() + " ";
|
||||||
|
|
||||||
if (rem.getVersion() == null)
|
if (rem.getVersion() == null)
|
||||||
msg += GxtAccountingEntryType.REMOVE.getName() + " by " + user.getName();
|
msg += GxtAccountingEntryType.REMOVE.getName() + " by " + user.getName();
|
||||||
else
|
else
|
||||||
msg+= GxtAccountingEntryType.REMOVE.getName() +" v."+rem.getVersion()+" by "+user.getName();
|
msg += GxtAccountingEntryType.REMOVE.getName() + " v." + rem.getVersion() + " by "
|
||||||
|
+ user.getName();
|
||||||
|
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryRemoval.class.getSimpleName());
|
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind "
|
||||||
|
+ shubAccEntry.getType() + " not castable to (instance of) "
|
||||||
|
+ AccountFolderEntryRemoval.class.getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RENAMING:
|
case RENAMING:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RENAME)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.RENAME)) {
|
||||||
|
|
||||||
if (shubAccEntry instanceof AccountFolderEntryRenaming) {
|
if (shubAccEntry instanceof AccountFolderEntryRenaming) {
|
||||||
af.setOperation(GxtAccountingEntryType.RENAME);
|
af.setOperation(GxtAccountingEntryType.RENAME);
|
||||||
AccountFolderEntryRenaming ren = (AccountFolderEntryRenaming) shubAccEntry;
|
AccountFolderEntryRenaming ren = (AccountFolderEntryRenaming) shubAccEntry;
|
||||||
String msg = ren.getOldItemName()==null || ren.getOldItemName().isEmpty()?"":ren.getOldItemName()+" ";
|
String msg = ren.getOldItemName() == null || ren.getOldItemName().isEmpty() ? ""
|
||||||
|
: ren.getOldItemName() + " ";
|
||||||
if (ren.getVersion() == null)
|
if (ren.getVersion() == null)
|
||||||
msg+= GxtAccountingEntryType.RENAME.getName() +" to "+ ren.getNewItemName()+ " by "+user.getName();
|
msg += GxtAccountingEntryType.RENAME.getName() + " to " + ren.getNewItemName() + " by "
|
||||||
|
+ user.getName();
|
||||||
else
|
else
|
||||||
msg+= " v."+ren.getVersion() +" "+GxtAccountingEntryType.RENAME.getName() +" to "+ ren.getNewItemName()+ " by "+user.getName();
|
msg += " v." + ren.getVersion() + " " + GxtAccountingEntryType.RENAME.getName() + " to "
|
||||||
|
+ ren.getNewItemName() + " by " + user.getName();
|
||||||
|
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryRenaming.class.getSimpleName());
|
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind "
|
||||||
|
+ shubAccEntry.getType() + " not castable to (instance of) "
|
||||||
|
+ AccountFolderEntryRenaming.class.getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ADD:
|
case ADD:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.ADD)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ADD)) {
|
||||||
|
|
||||||
if (shubAccEntry instanceof AccountFolderEntryAdd) {
|
if (shubAccEntry instanceof AccountFolderEntryAdd) {
|
||||||
af.setOperation(GxtAccountingEntryType.ADD);
|
af.setOperation(GxtAccountingEntryType.ADD);
|
||||||
AccountFolderEntryAdd acc = (AccountFolderEntryAdd) shubAccEntry;
|
AccountFolderEntryAdd acc = (AccountFolderEntryAdd) shubAccEntry;
|
||||||
String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
|
String msg = acc.getItemName() == null || acc.getItemName().isEmpty() ? ""
|
||||||
|
: acc.getItemName() + " ";
|
||||||
if (acc.getVersion() == null)
|
if (acc.getVersion() == null)
|
||||||
msg += GxtAccountingEntryType.ADD.getName() + " by " + user.getName();
|
msg += GxtAccountingEntryType.ADD.getName() + " by " + user.getName();
|
||||||
else
|
else
|
||||||
msg+=" v."+acc.getVersion()+ " "+GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
|
msg += " v." + acc.getVersion() + " " + GxtAccountingEntryType.ADD.getName() + " by "
|
||||||
|
+ user.getName();
|
||||||
|
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryAdd.class.getSimpleName());
|
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind "
|
||||||
|
+ shubAccEntry.getType() + " not castable to (instance of) "
|
||||||
|
+ AccountFolderEntryAdd.class.getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.UPDATE)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.UPDATE)) {
|
||||||
|
|
||||||
af.setOperation(GxtAccountingEntryType.UPDATE);
|
af.setOperation(GxtAccountingEntryType.UPDATE);
|
||||||
AccountEntryUpdate upd = (AccountEntryUpdate) shubAccEntry;
|
AccountEntryUpdate upd = (AccountEntryUpdate) shubAccEntry;
|
||||||
String msg = upd.getItemName()==null || upd.getItemName().isEmpty()?"":upd.getItemName()+" ";
|
String msg = upd.getItemName() == null || upd.getItemName().isEmpty() ? ""
|
||||||
|
: upd.getItemName() + " ";
|
||||||
if (upd.getVersion() == null)
|
if (upd.getVersion() == null)
|
||||||
msg += GxtAccountingEntryType.UPDATE.getName() + " by " + user.getName();
|
msg += GxtAccountingEntryType.UPDATE.getName() + " by " + user.getName();
|
||||||
else
|
else
|
||||||
msg+=" v."+upd.getVersion()+" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName();
|
msg += " v." + upd.getVersion() + " " + GxtAccountingEntryType.UPDATE.getName() + " by "
|
||||||
|
+ user.getName();
|
||||||
|
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
}
|
}
|
||||||
|
@ -659,7 +631,9 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
case SHARE:
|
case SHARE:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.SHARE)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.SHARE)) {
|
||||||
|
|
||||||
af.setOperation(GxtAccountingEntryType.SHARE);
|
af.setOperation(GxtAccountingEntryType.SHARE);
|
||||||
|
|
||||||
|
@ -669,10 +643,12 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
if (acc.getItemName() == null || acc.getItemName().isEmpty())
|
if (acc.getItemName() == null || acc.getItemName().isEmpty())
|
||||||
msg = "\"" + user.getName() + "\" " + GxtAccountingEntryType.SHARE.getName() + " folder";
|
msg = "\"" + user.getName() + "\" " + GxtAccountingEntryType.SHARE.getName() + " folder";
|
||||||
else
|
else
|
||||||
msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " folder "+acc.getItemName();
|
msg = user.getName() + " " + GxtAccountingEntryType.SHARE.getName() + " folder "
|
||||||
|
+ acc.getItemName();
|
||||||
|
|
||||||
if (acc.getMembers() != null && acc.getMembers().length > 0)
|
if (acc.getMembers() != null && acc.getMembers().length > 0)
|
||||||
msg+=" with "+UserUtil.separateFullNameToCommaForPortalLogin(Arrays.asList(acc.getMembers()));
|
msg += " with "
|
||||||
|
+ UserUtil.separateFullNameToCommaForPortalLogin(Arrays.asList(acc.getMembers()));
|
||||||
|
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
}
|
}
|
||||||
|
@ -680,12 +656,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
case UNSHARE:
|
case UNSHARE:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.UNSHARE)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.UNSHARE)) {
|
||||||
|
|
||||||
af.setOperation(GxtAccountingEntryType.UNSHARE);
|
af.setOperation(GxtAccountingEntryType.UNSHARE);
|
||||||
AccountEntryUnshare uns = (AccountEntryUnshare) shubAccEntry;
|
AccountEntryUnshare uns = (AccountEntryUnshare) shubAccEntry;
|
||||||
String msg = "Folder ";
|
String msg = "Folder ";
|
||||||
msg+= uns.getItemName()==null || uns.getItemName().isEmpty()?"":"\""+uns.getItemName()+"\" ";
|
msg += uns.getItemName() == null || uns.getItemName().isEmpty() ? ""
|
||||||
|
: "\"" + uns.getItemName() + "\" ";
|
||||||
// see Task #19544
|
// see Task #19544
|
||||||
if (shubAccEntry.getUser().equalsIgnoreCase("ALL")) {
|
if (shubAccEntry.getUser().equalsIgnoreCase("ALL")) {
|
||||||
// CASE ALL
|
// CASE ALL
|
||||||
|
@ -702,16 +681,20 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
case RESTORE:
|
case RESTORE:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RESTORE)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.RESTORE)) {
|
||||||
|
|
||||||
af.setOperation(GxtAccountingEntryType.RESTORE);
|
af.setOperation(GxtAccountingEntryType.RESTORE);
|
||||||
AccountEntryRestore acc = (AccountEntryRestore) shubAccEntry;
|
AccountEntryRestore acc = (AccountEntryRestore) shubAccEntry;
|
||||||
String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
|
String msg = acc.getItemName() == null || acc.getItemName().isEmpty() ? ""
|
||||||
|
: acc.getItemName() + " ";
|
||||||
|
|
||||||
if (acc.getVersion() == null)
|
if (acc.getVersion() == null)
|
||||||
msg += GxtAccountingEntryType.RESTORE.getName() + " by " + user.getName();
|
msg += GxtAccountingEntryType.RESTORE.getName() + " by " + user.getName();
|
||||||
else
|
else
|
||||||
msg+=" v."+acc.getVersion()+" "+GxtAccountingEntryType.RESTORE.getName() +" by "+user.getName();
|
msg += " v." + acc.getVersion() + " " + GxtAccountingEntryType.RESTORE.getName() + " by "
|
||||||
|
+ user.getName();
|
||||||
|
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
}
|
}
|
||||||
|
@ -719,12 +702,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
case DISABLED_PUBLIC_ACCESS:
|
case DISABLED_PUBLIC_ACCESS:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS)) {
|
||||||
|
|
||||||
af.setOperation(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS);
|
af.setOperation(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS);
|
||||||
AccountEntryDisabledPublicAccess acc = (AccountEntryDisabledPublicAccess) shubAccEntry;
|
AccountEntryDisabledPublicAccess acc = (AccountEntryDisabledPublicAccess) shubAccEntry;
|
||||||
// TODO acc.getItemName() is missing in SHUB
|
// TODO acc.getItemName() is missing in SHUB
|
||||||
//String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
|
// String msg = acc.getItemName()==null ||
|
||||||
|
// acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
|
||||||
String msg = GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS.getName() + " by " + user.getName();
|
String msg = GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS.getName() + " by " + user.getName();
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
}
|
}
|
||||||
|
@ -733,12 +719,15 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
case ENABLED_PUBLIC_ACCESS:
|
case ENABLED_PUBLIC_ACCESS:
|
||||||
|
|
||||||
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS)){
|
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|
||||||
|
|| gxtEntryType.equals(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS)) {
|
||||||
|
|
||||||
af.setOperation(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS);
|
af.setOperation(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS);
|
||||||
AccountEntryEnabledPublicAccess acc = (AccountEntryEnabledPublicAccess) shubAccEntry;
|
AccountEntryEnabledPublicAccess acc = (AccountEntryEnabledPublicAccess) shubAccEntry;
|
||||||
// TODO acc.getItemName() is missing in SHUB
|
// TODO acc.getItemName() is missing in SHUB
|
||||||
//String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
|
// String msg = acc.getItemName()==null ||
|
||||||
|
// acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
|
||||||
String msg = GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS.getName() + " by " + user.getName();
|
String msg = GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS.getName() + " by " + user.getName();
|
||||||
af.setDescription(msg);
|
af.setDescription(msg);
|
||||||
}
|
}
|
||||||
|
@ -759,7 +748,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the gcube item properties for gcube item as HTML.
|
* Gets the gcube item properties for gcube item as HTML.
|
||||||
*
|
*
|
||||||
|
@ -768,7 +756,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
*/
|
*/
|
||||||
public String getGcubeItemPropertiesForGcubeItemAsHTML(WorkspaceItem wsItem) {
|
public String getGcubeItemPropertiesForGcubeItemAsHTML(WorkspaceItem wsItem) {
|
||||||
|
|
||||||
|
|
||||||
Map<String, String> properties = getGcubeItemProperties(wsItem);
|
Map<String, String> properties = getGcubeItemProperties(wsItem);
|
||||||
|
|
||||||
if (properties != null) {
|
if (properties != null) {
|
||||||
|
@ -798,7 +785,6 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the gcube item properties.
|
* Gets the gcube item properties.
|
||||||
*
|
*
|
||||||
|
@ -822,4 +808,73 @@ public class StorageHubToWorkpaceConverter implements Serializable{
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************************
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* TESTING MODE METHODS
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
***********************************************************************************************************************************************/
|
||||||
|
protected static HashMap<String, InfoContactModel> hashTestUser = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used in test mode.
|
||||||
|
*
|
||||||
|
* @return the hash test users
|
||||||
|
*/
|
||||||
|
public static HashMap<String, InfoContactModel> getHashTestUsers() {
|
||||||
|
|
||||||
|
if (hashTestUser == null) {
|
||||||
|
hashTestUser = new HashMap<String, InfoContactModel>();
|
||||||
|
|
||||||
|
// USERS
|
||||||
|
hashTestUser.put("federico.defaveri",
|
||||||
|
new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri", null, false));
|
||||||
|
hashTestUser.put("antonio.gioia",
|
||||||
|
new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia", null, false));
|
||||||
|
hashTestUser.put("fabio.sinibaldi",
|
||||||
|
new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi", null, false));
|
||||||
|
hashTestUser.put("pasquale.pagano",
|
||||||
|
new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano", null, false));
|
||||||
|
hashTestUser.put("valentina.marioli",
|
||||||
|
new InfoContactModel("valentina.marioli", "valentina.marioli", "Valentina Marioli", null, false));
|
||||||
|
hashTestUser.put("roberto.cirillo",
|
||||||
|
new InfoContactModel("roberto.cirillo", "roberto.cirillo", "Roberto Cirillo", null, false));
|
||||||
|
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa",
|
||||||
|
"francesco.mangiacrapa", "Francesco Mangiacrapa", null, false));
|
||||||
|
hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante",
|
||||||
|
"massimiliano.assante", "Massimiliano Assante", null, false));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return hashTestUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<InfoContactModel> buildGxtInfoContactFromPortalLoginTestMode(List<String> listPortalLogin) {
|
||||||
|
|
||||||
|
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
|
||||||
|
|
||||||
|
for (String portalLogin : listPortalLogin)
|
||||||
|
listContact.add(getHashTestUsers().get(portalLogin));
|
||||||
|
|
||||||
|
return listContact;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************************************************************************************
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* END TESTING MODE
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
***********************************************************************************************************************************************/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue