() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ hpGetLink.clear();
+
+ }
+
+ @Override
+ public void onSuccess(GeoNaItemRef result) {
+ hpGetLink.clear();
+ String theURL = result.getRestrictedLink().getShortURL() != null
+ ? result.getRestrictedLink().getShortURL()
+ : result.getRestrictedLink().getCompleteURL();
+ String htmlLink = "";
+ HTML html = new HTML(htmlLink);
+ hpGetLink.add(html);
+ // modal.add(html);
+ }
+ });
+ }
+
+ if (projectAsJSON != null)
+ add(new ReportTemplateToHTML("Project", projectAsJSON, false));
+ if (lcDV.getAsJSONString() != null)
+ add(new ReportTemplateToHTML("Lifecycle Report", lcDV.getAsJSONString(), false));
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.java
index 329f95c..122be3a 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.java
@@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.report;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.ExternalLib;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
+import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.event.HiddenEvent;
@@ -47,57 +48,63 @@ public class ReportTemplateToHTML extends Composite {
@UiField
VerticalPanel htmlContainer;
-
+
@UiField
AccordionGroup showReportAsJSON;
@UiField
Paragraph reportJSON;
+ @UiField
+ Label labelToReport;
+
boolean toJSONERROR = false;
/**
* Instantiates a new report template to HTML.
*
- * @param reportAsJSON the report as JSON
+ * @param documentLabel the document label
+ * @param theJSONDocument the the JSON document
+ * @param openJSONReport the open JSON report
*/
- public ReportTemplateToHTML(String reportAsJSON, boolean openJSONReport) {
+ public ReportTemplateToHTML(String documentLabel, String theJSONDocument, boolean openJSONReport) {
initWidget(uiBinder.createAndBindUi(this));
vpContainer.setVisible(false);
showReportAsJSON.setDefaultOpen(openJSONReport);
- //showReportAsJSON.setIconPosition(IconPosition.RIGHT);
-
- if(openJSONReport) {
+ documentLabel = documentLabel == null ? "Document" : documentLabel;
+ labelToReport.setText(documentLabel);
+ // showReportAsJSON.setIconPosition(IconPosition.RIGHT);
+
+ if (openJSONReport) {
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
- }else {
+ } else {
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
}
-
+
showReportAsJSON.addShowHandler(new ShowHandler() {
-
+
@Override
public void onShow(ShowEvent showEvent) {
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
-
+
}
});
-
+
showReportAsJSON.addHiddenHandler(new HiddenHandler() {
-
+
@Override
public void onHidden(HiddenEvent hiddenEvent) {
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
-
+
}
});
-
-
- if (reportAsJSON != null) {
- GWT.log("report is: " + reportAsJSON);
+
+ if (theJSONDocument != null) {
+ GWT.log("report is: " + theJSONDocument);
vpContainer.setVisible(true);
try {
- JSONValue jsonObj = JSONParser.parse(reportAsJSON);
+ JSONValue jsonObj = JSONParser.parse(theJSONDocument);
JSONObject json = (JSONObject) jsonObj;
JSONValue valueChildren = json.get("children");
JSONArray jsonChildren = (JSONArray) valueChildren;
@@ -119,7 +126,7 @@ public class ReportTemplateToHTML extends Composite {
e.printStackTrace();
GWT.log("error: " + e.getMessage());
}
- reportJSON.add(new HTML("" + ExternalLib.toPrettyPrintJSON(reportAsJSON) + "
"));
+ reportJSON.add(new HTML("" + ExternalLib.toPrettyPrintJSON(theJSONDocument) + "
"));
}
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.ui.xml
index 572b030..30e0217 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.ui.xml
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.ui.xml
@@ -14,10 +14,10 @@
- Publication Report:
+ Report:
-
+
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 a7a274c..3ce34c6 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
@@ -157,7 +157,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
try {
LifecycleInformation lifecycleInfo = theProject.getLifecycleInformation();
LifecycleInformationDV liDV = ConvertToDataValueObjectModel.toLifecycleInformationDV(lifecycleInfo);
- return new CommitReport(theProject.getId(), liDV);
+
+ return new CommitReport(theProject.getId(), theProject.getProfileID(), theProject.getTheDocument().toJson(),
+ liDV);
} catch (Exception e) {
throw new Exception("Error occurred on loading LifecycleInformation for the project: " + theProject.getId()
+ ". Error: " + e.getMessage());
@@ -400,9 +402,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
List toReturnList = ConvertToDataValueObjectModel.toListResultDocument(projects);
searchedData.setData(toReturnList);
-
- // TODO BUGGY WORKAROUND. BLOCKED BY #22487 IT MUST BE REMOVE AFTER THE QUERY COUNT
+ // TODO BUGGY WORKAROUND. BLOCKED BY #22487 IT MUST BE REMOVE AFTER THE QUERY
+ // COUNT
// AND LIST.SIZE BY QUERY WILL BE AVAILABLE IN THE SERVICE
if (filter.getConditions() != null) {
searchedData.setTotalItems(toReturnList.size());
@@ -745,7 +747,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// DEV MODE
if (!SessionUtil.isIntoPortal()) {
LOG.warn("OUT OF PORTAL - DEV MODE detected");
- GcubeUserRole myRole = GcubeUserRole.DATA_EDITOR;
+ GcubeUserRole myRole = GcubeUserRole.DATA_MANAGER;
for (RoleRights roleRight : listUserRightsForRole) {
if (roleRight.getUserRole().equals(myRole)) {
@@ -945,4 +947,24 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
throw new Exception("An error occurred when getting list of Use Case Descriptors", e);
}
}
+
+ @Override
+ public LifecycleInformationDV getLifecycleInfoForProjectId(String profileID, String projectID) throws Exception {
+ LOG.info("getLifecycleInfoForProjectId called for profileID {}, projectID {} " + profileID, projectID);
+
+ ProjectsCaller client = GeoportalClientCaller.projects();
+ SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
+ try {
+
+ Project project = client.getProjectByID(profileID, projectID);
+ return ConvertToDataValueObjectModel.toLifecycleInformationDV(project.getLifecycleInformation());
+
+ } catch (Exception e) {
+ String error = "Error on retrieving the LifecycleInfo for profileID " + profileID + " and projectID "
+ + projectID;
+ LOG.error(error, e);
+ throw new Exception(error + ". Refresh and try again or contact the support");
+ }
+
+ }
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java
index 6022964..236bbdd 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java
@@ -19,6 +19,8 @@ public class CommitReport implements Serializable {
private static final long serialVersionUID = -3606902201347318287L;
public String projectID;
private LifecycleInformationDV lifecycleInformation;
+ private String profileID;
+ private String projectAsJSON;
/**
* Instantiates a new commit report.
@@ -27,8 +29,11 @@ public class CommitReport implements Serializable {
}
- public CommitReport(String projectID, LifecycleInformationDV lifecycleInfo) {
+ public CommitReport(String projectID, String profileID, String projectAsJSON,
+ LifecycleInformationDV lifecycleInfo) {
this.projectID = projectID;
+ this.profileID = profileID;
+ this.projectAsJSON = projectAsJSON;
this.lifecycleInformation = lifecycleInfo;
}
@@ -41,12 +46,29 @@ public class CommitReport implements Serializable {
}
public void setProjectID(String projectID) {
+ this.projectID = projectID;
}
public void setLifecycleInformation(LifecycleInformationDV lifecycleInformation) {
this.lifecycleInformation = lifecycleInformation;
}
+ public String getProfileID() {
+ return profileID;
+ }
+
+ public void setProfileID(String profileID) {
+ this.profileID = profileID;
+ }
+
+ public String getProjectAsJSON() {
+ return projectAsJSON;
+ }
+
+ public void setProjectAsJSON(String projectAsJSON) {
+ this.projectAsJSON = projectAsJSON;
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@@ -54,6 +76,10 @@ public class CommitReport implements Serializable {
builder.append(projectID);
builder.append(", lifecycleInformation=");
builder.append(lifecycleInformation);
+ builder.append(", profileID=");
+ builder.append(profileID);
+ builder.append(", projectAsJSON=");
+ builder.append(projectAsJSON);
builder.append("]");
return builder.toString();
}