Removed moderation URL

This commit is contained in:
Luca Frosini 2022-07-12 11:36:48 +02:00
parent 6dbac9bff4
commit cff70a3545
1 changed files with 32 additions and 31 deletions

View File

@ -1,18 +1,18 @@
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;
import org.gcube.gcat.api.moderation.CMItemStatus;
import org.gcube.gcat.moderation.thread.social.notifications.SocialNotificationModerationThread;
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,29 +62,30 @@ public abstract class ModerationThread {
}
public String getModerationURL() {
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;
// 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;
}
/**