Managed Create Relation facility
This commit is contained in:
parent
8d4b53388c
commit
8c1392b8ff
|
@ -20,6 +20,7 @@ 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.project.LifecycleInformationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||
|
@ -31,6 +32,8 @@ import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelat
|
|||
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateRelationHandler;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateRelationHandlerEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationOnItemEvent;
|
||||
|
@ -276,7 +279,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
public void onResize(ResizeEvent event) {
|
||||
GWT.log("onWindowResized width: " + event.getWidth() + " height: " + event.getHeight());
|
||||
updateSize();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -376,7 +379,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
GWT.log("New workspace dimension Height: " + rootHeight);
|
||||
mainTabPanel.setInternalHeight(rootHeight);
|
||||
//mainTabPanel.setlistOfProjectCenterPanelHeight(rootHeight-20+"px");
|
||||
// mainTabPanel.setlistOfProjectCenterPanelHeight(rootHeight-20+"px");
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
@ -801,13 +804,94 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
appManagerBus.addHandler(CreateRelationHandlerEvent.TYPE, new CreateRelationHandler() {
|
||||
|
||||
@Override
|
||||
public void onCreateRelation(CreateRelationHandlerEvent createRelationHE) {
|
||||
|
||||
final Modal modal = new Modal(true, true);
|
||||
modal.setTitle("Creating relation...");
|
||||
modal.setWidth(800);
|
||||
modal.setCloseVisible(false);
|
||||
String relName = createRelationHE.getRelationshipName();
|
||||
String fromProfileID = createRelationHE.getFromProject().getProfileID();
|
||||
String fromProjectID = createRelationHE.getFromProject().getId();
|
||||
String toProfileID = createRelationHE.getToProject().getProfileID();
|
||||
String toProjectID = createRelationHE.getToProject().getId();
|
||||
final VerticalPanel modalContainerPanel = new VerticalPanel();
|
||||
final LoaderIcon loader = new LoaderIcon("Trying to create the relation " + relName
|
||||
+ " from Project ID: " + fromProjectID + " to Project ID: " + toProjectID);
|
||||
modalContainerPanel.add(loader);
|
||||
modal.add(modalContainerPanel);
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().createRelationship(fromProfileID, fromProjectID,
|
||||
relName, toProfileID, toProjectID, new AsyncCallback<RelationshipDV>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
modalContainerPanel.clear();
|
||||
modal.setCloseVisible(true);
|
||||
try {
|
||||
modal.remove(loader);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Alert alert = new Alert(caught.getMessage());
|
||||
alert.setType(AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
modal.add(alert);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(RelationshipDV result) {
|
||||
modal.setTitle("Relationship created");
|
||||
modalContainerPanel.clear();
|
||||
modal.setCloseVisible(true);
|
||||
try {
|
||||
modal.remove(loader);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
Alert alert = new Alert();
|
||||
alert.setType(AlertType.SUCCESS);
|
||||
alert.setClose(false);
|
||||
alert.setText("Relationship "+relName+" created correctly!");
|
||||
modal.add(alert);
|
||||
|
||||
String htmlMsg = "In the project with:";
|
||||
htmlMsg += "<ul>";
|
||||
htmlMsg += "<li>id: " + fromProjectID + "</li>";
|
||||
htmlMsg += "<li>profile: " + fromProfileID + "</li>";
|
||||
htmlMsg += "<li>"
|
||||
+ createRelationHE.getFromProject().getFirstEntryOfMap().getKey()
|
||||
+ ": "
|
||||
+ createRelationHE.getFromProject().getFirstEntryOfMap().getValue()
|
||||
+ "</li>";
|
||||
htmlMsg += "</ul>";
|
||||
htmlMsg += "has been created the relationship <b>" + relName + "</b> to the project wiht id: "
|
||||
+ toProjectID;
|
||||
modal.add(new HTML(htmlMsg));
|
||||
ReportTemplateToHTML rtth = new ReportTemplateToHTML("Relationship", result.getAsJSON(),
|
||||
false, false);
|
||||
rtth.showAsJSON(false);
|
||||
modal.add(rtth);
|
||||
|
||||
appManagerBus.fireEvent(new CloseCreateRelationGUIEvent());
|
||||
}
|
||||
});
|
||||
|
||||
modal.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
appManagerBus.addHandler(CloseCreateRelationGUIEvent.TYPE, new CloseCreateRelationGUIEventHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClose(CloseCreateRelationGUIEvent closeCreateRelationGUI) {
|
||||
mainTabPanel.showCreateRelationPanel(false, null);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -828,89 +912,89 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
DocumentDV item = grpw.getSelectItems().get(0);
|
||||
|
||||
if (item instanceof ResultDocumentDV) {
|
||||
final ResultDocumentDV resultDocumentDV = (ResultDocumentDV) item;
|
||||
|
||||
final ResultDocumentDV resultDocumentDV = (ResultDocumentDV) item;
|
||||
String htmlMsg = "Going to perform the step/s <i><b>" + wActionOnItem.getAction().getCallSteps()
|
||||
+ "</b></i> on the project with:";
|
||||
htmlMsg += "<ul>";
|
||||
htmlMsg += "<li>id: " + resultDocumentDV.getId() + "</li>";
|
||||
htmlMsg += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
|
||||
htmlMsg += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
|
||||
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
|
||||
htmlMsg += "</ul>";
|
||||
htmlMsg += "<br>";
|
||||
htmlMsg += "Would you like to proceed?";
|
||||
|
||||
String htmlMsg = "Going to perform the step/s <i><b>"
|
||||
+ wActionOnItem.getAction().getCallSteps() + "</b></i> on the project with:";
|
||||
htmlMsg += "<ul>";
|
||||
htmlMsg += "<li>id: " + resultDocumentDV.getId() + "</li>";
|
||||
htmlMsg += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
|
||||
htmlMsg += "<li>"+resultDocumentDV.getFirstEntryOfMap().getKey()+": " + resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
|
||||
htmlMsg += "</ul>";
|
||||
htmlMsg += "<br>";
|
||||
htmlMsg += "Would you like to proceed?";
|
||||
final ModalConfirm dialog = new ModalConfirm(null,
|
||||
"Step/s " + wActionOnItem.getAction().getTitle() + " Confirm?", htmlMsg);
|
||||
dialog.addToCenterPanel(
|
||||
new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false));
|
||||
|
||||
final ModalConfirm dialog = new ModalConfirm(null, "Step/s "+wActionOnItem.getAction().getTitle()+" Confirm?", htmlMsg);
|
||||
dialog.addToCenterPanel(
|
||||
new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false));
|
||||
dialog.getYesButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
dialog.getYesButton().addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
dialog.hide();
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
dialog.hide();
|
||||
final Modal modal = new Modal(true, true);
|
||||
modal.setCloseVisible(false);
|
||||
modal.setTitle("Perfoming Steps...");
|
||||
modal.hide(false);
|
||||
modal.setWidth(800);
|
||||
modal.setMaxHeigth("650px");
|
||||
final VerticalPanel modalContainerPanel = new VerticalPanel();
|
||||
final LoaderIcon loader = new LoaderIcon();
|
||||
loader.setText("Trying to perfom step/s " + wActionOnItem.getAction().getCallSteps()
|
||||
+ ", please wait...");
|
||||
modalContainerPanel.add(loader);
|
||||
modal.add(modalContainerPanel);
|
||||
|
||||
final Modal modal = new Modal(true, true);
|
||||
modal.setCloseVisible(false);
|
||||
modal.setTitle("Perfoming Steps...");
|
||||
modal.hide(false);
|
||||
modal.setWidth(800);
|
||||
modal.setMaxHeigth("650px");
|
||||
final VerticalPanel modalContainerPanel = new VerticalPanel();
|
||||
final LoaderIcon loader = new LoaderIcon();
|
||||
loader.setText("Trying to perfom step/s " + wActionOnItem.getAction().getCallSteps()
|
||||
+ ", please wait...");
|
||||
modalContainerPanel.add(loader);
|
||||
modal.add(modalContainerPanel);
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().performActionSteps(
|
||||
resultDocumentDV.getProfileID(), resultDocumentDV.getId(),
|
||||
wActionOnItem.getAction(), new AsyncCallback<ProjectDV>() {
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().performActionSteps(
|
||||
resultDocumentDV.getProfileID(), resultDocumentDV.getId(),
|
||||
wActionOnItem.getAction(), new AsyncCallback<ProjectDV>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
modal.setCloseVisible(true);
|
||||
try {
|
||||
modalContainerPanel.remove(loader);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Alert alert = new Alert(caught.getMessage());
|
||||
alert.setType(AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
modal.add(alert);
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
modal.setCloseVisible(true);
|
||||
try {
|
||||
modalContainerPanel.remove(loader);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Alert alert = new Alert(caught.getMessage());
|
||||
alert.setType(AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
modal.add(alert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ProjectDV result) {
|
||||
modal.setCloseVisible(true);
|
||||
try {
|
||||
modalContainerPanel.remove(loader);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Alert alert = new Alert(
|
||||
"Steps: " + wActionOnItem.getAction().getCallSteps()
|
||||
+ ", performed correclty");
|
||||
alert.setType(AlertType.INFO);
|
||||
alert.setClose(false);
|
||||
modal.add(alert);
|
||||
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false,
|
||||
resultDocumentDV.getProfileID(),
|
||||
mainTabPanel.getCurrentProjectsSearchingFilter(), true));
|
||||
|
||||
@Override
|
||||
public void onSuccess(ProjectDV result) {
|
||||
modal.setTitle("Step/s performed");
|
||||
modal.setCloseVisible(true);
|
||||
try {
|
||||
modalContainerPanel.remove(loader);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
});
|
||||
Alert alert = new Alert(
|
||||
"Steps: " + wActionOnItem.getAction().getCallSteps()
|
||||
+ ", performed correclty");
|
||||
alert.setType(AlertType.INFO);
|
||||
alert.setClose(false);
|
||||
modal.add(alert);
|
||||
|
||||
modal.show();
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false,
|
||||
resultDocumentDV.getProfileID(),
|
||||
mainTabPanel.getCurrentProjectsSearchingFilter(), true));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
modal.show();
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -1155,7 +1239,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
htmlMsg += "<ul>";
|
||||
htmlMsg += "<li>id: " + resultDocumentDV.getId() + "</li>";
|
||||
htmlMsg += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
|
||||
htmlMsg += "<li>"+resultDocumentDV.getFirstEntryOfMap().getKey()+": " + resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
|
||||
htmlMsg += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
|
||||
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
|
||||
htmlMsg += "</ul>";
|
||||
htmlMsg += "<br>";
|
||||
htmlMsg += "This operation cannot be undone. Would you like to proceed?";
|
||||
|
@ -1209,7 +1294,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false,
|
||||
resultDocumentDV.getProfileID(),
|
||||
mainTabPanel.getCurrentProjectsSearchingFilter(), false));
|
||||
mainTabPanel.getCurrentProjectsSearchingFilter(),
|
||||
false));
|
||||
} else {
|
||||
modal.setTitle("Error");
|
||||
Alert alert = new Alert(
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
|||
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.RelationshipDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||
|
@ -180,11 +181,23 @@ public interface GeoportalDataEntryService extends RemoteService {
|
|||
* Perform action steps.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @param action the action
|
||||
* @return the project DV
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
List<String> getRelationshipNames(String profileID) throws Exception;
|
||||
|
||||
/**
|
||||
* Creates the relationship.
|
||||
*
|
||||
* @param fromProfileID the from profile ID
|
||||
* @param fromProjectID the from project ID
|
||||
* @param relationshipName the relationship name
|
||||
* @param toProfileID the to profile ID
|
||||
* @param toProjectID the to project ID
|
||||
* @return the relationship DV
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
RelationshipDV createRelationship(String fromProfileID, String fromProjectID, String relationshipName,
|
||||
String toProfileID, String toProjectID) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
|||
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.RelationshipDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||
|
@ -85,4 +86,7 @@ public interface GeoportalDataEntryServiceAsync {
|
|||
|
||||
void getRelationshipNames(String profileID, AsyncCallback<List<String>> callback);
|
||||
|
||||
void createRelationship(String fromProfileID, String fromProjectID, String relationshipName, String toProfileID,
|
||||
String toProjectID, AsyncCallback<RelationshipDV> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
/**
|
||||
* The Interface CreateRelationHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 21, 2022
|
||||
*/
|
||||
public interface CreateRelationHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On create relation.
|
||||
*
|
||||
* @param createRelationHandlerEvent the create relation handler event
|
||||
*/
|
||||
void onCreateRelation(CreateRelationHandlerEvent createRelationHandlerEvent);
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
public class CreateRelationHandlerEvent extends GwtEvent<CreateRelationHandler> {
|
||||
|
||||
/** The type. */
|
||||
public static Type<CreateRelationHandler> TYPE = new Type<CreateRelationHandler>();
|
||||
private ResultDocumentDV fromProject;
|
||||
private String relationshipName;
|
||||
private ResultDocumentDV toProject;
|
||||
|
||||
public CreateRelationHandlerEvent(ResultDocumentDV fromProject, String relationshipName,
|
||||
ResultDocumentDV toProject) {
|
||||
this.fromProject = fromProject;
|
||||
this.relationshipName = relationshipName;
|
||||
this.toProject = toProject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<CreateRelationHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(CreateRelationHandler handler) {
|
||||
handler.onCreateRelation(this);
|
||||
}
|
||||
|
||||
public ResultDocumentDV getFromProject() {
|
||||
return fromProject;
|
||||
}
|
||||
|
||||
public String getRelationshipName() {
|
||||
return relationshipName;
|
||||
}
|
||||
|
||||
public ResultDocumentDV getToProject() {
|
||||
return toProject;
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateRelationHandlerEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
|
||||
|
||||
|
@ -70,10 +71,10 @@ public class CreateRelationProjectsPanel extends Composite {
|
|||
|
||||
@UiField
|
||||
Button closeButton;
|
||||
|
||||
|
||||
@UiField
|
||||
Button buttCreateRelation;
|
||||
|
||||
|
||||
@UiField
|
||||
Alert alertMessage;
|
||||
|
||||
|
@ -148,62 +149,65 @@ public class CreateRelationProjectsPanel extends Composite {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
buttCreateRelation.addClickHandler(new ClickHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
checkFormPassed();
|
||||
|
||||
boolean isValidForm = checkFormPassed();
|
||||
if (isValidForm) {
|
||||
buttCreateRelation.setEnabled(false);
|
||||
appManagerBus.fireEvent(new CreateRelationHandlerEvent(selectedProjects.get(0),
|
||||
listBoxRelationNames.getSelectedItemText(), selectedProjects.get(1)));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
selectedProject(project);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean checkFormPassed() {
|
||||
|
||||
|
||||
alertMessage.setVisible(false);
|
||||
|
||||
|
||||
ResultDocumentDV first = selectedProjects.get(0);
|
||||
if (first == null) {
|
||||
alertMessage.setVisible(true);
|
||||
alertMessage.setText("You must select the first project from the 'List of Project' Table");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
ResultDocumentDV second = selectedProjects.get(1);
|
||||
if (second == null) {
|
||||
alertMessage.setVisible(true);
|
||||
alertMessage.setText("You must select the second project from the 'List of Project' Table");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(first.getId().compareTo(second.getId())==0) {
|
||||
|
||||
if (first.getId().compareTo(second.getId()) == 0) {
|
||||
alertMessage.setVisible(true);
|
||||
alertMessage.setText("First and Second project cannot be the same project");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
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()+")";
|
||||
String htmlMsg = "Selected: <b>" + project.getFirstEntryOfMap().getValue() + "</b> (id: " + project.getId()
|
||||
+ ")";
|
||||
|
||||
if (first == null) {
|
||||
firstItemAlert.setVisible(false);
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.bson.Document;
|
|||
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||
import org.gcube.application.geoportal.common.model.document.Project;
|
||||
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
||||
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
|
||||
import org.gcube.application.geoportal.common.model.rest.TempFile;
|
||||
|
@ -41,6 +42,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.RelationshipDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
|
@ -993,4 +995,27 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RelationshipDV createRelationship(String fromProfileID, String fromProjectID, String relationshipName,
|
||||
String toProfileID, String toProjectID) throws Exception {
|
||||
LOG.info("createRelationship called");
|
||||
|
||||
try {
|
||||
ProjectsCaller projects = GeoportalClientCaller.projects();
|
||||
Relationship relationship = projects.createRelationship(fromProfileID, fromProjectID, relationshipName,
|
||||
toProfileID, toProjectID);
|
||||
|
||||
RelationshipDV relationshipDV = ConvertToDataValueObjectModel.toRelationshipDV(relationship);
|
||||
LOG.info("returning: " + relationshipDV);
|
||||
return relationshipDV;
|
||||
|
||||
} catch (Exception e) {
|
||||
String error = "Error occurred on creating the relationship";
|
||||
LOG.error(error, e);
|
||||
throw new Exception(
|
||||
error + ". Error: " + e.getMessage() + ". Refresh and try again or contact the support");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue