Getting catalogue moderators from social

This commit is contained in:
Luca Frosini 2021-11-25 17:58:56 +01:00
parent 69a22d2461
commit 9069397b58
1 changed files with 13 additions and 11 deletions

View File

@ -2,6 +2,8 @@ package org.gcube.gcat.zulip;
import java.util.Set;
import javax.ws.rs.InternalServerErrorException;
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.com.fasterxml.jackson.databind.node.ArrayNode;
@ -11,6 +13,8 @@ import org.gcube.gcat.api.GCatConstants;
import org.gcube.gcat.persistence.ckan.CKANUser;
import org.gcube.gcat.social.SocialUsers;
import org.gcube.gcat.utils.Constants;
import org.gcube.gcat.utils.ContextUtility;
import org.gcube.gcat.zulip.ZulipResponse.Result;
import org.gcube.storagehub.ApplicationMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -47,9 +51,8 @@ public class ZulipStream {
protected ObjectMapper objectMapper;
protected ZulipRestExecutor getZulipRestExecutor() {
// ZulipAuth zulipAuth = new ZulipAuth(ContextUtility.getUsername());
// return new ZulipRestExecutor(zulipAuth.getEmail(), zulipAuth.getAPIKey(), zulipAuth.getSite());
return null;
ZulipAuth zulipAuth = new ZulipAuth(ContextUtility.getUsername());
return new ZulipRestExecutor(zulipAuth.getEmail(), zulipAuth.getAPIKey(), zulipAuth.getSite());
}
public ZulipStream() {
@ -105,14 +108,13 @@ public class ZulipStream {
protected ZulipResponse executeZulipCall(ZulipRestExecutor zulipRestExecutor, ZulipRestAPICall call) throws Exception {
logger.trace("Going to execute {}", call);
// String responseString = zulipRestExecutor.executeCall(call);
// logger.trace("Response from {} is {}", call.getClass().getSimpleName(), responseString);
// ZulipResponse zulipResponse = new ZulipResponse(responseString);
// if(zulipResponse.getResponseResult()==Result.error) {
// throw new InternalServerErrorException(zulipResponse.getResponseMessage());
// }
// return zulipResponse;
return null;
String responseString = zulipRestExecutor.executeCall(call);
logger.trace("Response from {} is {}", call.getClass().getSimpleName(), responseString);
ZulipResponse zulipResponse = new ZulipResponse(responseString);
if(zulipResponse.getResponseResult()==Result.error) {
throw new InternalServerErrorException(zulipResponse.getResponseMessage());
}
return zulipResponse;
}
public void create() throws Exception {