integrated new bean StepPerformedResultDV

This commit is contained in:
Francesco Mangiacrapa 2024-04-11 11:04:54 +02:00
parent 140856db03
commit 63816fe648
6 changed files with 104 additions and 40 deletions

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -141,7 +144,10 @@
<wb-module deploy-name="geoportal-data-entry-app-3.3.0-SNAPSHOT"> <wb-module deploy-name="geoportal-data-entry-app-3.3.0-SNAPSHOT">
@ -283,7 +289,10 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -425,7 +434,10 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -567,7 +579,10 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -667,10 +682,10 @@
<dependent-module archiveName="uri-resolver-manager-1.8.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager"> <dependent-module archiveName="uri-resolver-manager-1.8.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="geoportal-common-1.0.14-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-common/geoportal-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -812,7 +827,10 @@
<property name="context-root" value="geoportal-data-entry-app"/> <property name="context-root" value="geoportal-data-entry-app"/>
@ -954,7 +972,10 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -1096,7 +1117,10 @@
</wb-module> </wb-module>

View File

@ -21,8 +21,9 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfil
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.BasicLifecycleInformationDV.Status;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; 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.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER; 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.HandlerDeclarationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV; import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
@ -257,7 +258,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurred on istancing the application. Please, contact the support. Error is: "+caught.getMessage(); String errorMsg = "Sorry, an error occurred on istancing the application. Please, contact the support. Error is: "
+ caught.getMessage();
Alert alert = new Alert(errorMsg, AlertType.ERROR); Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false); alert.setClose(false);
try { try {
@ -328,8 +330,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if(caught instanceof ProjectNotFoundException) { if (caught instanceof ProjectNotFoundException) {
Modal errorModal = new Modal(true, true); Modal errorModal = new Modal(true, true);
errorModal.setCloseVisible(true); errorModal.setCloseVisible(true);
errorModal.setTitle("Oops..."); errorModal.setTitle("Oops...");
@ -343,11 +345,10 @@ public class GeoPortalDataEntryApp implements EntryPoint {
errorPanelMsg.add(erroMessage); errorPanelMsg.add(erroMessage);
errorModal.add(errorPanelMsg); errorModal.add(errorPanelMsg);
errorModal.show(); errorModal.show();
} } else {
else {
Window.alert("Error " + caught.getMessage()); Window.alert("Error " + caught.getMessage());
} }
initExecutor.execute(); initExecutor.execute();
} }
@ -1365,8 +1366,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal.add(modalContainerPanel); modal.add(modalContainerPanel);
GeoportalDataEntryServiceAsync.Util.getInstance().performActionSteps( GeoportalDataEntryServiceAsync.Util.getInstance().performActionSteps(
resultDocumentDV.getProfileID(), resultDocumentDV.getId(),stvp.getOptionalMessage(), resultDocumentDV.getProfileID(), resultDocumentDV.getId(),
wActionOnItem.getAction(), new AsyncCallback<ProjectDV>() { stvp.getOptionalMessage(), wActionOnItem.getAction(),
new AsyncCallback<StepPerformedResultDV>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -1382,7 +1384,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
} }
@Override @Override
public void onSuccess(final ProjectDV result) { public void onSuccess(final StepPerformedResultDV result) {
modal.setTitle("Step/s performed"); modal.setTitle("Step/s performed");
modal.setCloseVisible(true); modal.setCloseVisible(true);
try { try {
@ -1396,22 +1398,50 @@ public class GeoPortalDataEntryApp implements EntryPoint {
String stepsToString = ""; String stepsToString = "";
for (String step : wActionOnItem.getAction().getCallSteps()) { for (String step : wActionOnItem.getAction().getCallSteps()) {
stepsToString += step + ", "; stepsToString += step + " ";
}
Status status = Status.NOT_SPECIFIED;
AlertType alertType = AlertType.INFO;
String statusMsg = "status " + status.getLabel();
try {
status = result.getLifecycleInfoDV().getLastOperationStatus();
switch (status) {
case OK:
alertType = AlertType.SUCCESS;
statusMsg = "performed with " + status.getLabel().toUpperCase()+"!";
break;
case WARNING:
alertType = AlertType.WARNING;
statusMsg = "performed with " + status.getLabel().toUpperCase()+"!";
break;
case ERROR:
alertType = AlertType.ERROR;
statusMsg = "performed with " + status.getLabel().toUpperCase()+"!";
break;
default:
alertType = AlertType.INFO;
statusMsg = "performed. Current status " + status.getLabel();
break;
}
} catch (Exception e) {
// silent
} }
Alert alert = new Alert( Alert alert = new Alert(
stepString + " " + stepsToString + "performed correclty!"); stepString + " " + stepsToString + " " + statusMsg);
alert.setType(AlertType.INFO); alert.setType(alertType);
alert.setClose(false); alert.setClose(false);
modal.add(alert); modal.add(alert);
GeoportalDataEntryServiceAsync.Util.getInstance() GeoportalDataEntryServiceAsync.Util.getInstance()
.getResultDocumentFoProjectByID(result.getProfileID(), .getResultDocumentFoProjectByID(result.getProfileID(),
result.getId(), new AsyncCallback<ResultDocumentDV>() { result.getProjectId(),
new AsyncCallback<ResultDocumentDV>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
// TODO Auto-generated method stub Window.alert("Error: " + caught.getMessage());
} }
@ -1631,7 +1661,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal.add(hpGetLink); modal.add(hpGetLink);
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(resultDocumentDV.getId(), GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(resultDocumentDV.getId(),
resultDocumentDV.getProfileID(), GeoportalItemReferences.SHARE_LINK_TO.DATA_VIEWER, new AsyncCallback<GeoportalItemReferences>() { resultDocumentDV.getProfileID(), GeoportalItemReferences.SHARE_LINK_TO.DATA_VIEWER,
new AsyncCallback<GeoportalItemReferences>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
try { try {
@ -1679,7 +1710,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
break; break;
} }
case GET_SHAREABLE_LINK: { case GET_SHAREABLE_LINK: {
final Modal modal = new Modal(true, true); final Modal modal = new Modal(true, true);
@ -1691,7 +1722,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal.add(hpGetLink); modal.add(hpGetLink);
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(resultDocumentDV.getId(), GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(resultDocumentDV.getId(),
resultDocumentDV.getProfileID(), GeoportalItemReferences.SHARE_LINK_TO.DATA_ENTRY, new AsyncCallback<GeoportalItemReferences>() { resultDocumentDV.getProfileID(), GeoportalItemReferences.SHARE_LINK_TO.DATA_ENTRY,
new AsyncCallback<GeoportalItemReferences>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
try { try {
@ -1722,8 +1754,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
Anchor anchor = new Anchor(theURL); Anchor anchor = new Anchor(theURL);
anchor.setHref(theURL); anchor.setHref(theURL);
anchor.setTarget("_blank"); anchor.setTarget("_blank");
anchor.setTitle( anchor.setTitle("Shareable link of the project with id: "
"Shareable link of the project with id: " + resultDocumentDV.getId()); + resultDocumentDV.getId());
com.github.gwtbootstrap.client.ui.Label label = new com.github.gwtbootstrap.client.ui.Label( com.github.gwtbootstrap.client.ui.Label label = new com.github.gwtbootstrap.client.ui.Label(
"Shareable link"); "Shareable link");
label.setType(LabelType.SUCCESS); label.setType(LabelType.SUCCESS);

View File

@ -12,6 +12,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; 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.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV; import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView; import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
@ -146,7 +147,7 @@ public interface GeoportalDataEntryService extends RemoteService {
* @param action the action * @param action the action
* @return the project DV * @return the project DV
*/ */
ProjectDV performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action) throws Exception; StepPerformedResultDV performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action) throws Exception;
/** /**
* Gets the relationships definition. * Gets the relationships definition.

View File

@ -12,6 +12,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; 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.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV; import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView; import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
@ -80,7 +81,7 @@ public interface GeoportalDataEntryServiceAsync {
AsyncCallback<LifecycleInformationDV> callback); AsyncCallback<LifecycleInformationDV> callback);
void performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action, void performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action,
AsyncCallback<ProjectDV> callback); AsyncCallback<StepPerformedResultDV> callback);
void getRelationshipsDefinition(String profileID, AsyncCallback<List<RelationshipDefinitionDV>> callback); void getRelationshipsDefinition(String profileID, AsyncCallback<List<RelationshipDefinitionDV>> callback);

View File

@ -36,7 +36,7 @@
<!-- If you add id attribute to element,You should use b:id attribute. --> <!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextArea addStyleNames="{style.text-are-size}" <b:TextArea addStyleNames="{style.text-are-size}"
ui:field="txtOptionalMessage"></b:TextArea> ui:field="txtOptionalMessage"></b:TextArea>
<b:HelpBlock>You can add an optional message...</b:HelpBlock> <b:HelpBlock>You can optionally add a message...</b:HelpBlock>
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
</b:Fieldset> </b:Fieldset>

View File

@ -55,6 +55,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfil
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV; 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.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER; 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.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
@ -1272,7 +1273,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
* @throws Exception the exception * @throws Exception the exception
*/ */
@Override @Override
public ProjectDV performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action) public StepPerformedResultDV performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action)
throws Exception { throws Exception {
LOG.info("performActionSteps called for profileID {}, projectID {}, action: " + action, profileID, projectID); LOG.info("performActionSteps called for profileID {}, projectID {}, action: " + action, profileID, projectID);
@ -1289,11 +1290,16 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.info("calling stepID {} on projectID {}", stepID, projectID); LOG.info("calling stepID {} on projectID {}", stepID, projectID);
project = client.performStep(profileID, projectID, stepID, optionalMessage, null); project = client.performStep(profileID, projectID, stepID, optionalMessage, null);
} }
LifecycleInformationDV lifecycleInfo = getLifecycleInfoForProjectId(profileID, projectID);
lifecycleInfo.getLastOperationStatus();
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true); StepPerformedResultDV sprv = new StepPerformedResultDV(profileID, projectID, lifecycleInfo);
ProjectDV theProject = ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder);
LOG.info("performActionSteps returning theProject with ID {}", projectID); // ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
return theProject; // ProjectDV theProject = ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder);
LOG.info("performActionSteps returning theProject with ID {}", sprv);
return sprv;
} catch (Exception e) { } catch (Exception e) {
String error = "Error occurred on performing the workflow step/s on the project id " + projectID; String error = "Error occurred on performing the workflow step/s on the project id " + projectID;
LOG.error(error, e); LOG.error(error, e);