67 lines
1.9 KiB
Java
67 lines
1.9 KiB
Java
package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
|
|
|
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
|
|
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
/**
|
|
* The Class ConcessioniMongoService.
|
|
*
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
*
|
|
* Sep 23, 2021
|
|
*/
|
|
public class ConcessioniMongoService {
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(ConcessioniMongoService.class);
|
|
|
|
/**
|
|
* Instantiates a new concessioni mongo service.
|
|
*/
|
|
protected ConcessioniMongoService() {
|
|
}
|
|
|
|
/**
|
|
* Gets the item by id.
|
|
*
|
|
* @param mongoItemId the mongo item id
|
|
* @return the item by id
|
|
* @throws Exception the exception
|
|
*/
|
|
protected Concessione getItemById(String mongoItemId) throws Exception {
|
|
LOG.info("called getItemById: " + mongoItemId);
|
|
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
|
// Returning item by Id
|
|
return concessioniManager.getById(mongoItemId);
|
|
}
|
|
|
|
|
|
/**
|
|
* To concessione.
|
|
*
|
|
* @param jsonString the json string
|
|
* @return the concessione
|
|
*/
|
|
protected 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); }
|
|
*/
|
|
|
|
}
|