Integrated with timeline config
This commit is contained in:
parent
fec3f26c0a
commit
62dc1bad6c
|
@ -161,9 +161,6 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.gcube.application.geoportal.common.model.document.identification.Iden
|
||||||
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
|
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
|
||||||
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
|
import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportal.common.rest.Projects;
|
import org.gcube.application.geoportal.common.rest.Projects;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
|
@ -97,6 +98,8 @@ import com.jayway.jsonpath.Option;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements GeoportalDataViewerService {
|
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements GeoportalDataViewerService {
|
||||||
|
|
||||||
|
private static final String TIMELINE_CONFIG_TJT_DOCUMENT = "tjt_document";
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerServiceImpl.class);
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerServiceImpl.class);
|
||||||
|
|
||||||
private static final String CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE = "MAP_IMAGE_PREVIEW_FOR_CONCESSIONE";
|
private static final String CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE = "MAP_IMAGE_PREVIEW_FOR_CONCESSIONE";
|
||||||
|
@ -986,7 +989,14 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.info("Trying to get project for id " + profileID);
|
LOG.info("Trying to get project for id " + profileID);
|
||||||
|
|
||||||
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
UseCaseDescriptor ucd = GeoportalClientCaller.useCaseDescriptors().getUCDForId(profileID);
|
|
||||||
|
UseCaseDescriptor ucd = SessionUtil.getUCDForId(this.getThreadLocalRequest(), profileID);
|
||||||
|
|
||||||
|
if (ucd == null) {
|
||||||
|
ucd = GeoportalClientCaller.useCaseDescriptors().getUCDForId(profileID);
|
||||||
|
SessionUtil.setUCDForId(this.getThreadLocalRequest(), profileID, ucd);
|
||||||
|
}
|
||||||
|
|
||||||
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
||||||
|
|
||||||
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
||||||
|
@ -1173,6 +1183,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
ProjectDV projectDV = new ProjectDV();
|
ProjectDV projectDV = new ProjectDV();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
|
|
||||||
useCaseDescriptors().build().query(request).forEachRemaining(u -> {
|
useCaseDescriptors().build().query(request).forEachRemaining(u -> {
|
||||||
try {
|
try {
|
||||||
LOG.debug("UCD for id" + u.getId() + " returend name: " + u.getName());
|
LOG.debug("UCD for id" + u.getId() + " returend name: " + u.getName());
|
||||||
|
@ -1197,7 +1209,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.warn("Error on getting minimalProjectDV of projectID: ", e);
|
LOG.warn("Error on getting minimalProjectDV of projectID: ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.debug("minimalProjectDV returning: "+projectDV);
|
LOG.debug("minimalProjectDV returning: " + projectDV);
|
||||||
return projectDV;
|
return projectDV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,7 +1223,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
private GeoJSON spatialReference(String profileID, String projectID) {
|
private GeoJSON spatialReference(String profileID, String projectID) {
|
||||||
LOG.trace("spatialReference for profileID: " + profileID + ", projectID: " + projectID + "called");
|
LOG.trace("spatialReference for profileID: " + profileID + ", projectID: " + projectID + "called");
|
||||||
try {
|
try {
|
||||||
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
List<IdentificationReference> listIR = projects(profileID).build().getById(projectID)
|
List<IdentificationReference> listIR = projects(profileID).build().getById(projectID)
|
||||||
.getIdentificationReferenceByType(IdentificationReferencesTYPE.SPATIAL_REFERENCE.getType());
|
.getIdentificationReferenceByType(IdentificationReferencesTYPE.SPATIAL_REFERENCE.getType());
|
||||||
if (listIR != null && !listIR.isEmpty()) {
|
if (listIR != null && !listIR.isEmpty()) {
|
||||||
|
@ -1241,13 +1253,16 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LinkedHashMap<String, Object> documentAsMap = new LinkedHashMap<String, Object>(limit);
|
LinkedHashMap<String, Object> documentAsMap = new LinkedHashMap<String, Object>(limit);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
|
||||||
|
|
||||||
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
|
|
||||||
|
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Iterator<Entry<String, Object>> entrySetsIt = theProject.getTheDocument().entrySet().iterator();
|
Iterator<Entry<String, Object>> entrySetsIt = theProject.getTheDocument().entrySet().iterator();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (entrySetsIt.hasNext()) {
|
while (entrySetsIt.hasNext()) {
|
||||||
if (i+1 > limit)
|
if (i + 1 > limit)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Entry<String, Object> entry = entrySetsIt.next();
|
Entry<String, Object> entry = entrySetsIt.next();
|
||||||
|
@ -1259,29 +1274,24 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*QueryRequest request = new QueryRequest();
|
/*
|
||||||
request.setFilter(Document.parse("{\"" + Project.ID + "\" : " + "{\"$eq\" : \"" + projectID + "\"}}"));
|
* QueryRequest request = new QueryRequest();
|
||||||
request.setProjection(Document.parse("{\"" + Project.THE_DOCUMENT + "\" : " + "1}"));
|
* request.setFilter(Document.parse("{\"" + Project.ID + "\" : " +
|
||||||
// should be one
|
* "{\"$eq\" : \"" + projectID + "\"}}"));
|
||||||
projects(profileID).build().query(request).forEachRemaining(p -> {
|
* request.setProjection(Document.parse("{\"" + Project.THE_DOCUMENT + "\" : " +
|
||||||
try {
|
* "1}")); // should be one
|
||||||
Iterator<Entry<String, Object>> entrySetsIt = p.getTheDocument().entrySet().iterator();
|
* projects(profileID).build().query(request).forEachRemaining(p -> { try {
|
||||||
int i = 0;
|
* Iterator<Entry<String, Object>> entrySetsIt =
|
||||||
while (entrySetsIt.hasNext()) {
|
* p.getTheDocument().entrySet().iterator(); int i = 0; while
|
||||||
if (i > limit)
|
* (entrySetsIt.hasNext()) { if (i > limit) break;
|
||||||
break;
|
*
|
||||||
|
* Entry<String, Object> entry = entrySetsIt.next();
|
||||||
|
* documentAsMap.put(entry.getKey(), entry.getValue()); i++; }
|
||||||
|
*
|
||||||
|
* } catch (Exception e) { throw e; } });
|
||||||
|
*/
|
||||||
|
|
||||||
Entry<String, Object> entry = entrySetsIt.next();
|
LOG.debug("getEntrySetsDocumentForProjectID returning map: " + documentAsMap);
|
||||||
documentAsMap.put(entry.getKey(), entry.getValue());
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
LOG.debug("getEntrySetsDocumentForProjectID returning map: "+documentAsMap);
|
|
||||||
return documentAsMap;
|
return documentAsMap;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1301,58 +1311,88 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
try {
|
try {
|
||||||
LOG.info("Trying to getRelationshipsForTimeline for id " + profileID);
|
LOG.info("Trying to getRelationshipsForTimeline for id " + profileID);
|
||||||
|
|
||||||
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
List<String> listJSON = new ArrayList<String>();
|
List<String> listJSON = new ArrayList<String>();
|
||||||
|
String template = null;
|
||||||
try {
|
try {
|
||||||
String template = "{\"content\": \"$.nome\"," + "\"title\": \"$.nome\","
|
|
||||||
+ "\"start\" : \"$.dataInizioProgetto\"," + "\"end\" : \"$.dataFineProgetto\"}";
|
|
||||||
|
|
||||||
JSONObject sourceJsonTemplate = new JSONObject(template);
|
template = SessionUtil.getJSONTimelineTemplate(this.getThreadLocalRequest(), profileID);
|
||||||
com.jayway.jsonpath.Configuration conf = com.jayway.jsonpath.Configuration.defaultConfiguration();
|
|
||||||
com.jayway.jsonpath.Configuration conf2 = conf.addOptions(Option.ALWAYS_RETURN_LIST);
|
|
||||||
|
|
||||||
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
try {
|
||||||
List<Relationship> relationships = theProject.getRelationships();
|
|
||||||
|
|
||||||
if (relationships == null || relationships.size() == 0)
|
if (template == null) {
|
||||||
return new ArrayList<String>();
|
|
||||||
|
|
||||||
// Adding the input document
|
List<HandlerDeclaration> timelineHandlers = useCaseDescriptors().build().getById(profileID)
|
||||||
DocumentContext targetDoc = JsonPath.using(conf2).parse(theProject.getTheDocument().toJson());
|
.getHandlersByType(GEOPORTAL_DATA_HANDLER.geoportal_timeline_json_template.getType());
|
||||||
|
|
||||||
JSONObject targetJsonObject = toTimelineJSONModel(targetDoc, sourceJsonTemplate, profileID, projectID,
|
if (timelineHandlers != null && timelineHandlers.size() > 0) {
|
||||||
null);
|
HandlerDeclaration handler = timelineHandlers.get(0); // only one expected
|
||||||
|
Document config = handler.getConfiguration();
|
||||||
targetJsonObject.put("selected", "from here");
|
LinkedHashMap<String, Object> tjtDoc = (LinkedHashMap<String, Object>) config
|
||||||
String theJSONResult = targetJsonObject.toString();
|
.get(TIMELINE_CONFIG_TJT_DOCUMENT);
|
||||||
LOG.debug("Base jsonObject " + theJSONResult);
|
template = new Document(tjtDoc).toJson();
|
||||||
listJSON.add(theJSONResult);
|
LOG.info(TIMELINE_CONFIG_TJT_DOCUMENT + " read is: " + template);
|
||||||
|
SessionUtil.setJSONTimelineTemplate(this.getThreadLocalRequest(), profileID, template);
|
||||||
// Adding the relationships
|
}
|
||||||
for (Relationship relationship : relationships) {
|
|
||||||
|
|
||||||
// Adding the first level of the related project
|
|
||||||
theProject = GeoportalClientCaller.projects().getProjectByID(relationship.getTargetUCD(),
|
|
||||||
relationship.getTargetID());
|
|
||||||
targetDoc = JsonPath.using(conf2).parse(theProject.getTheDocument().toJson());
|
|
||||||
targetJsonObject = toTimelineJSONModel(targetDoc, sourceJsonTemplate, relationship.getTargetUCD(),
|
|
||||||
relationship.getTargetID(), relationship.getRelationshipName());
|
|
||||||
theJSONResult = targetJsonObject.toString();
|
|
||||||
listJSON.add(theJSONResult);
|
|
||||||
|
|
||||||
LOG.debug("\n\ngetRelationshipsChain for " + relationship);
|
|
||||||
Iterator<RelationshipNavigationObject> iterator = GeoportalClientCaller.projects()
|
|
||||||
.getRelationshipChain(relationship.getTargetUCD(), relationship.getTargetID(),
|
|
||||||
relationship.getRelationshipName(), true);
|
|
||||||
// Adding deep > 1
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
RelationshipNavigationObject nav = (RelationshipNavigationObject) iterator.next();
|
|
||||||
listJSON = visitRelationshipsChain(nav, relationship.getRelationshipName(), listJSON, conf2,
|
|
||||||
sourceJsonTemplate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.debug("Finally list of jsonObject " + listJSON);
|
} catch (Exception e) {
|
||||||
|
LOG.warn(GEOPORTAL_DATA_HANDLER.geoportal_timeline_json_template.getType()
|
||||||
|
+ " not found!!! Timeline cannot be available");
|
||||||
|
}
|
||||||
|
// String template = "{\"content\": \"$.nome\"," + "\"title\": \"$.nome\","
|
||||||
|
// + "\"start\" : \"$.dataInizioProgetto\"," + "\"end\" : \"$.dataFineProgetto\"}";
|
||||||
|
|
||||||
|
if (template != null) {
|
||||||
|
|
||||||
|
JSONObject sourceJsonTemplate = new JSONObject(template);
|
||||||
|
com.jayway.jsonpath.Configuration conf = com.jayway.jsonpath.Configuration.defaultConfiguration();
|
||||||
|
com.jayway.jsonpath.Configuration conf2 = conf.addOptions(Option.ALWAYS_RETURN_LIST);
|
||||||
|
|
||||||
|
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
||||||
|
List<Relationship> relationships = theProject.getRelationships();
|
||||||
|
|
||||||
|
if (relationships == null || relationships.size() == 0)
|
||||||
|
return new ArrayList<String>();
|
||||||
|
|
||||||
|
// Adding the input document
|
||||||
|
DocumentContext targetDoc = JsonPath.using(conf2).parse(theProject.getTheDocument().toJson());
|
||||||
|
|
||||||
|
JSONObject targetJsonObject = toTimelineJSONModel(targetDoc, sourceJsonTemplate, profileID,
|
||||||
|
projectID, null);
|
||||||
|
|
||||||
|
targetJsonObject.put("selected", "from here");
|
||||||
|
String theJSONResult = targetJsonObject.toString();
|
||||||
|
LOG.debug("Base jsonObject " + theJSONResult);
|
||||||
|
listJSON.add(theJSONResult);
|
||||||
|
|
||||||
|
// Adding the relationships
|
||||||
|
for (Relationship relationship : relationships) {
|
||||||
|
|
||||||
|
// Adding the first level of the related project
|
||||||
|
theProject = GeoportalClientCaller.projects().getProjectByID(relationship.getTargetUCD(),
|
||||||
|
relationship.getTargetID());
|
||||||
|
targetDoc = JsonPath.using(conf2).parse(theProject.getTheDocument().toJson());
|
||||||
|
targetJsonObject = toTimelineJSONModel(targetDoc, sourceJsonTemplate,
|
||||||
|
relationship.getTargetUCD(), relationship.getTargetID(),
|
||||||
|
relationship.getRelationshipName());
|
||||||
|
theJSONResult = targetJsonObject.toString();
|
||||||
|
listJSON.add(theJSONResult);
|
||||||
|
|
||||||
|
LOG.debug("\n\ngetRelationshipsChain for " + relationship);
|
||||||
|
Iterator<RelationshipNavigationObject> iterator = GeoportalClientCaller.projects()
|
||||||
|
.getRelationshipChain(relationship.getTargetUCD(), relationship.getTargetID(),
|
||||||
|
relationship.getRelationshipName(), true);
|
||||||
|
// Adding deep > 1
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
RelationshipNavigationObject nav = (RelationshipNavigationObject) iterator.next();
|
||||||
|
listJSON = visitRelationshipsChain(nav, relationship.getRelationshipName(), listJSON, conf2,
|
||||||
|
sourceJsonTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.debug("Finally list of jsonObject " + listJSON);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String erroMsg = "Error occurred on reading relatioships for id: " + projectID;
|
String erroMsg = "Error occurred on reading relatioships for id: " + projectID;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
|
@ -35,7 +36,7 @@ import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
* Oct 20, 2020
|
* Oct 20, 2020
|
||||||
*/
|
*/
|
||||||
public class SessionUtil {
|
public class SessionUtil {
|
||||||
|
|
||||||
private static final String MAP_UCD_ID_TO_GCUBE_PROFILES = "MAP_UCD_ID_TO_GCUBE_PROFILES";
|
private static final String MAP_UCD_ID_TO_GCUBE_PROFILES = "MAP_UCD_ID_TO_GCUBE_PROFILES";
|
||||||
|
|
||||||
/** The log. */
|
/** The log. */
|
||||||
|
@ -43,9 +44,11 @@ public class SessionUtil {
|
||||||
|
|
||||||
private static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
private static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
||||||
private static final String LIST_BASE_MAPS_LAYERS = "LIST_BASE_MAPS_LAYERS";
|
private static final String LIST_BASE_MAPS_LAYERS = "LIST_BASE_MAPS_LAYERS";
|
||||||
|
private static final String TIMELINE_JSON_TEMPLATE = "TIMELINE_JSON_TEMPLATE";
|
||||||
|
private static final String USE_CASE_DESCRIPTOR = "USE_CASE_DESCRIPTOR";
|
||||||
private static final String LIST_OF_CONCESSIONI = "LIST_OF_CONCESSIONI_DATA_VIEWER";
|
private static final String LIST_OF_CONCESSIONI = "LIST_OF_CONCESSIONI_DATA_VIEWER";
|
||||||
private static final String GNA_DATAVIEWER_CONFIG_PROFILE = "GNA_DATAVIEWER_CONFIG_PROFILE";
|
private static final String GNA_DATAVIEWER_CONFIG_PROFILE = "GNA_DATAVIEWER_CONFIG_PROFILE";
|
||||||
|
|
||||||
private static final String COUNT_DOCS_FOR_PROFILE_ID = "GNA_DATAVIEWER_COUNT_DOCS_FOR_PROFILE_ID";
|
private static final String COUNT_DOCS_FOR_PROFILE_ID = "GNA_DATAVIEWER_COUNT_DOCS_FOR_PROFILE_ID";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -181,7 +184,7 @@ public class SessionUtil {
|
||||||
|
|
||||||
return shortener;
|
return shortener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the GNA base maps.
|
* Gets the GNA base maps.
|
||||||
*
|
*
|
||||||
|
@ -206,6 +209,55 @@ public class SessionUtil {
|
||||||
return lstBML;
|
return lstBML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the JSON timeline template.
|
||||||
|
*
|
||||||
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @return the JSON timeline template
|
||||||
|
*/
|
||||||
|
public static String getJSONTimelineTemplate(HttpServletRequest httpServletRequest, String profileID) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
return (String) session.getAttribute(TIMELINE_JSON_TEMPLATE + profileID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the JSON timeline template.
|
||||||
|
*
|
||||||
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @param jsonTimelineTemplate the json timeline template
|
||||||
|
*/
|
||||||
|
public static void setJSONTimelineTemplate(HttpServletRequest httpServletRequest, String profileID,
|
||||||
|
String jsonTimelineTemplate) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
session.setAttribute(TIMELINE_JSON_TEMPLATE + profileID, jsonTimelineTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the UCD for id.
|
||||||
|
*
|
||||||
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @return the UCD for id
|
||||||
|
*/
|
||||||
|
public static UseCaseDescriptor getUCDForId(HttpServletRequest httpServletRequest, String profileID) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
return (UseCaseDescriptor) session.getAttribute(USE_CASE_DESCRIPTOR + profileID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the UCD for id.
|
||||||
|
*
|
||||||
|
* @param httpServletRequest the http servlet request
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @param ucd the ucd
|
||||||
|
*/
|
||||||
|
public static void setUCDForId(HttpServletRequest httpServletRequest, String profileID, UseCaseDescriptor ucd) {
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
session.setAttribute(USE_CASE_DESCRIPTOR + profileID, ucd);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of concessioni.
|
* Gets the list of concessioni.
|
||||||
*
|
*
|
||||||
|
@ -220,36 +272,32 @@ public class SessionUtil {
|
||||||
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
||||||
throw new Exception("getListConcessioni must be revisited!!!!");
|
throw new Exception("getListConcessioni must be revisited!!!!");
|
||||||
/*
|
/*
|
||||||
// setting null to force reloading from service
|
* // setting null to force reloading from service if (reloadFromService)
|
||||||
if (reloadFromService)
|
* listOfConcessioni = null;
|
||||||
listOfConcessioni = null;
|
*
|
||||||
|
* if (listOfConcessioni == null) { listOfConcessioni = new
|
||||||
if (listOfConcessioni == null) {
|
* ArrayList<Concessione>();
|
||||||
listOfConcessioni = new ArrayList<Concessione>();
|
* LOG.info("Loading list of concessione from client mongo");
|
||||||
LOG.info("Loading list of concessione from client mongo");
|
* SessionUtil.getCurrentContext(httpServletRequest, true); MongoServiceCommon
|
||||||
SessionUtil.getCurrentContext(httpServletRequest, true);
|
* serviceUtil = new MongoServiceCommon(); MongoConcessioni clientMongo =
|
||||||
MongoServiceCommon serviceUtil = new MongoServiceCommon();
|
* serviceUtil.getInstanceMongoConcessioni();
|
||||||
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
*
|
||||||
|
* Iterator<Concessione> concessioni = clientMongo.getList(); if (concessioni !=
|
||||||
Iterator<Concessione> concessioni = clientMongo.getList();
|
* null) { while (concessioni.hasNext()) { Concessione concessione =
|
||||||
if (concessioni != null) {
|
* (Concessione) concessioni.next(); listOfConcessioni.add(concessione);
|
||||||
while (concessioni.hasNext()) {
|
*
|
||||||
Concessione concessione = (Concessione) concessioni.next();
|
* } } // LOG.debug("Got list of concessioni from client mongo: " +
|
||||||
listOfConcessioni.add(concessione);
|
* listOfConcessioni); session.setAttribute(LIST_OF_CONCESSIONI,
|
||||||
|
* listOfConcessioni);
|
||||||
}
|
* LOG.info("Saved in session list of concessioni from client mongo with size: "
|
||||||
}
|
* + listOfConcessioni.size());
|
||||||
// LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
*
|
||||||
session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
* } else LOG.info("list of concessioni presents in session, using it");
|
||||||
LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
*
|
||||||
|
* LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
||||||
} else
|
* return listOfConcessioni;
|
||||||
LOG.info("list of concessioni presents in session, using it");
|
*
|
||||||
|
*/
|
||||||
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
|
||||||
return listOfConcessioni;
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -274,8 +322,7 @@ public class SessionUtil {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
session.setAttribute(GNA_DATAVIEWER_CONFIG_PROFILE, gNADVConfigProfile);
|
session.setAttribute(GNA_DATAVIEWER_CONFIG_PROFILE, gNADVConfigProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the total document for profile ID.
|
* Gets the total document for profile ID.
|
||||||
*
|
*
|
||||||
|
@ -302,4 +349,5 @@ public class SessionUtil {
|
||||||
session.setAttribute(COUNT_DOCS_FOR_PROFILE_ID + theProfileID, countForProfileId);
|
session.setAttribute(COUNT_DOCS_FOR_PROFILE_ID + theProfileID, countForProfileId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue