#23834 Integrated with the create/view/delete Relationship facility
This commit is contained in:
parent
e7a3c0e52e
commit
f14a395b0c
|
@ -15,7 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
- [#22685] Migrated to geoportal-data-list configuration for UCD
|
- [#22685] Migrated to geoportal-data-list configuration for UCD
|
||||||
- [#23784] Migrated list and reload, searching and ordering functionalities
|
- [#23784] Migrated list and reload, searching and ordering functionalities
|
||||||
- [#23785] Migrated the GNA functionalities
|
- [#23785] Migrated the GNA functionalities
|
||||||
- [#23834] Create Relationship facility
|
- [#23834] Integrated with the create/view/delete Relationship facility
|
||||||
- [#23913] Integrated with GUI presentation configurations read from IS
|
- [#23913] Integrated with GUI presentation configurations read from IS
|
||||||
- Moved to maven-portal-bom v3.7.0[-SNAPSHOT]
|
- Moved to maven-portal-bom v3.7.0[-SNAPSHOT]
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ 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.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.RelationshipDV;
|
|
||||||
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;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
|
@ -32,14 +31,14 @@ 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.CloseCreateRelationGUIEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
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.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.GetListOfRecordsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationOnItemEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationOnItemEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.RelationActionHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.RelationActionHandlerEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent;
|
||||||
|
@ -215,7 +214,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Loading Geoportal Configurations from IS
|
// Loading Geoportal Configurations from IS
|
||||||
GeoportalDataEntryServiceAsync.Util.getInstance()
|
GeoportalDataEntryServiceAsync.Util.getInstance()
|
||||||
.readDataViewerConfig(new AsyncCallback<GNADataEntryExtendedConfigProfile>() {
|
.readDataViewerConfig(new AsyncCallback<GNADataEntryExtendedConfigProfile>() {
|
||||||
|
|
||||||
|
@ -238,7 +237,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(GNADataEntryExtendedConfigProfile gNADataEntryConfig) {
|
public void onSuccess(GNADataEntryExtendedConfigProfile gNADataEntryConfig) {
|
||||||
GWT.log(GNADataEntryExtendedConfigProfile.class.getSimpleName() + " loaded: " + gNADataEntryConfig);
|
GWT.log(GNADataEntryExtendedConfigProfile.class.getSimpleName() + " loaded: "
|
||||||
|
+ gNADataEntryConfig);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
|
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
|
||||||
|
@ -251,7 +251,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
initGUI();
|
initGUI();
|
||||||
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
||||||
mainTabPanel.setRole(userRole);
|
mainTabPanel.setRole(userRole);
|
||||||
//GUI Presentation
|
// GUI Presentation
|
||||||
mainTabPanel.setGUIPresentation(gNADataEntryConfig.getDataEntryGUIPresentation());
|
mainTabPanel.setGUIPresentation(gNADataEntryConfig.getDataEntryGUIPresentation());
|
||||||
|
|
||||||
RoleRights roleRights = myRights.getRoleRights();
|
RoleRights roleRights = myRights.getRoleRights();
|
||||||
|
@ -784,7 +784,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
searchingFilter = mainTabPanel.getCurrentProjectsSearchingFilter();
|
searchingFilter = mainTabPanel.getCurrentProjectsSearchingFilter();
|
||||||
|
|
||||||
// Searching in the cache if the list of relationship definition is present
|
// Searching in the cache if the list of relationship definition is present
|
||||||
List<RelationshipDefinitionDV> listRelationshipsDef = geoportalCaches.getListRelationshipDefinitionForProfileId(profileID);
|
List<RelationshipDefinitionDV> listRelationshipsDef = geoportalCaches
|
||||||
|
.getListRelationshipDefinitionForProfileId(profileID);
|
||||||
// Loading list of relationships definition ProfileID
|
// Loading list of relationships definition ProfileID
|
||||||
if (listRelationshipsDef == null || listRelationshipsDef.isEmpty()) {
|
if (listRelationshipsDef == null || listRelationshipsDef.isEmpty()) {
|
||||||
|
|
||||||
|
@ -794,7 +795,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<RelationshipDefinitionDV> relationshipDef) {
|
public void onSuccess(List<RelationshipDefinitionDV> relationshipDef) {
|
||||||
GWT.log("getRelationshipNames for " + profileID + " are: " + relationshipDef);
|
GWT.log("getRelationshipNames for " + profileID + " are: " + relationshipDef);
|
||||||
geoportalCaches.putListRelationshipsDefinitionForProfileID(profileID, relationshipDef);
|
geoportalCaches.putListRelationshipsDefinitionForProfileID(profileID,
|
||||||
|
relationshipDef);
|
||||||
mainTabPanel.enableRelatioshipFacilities(
|
mainTabPanel.enableRelatioshipFacilities(
|
||||||
relationshipDef != null && !relationshipDef.isEmpty());
|
relationshipDef != null && !relationshipDef.isEmpty());
|
||||||
}
|
}
|
||||||
|
@ -840,81 +842,262 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
appManagerBus.addHandler(CreateRelationHandlerEvent.TYPE, new CreateRelationHandler() {
|
appManagerBus.addHandler(RelationActionHandlerEvent.TYPE, new RelationActionHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateRelation(CreateRelationHandlerEvent createRelationHE) {
|
public void onCreateRelation(RelationActionHandlerEvent createRelationHE) {
|
||||||
|
|
||||||
final Modal modal = new Modal(true, true);
|
if (createRelationHE.getRelactionActionType() == null)
|
||||||
modal.setTitle("Creating relation...");
|
return;
|
||||||
modal.setWidth(800);
|
|
||||||
modal.setCloseVisible(false);
|
|
||||||
final RelationshipDefinitionDV relationSelected = createRelationHE.getRelationSelected();
|
|
||||||
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 " + relationSelected.getLabel()
|
|
||||||
+ " from Project ID: " + fromProjectID + " to Project ID: " + toProjectID);
|
|
||||||
modalContainerPanel.add(loader);
|
|
||||||
modal.add(modalContainerPanel);
|
|
||||||
|
|
||||||
GeoportalDataEntryServiceAsync.Util.getInstance().createRelationship(fromProfileID, fromProjectID,
|
switch (createRelationHE.getRelactionActionType()) {
|
||||||
relationSelected.getId(), toProfileID, toProjectID, new AsyncCallback<Void>() {
|
case DELETE: {
|
||||||
|
|
||||||
@Override
|
if (createRelationHE.getFromProject() == null || createRelationHE.getToProject() == null) {
|
||||||
public void onFailure(Throwable caught) {
|
DialogInform di = new DialogInform(null, "No selection", "You must select a Project");
|
||||||
modalContainerPanel.clear();
|
di.center();
|
||||||
modal.setCloseVisible(true);
|
return;
|
||||||
try {
|
}
|
||||||
modal.remove(loader);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
Alert alert = new Alert(caught.getMessage());
|
|
||||||
alert.setType(AlertType.ERROR);
|
|
||||||
alert.setClose(false);
|
|
||||||
modal.add(alert);
|
|
||||||
|
|
||||||
}
|
String firstProject = createRelationHE.getFromProject().getFirstEntryOfMap().getKey() + ": "
|
||||||
|
+ createRelationHE.getFromProject().getFirstEntryOfMap().getValue() + " (id:"
|
||||||
|
+ createRelationHE.getFromProject().getId() + ")";
|
||||||
|
|
||||||
@Override
|
final String relationName = createRelationHE.getRelationName();
|
||||||
public void onSuccess(Void 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 " + relationSelected.getLabel() + " created correctly!");
|
|
||||||
modal.add(alert);
|
|
||||||
|
|
||||||
String htmlMsg = "In the project with:";
|
String secondProject = createRelationHE.getToProject().getFirstEntryOfMap().getKey() + ": "
|
||||||
htmlMsg += "<ul>";
|
+ createRelationHE.getToProject().getFirstEntryOfMap().getValue() + " (id:"
|
||||||
htmlMsg += "<li>id: " + fromProjectID + "</li>";
|
+ createRelationHE.getToProject().getId() + ")";
|
||||||
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>" + relationSelected.getLabel()
|
|
||||||
+ "</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());
|
String htmlMsg = "Going to delete the relation <b>" + relationName + "</b><br>";
|
||||||
}
|
htmlMsg += "<i style='color:#333;'>From Project:</i><ul><li>" + firstProject + "</li></ul>";
|
||||||
});
|
htmlMsg += "<b>" + relationName + "</b><br>";
|
||||||
|
htmlMsg += "<i style='color:#333;'>To Project:</i><ul><li>" + secondProject + "</li></ul>";
|
||||||
|
htmlMsg += "<br>";
|
||||||
|
htmlMsg += "Would you like to proceed?";
|
||||||
|
|
||||||
modal.show();
|
final ModalConfirm dialog = new ModalConfirm(null,
|
||||||
|
"Deleting relationship " + relationName + ", Confirm?", htmlMsg);
|
||||||
|
|
||||||
|
dialog.getYesButton().addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
dialog.hide();
|
||||||
|
|
||||||
|
final Modal modal = new Modal(true, true);
|
||||||
|
modal.setTitle("Deleting relationship...");
|
||||||
|
modal.setWidth(800);
|
||||||
|
modal.setCloseVisible(false);
|
||||||
|
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 delete the relation " + relationName
|
||||||
|
+ " from Project ID: " + fromProjectID + " to Project ID: " + toProjectID);
|
||||||
|
modalContainerPanel.add(loader);
|
||||||
|
modal.add(modalContainerPanel);
|
||||||
|
|
||||||
|
GeoportalDataEntryServiceAsync.Util.getInstance().deleteRelationship(fromProfileID,
|
||||||
|
fromProjectID, relationName, toProfileID, toProjectID, new AsyncCallback<ResultDocumentDV>() {
|
||||||
|
|
||||||
|
@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(ResultDocumentDV result) {
|
||||||
|
modal.setTitle("Relationship deleted");
|
||||||
|
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 " + relationName + " deleted correctly!");
|
||||||
|
modal.add(alert);
|
||||||
|
|
||||||
|
String htmlMsg = "In the project with:";
|
||||||
|
htmlMsg += "<ul>";
|
||||||
|
htmlMsg += "<li>id: " + fromProjectID + "</li>";
|
||||||
|
htmlMsg += "<li>profile: " + fromProfileID + "</li>";
|
||||||
|
htmlMsg += "<li>"
|
||||||
|
+ result.getFirstEntryOfMap().getKey()
|
||||||
|
+ ": "
|
||||||
|
+ result.getFirstEntryOfMap().getValue()
|
||||||
|
+ "</li>";
|
||||||
|
htmlMsg += "</ul>";
|
||||||
|
htmlMsg += "has been deleted the relationship <b>" + relationName
|
||||||
|
+ "</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);
|
||||||
|
|
||||||
|
List<DocumentDV> listDocuments = Arrays
|
||||||
|
.asList(result);
|
||||||
|
|
||||||
|
appManagerBus.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments,
|
||||||
|
OPERATION_ON_ITEM.VIEW_RELATIONSHIPS));
|
||||||
|
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(false,
|
||||||
|
fromProfileID,
|
||||||
|
mainTabPanel.getCurrentProjectsSearchingFilter(), true));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CREATE: {
|
||||||
|
|
||||||
|
if (createRelationHE.getFromProject() == null || createRelationHE.getToProject() == null) {
|
||||||
|
DialogInform di = new DialogInform(null, "No selection",
|
||||||
|
"You must select a Project from/to in the table");
|
||||||
|
di.center();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String firstProject = createRelationHE.getFromProject().getFirstEntryOfMap().getKey() + ": "
|
||||||
|
+ createRelationHE.getFromProject().getFirstEntryOfMap().getValue() + " (id:"
|
||||||
|
+ createRelationHE.getFromProject().getId() + ")";
|
||||||
|
|
||||||
|
String relation = createRelationHE.getRelationSelected().getLabel();
|
||||||
|
|
||||||
|
String secondProject = createRelationHE.getToProject().getFirstEntryOfMap().getKey() + ": "
|
||||||
|
+ createRelationHE.getToProject().getFirstEntryOfMap().getValue() + " (id:"
|
||||||
|
+ createRelationHE.getToProject().getId() + ")";
|
||||||
|
|
||||||
|
String htmlMsg = "Going to create the relation <b>" + relation + "</b><br>";
|
||||||
|
htmlMsg += "<i style='color:#333;'>From Project:</i><ul><li>" + firstProject + "</li></ul>";
|
||||||
|
htmlMsg += "<b>" + relation + "</b><br>";
|
||||||
|
htmlMsg += "<i style='color:#333;'>To Project:</i><ul><li>" + secondProject + "</li></ul>";
|
||||||
|
htmlMsg += "<br>";
|
||||||
|
htmlMsg += "Would you like to proceed?";
|
||||||
|
|
||||||
|
final ModalConfirm dialog = new ModalConfirm(null,
|
||||||
|
"Creating relationship " + relation + ", Confirm?", htmlMsg);
|
||||||
|
|
||||||
|
dialog.getYesButton().addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
dialog.hide();
|
||||||
|
|
||||||
|
final Modal modal = new Modal(true, true);
|
||||||
|
modal.setTitle("Creating relationship...");
|
||||||
|
modal.setWidth(800);
|
||||||
|
modal.setCloseVisible(false);
|
||||||
|
final RelationshipDefinitionDV relationSelected = createRelationHE.getRelationSelected();
|
||||||
|
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 " + relationSelected.getLabel()
|
||||||
|
+ " from Project ID: " + fromProjectID + " to Project ID: " + toProjectID);
|
||||||
|
modalContainerPanel.add(loader);
|
||||||
|
modal.add(modalContainerPanel);
|
||||||
|
|
||||||
|
GeoportalDataEntryServiceAsync.Util.getInstance().createRelationship(fromProfileID,
|
||||||
|
fromProjectID, relationSelected.getId(), toProfileID, toProjectID,
|
||||||
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
|
@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(Void 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 " + relationSelected.getLabel()
|
||||||
|
+ " 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>"
|
||||||
|
+ relationSelected.getLabel() + "</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());
|
||||||
|
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(false,
|
||||||
|
fromProfileID,
|
||||||
|
mainTabPanel.getCurrentProjectsSearchingFilter(), true));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1262,7 +1445,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
case VIEW_RELATIONSHIPS: {
|
case VIEW_RELATIONSHIPS: {
|
||||||
|
GWT.log("VIEW_RELATIONSHIPS fired");
|
||||||
mainTabPanel.showViewProjectRelationsPanel(true, resultDocumentDV);
|
mainTabPanel.showViewProjectRelationsPanel(true, resultDocumentDV);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
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.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.RelationshipDV;
|
|
||||||
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.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
@ -210,4 +209,18 @@ public interface GeoportalDataEntryService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
ResultDocumentDV getResultDocumentFoProjectByID(String profileID, String projectID) throws Exception;
|
ResultDocumentDV getResultDocumentFoProjectByID(String profileID, String projectID) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete relationship.
|
||||||
|
*
|
||||||
|
* @param fromProfileID the from profile ID
|
||||||
|
* @param fromProjectID the from project ID
|
||||||
|
* @param id the id
|
||||||
|
* @param toProfileID the to profile ID
|
||||||
|
* @param toProjectID the to project ID
|
||||||
|
* @return
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
ResultDocumentDV deleteRelationship(String fromProfileID, String fromProjectID, String id, String toProfileID,
|
||||||
|
String toProjectID) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
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.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.RelationshipDV;
|
|
||||||
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.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
@ -93,4 +92,7 @@ public interface GeoportalDataEntryServiceAsync {
|
||||||
|
|
||||||
void getResultDocumentFoProjectByID(String profileID, String projectID, AsyncCallback<ResultDocumentDV> callback);
|
void getResultDocumentFoProjectByID(String profileID, String projectID, AsyncCallback<ResultDocumentDV> callback);
|
||||||
|
|
||||||
|
void deleteRelationship(String fromProfileID, String fromProjectID, String id, String toProfileID,
|
||||||
|
String toProjectID, AsyncCallback<ResultDocumentDV> asyncCallback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
|
||||||
|
|
||||||
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 RelationshipDefinitionDV relationSelected;
|
|
||||||
private ResultDocumentDV toProject;
|
|
||||||
|
|
||||||
public CreateRelationHandlerEvent(ResultDocumentDV fromProject, RelationshipDefinitionDV relationSelected,
|
|
||||||
ResultDocumentDV toProject) {
|
|
||||||
this.fromProject = fromProject;
|
|
||||||
this.relationSelected = relationSelected;
|
|
||||||
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 RelationshipDefinitionDV getRelationSelected() {
|
|
||||||
return relationSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResultDocumentDV getToProject() {
|
|
||||||
return toProject;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,18 +3,18 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface CreateRelationHandler.
|
* The Interface RelationActionHandler.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Sep 21, 2022
|
* Oct 5, 2022
|
||||||
*/
|
*/
|
||||||
public interface CreateRelationHandler extends EventHandler {
|
public interface RelationActionHandler extends EventHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On create relation.
|
* On create relation.
|
||||||
*
|
*
|
||||||
* @param createRelationHandlerEvent the create relation handler event
|
* @param createRelationHandlerEvent the create relation handler event
|
||||||
*/
|
*/
|
||||||
void onCreateRelation(CreateRelationHandlerEvent createRelationHandlerEvent);
|
void onCreateRelation(RelationActionHandlerEvent createRelationHandlerEvent);
|
||||||
}
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class RelationActionHandlerEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Oct 5, 2022
|
||||||
|
*/
|
||||||
|
public class RelationActionHandlerEvent extends GwtEvent<RelationActionHandler> {
|
||||||
|
|
||||||
|
/** The type. */
|
||||||
|
public static Type<RelationActionHandler> TYPE = new Type<RelationActionHandler>();
|
||||||
|
private ResultDocumentDV fromProject;
|
||||||
|
private RelationshipDefinitionDV relationSelected;
|
||||||
|
private ResultDocumentDV toProject;
|
||||||
|
private RELACTION_ACTION_TYPE relactionActionType;
|
||||||
|
private String relationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum RELACTION_ACTION_TYPE.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Oct 5, 2022
|
||||||
|
*/
|
||||||
|
public static enum RELACTION_ACTION_TYPE {
|
||||||
|
CREATE, DELETE
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new relation action handler event.
|
||||||
|
*
|
||||||
|
* @param fromProject the from project
|
||||||
|
* @param relationSelected the relation selected
|
||||||
|
* @param toProject the to project
|
||||||
|
*/
|
||||||
|
public RelationActionHandlerEvent(ResultDocumentDV fromProject, RelationshipDefinitionDV relationSelected,
|
||||||
|
ResultDocumentDV toProject) {
|
||||||
|
this.fromProject = fromProject;
|
||||||
|
this.relationSelected = relationSelected;
|
||||||
|
this.toProject = toProject;
|
||||||
|
this.relactionActionType = RELACTION_ACTION_TYPE.CREATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new relation action handler event.
|
||||||
|
*
|
||||||
|
* @param fromProject the from project
|
||||||
|
* @param relationName the relation name
|
||||||
|
* @param toProject the to project
|
||||||
|
*/
|
||||||
|
public RelationActionHandlerEvent(ResultDocumentDV fromProject, String relationName, ResultDocumentDV toProject) {
|
||||||
|
this.fromProject = fromProject;
|
||||||
|
this.toProject = toProject;
|
||||||
|
this.relationName = relationName;
|
||||||
|
this.relactionActionType = RELACTION_ACTION_TYPE.DELETE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<RelationActionHandler> 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(RelationActionHandler handler) {
|
||||||
|
handler.onCreateRelation(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the from project.
|
||||||
|
*
|
||||||
|
* @return the from project
|
||||||
|
*/
|
||||||
|
public ResultDocumentDV getFromProject() {
|
||||||
|
return fromProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the relation selected.
|
||||||
|
*
|
||||||
|
* @return the relation selected
|
||||||
|
*/
|
||||||
|
public RelationshipDefinitionDV getRelationSelected() {
|
||||||
|
return relationSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the to project.
|
||||||
|
*
|
||||||
|
* @return the to project
|
||||||
|
*/
|
||||||
|
public ResultDocumentDV getToProject() {
|
||||||
|
return toProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the relaction action type.
|
||||||
|
*
|
||||||
|
* @return the relaction action type
|
||||||
|
*/
|
||||||
|
public RELACTION_ACTION_TYPE getRelactionActionType() {
|
||||||
|
return relactionActionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the relation name.
|
||||||
|
*
|
||||||
|
* @return the relation name
|
||||||
|
*/
|
||||||
|
public String getRelationName() {
|
||||||
|
return relationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
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.CloseCreateRelationGUIEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateRelationHandlerEvent;
|
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.resource.Images;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ public class CreateRelationProjectsPanel extends Composite {
|
||||||
|
|
||||||
RelationshipDefinitionDV relationSelected = mapRelationsDefiniton.get(listBoxRelationNames.getSelectedValue());
|
RelationshipDefinitionDV relationSelected = mapRelationsDefiniton.get(listBoxRelationNames.getSelectedValue());
|
||||||
|
|
||||||
appManagerBus.fireEvent(new CreateRelationHandlerEvent(selectedProjects.get(0),
|
appManagerBus.fireEvent(new RelationActionHandlerEvent(selectedProjects.get(0),
|
||||||
relationSelected, selectedProjects.get(1)));
|
relationSelected, selectedProjects.get(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
package org.gcube.portlets.user.geoportaldataentry.client.ui.relation;
|
package org.gcube.portlets.user.geoportaldataentry.client.ui.relation;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
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.RelationshipDV;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
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.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.report.ReportTemplateToHTML;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||||
|
|
||||||
|
@ -17,7 +19,6 @@ import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
@ -62,6 +63,8 @@ public class ViewRelationshipPanel extends Composite {
|
||||||
|
|
||||||
private HandlerManager appManagerBus;
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
|
private Map<String, ResultDocumentDV> mapOfTargetProjectForId = new HashMap<String, ResultDocumentDV>();
|
||||||
|
|
||||||
public ViewRelationshipPanel(HandlerManager appManagerBus, ResultDocumentDV fromProject) {
|
public ViewRelationshipPanel(HandlerManager appManagerBus, ResultDocumentDV fromProject) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.appManagerBus = appManagerBus;
|
this.appManagerBus = appManagerBus;
|
||||||
|
@ -102,12 +105,34 @@ public class ViewRelationshipPanel extends Composite {
|
||||||
secondProjectPanelContainer.clear();
|
secondProjectPanelContainer.clear();
|
||||||
|
|
||||||
for (RelationshipDV relationDV : project.getListRelationshipDV()) {
|
for (RelationshipDV relationDV : project.getListRelationshipDV()) {
|
||||||
|
|
||||||
|
|
||||||
final FlexTable flexTable = new FlexTable();
|
final FlexTable flexTable = new FlexTable();
|
||||||
flexTable.getElement().getStyle().setMarginTop(10, Unit.PX);
|
flexTable.getElement().addClassName("box-table-diplay-project");
|
||||||
Label label = new Label();
|
Label label = new Label();
|
||||||
label.setType(LabelType.INFO);
|
label.setType(LabelType.INFO);
|
||||||
label.setText(relationDV.getRelationshipName());
|
label.setText(relationDV.getRelationshipName());
|
||||||
flexTable.setWidget(0, 0, label);
|
|
||||||
|
|
||||||
|
FlowPanel panelContainer = new FlowPanel();
|
||||||
|
Button deleteRelation = new Button("",IconType.TRASH);
|
||||||
|
deleteRelation.setTitle("Delete this releation");
|
||||||
|
deleteRelation.setType(ButtonType.LINK);
|
||||||
|
deleteRelation.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
ResultDocumentDV toProject = mapOfTargetProjectForId.get(relationDV.getTargetUCD());
|
||||||
|
appManagerBus.fireEvent(new RelationActionHandlerEvent(project, relationDV.getRelationshipName(), toProject));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
panelContainer.add(label);
|
||||||
|
panelContainer.add(deleteRelation);
|
||||||
|
flexTable.setWidget(0, 0, panelContainer);
|
||||||
|
|
||||||
|
|
||||||
flexTable.setWidget(1, 0, new LoaderIcon("loading project.."));
|
flexTable.setWidget(1, 0, new LoaderIcon("loading project.."));
|
||||||
GeoportalDataEntryServiceAsync.Util.getInstance().getResultDocumentFoProjectByID(relationDV.getTargetUCD(),
|
GeoportalDataEntryServiceAsync.Util.getInstance().getResultDocumentFoProjectByID(relationDV.getTargetUCD(),
|
||||||
relationDV.getTargetID(), new AsyncCallback<ResultDocumentDV>() {
|
relationDV.getTargetID(), new AsyncCallback<ResultDocumentDV>() {
|
||||||
|
@ -120,6 +145,7 @@ public class ViewRelationshipPanel extends Composite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ResultDocumentDV result) {
|
public void onSuccess(ResultDocumentDV result) {
|
||||||
|
mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result);
|
||||||
Entry<String, Object> firstEntrySet = result.getFirstEntryOfMap();
|
Entry<String, Object> firstEntrySet = result.getFirstEntryOfMap();
|
||||||
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue()
|
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue()
|
||||||
+ "</b> (id: " + result.getId() + ")";
|
+ "</b> (id: " + result.getId() + ")";
|
||||||
|
|
|
@ -401,7 +401,7 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
|
||||||
|
|
||||||
for (String relationName : mapclusterOfRelationships.keySet()) {
|
for (String relationName : mapclusterOfRelationships.keySet()) {
|
||||||
|
|
||||||
html += mapclusterOfRelationships.get(relationName) + " - " + relationName + "\n";
|
html += mapclusterOfRelationships.get(relationName) + " - " + relationName + "; ";
|
||||||
}
|
}
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.client.utils.Serialization;
|
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.Project;
|
||||||
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
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.useCaseDescriptor.RelationshipDefinition;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.RelationshipDefinition;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
|
@ -39,7 +38,6 @@ 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.config.GcubeProfileDV;
|
||||||
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.RelationshipDV;
|
|
||||||
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;
|
||||||
|
@ -987,6 +985,26 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultDocumentDV deleteRelationship(String fromProfileID, String fromProjectID, String relationshipId, String toProfileID,
|
||||||
|
String toProjectID) throws Exception {
|
||||||
|
LOG.info("deleteRelationship called");
|
||||||
|
try {
|
||||||
|
ProjectsCaller projects = GeoportalClientCaller.projects();
|
||||||
|
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||||
|
projects.deleteRelationship(fromProfileID, fromProjectID, relationshipId, toProfileID, toProjectID);
|
||||||
|
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||||
|
return getResultDocumentFoProjectByID(fromProfileID, fromProjectID);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
String error = "Error occurred on deleting the relationship";
|
||||||
|
LOG.error(error, e);
|
||||||
|
throw new Exception(
|
||||||
|
error + ". Error: " + e.getMessage() + ". Refresh and try again or contact the support");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the project by ID.
|
* Gets the project by ID.
|
||||||
*
|
*
|
||||||
|
@ -1045,4 +1063,5 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,3 +242,13 @@ h1 {
|
||||||
.theDetailsPanel .accordion-group {
|
.theDetailsPanel .accordion-group {
|
||||||
border: 0 !important;
|
border: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.box-table-diplay-project {
|
||||||
|
border: 1px solid #96a5b5;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-table-diplay-project td {
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
Loading…
Reference in New Issue