fixing method isItemSynched

task_21379
Francesco Mangiacrapa 3 years ago
parent 24e6bca0b0
commit ac7fb2101b

@ -25,6 +25,7 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// TODO: Auto-generated Javadoc
/**
* The Class SyncronizeWithThredds.
*
@ -116,12 +117,18 @@ public class SyncronizeWithThredds {
/**
* Checks if is item synched.
*
* @param folderId the folder id
* @param folderId the folder id
* @param scope the scope
* @param userToken the user token
* @return the th sync folder descriptor
* @throws ItemNotSynched the item not synched
* @throws Exception the exception
*/
public ThSyncFolderDescriptor isItemSynched(String folderId) throws ItemNotSynched {
public ThSyncFolderDescriptor isItemSynched(String folderId, String scope, String userToken)
throws ItemNotSynched, Exception {
setContextParameters(scope, userToken);
ThSyncFolderDescriptor config = null;
try {
config = workspaceThreddsSynchronize.getConfiguration(folderId);
@ -381,7 +388,9 @@ public class SyncronizeWithThredds {
/**
* Gets the sync status info.
*
* @param itemId the item id
* @param itemId the item id
* @param scope the scope
* @param userToken the user token
* @return the sync status info
* @throws Exception the exception
*/

@ -126,14 +126,14 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
logger.debug("called isItemSynched for folderId: " + folderId);
try {
ThSyncFolderDescriptor theConfig = getSyncService().isItemSynched(folderId);
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
ThSyncFolderDescriptor theConfig = getSyncService().isItemSynched(folderId,wsScope,wsUserToken);
if (theConfig != null) {
logger.info("Folder id: " + folderId + " is synched");
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
Sync_Status theStatus = getSyncService().getSyncStatusInfo(folderId,wsScope,wsUserToken);
WsThreddsSynchFolderDescriptor toWsThreddFolder = BeanConverter.toWsThreddsFolderConfig(theConfig,
theStatus);
@ -206,7 +206,9 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
try {
GCubeUser user = PortalContext.getConfiguration().getCurrentUser(this.getThreadLocalRequest());
ThSyncFolderDescriptor foldeDesr = getSyncService().isItemSynched(folderId);
String wsScope = PortalContext.getConfiguration().getCurrentScope(this.getThreadLocalRequest());
String wsUserToken = PortalContext.getConfiguration().getCurrentUserToken(wsScope, user.getUsername());
ThSyncFolderDescriptor foldeDesr = getSyncService().isItemSynched(folderId,wsScope,wsUserToken);
return getSyncService().doUnSync(folderId, true, foldeDesr.getConfiguration(), this.getThreadLocalRequest(),
user);
} catch (Exception e) {

Loading…
Cancel
Save