diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index e46083b..cb1bb0b 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,8 @@ - + + + + @@ -62,7 +65,10 @@ - + + + + @@ -125,7 +131,10 @@ - + + + + @@ -188,7 +197,10 @@ - + + + + @@ -251,7 +263,10 @@ - + + + + @@ -266,10 +281,10 @@ - - uses - - + + + + @@ -332,7 +347,10 @@ - + + + + @@ -395,7 +413,10 @@ - + + + + @@ -458,7 +479,10 @@ - + + + + diff --git a/pom.xml b/pom.xml index 84dba44..211ada1 100644 --- a/pom.xml +++ b/pom.xml @@ -161,6 +161,12 @@ [1.0.0, 2.0.0-SNAPSHOT) compile + + org.json + json + 20140107 + compile + org.gcube.application geoportal-data-common diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java index 277d092..7dde208 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java @@ -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. diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java index 7821038..d452a39 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java @@ -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; diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java index d56cf1c..85514af 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java @@ -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); + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java index 4015843..c34c038 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java @@ -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 asyncCallback); + void temporalReferenceForProject(String profileID, String projectID, AsyncCallback callback); + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.java index 4506ed2..cd497bc 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.java @@ -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); } /** diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.ui.xml index af7e5e6..c969bc3 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.ui.xml @@ -79,7 +79,9 @@ Go to bottom - select "Project Type" + + select "Project Type" +
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/CreateRelationProjectsPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/CreateRelationProjectsPanel.java index d91bca5..affc59d 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/CreateRelationProjectsPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/CreateRelationProjectsPanel.java @@ -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 mapRelationsDefiniton = new HashMap(); private HashMap selectedProjects = new HashMap(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 += "
    "; -// htmlMsg += "
  • id: " + project.getId() + "
  • "; -// htmlMsg += "
  • "+project.getFirstEntryOfMap().getKey()+": " + project.getFirstEntryOfMap().getValue() + "
  • "; -// htmlMsg += "
"; - + String htmlMsg = "Selected: " + project.getFirstEntryOfMap().getValue() + " (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() { + + @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))); + } + + } + }); + } + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java index d65b82f..7b878ed 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/relation/ViewRelationshipPanel.java @@ -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 mapOfTargetProjectForId = new HashMap(); - 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 firstEntrySet = project.getFirstEntryOfMap(); String htmlMsg = firstEntrySet.getKey() + ": " + firstEntrySet.getValue() + " (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 { + " (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() { + + @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))); + } + + } + }); + } } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/HTMLUtil.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/HTMLUtil.java index bb6742c..c237122 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/HTMLUtil.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/HTMLUtil.java @@ -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 = ""; + + 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 += ""; + + return htmlCode; + } } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java index 39c3c44..726d062 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java @@ -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 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. * diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/SessionUtil.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/SessionUtil.java index 6cd3bfd..e7eb43a 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/SessionUtil.java @@ -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); + } + } diff --git a/src/main/webapp/GeoPortalDataEntryApp.css b/src/main/webapp/GeoPortalDataEntryApp.css index 41ae615..6387bfb 100644 --- a/src/main/webapp/GeoPortalDataEntryApp.css +++ b/src/main/webapp/GeoPortalDataEntryApp.css @@ -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; } \ No newline at end of file