in progress on #21388

This commit is contained in:
Francesco Mangiacrapa 2021-05-12 16:33:37 +02:00
parent fd6d1570e8
commit cc17be1761
3 changed files with 366 additions and 298 deletions

View File

@ -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

View File

@ -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;