Restored moderation link
This commit is contained in:
parent
d40dcc2f95
commit
7f3bbdd1ca
|
@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
# Changelog for gCube Catalogue (gCat) Service
|
||||
|
||||
## [v2.4.0-SNAPSHOT]
|
||||
|
||||
- Added moderation link in moderation message [#23142]
|
||||
|
||||
|
||||
## [v2.3.0]
|
||||
|
||||
- Switched moderation messages to notification [#23317]
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
|||
<groupId>org.gcube.data-catalogue</groupId>
|
||||
<artifactId>gcat</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.3.0</version>
|
||||
<version>2.4.0-SNAPSHOT</version>
|
||||
<name>gCube Catalogue (gCat) Service</name>
|
||||
<description>
|
||||
This service allows any client to publish on the gCube Catalogue.
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
package org.gcube.gcat.moderation.thread;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Map;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
import org.gcube.gcat.api.configuration.CatalogueConfiguration;
|
||||
//import org.gcube.common.authorization.utils.manager.SecretManager;
|
||||
//import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
|
||||
//import org.gcube.gcat.api.configuration.CatalogueConfiguration;
|
||||
|
@ -13,6 +19,9 @@ import org.gcube.gcat.persistence.ckan.CKANUser;
|
|||
//import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
|
||||
//import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryString.MODERATION_OP;
|
||||
//import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryStringBuilder;
|
||||
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
|
||||
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryString.MODERATION_OP;
|
||||
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryStringBuilder;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
|
@ -62,34 +71,29 @@ public abstract class ModerationThread {
|
|||
}
|
||||
|
||||
public String getModerationURL() {
|
||||
//
|
||||
// TODO Add the following change in changelog
|
||||
// - Added moderation link in moderation message [#23142]
|
||||
//
|
||||
// if(moderationURL==null) {
|
||||
// try {
|
||||
// SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
// String context = secretManager.getContext();
|
||||
// UriResolverManager resolver = new UriResolverManager("CTLG");
|
||||
// Map<String, String> params = new HashMap<String, String>();
|
||||
// params.put("gcube_scope", context); //e.g. /gcube/devsec/devVRE
|
||||
// params.put("entity_context", "organization");
|
||||
// params.put("entity_name", CatalogueConfiguration.getOrganizationName(context)); //e.g. devvre
|
||||
//
|
||||
// CatalogueResolverQueryStringBuilder builder = new CatalogueResolverQueryStringBuilder(itemName); //item name under moderation
|
||||
// builder.itemStatus(cmItemStatus.name()). //e.g. pending, approved, rejected
|
||||
// moderation(MODERATION_OP.show);
|
||||
//
|
||||
// String queryString = builder.buildQueryParametersToQueryString();
|
||||
// params.put(CatalogueResolverQueryStringBuilder.QUERY_STRING_PARAMETER, queryString);
|
||||
//
|
||||
// moderationURL = resolver.getLink(params, true);
|
||||
// }catch (Exception e) {
|
||||
// return itemURL;
|
||||
// }
|
||||
// }
|
||||
// return moderationURL;
|
||||
return itemURL;
|
||||
if(moderationURL==null) {
|
||||
try {
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
String context = secretManager.getContext();
|
||||
UriResolverManager resolver = new UriResolverManager("CTLG");
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put("gcube_scope", context); //e.g. /gcube/devsec/devVRE
|
||||
params.put("entity_context", "organization");
|
||||
params.put("entity_name", CatalogueConfiguration.getOrganizationName(context)); //e.g. devvre
|
||||
|
||||
CatalogueResolverQueryStringBuilder builder = new CatalogueResolverQueryStringBuilder(itemName); //item name under moderation
|
||||
builder.itemStatus(cmItemStatus.name()). //e.g. pending, approved, rejected
|
||||
moderation(MODERATION_OP.show);
|
||||
|
||||
String queryString = builder.buildQueryParametersToQueryString();
|
||||
params.put(CatalogueResolverQueryStringBuilder.QUERY_STRING_PARAMETER, queryString);
|
||||
|
||||
moderationURL = resolver.getLink(params, true);
|
||||
}catch (Exception e) {
|
||||
return itemURL;
|
||||
}
|
||||
}
|
||||
return moderationURL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue