added check and event class for reverting GRSF operations

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@162887 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2018-02-04 11:05:22 +00:00
parent 2a325c457d
commit 2b3d7f3cbd
8 changed files with 77 additions and 5 deletions

View File

@ -29,7 +29,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>

View File

@ -1,6 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error

View File

@ -4,6 +4,9 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="ckan-util-library-2.4.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-util-library/ckan-util-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="gcube-ckan-datacatalog"/>
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module>

View File

@ -4,6 +4,7 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
import org.gcube.datacatalogue.grsf_manage_widget.client.events.HideManagementPanelEvent;
import org.gcube.datacatalogue.grsf_manage_widget.client.events.HideManagementPanelEventHandler;
import org.gcube.datacatalogue.grsf_manage_widget.client.view.ManageProductWidget;
import org.gcube.datacatalogue.grsf_manage_widget.client.view.ManageRevertOperationWidget;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
@ -20,6 +21,8 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowManage
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowManageProductWidgetEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowOrganizationsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowOrganizationsEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowRevertOperationWidgetEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowRevertOperationWidgetEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowStatisticsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowStatisticsEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesEvent;
@ -217,6 +220,16 @@ public class CkanEventHandlerManager {
new ManageProductWidget(event.getProductIdentifier(), eventBus);
}
});
eventBus.addHandler(ShowRevertOperationWidgetEvent.TYPE, new ShowRevertOperationWidgetEventHandler() {
@Override
public void onShowRevertOperationWidgetEvent(
ShowRevertOperationWidgetEvent event) {
new ManageRevertOperationWidget(event.getEncryptedUrl(), eventBus);
}
});
eventBus.addHandler(ShareLinkEvent.TYPE, new ShareLinkEventHandler() {

View File

@ -26,6 +26,7 @@ public class GCubeCkanDataCatalog implements EntryPoint {
private CkanEventHandlerManager eventManager = new CkanEventHandlerManager();
public static final String GET_PATH_PARAMETER = "path";
public static final String GET_QUERY_PARAMETER = "query";
public static final String REVERT_QUERY_PARAM = "manage";
public static final String GCUBE_CKAN_IFRAME = "gcube-ckan-iframe";
/**

View File

@ -0,0 +1,37 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.GwtEvent;
public class ShowRevertOperationWidgetEvent extends GwtEvent<ShowRevertOperationWidgetEventHandler> {
public static Type<ShowRevertOperationWidgetEventHandler> TYPE = new Type<ShowRevertOperationWidgetEventHandler>();
private String encryptedUrl;
/**
*
* @param encryptedUrl
*/
public ShowRevertOperationWidgetEvent(String encryptedUrl) {
this.encryptedUrl = encryptedUrl;
}
public String getEncryptedUrl() {
return encryptedUrl;
}
public void setEncryptedUrl(String encryptedUrl) {
this.encryptedUrl = encryptedUrl;
}
@Override
public com.google.gwt.event.shared.GwtEvent.Type<ShowRevertOperationWidgetEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ShowRevertOperationWidgetEventHandler handler) {
handler.onShowRevertOperationWidgetEvent(this);
}
}

View File

@ -0,0 +1,9 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.EventHandler;
public interface ShowRevertOperationWidgetEventHandler extends EventHandler {
void onShowRevertOperationWidgetEvent(ShowRevertOperationWidgetEvent showRevertOperationWidget);
}

View File

@ -10,6 +10,7 @@ import java.util.Map;
import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowRevertOperationWidgetEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.resource.CkanPortletResources;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
@ -80,9 +81,9 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
ckanGroupsPanel = new CkanGroupsPanel(this);
initPanel();
setTopPanelVisible(true);
// decode parameters (they could have been encoded)
Map<String, String> paramsMap = new HashMap<String, String>(2);
final Map<String, String> paramsMap = new HashMap<String, String>(2);
String queryParameters = Window.Location.getQueryString();
if(queryParameters != null && !queryParameters.isEmpty()){
String decoded = URL.decodeQueryString(queryParameters); // equals should be encoded too (%3D)
@ -202,7 +203,15 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
ckanGroupsPanel.setGroups(null);
}
});
// check if the url encodes a revert operation to be performed
if(paramsMap.containsKey(GCubeCkanDataCatalog.REVERT_QUERY_PARAM) &&
paramsMap.get(GCubeCkanDataCatalog.REVERT_QUERY_PARAM).equals("true")){
eventBus.fireEvent(new ShowRevertOperationWidgetEvent(Window.Location.getHref()));
}
/**
* Just check if it is enabled.. then we need to listen for dom events coming
*/