#24136 Integrated the temporal dimension on the front-end side

This commit is contained in:
Francesco Mangiacrapa 2022-11-17 11:53:11 +01:00
parent d7de30ea5d
commit 2ff7473ec9
14 changed files with 322 additions and 46 deletions

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -62,7 +65,10 @@
<wb-module deploy-name="geoportal-data-entry-app-3.0.0-SNAPSHOT">
@ -125,7 +131,10 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -188,7 +197,10 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -251,7 +263,10 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -266,10 +281,10 @@
<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>
@ -332,7 +347,10 @@
<property name="context-root" value="geoportal-data-entry-app"/>
@ -395,7 +413,10 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -458,7 +479,10 @@
</wb-module>

View File

@ -161,6 +161,12 @@
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>

View File

@ -9,6 +9,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescrip
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.ui.RootPanel;
/**
@ -45,6 +46,8 @@ public class ConstantsGeoPortalDataEntryApp {
public static final String CSS_CLASS_GEOPORTAL_LOADERS_CENTER = "geoportal-loaders-center";
public static final String WORKFLOW_ACTION_POST_CREATION_ACTION_ID = "post_creation_action";
public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy");
/**
* The Enum ACTION_PERFORMED_ON_ITEM.

View File

@ -782,7 +782,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
// CacheSearchingFilterParametersFromConfig seachingFilterParameters = geoportalCaches
// .getFilterParametersForProfileId(getListOfRecordsEvent.getProfileID());
String profileID = getListOfRecordsEvent.getProfileID();
final String profileID = getListOfRecordsEvent.getProfileID();
if (profileID == null) {
new DialogInform(null, "Error", "No Use Case Descriptor selected").center();
return;

View File

@ -9,6 +9,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
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.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
@ -189,4 +190,13 @@ public interface GeoportalDataEntryService extends RemoteService {
ResultDocumentDV deleteRelationship(String fromProfileID, String fromProjectID, String id, String toProfileID,
String toProjectID) throws Exception;
/**
* Temporal reference for project.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the temporal reference DV
*/
TemporalReferenceDV temporalReferenceForProject(String profileID, String projectID);
}

View File

@ -9,6 +9,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
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.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
@ -85,4 +86,6 @@ public interface GeoportalDataEntryServiceAsync {
void deleteRelationship(String fromProfileID, String fromProjectID, String id, String toProfileID,
String toProjectID, AsyncCallback<ResultDocumentDV> asyncCallback);
void temporalReferenceForProject(String profileID, String projectID, AsyncCallback<TemporalReferenceDV> callback);
}

View File

