|
|
|
@ -23,7 +23,6 @@ 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.RelationshipNavigationObject;
|
|
|
|
|
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.rest.Projects;
|
|
|
|
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
|
|
|
@ -46,6 +45,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.materialization.In
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.IdentificationReferencesTYPE;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
|
|
|
@ -81,9 +81,6 @@ import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|
|
|
|
import com.jayway.jsonpath.DocumentContext;
|
|
|
|
|
import com.jayway.jsonpath.JsonPath;
|
|
|
|
|
import com.jayway.jsonpath.Option;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The server side implementation of the RPC service.
|
|
|
|
@ -95,11 +92,13 @@ import com.jayway.jsonpath.Option;
|
|
|
|
|
@SuppressWarnings("serial")
|
|
|
|
|
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements GeoportalDataViewerService {
|
|
|
|
|
|
|
|
|
|
private static final String TIMELINE_CONFIG_TJT_DOCUMENT = "tjt_document";
|
|
|
|
|
// private static final String TIMELINE_CONFIG_TJT_DOCUMENT =
|
|
|
|
|
// UseCaseDescriptorCaller.TIMELINE_CONFIG_TJT_DOCUMENT;
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Enum COMMON_IMAGES_FORMAT.
|
|
|
|
@ -848,12 +847,75 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
|
|
|
|
|
theProjectDV.setProfileName(ucd.getName());
|
|
|
|
|
|
|
|
|
|
TemporalReferenceDV temporalReference = temporalReferenceForProject(theProject);
|
|
|
|
|
if (temporalReference == null)
|
|
|
|
|
temporalReference = new TemporalReferenceDV();
|
|
|
|
|
theProjectDV.setTemporalReference(temporalReference);
|
|
|
|
|
|
|
|
|
|
ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, scope, userName);
|
|
|
|
|
|
|
|
|
|
if (LOG.isTraceEnabled()) {
|
|
|
|
|
Geoportal_JSON_Mapper.prettyPrintProjectView(projectView);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOG.info("returning project view for id: " + projectView.getTheProjectDV().getId());
|
|
|
|
|
return projectView;
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
String erroMsg = "Error occurred on creating projectView for id: " + projectID;
|
|
|
|
|
LOG.error(erroMsg, e);
|
|
|
|
|
throw new Exception(erroMsg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the project edit for id.
|
|
|
|
|
*
|
|
|
|
|
* @param profileID the profile ID
|
|
|
|
|
* @param projectID the project ID
|
|
|
|
|
* @return the project edit for id
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
public ProjectView getProjectEditForId(String profileID, String projectID) throws Exception {
|
|
|
|
|
LOG.info("getProjectEditForId profileID: " + profileID + ", projectID: " + projectID + ", called");
|
|
|
|
|
|
|
|
|
|
if (profileID == null || projectID == null)
|
|
|
|
|
throw new Exception("Invalid parameter. Either profileID or projectID is null");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
String scope = SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
|
|
|
|
String userName = null;
|
|
|
|
|
try {
|
|
|
|
|
userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOG.info("User not found in session, the userName for cecking policy will be null");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOG.info("Trying to get project for id " + profileID);
|
|
|
|
|
|
|
|
|
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
|
|
|
|
projectBuilder.relationships(true);
|
|
|
|
|
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
|
|
|
|
|
theProjectDV.setProfileName(ucd.getName());
|
|
|
|
|
|
|
|
|
|
ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, scope, userName);
|
|
|
|
|
|
|
|
|
|
if (LOG.isTraceEnabled()) {
|
|
|
|
|
Geoportal_JSON_Mapper.prettyPrintProjectView(projectView);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOG.info("returning project view for id: " + projectView.getTheProjectDV().getId());
|
|
|
|
|
return projectView;
|
|
|
|
@ -939,6 +1001,18 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
ProjectDV projectDV = minimalProjectDV(profileID, projectID, true, 2);
|
|
|
|
|
layerObject.setProjectDV(projectDV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (layerObject.getProjectDV().getTemporalReference() == null) {
|
|
|
|
|
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID,
|
|
|
|
|
projectID);
|
|
|
|
|
TemporalReferenceDV temporalReferenceDV = temporalReferenceForProject(theProject);
|
|
|
|
|
// Empty TemporalReferenceDV
|
|
|
|
|
if (temporalReferenceDV == null)
|
|
|
|
|
temporalReferenceDV = new TemporalReferenceDV();
|
|
|
|
|
|
|
|
|
|
layerObject.getProjectDV().setTemporalReference(temporalReferenceDV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -984,6 +1058,17 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (layerObject.getProjectDV().getTemporalReference() == null) {
|
|
|
|
|
Project theProject = GeoportalClientCaller.projects()
|
|
|
|
|
.getProjectByID(layerObject.getProfileID(), layerObject.getProjectID());
|
|
|
|
|
TemporalReferenceDV temporalReferenceDV = temporalReferenceForProject(theProject);
|
|
|
|
|
// Empty TemporalReferenceDV
|
|
|
|
|
if (temporalReferenceDV == null)
|
|
|
|
|
temporalReferenceDV = new TemporalReferenceDV();
|
|
|
|
|
|
|
|
|
|
layerObject.getProjectDV().setTemporalReference(temporalReferenceDV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LOG.debug("Case PROJECT_LAYER/GENERIC_LAYER setting layerObject: " + layerObject);
|
|
|
|
|
geoDAO.setSourceLayerObject(layerObject);
|
|
|
|
|
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
|
|
|
@ -1012,8 +1097,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
/**
|
|
|
|
|
* Minimal project DV.
|
|
|
|
|
*
|
|
|
|
|
* @param profileID the profile ID
|
|
|
|
|
* @param projectID the project ID
|
|
|
|
|
* @param profileID the profile ID
|
|
|
|
|
* @param projectID the project ID
|
|
|
|
|
* @param loadDocument the load document
|
|
|
|
|
* @param limitDocumentEntries the limit document entries
|
|
|
|
|
* @return the project DV
|
|
|
|
|
*/
|
|
|
|
|
private ProjectDV minimalProjectDV(String profileID, String projectID, boolean loadDocument,
|
|
|
|
@ -1029,7 +1116,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useCaseDescriptors().build().query(request).forEachRemaining(u -> {
|
|
|
|
|
try {
|
|
|
|
|
LOG.debug("UCD for id" + u.getId() + " returend name: " + u.getName());
|
|
|
|
@ -1098,9 +1185,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
LinkedHashMap<String, Object> documentAsMap = new LinkedHashMap<String, Object>(limit);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
@ -1148,6 +1235,14 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
return documentAsMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the relationships for timeline.
|
|
|
|
|
*
|
|
|
|
|
* @param profileID the profile ID
|
|
|
|
|
* @param projectID the project ID
|
|
|
|
|
* @return the relationships for timeline
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getRelationshipsForTimeline(String profileID, String projectID) throws Exception {
|
|
|
|
|
if (profileID == null || projectID == null)
|
|
|
|
@ -1166,17 +1261,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if (template == null) {
|
|
|
|
|
|
|
|
|
|
List<HandlerDeclaration> timelineHandlers = useCaseDescriptors().build().getById(profileID)
|
|
|
|
|
.getHandlersByType(GEOPORTAL_DATA_HANDLER.geoportal_timeline_json_template.getType());
|
|
|
|
|
|
|
|
|
|
if (timelineHandlers != null && timelineHandlers.size() > 0) {
|
|
|
|
|
HandlerDeclaration handler = timelineHandlers.get(0); // only one expected
|
|
|
|
|
Document config = handler.getConfiguration();
|
|
|
|
|
LinkedHashMap<String, Object> tjtDoc = (LinkedHashMap<String, Object>) config
|
|
|
|
|
.get(TIMELINE_CONFIG_TJT_DOCUMENT);
|
|
|
|
|
template = new Document(tjtDoc).toJson();
|
|
|
|
|
LOG.info(TIMELINE_CONFIG_TJT_DOCUMENT + " read is: " + template);
|
|
|
|
|
Document temporalJsonTemplate = GeoportalClientCaller.useCaseDescriptors()
|
|
|
|
|
.readTemporalDimensionTemplate(profileID);
|
|
|
|
|
if (temporalJsonTemplate != null) {
|
|
|
|
|
template = new Document(temporalJsonTemplate).toJson();
|
|
|
|
|
LOG.info(UseCaseDescriptorCaller.TIMELINE_CONFIG_TJT_DOCUMENT + " read is: " + template);
|
|
|
|
|
SessionUtil.setJSONTimelineTemplate(this.getThreadLocalRequest(), profileID, template);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1191,8 +1280,6 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
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();
|
|
|
|
@ -1200,11 +1287,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
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);
|
|
|
|
|
JSONObject targetJsonObject = toTimelineWithImageJSONModel(theProject, sourceJsonTemplate,
|
|
|
|
|
profileID, projectID, null);
|
|
|
|
|
|
|
|
|
|
targetJsonObject.put("selected", "from here");
|
|
|
|
|
String theJSONResult = targetJsonObject.toString();
|
|
|
|
@ -1217,8 +1301,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
// 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,
|
|
|
|
|
targetJsonObject = toTimelineWithImageJSONModel(theProject, sourceJsonTemplate,
|
|
|
|
|
relationship.getTargetUCD(), relationship.getTargetID(),
|
|
|
|
|
relationship.getRelationshipName());
|
|
|
|
|
theJSONResult = targetJsonObject.toString();
|
|
|
|
@ -1231,7 +1314,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
// Adding deep > 1
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
|
RelationshipNavigationObject nav = (RelationshipNavigationObject) iterator.next();
|
|
|
|
|
listJSON = visitRelationshipsChain(nav, relationship.getRelationshipName(), listJSON, conf2,
|
|
|
|
|
listJSON = visitRelationshipsChain(nav, relationship.getRelationshipName(), listJSON,
|
|
|
|
|
sourceJsonTemplate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1247,16 +1330,24 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
LOG.debug("returning list of relantionships having size: " + listJSON.size());
|
|
|
|
|
return listJSON;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
String erroMsg = "Error occurred on reading relatioships for id: " + projectID;
|
|
|
|
|
String erroMsg = "Error occurred on reading relationships for id: " + projectID;
|
|
|
|
|
LOG.error(erroMsg, e);
|
|
|
|
|
throw new Exception(erroMsg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Visit relationships chain.
|
|
|
|
|
*
|
|
|
|
|
* @param nav the nav
|
|
|
|
|
* @param relationshipName the relationship name
|
|
|
|
|
* @param listJSONTimelineModel the list JSON timeline model
|
|
|
|
|
* @param sourceJsonTemplate the source json template
|
|
|
|
|
* @return the list
|
|
|
|
|
*/
|
|
|
|
|
// recursive visit of the Relationships
|
|
|
|
|
public List<String> visitRelationshipsChain(RelationshipNavigationObject nav, String relationshipName,
|
|
|
|
|
List<String> listJSONTimelineModel, com.jayway.jsonpath.Configuration conf2,
|
|
|
|
|
JSONObject sourceJsonTemplate) {
|
|
|
|
|
List<String> listJSONTimelineModel, JSONObject sourceJsonTemplate) {
|
|
|
|
|
|
|
|
|
|
if (nav == null)
|
|
|
|
|
return listJSONTimelineModel;
|
|
|
|
@ -1271,8 +1362,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
Project targetProject = nav.getTarget();
|
|
|
|
|
DocumentContext targetDoc = JsonPath.using(conf2).parse(targetProject.getTheDocument().toJson());
|
|
|
|
|
JSONObject targetJsonObject = toTimelineJSONModel(targetDoc, sourceJsonTemplate,
|
|
|
|
|
JSONObject targetJsonObject = toTimelineWithImageJSONModel(targetProject, sourceJsonTemplate,
|
|
|
|
|
nav.getTarget().getProfileID(), nav.getTarget().getId(), relationshipName);
|
|
|
|
|
String theJSONResult = targetJsonObject.toString();
|
|
|
|
|
listJSONTimelineModel.add(theJSONResult);
|
|
|
|
@ -1285,44 +1375,32 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
LOG.debug("visiting children...");
|
|
|
|
|
for (RelationshipNavigationObject relationship : nav.getChildren()) {
|
|
|
|
|
listJSONTimelineModel = visitRelationshipsChain(relationship, relationshipName, listJSONTimelineModel,
|
|
|
|
|
conf2, sourceJsonTemplate);
|
|
|
|
|
sourceJsonTemplate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return listJSONTimelineModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private JSONObject toTimelineJSONModel(DocumentContext targetDoc, JSONObject sourceJsonTemplate, String targetUCD,
|
|
|
|
|
String targetProjectID, String relationName) {
|
|
|
|
|
JSONObject targetJsonObject = new JSONObject();
|
|
|
|
|
|
|
|
|
|
targetJsonObject.put("id", targetUCD + "," + targetProjectID);
|
|
|
|
|
/**
|
|
|
|
|
* To timeline with image JSON model.
|
|
|
|
|
*
|
|
|
|
|
* @param theProject the the project
|
|
|
|
|
* @param sourceJsonTemplate the source json template
|
|
|
|
|
* @param targetUCD the target UCD
|
|
|
|
|
* @param targetID the target ID
|
|
|
|
|
* @param relationName the relation name
|
|
|
|
|
* @return the JSON object
|
|
|
|
|
*/
|
|
|
|
|
private JSONObject toTimelineWithImageJSONModel(Project theProject, JSONObject sourceJsonTemplate, String targetUCD,
|
|
|
|
|
String targetID, String relationName) {
|
|
|
|
|
|
|
|
|
|
if (relationName != null)
|
|
|
|
|
targetJsonObject.put("relationship_name", relationName);
|
|
|
|
|
JSONObject targetJsonObject = ConvertToDataValueObjectModel.toTimelineJSONModel(theProject, sourceJsonTemplate,
|
|
|
|
|
targetUCD, targetID, relationName);
|
|
|
|
|
|
|
|
|
|
for (Object key : sourceJsonTemplate.keySet()) {
|
|
|
|
|
String jsonPath = null;
|
|
|
|
|
String theKey = null;
|
|
|
|
|
try {
|
|
|
|
|
theKey = key + "";
|
|
|
|
|
LOG.debug("Searching key: " + theKey);
|
|
|
|
|
jsonPath = sourceJsonTemplate.getString(theKey);
|
|
|
|
|
LOG.debug("with key: " + theKey + " read JSON path: " + jsonPath);
|
|
|
|
|
List<String> listValue = targetDoc.read(jsonPath);
|
|
|
|
|
String result = "";
|
|
|
|
|
for (int i = 0; i < listValue.size() - 1; i++) {
|
|
|
|
|
result += listValue.get(i) + ", ";
|
|
|
|
|
}
|
|
|
|
|
result += listValue.get(listValue.size() - 1);
|
|
|
|
|
targetJsonObject.put(theKey, result);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOG.trace("Error on setting key: {}, path: {}", theKey, jsonPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<PayloadDV> images = null;
|
|
|
|
|
try {
|
|
|
|
|
images = getImagesForId(targetUCD, targetProjectID, true);
|
|
|
|
|
images = getImagesForId(theProject.getProfileID(), theProject.getId(), true);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1335,4 +1413,59 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Temporal reference for project.
|
|
|
|
|
*
|
|
|
|
|
* @param theProject the the project
|
|
|
|
|
* @return the temporal reference DV
|
|
|
|
|
*/
|
|
|
|
|
private TemporalReferenceDV temporalReferenceForProject(Project theProject) {
|
|
|
|
|
LOG.trace("temporalReference for profileID: " + theProject.getProfileID() + ", projectID: "
|
|
|
|
|
+ theProject.getId() + "called");
|
|
|
|
|
String template = null;
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
|
|
|
|
template = SessionUtil.getJSONTimelineTemplate(this.getThreadLocalRequest(), theProject.getProfileID());
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if (template == null) {
|
|
|
|
|
|
|
|
|
|
Document temporalJsonTemplate = GeoportalClientCaller.useCaseDescriptors()
|
|
|
|
|
.readTemporalDimensionTemplate(theProject.getProfileID());
|
|
|
|
|
|
|
|
|
|
if (temporalJsonTemplate != null) {
|
|
|
|
|
template = new Document(temporalJsonTemplate).toJson();
|
|
|
|
|
LOG.info(UseCaseDescriptorCaller.TIMELINE_CONFIG_TJT_DOCUMENT + " read is: " + template);
|
|
|
|
|
SessionUtil.setJSONTimelineTemplate(this.getThreadLocalRequest(), theProject.getProfileID(),
|
|
|
|
|
template);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} 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);
|
|
|
|
|
JSONObject targetJsonObject = ConvertToDataValueObjectModel.toTimelineJSONModel(theProject,
|
|
|
|
|
sourceJsonTemplate, theProject.getProfileID(), theProject.getId(), null);
|
|
|
|
|
|
|
|
|
|
return ConvertToDataValueObjectModel.toTemporalReferenceDV(theProject, targetJsonObject);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
String erroMsg = "Error occurred on reading temporalReference for id: " + theProject.getId();
|
|
|
|
|
LOG.warn(erroMsg, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|