parent
46ae55e8dd
commit
6224dd7f7c
@ -1,20 +0,0 @@
|
||||
//package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||
//
|
||||
///**
|
||||
// * The Class ApplicationProfileException.
|
||||
// *
|
||||
// * @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||
// * Sep 6, 2016
|
||||
// */
|
||||
//@SuppressWarnings("serial")
|
||||
//public class ApplicationProfileNotFoundException extends Exception {
|
||||
//
|
||||
// /**
|
||||
// * Instantiates a new application profile exception.
|
||||
// *
|
||||
// * @param message the message
|
||||
// */
|
||||
// public ApplicationProfileNotFoundException(String message) {
|
||||
// super(message);
|
||||
// }
|
||||
//}
|
@ -1,163 +0,0 @@
|
||||
//package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||
//
|
||||
//import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//
|
||||
//import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||
//import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
//import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
||||
//import org.gcube.common.keycloak.KeycloakClientFactory;
|
||||
//import org.gcube.common.keycloak.model.TokenResponse;
|
||||
//import org.gcube.common.scope.api.ScopeProvider;
|
||||
//import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * The Class ConcessioniMongoServiceIdentityProxy.
|
||||
// *
|
||||
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
// *
|
||||
// * Sep 23, 2021
|
||||
// */
|
||||
//public class ConcessioniMongoService2 {
|
||||
//
|
||||
// private static final Logger LOG = LoggerFactory.getLogger(ConcessioniMongoService2.class);
|
||||
//
|
||||
// /**
|
||||
// * Instantiates a new concessioni mongo service, interface for client
|
||||
// * statefulMongoConcessioni.
|
||||
// */
|
||||
// public ConcessioniMongoService2() {
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the item by id.
|
||||
// *
|
||||
// * @param request the request
|
||||
// * @param mongoItemId the mongo item id
|
||||
// * @return the item by id
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// public Concessione getItemById(HttpServletRequest request, String mongoItemId) throws Exception {
|
||||
// LOG.info("called getItemById: " + mongoItemId);
|
||||
// SessionUtil.getCurrentContext(request, true);
|
||||
// SessionUtil.getCurrentToken(request, true);
|
||||
// // Obtain the client
|
||||
// ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
||||
// // Returning item by Id
|
||||
// return concessioniManager.getById(mongoItemId);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the item by id.
|
||||
// *
|
||||
// * @param request the request
|
||||
// * @param mongoItemId the mongo item id
|
||||
// * @return the item by id
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// public Concessione getItemById(String mongoItemId) throws Exception {
|
||||
// LOG.info("called getItemById: " + mongoItemId);
|
||||
// ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
||||
// // Returning item by Id
|
||||
// return concessioniManager.getById(mongoItemId);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Iam client get item by.
|
||||
// *
|
||||
// * @param scope the scope
|
||||
// * @param mongoItemId the mongo item id
|
||||
// * @param clientId the client id
|
||||
// * @param clientSecret the secret
|
||||
// * @return the concessione
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// public Concessione iamClientGetItemBy(String scope, String mongoItemId, String clientId, String clientSecret)
|
||||
// throws Exception {
|
||||
// LOG.info("called IAM Client getItemById: " + mongoItemId);
|
||||
//
|
||||
// ScopeProvider.instance.set(scope);
|
||||
//
|
||||
// if (clientId == null) {
|
||||
// throw new Exception("Invalid parameter 'clientId'");
|
||||
// }
|
||||
//
|
||||
// if (clientSecret == null) {
|
||||
// throw new Exception("Invalid parameter 'secret'");
|
||||
// }
|
||||
//
|
||||
// String umaAcessToken = null;
|
||||
// try {
|
||||
//
|
||||
// LOG.info("Querying KeycloakClientFactory to get UMA token..");
|
||||
// TokenResponse tr = KeycloakClientFactory.newInstance().queryUMAToken(clientId, clientSecret, scope, null);
|
||||
// umaAcessToken = tr.getAccessToken();
|
||||
// if (umaAcessToken != null && !umaAcessToken.isEmpty()) {
|
||||
// LOG.info("UMA Access Token read correctly");
|
||||
// } else {
|
||||
// LOG.error("UMA Access Token NOT RETRIEVED!!!");
|
||||
// throw new Exception("UMA Access Token is null or empty");
|
||||
// }
|
||||
// } catch (Exception e2) {
|
||||
// throw new Exception("Error occurred on reading UMA access token:", e2);
|
||||
// }
|
||||
//
|
||||
// String previousUMAToken = null;
|
||||
// try {
|
||||
//
|
||||
// try {
|
||||
// // Here the previousUMAToken should be null
|
||||
// previousUMAToken = AccessTokenProvider.instance.get();
|
||||
// } catch (Exception e) {
|
||||
// // catching excpetion to be sure
|
||||
// // silent
|
||||
// }
|
||||
//
|
||||
// LOG.debug("JWT token: " + umaAcessToken.substring(0, 20) + "_MASKED_TOKEN_");
|
||||
// LOG.info("Setting clientId '" + clientId + "' identity by JWT token in the "
|
||||
// + AccessTokenProvider.class.getSimpleName());
|
||||
// AccessTokenProvider.instance.set(umaAcessToken);
|
||||
// ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
||||
// // Returning item by Id
|
||||
// return concessioniManager.getById(mongoItemId);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// LOG.error(e.getMessage(), e);
|
||||
// throw new Exception(e.getMessage());
|
||||
// } finally {
|
||||
// try {
|
||||
// AccessTokenProvider.instance.set(previousUMAToken);
|
||||
// LOG.info("Done reset to prevoius UMA token into " + AccessTokenProvider.class.getSimpleName());
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * To concessione.
|
||||
// *
|
||||
// * @param jsonString the json string
|
||||
// * @return the concessione
|
||||
// */
|
||||
// public Concessione toConcessione(String jsonString) {
|
||||
// LOG.info("toConcessione called");
|
||||
// try {
|
||||
// return org.gcube.application.geoportal.client.utils.Serialization.read(jsonString, Concessione.class);
|
||||
// } catch (Exception e) {
|
||||
// LOG.warn("Error on serializing: ", e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * For testing public Concessione iamClientGetItemBy(HttpServletRequest request,
|
||||
// * String mongoItemId, String clientId, String secret) throws Exception { String
|
||||
// * scope = SessionUtil.getCurrentContext(request, true); return
|
||||
// * iamClientGetItemBy(scope, mongoItemId, clientId, secret); }
|
||||
// */
|
||||
//
|
||||
//}
|
@ -1,83 +0,0 @@
|
||||
//package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//
|
||||
//import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
//import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||
//import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||
//import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//
|
||||
///**
|
||||
// * The Class ConcessioneImageUtil.
|
||||
// *
|
||||
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
// *
|
||||
// * Sep 7, 2021
|
||||
// */
|
||||
//public class ConcessioneImageUtil {
|
||||
//
|
||||
// private static final Logger LOG = LoggerFactory.getLogger(ConcessioneImageUtil.class);
|
||||
//
|
||||
// /**
|
||||
// * Gets the uploaded images for id.
|
||||
// *
|
||||
// * @param httpServletRequest the http servlet request
|
||||
// * @param itemType the item type
|
||||
// * @param itemId the item id
|
||||
// * @param maxImages the max images
|
||||
// * @return the uploaded images for id
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// public List<UploadedImageDV> getUploadedImagesForId(HttpServletRequest httpServletRequest, String itemType,
|
||||
// String itemId, Integer maxImages) throws Exception {
|
||||
// LOG.info("getUploadedImagesForId [itemId: " + itemId + ", itemType: " + itemType + "] called");
|
||||
//
|
||||
// if (itemType == null)
|
||||
// throw new Exception("Invalid parameter. The itemType is null");
|
||||
//
|
||||
// if (itemId == null)
|
||||
// throw new Exception("Invalid parameter. The itemId is null");
|
||||
//
|
||||
// List<UploadedImageDV> listUI = null;
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// if (itemType.equalsIgnoreCase("concessione")) {
|
||||
//
|
||||
// LOG.info("Trying to get concessione for id " + itemId);
|
||||
// ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(httpServletRequest);
|
||||
// Concessione concessione = cms.getItemById(itemId);
|
||||
// if (concessione != null) {
|
||||
// LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
|
||||
// List<UploadedImage> images = concessione.getImmaginiRappresentative();
|
||||
//
|
||||
// if (images != null) {
|
||||
// listUI = new ArrayList<UploadedImageDV>();
|
||||
// int max = maxImages < images.size() ? maxImages : images.size();
|
||||
// for (int i = 0; i < max; i++) {
|
||||
// UploadedImageDV ui = ConvertToDataViewModel.toUploadedImage(images.get(i));
|
||||
// listUI.add(ui);
|
||||
// }
|
||||
// LOG.info("For id " + itemId + ", got " + listUI.size() + " image/s");
|
||||
// }
|
||||
// } else
|
||||
// throw new Exception("Concessione with id '" + itemId + "' not available");
|
||||
// }
|
||||
//
|
||||
// return listUI;
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// String erroMsg = UploadedImage.class.getSimpleName() + " not available for "
|
||||
// + Concessione.class.getSimpleName() + " with id " + itemId;
|
||||
// LOG.error(erroMsg, e);
|
||||
// throw new Exception(erroMsg);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
Loading…
Reference in New Issue