@ -18,8 +18,8 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginate
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Dropdown;
import com.github.gwtbootstrap.client.ui.Hero;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
@ -83,7 +83,7 @@ public class ListOfProjectTablePanel extends Composite {
Dropdown ddProjectType;
@UiField
Paragraph noProjectSelectionMessage;
Hero noProjectSelectionMessage;
private CacheSearchingFilterParametersFromConfig cacheSearchingFilterParameters;
@ -317,10 +317,10 @@ public class ListOfProjectTablePanel extends Composite {
@Override
public void execute() {
noProjectSelectionMessage.setVisible(true);
//noProjectSelectionMessage.setVisible(true);
// SELECTION on the first item
if (ucdProjectTypesForListingDataView.size() > 0) {
noProjectSelectionMessage.setVisible(false);
//noProjectSelectionMessage.setVisible(false);
UseCaseDescriptorDV singleUCD = ucdProjectTypesForListingDataView.get(0);
alertProjectType.setText(singleUCD.getName());
// setFilteringParameters(displayFields, sortByFields, searchForFields,
@ -420,12 +420,13 @@ public class ListOfProjectTablePanel extends Composite {
}
public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) {
GWT.log("showListOfProjectsView for: "+grpw);
this.grpw = grpw;
geonaListOfRecordsPanel.clear();
VerticalPanel htmllPanel = new VerticalPanel();
htmllPanel.add(grpw.getCellPanel());
htmllPanel.add(grpw.getPagerPanel());
geonaListOfRecordsPanel.add(htmllPanel);
VerticalPanel verticalPanel = new VerticalPanel();
verticalPanel.add(this.grpw.getCellPanel());
verticalPanel.add(this.grpw.getPagerPanel());
geonaListOfRecordsPanel.add(verticalPanel);
}
/**

View File

@ -79,7 +79,9 @@
<a href="#bottomPage2">Go to bottom</a>
</g:HTMLPanel>
<g:HTMLPanel ui:field="geonaListOfRecordsPanel">
<b:Paragraph ui:field="noProjectSelectionMessage">select "Project Type"</b:Paragraph>
<b:Hero ui:field="noProjectSelectionMessage">
<b:Paragraph>select "Project Type"</b:Paragraph>
</b:Hero>
</g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="bottomPage2"></div>

View File

@ -5,12 +5,15 @@ import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.RelationActionHandlerEvent;
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
@ -25,7 +28,9 @@ import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
@ -77,7 +82,7 @@ public class CreateRelationProjectsPanel extends Composite {
@UiField
Alert alertMessage;
private Map<String, RelationshipDefinitionDV> mapRelationsDefiniton = new HashMap<String, RelationshipDefinitionDV>();
private HashMap<Integer, ResultDocumentDV> selectedProjects = new HashMap<Integer, ResultDocumentDV>(2);
@ -171,11 +176,12 @@ public class CreateRelationProjectsPanel extends Composite {
boolean isValidForm = checkFormPassed();
if (isValidForm) {
buttCreateRelation.setEnabled(false);
RelationshipDefinitionDV relationSelected = mapRelationsDefiniton.get(listBoxRelationNames.getSelectedValue());
appManagerBus.fireEvent(new RelationActionHandlerEvent(selectedProjects.get(0),
relationSelected, selectedProjects.get(1)));
RelationshipDefinitionDV relationSelected = mapRelationsDefiniton
.get(listBoxRelationNames.getSelectedValue());
appManagerBus.fireEvent(new RelationActionHandlerEvent(selectedProjects.get(0), relationSelected,
selectedProjects.get(1)));
}
}
@ -216,23 +222,23 @@ public class CreateRelationProjectsPanel extends Composite {
public void selectedProject(ResultDocumentDV project) {
ResultDocumentDV first = selectedProjects.get(0);
// String htmlMsg = "Selected";
// htmlMsg += "<ul>";
// htmlMsg += "<li>id: " + project.getId() + "</li>";
// htmlMsg += "<li>"+project.getFirstEntryOfMap().getKey()+": " + project.getFirstEntryOfMap().getValue() + "</li>";
// htmlMsg += "</ul>";
String htmlMsg = "Selected: <b>" + project.getFirstEntryOfMap().getValue() + "</b> (id: " + project.getId()
+ ")";
if (first == null) {
firstItemAlert.setVisible(false);
selectedProjects.put(0, project);
firstProjectPanelContainer.add(new HTML(htmlMsg));
FlexTable flex = new FlexTable();
flex.setWidget(0, 0, new HTML(htmlMsg));
FlowPanel temporalContainer = new FlowPanel();
flex.setWidget(1, 0, temporalContainer);
firstProjectPanelContainer.add(flex);
addTemportalReferenceToPanel(temporalContainer, project.getProfileID(), project.getProjectID());
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
rtth.showAsJSON(false);
firstProjectPanelContainer.add(rtth);
return;
}
@ -241,7 +247,12 @@ public class CreateRelationProjectsPanel extends Composite {
if (second == null) {
secondItemAlert.setVisible(false);
selectedProjects.put(1, project);
secondProjectPanelContainer.add(new HTML(htmlMsg));
FlexTable flex = new FlexTable();
flex.setWidget(0, 0, new HTML(htmlMsg));
FlowPanel temporalContainer = new FlowPanel();
flex.setWidget(1, 0, temporalContainer);
addTemportalReferenceToPanel(temporalContainer, project.getProfileID(), project.getProjectID());
secondProjectPanelContainer.add(flex);
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
rtth.showAsJSON(false);
secondProjectPanelContainer.add(rtth);
@ -249,4 +260,25 @@ public class CreateRelationProjectsPanel extends Composite {
}
private void addTemportalReferenceToPanel(final ComplexPanel panelContainer, String profileID, String projectID) {
GeoportalDataEntryServiceAsync.Util.getInstance().temporalReferenceForProject(profileID, projectID,
new AsyncCallback<TemporalReferenceDV>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(TemporalReferenceDV result) {
if (result != null) {
panelContainer.add(new HTML(HTMLUtil.toHTMLCode(result)));
}
}
});
}
}

View File

@ -6,10 +6,12 @@ import java.util.Map.Entry;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.RelationActionHandlerEvent;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import com.github.gwtbootstrap.client.ui.Button;
@ -27,6 +29,7 @@ import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
@ -70,10 +73,12 @@ public class ViewRelationshipPanel extends Composite {
private Map<String, ResultDocumentDV> mapOfTargetProjectForId = new HashMap<String, ResultDocumentDV>();
public ViewRelationshipPanel(HandlerManager appManagerBus, ResultDocumentDV fromProject, boolean showExpand) {
private ResultDocumentDV fromTheProject;
public ViewRelationshipPanel(HandlerManager appManagerBus, final ResultDocumentDV fromProject, boolean showExpand) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
this.fromTheProject = fromProject;
closeButton.setType(ButtonType.LINK);
closeButton.setIcon(IconType.REMOVE);
closeButton.setIconSize(IconSize.LARGE);
@ -96,18 +101,26 @@ public class ViewRelationshipPanel extends Composite {
Modal mw = new Modal(true, true);
mw.setTitle("Relationships");
mw.getElement().addClassName("no_modal_body_max_height");
int width = 0;
int heigth = 0;
try {
width = Window.getClientWidth() * 75 / 100;
heigth = Window.getClientHeight() * 75 / 100;
} catch (Exception e) {
// TODO: handle exception
}
if (width > 500)
if (width > 800) {
mw.setWidth(width);
}
if(heigth > 600) {
mw.setHeight(heigth+"px");
}
mw.add(new ViewRelationshipPanel(appManagerBus, fromProject, false));
mw.add(new ViewRelationshipPanel(appManagerBus, fromTheProject, false));
mw.show();
}
@ -125,12 +138,20 @@ public class ViewRelationshipPanel extends Composite {
public void showRelationsOf(ResultDocumentDV project) {
firstProjectPanelContainer.clear();
secondProjectPanelContainer.clear();
this.fromTheProject = project;
Entry<String, Object> firstEntrySet = project.getFirstEntryOfMap();
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
+ ")";
FlexTable flex = new FlexTable();
flex.setWidget(0, 0, new HTML(htmlMsg));
FlowPanel fromTemporalContainer = new FlowPanel();
flex.setWidget(1, 0, fromTemporalContainer);
firstProjectPanelContainer.add(flex);
addTemportalReferenceToPanel(fromTemporalContainer, project.getProfileID(), project.getProjectID());
firstProjectPanelContainer.add(new HTML(htmlMsg));
//firstProjectPanelContainer.add(new HTML(htmlMsg));
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
rtth.showAsJSON(false);
firstProjectPanelContainer.add(rtth);
@ -187,12 +208,15 @@ public class ViewRelationshipPanel extends Composite {
+ "</b> (id: " + result.getId() + ")";
flexTable.setWidget(1, 0, new HTML(htmlMsg));
FlowPanel toTemporalContainer = new FlowPanel();
flexTable.setWidget(2, 0, toTemporalContainer);
addTemportalReferenceToPanel(toTemporalContainer, result.getProfileID(), result.getProjectID());
ReportTemplateToHTML rtth2 = new ReportTemplateToHTML("", result.getDocumentAsJSON(),
false, false);
rtth2.showAsJSON(false);
flexTable.setWidget(2, 0, rtth2);
flexTable.setWidget(3, 0, rtth2);
}
});
@ -202,5 +226,26 @@ public class ViewRelationshipPanel extends Composite {
}
}
private void addTemportalReferenceToPanel(final ComplexPanel panelContainer, String profileID, String projectID) {
GeoportalDataEntryServiceAsync.Util.getInstance().temporalReferenceForProject(profileID, projectID,
new AsyncCallback<TemporalReferenceDV>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(TemporalReferenceDV result) {
if (result != null) {
panelContainer.add(new HTML(HTMLUtil.toHTMLCode(result)));
}
}
});
}
}

View File

@ -1,5 +1,8 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
/**
* The Class HTMLUtil.
*
@ -139,5 +142,29 @@ public class HTMLUtil {
}
}-*/;
public static String toHTMLCode(TemporalReferenceDV tempRef) {
String htmlCode = "<span class='display-date'>";
if (tempRef != null) {
String dateToString = "";
if (tempRef.getStart() != null) {
dateToString += ConstantsGeoPortalDataEntryApp.DATE_TIME_FORMAT.format(tempRef.getStart());
}
dateToString += " / ";
if (tempRef.getStart() != null) {
dateToString += ConstantsGeoPortalDataEntryApp.DATE_TIME_FORMAT.format(tempRef.getEnd());
}
htmlCode += dateToString;
}
htmlCode += "</span>";
return htmlCode;
}
}

View File

@ -45,6 +45,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
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.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
@ -111,8 +112,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
/**
* Save geona data forms.
*
* @param profileID the profile ID
* @param tree_Node the tree node
* @param profileID the profile ID
* @param tree_Node the tree node
* @param stepsOnPostCreation the steps on post creation
* @return the commit report
* @throws Exception the exception
*/
@ -215,6 +217,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
* @param theProject the the project
* @param tree_Node the tree node
* @param sectionJSONPathIndexer the json path indexer
* @param tempDirs the temp dirs
* @return the list
* @throws Exception the exception
*/
public List<File> recursiveUploadFileset(MongoServiceUtil mongoService, String profileID, Project theProject,
@ -370,6 +374,13 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
return toUpload;
}
/**
* Copy content.
*
* @param a the a
* @param b the b
* @throws Exception the exception
*/
public static void copyContent(File a, File b) throws Exception {
FileInputStream in = new FileInputStream(a);
FileOutputStream out = new FileOutputStream(b);
@ -935,6 +946,17 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
}
/**
* Delete relationship.
*
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param relationshipId the relationship id
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @return the result document DV
* @throws Exception the exception
*/
@Override
public ResultDocumentDV deleteRelationship(String fromProfileID, String fromProjectID, String relationshipId,
String toProfileID, String toProjectID) throws Exception {
@ -997,8 +1019,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.info("getResultDocumentFoProjectByID called");
try {
ProjectsCaller projects = GeoportalClientCaller.projects();
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
ProjectsCaller projects = GeoportalClientCaller.projects();
Project project = projects.getProjectByID(profileID, projectID);
ResultDocumentDV documentDV = ConvertToDataValueObjectModel.toResultDocumentDV(project);
LOG.info("returning: " + documentDV.getId());
@ -1013,6 +1035,69 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
}
/**
* Temporal reference for project.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the temporal reference DV
*/
@Override
public TemporalReferenceDV temporalReferenceForProject(String profileID, String projectID) {
LOG.info("temporalReferenceForProject called for profileID: {}, and projectID: {}", profileID, projectID);
String template = null;
if (profileID == null || projectID == null)
return null;
try {
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
ProjectsCaller projects = GeoportalClientCaller.projects();
Project theProject = projects.getProjectByID(profileID, projectID);
template = SessionUtil.getJSONTimelineTemplate(this.getThreadLocalRequest(), profileID);
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: " + projectID;
LOG.warn(erroMsg, e);
}
return null;
}
/**
* Pretty print client data entry map.
*

View File

@ -50,6 +50,7 @@ public class SessionUtil {
private static final String LIST_OF_PROJECTS = "LIST_OF_PROJECTS";
private static final String COUNT_DOCS_FOR_PROFILE_ID = "COUNT_DOCS_FOR_PROFILE_ID";
private static final String TIMELINE_JSON_TEMPLATE = "DATA_ENTRY_TIMELINE_JSON_TEMPLATE";
/** The log. */
private static Logger LOG = LoggerFactory.getLogger(SessionUtil.class);
@ -326,5 +327,31 @@ public class SessionUtil {
HttpSession session = threadLocalRequest.getSession();
session.setAttribute(LIST_OF_RELATIONSHIP_DEFINITION + profileID, listRelationshipNames);
}
/**
* 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);
}
}

View File

@ -259,4 +259,15 @@ h1 {
.box-table-diplay-project td {
padding-left: 5px;
}
.display-date {
color: red;
background-color: #f7f7f9;
padding: 2px;
border-radius: 2px;
}
.no_modal_body_max_height .modal-body {
max-height: 90% !important;
}