created the CloneOperationPanel..
This commit is contained in:
parent
eb6a8ff587
commit
2c2109836c
|
@ -1,5 +1,7 @@
|
||||||
<?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">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +26,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-entry-app-2.2.0-SNAPSHOT">
|
<wb-module deploy-name="geoportal-data-entry-app-2.2.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +53,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +80,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,10 +107,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
<dependent-module archiveName="metadata-profile-discovery-1.0.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-discovery/metadata-profile-discovery">
|
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,7 +134,9 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,7 +161,9 @@
|
||||||
|
|
||||||
|
|
||||||
<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"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +188,9 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
8
pom.xml
8
pom.xml
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Convenience property to set the GWT version -->
|
<!-- Convenience property to set the GWT version -->
|
||||||
<gwtVersion>2.8.2</gwtVersion>
|
<gwtVersion>2.9.0</gwtVersion>
|
||||||
<!-- GWT needs at least java 1.6 -->
|
<!-- GWT needs at least java 1.6 -->
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -163,13 +163,17 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.application</groupId>
|
<groupId>org.gcube.application</groupId>
|
||||||
<artifactId>geoportal-client</artifactId>
|
<artifactId>geoportal-client</artifactId>
|
||||||
<version>[1.0.0, 1.0.7-SNAPSHOT)</version>
|
<version>[1.0.0, 1.0.8-SNAPSHOT)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>servlet-api</artifactId>
|
<artifactId>servlet-api</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.ow2.asm</groupId>
|
||||||
|
<artifactId>asm</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- END FORCING -->
|
<!-- END FORCING -->
|
||||||
|
|
|
@ -24,6 +24,8 @@ import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEven
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEventHandler;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionPerformedOnItemEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CloneProjectEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.events.CloneProjectEventHandler;
|
||||||
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.GetListOfRecordsEvent;
|
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
||||||
|
@ -31,6 +33,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecords
|
||||||
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.resource.Images;
|
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||||
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.CloneOperationPanel;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaMainTabPanel;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaMainTabPanel;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginatedView;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginatedView;
|
||||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.ModalWindow;
|
import org.gcube.portlets.user.geoportaldataentry.client.ui.ModalWindow;
|
||||||
|
@ -120,40 +123,6 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
RootPanel.get(DIV_PORTLET_ID).add(loader);
|
RootPanel.get(DIV_PORTLET_ID).add(loader);
|
||||||
|
|
||||||
/*
|
|
||||||
* GeoportalDataEntryServiceAsync.Util.getInstance().listDisplayFields(new
|
|
||||||
* AsyncCallback<List<ItemField>>() {
|
|
||||||
*
|
|
||||||
* @Override public void onFailure(Throwable caught) {
|
|
||||||
* Window.alert(caught.getMessage());
|
|
||||||
*
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* @Override public void onSuccess(List<ItemField> result) {
|
|
||||||
*
|
|
||||||
* for (ItemField itemField : result) { if(itemField.isDisplayAsResult()) {
|
|
||||||
* displayFields.add(itemField); }
|
|
||||||
*
|
|
||||||
* if(itemField.isSearchable()) { searchByFields.add(itemField); }
|
|
||||||
*
|
|
||||||
* if(itemField.isSortable()) { sortByFields.add(itemField); } }
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* GWT.log("List display fields: "+result); SearchingFilter initialSortFilter =
|
|
||||||
* new SearchingFilter(); initialSortFilter.setOrder(ORDER.ASC);
|
|
||||||
* initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name",
|
|
||||||
* Arrays.asList("name"), true, true, true)));
|
|
||||||
*
|
|
||||||
* displayFields = result; mainTabPanel = new GeonaMainTabPanel(appManagerBus,
|
|
||||||
* displayFields, sortByFields, searchByFields, initialSortFilter);
|
|
||||||
* mainTabPanel.setLoaderVisible("Loading...", true);
|
|
||||||
*
|
|
||||||
* geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
|
||||||
* mainTabPanel.addFormPanel(geoNaMainForm);
|
|
||||||
*
|
|
||||||
* } });
|
|
||||||
*/
|
|
||||||
|
|
||||||
GeoportalDataEntryServiceAsync.Util.getInstance()
|
GeoportalDataEntryServiceAsync.Util.getInstance()
|
||||||
.readDataViewerConfig(new AsyncCallback<GNADataEntryExtConfigProfile>() {
|
.readDataViewerConfig(new AsyncCallback<GNADataEntryExtConfigProfile>() {
|
||||||
|
|
||||||
|
@ -262,79 +231,6 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// GeoportalDataEntryServiceAsync.Util.getInstance().getMyRightsInTheContext(new AsyncCallback<UserRights>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFailure(Throwable caught) {
|
|
||||||
// String errorMsg = "Sorry, an error occurrend on istancing the application. Please, contact the support";
|
|
||||||
// Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
|
||||||
// alert.setClose(false);
|
|
||||||
// try {
|
|
||||||
// RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// RootPanel.get(DIV_PORTLET_ID).add(alert);
|
|
||||||
// Window.alert(errorMsg);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(UserRights result) {
|
|
||||||
// try {
|
|
||||||
// RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// myRights = result;
|
|
||||||
// initGUI();
|
|
||||||
// GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
|
||||||
// String msg = "Logged in as ";
|
|
||||||
// if(userRole != null && userRole.getName()!=null) {
|
|
||||||
// msg+= userRole.getName().substring(userRole.getName().indexOf("-")+1, userRole.getName().length());
|
|
||||||
// }else
|
|
||||||
// msg+="Member";
|
|
||||||
//
|
|
||||||
// mainTabPanel.setRoleLabel(msg);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// RoleRights roleRights = myRights.getRoleRights();
|
|
||||||
// boolean canCreateNewItem = roleRights.getListPermessions().keySet().contains(ACTION_ON_ITEM.CREATE_NEW_PROJECT);
|
|
||||||
//
|
|
||||||
// if (!canCreateNewItem) {
|
|
||||||
// // removing Tab "Create New Project"
|
|
||||||
// mainTabPanel.removeTab(0);
|
|
||||||
// // activating Tab "List of Project"
|
|
||||||
// mainTabPanel.setTabActive(0);
|
|
||||||
// mainTabPanel.instanceAndShowListOfConcessioni();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFailure(Throwable caught) {
|
|
||||||
// Window.alert(
|
|
||||||
// "Sorry, an error occurrend when loading configurations. Please, contact the support");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(GeonaISConfig result) {
|
|
||||||
//
|
|
||||||
// if (result != null && result.getgRSecondaryType() != null
|
|
||||||
// && result.getScope() != null) {
|
|
||||||
// callGetMetadataProfiles(result.getScope(), result.getgRSecondaryType());
|
|
||||||
// } else
|
|
||||||
// Window.alert(
|
|
||||||
// "Sorry, no configuration found in the context. Please, contact the support");
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initGUI() {
|
private void initGUI() {
|
||||||
|
@ -654,6 +550,38 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
appManagerBus.addHandler(CloneProjectEvent.TYPE, new CloneProjectEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateNewProject(CloneProjectEvent cloneProject) {
|
||||||
|
|
||||||
|
if (cloneProject.getConcessione() != null) {
|
||||||
|
|
||||||
|
GeoportalDataEntryServiceAsync.Util.getInstance().cloneTheRecord(
|
||||||
|
cloneProject.getConcessione().getItemId(), cloneProject.getNewProjectName(),
|
||||||
|
new AsyncCallback<CommitReport>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Alert alert = new Alert(caught.getMessage());
|
||||||
|
alert.setType(AlertType.ERROR);
|
||||||
|
alert.setClose(false);
|
||||||
|
Modal modal = new Modal(true);
|
||||||
|
modal.add(alert);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(CommitReport result) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
appManagerBus.addHandler(ActionPerformedOnItemEvent.TYPE, new ActionPerformedOnItemEventHandler() {
|
appManagerBus.addHandler(ActionPerformedOnItemEvent.TYPE, new ActionPerformedOnItemEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -844,32 +772,20 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
||||||
|
|
||||||
case CLONE_PROJECT: {
|
case CLONE_PROJECT: {
|
||||||
|
|
||||||
String htmlMsg = "Going to create a copy of the project with:";
|
final Modal modal3 = new Modal(true, true);
|
||||||
htmlMsg += "<ul>";
|
modal3.setTitle("Creating a copy of the project...");
|
||||||
htmlMsg += "<li>id: " + concessione.getItemId() + "</li>";
|
modal3.setWidth(950);
|
||||||
htmlMsg += "<li>name: " + concessione.getNome() + "</li>";
|
modal3.setHeight("700px");
|
||||||
htmlMsg += "</ul>";
|
modal3.setCloseVisible(true);
|
||||||
htmlMsg += "<br>";
|
((Element) modal3.getElement().getChildNodes().getItem(1))
|
||||||
htmlMsg += "Would you like to proceed?";
|
.addClassName("modal-body-custom");
|
||||||
|
|
||||||
final DialogConfirm dialog = new DialogConfirm(null, "Cloning Confirm?", htmlMsg);
|
CloneOperationPanel clonePanel = new CloneOperationPanel(appManagerBus, concessione);
|
||||||
dialog.center();
|
|
||||||
|
|
||||||
dialog.getYesButton().addClickHandler(new ClickHandler() {
|
modal3.add(clonePanel);
|
||||||
|
modal3.show();
|
||||||
@Override
|
|
||||||
public void onClick(ClickEvent event) {
|
|
||||||
dialog.hide();
|
|
||||||
final Modal modal = new Modal(true, true);
|
|
||||||
modal.setCloseVisible(true);
|
|
||||||
final HorizontalPanel hp = new HorizontalPanel();
|
|
||||||
final LoaderIcon lc = new LoaderIcon("Creating a copy of the project...");
|
|
||||||
hp.add(lc);
|
|
||||||
modal.add(hp);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
case DELETE_PROJECT: {
|
case DELETE_PROJECT: {
|
||||||
|
|
||||||
|
|
|
@ -139,4 +139,14 @@ public interface GeoportalDataEntryService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception;
|
GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the record.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param newProjectName the new project name
|
||||||
|
* @return the commit report
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
CommitReport cloneTheRecord(String itemId, String newProjectName) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,4 +63,6 @@ public interface GeoportalDataEntryServiceAsync {
|
||||||
|
|
||||||
void readDataViewerConfig(AsyncCallback<GNADataEntryExtConfigProfile> asyncCallback);
|
void readDataViewerConfig(AsyncCallback<GNADataEntryExtConfigProfile> asyncCallback);
|
||||||
|
|
||||||
|
void cloneTheRecord(String itemId, String newProjectName, AsyncCallback<CommitReport> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class CloneProjectEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 26, 2022
|
||||||
|
*/
|
||||||
|
public class CloneProjectEvent extends GwtEvent<CloneProjectEventHandler> {
|
||||||
|
|
||||||
|
/** The type. */
|
||||||
|
public static Type<CloneProjectEventHandler> TYPE = new Type<CloneProjectEventHandler>();
|
||||||
|
private ConcessioneDV concessione;
|
||||||
|
private String newProjectName;
|
||||||
|
|
||||||
|
public CloneProjectEvent(ConcessioneDV concessione, String newProjectName) {
|
||||||
|
this.concessione = concessione;
|
||||||
|
this.newProjectName = newProjectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<CloneProjectEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(CloneProjectEventHandler handler) {
|
||||||
|
handler.onCreateNewProject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConcessioneDV getConcessione() {
|
||||||
|
return concessione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNewProjectName() {
|
||||||
|
return newProjectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface CreateNewProjectEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Oct 13, 2020
|
||||||
|
*/
|
||||||
|
public interface CloneProjectEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On create new project.
|
||||||
|
*
|
||||||
|
* @param cloneProject the clone project
|
||||||
|
*/
|
||||||
|
void onCreateNewProject(CloneProjectEvent cloneProject);
|
||||||
|
}
|
|
@ -2,23 +2,18 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
// TODO: Auto-generated Javadoc
|
|
||||||
/**
|
/**
|
||||||
* The Class CreateNewProjectEvent.
|
* The Class CreateNewProjectEvent.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Oct 13, 2020
|
* Oct 13, 2020
|
||||||
*/
|
*/
|
||||||
public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler> {
|
public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler> {
|
||||||
|
|
||||||
/** The type. */
|
/** The type. */
|
||||||
public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>();
|
public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>();
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new cancel upload event.
|
|
||||||
*/
|
|
||||||
public CreateNewProjectEvent() {
|
public CreateNewProjectEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +22,9 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
||||||
*
|
*
|
||||||
* @return the associated type
|
* @return the associated type
|
||||||
*/
|
*/
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,8 +37,12 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
||||||
*
|
*
|
||||||
* @param handler the handler
|
* @param handler the handler
|
||||||
*/
|
*/
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||||
|
* EventHandler)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void dispatch(CreateNewProjectEventHandler handler) {
|
protected void dispatch(CreateNewProjectEventHandler handler) {
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class CloneOperationPanel extends Composite {
|
||||||
|
|
||||||
|
private static CloneOperationPanelUiBinder uiBinder = GWT.create(CloneOperationPanelUiBinder.class);
|
||||||
|
|
||||||
|
interface CloneOperationPanelUiBinder extends UiBinder<Widget, CloneOperationPanel> {
|
||||||
|
}
|
||||||
|
|
||||||
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
|
public CloneOperationPanel(HandlerManager appManagerBus, ConcessioneDV concessione) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.appManagerBus = appManagerBus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TextBox projectNameTextBox;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
AlertBlock infoBlock;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
AlertBlock infoProjectName;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button publishNewProjectButton;
|
||||||
|
|
||||||
|
private ConcessioneDV selectedProject;
|
||||||
|
|
||||||
|
public CloneOperationPanel(ConcessioneDV concessione) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
|
this.selectedProject = concessione;
|
||||||
|
infoProjectName.setText(selectedProject.getNome());
|
||||||
|
projectNameTextBox.setText(selectedProject.getNome());
|
||||||
|
projectNameTextBox.setEnabled(false);
|
||||||
|
|
||||||
|
publishNewProjectButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
boolean isValid = checkIsValidForm();
|
||||||
|
|
||||||
|
if (isValid) {
|
||||||
|
appManagerBus.fireEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean checkIsValidForm() {
|
||||||
|
String text = projectNameTextBox.getText();
|
||||||
|
if (text == null || text.isEmpty()) {
|
||||||
|
infoBlock.setVisible(true);
|
||||||
|
infoBlock.setText("The Project's name cannot be empty!");
|
||||||
|
infoBlock.setType(AlertType.ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.form-main-style {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fieldset-border-style {
|
||||||
|
border: 1px groove #444;
|
||||||
|
-webkit-box-shadow: 0px 0px 0px 0px #000;
|
||||||
|
box-shadow: 0px 0px 0px 0px #000;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-style {
|
||||||
|
width: auto;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@external .form-horizontal .input-large;
|
||||||
|
.form-horizontal .input-large {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-alert-style {
|
||||||
|
margin-top: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-save-style {
|
||||||
|
margin-top: 10px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||||
|
ui:field="form">
|
||||||
|
<b:AlertBlock type="INFO" animation="true" close="false"
|
||||||
|
ui:field="infoProjectName" styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||||
|
<b:Fieldset styleName="{style.fieldset-border-style}">
|
||||||
|
|
||||||
|
<b:Legend styleName="{style.legend-style}">
|
||||||
|
Clone Project
|
||||||
|
<small>
|
||||||
|
<span style="color:red;">*</span>
|
||||||
|
is required
|
||||||
|
</small>
|
||||||
|
</b:Legend>
|
||||||
|
|
||||||
|
<b:ControlGroup>
|
||||||
|
<b:ControlLabel for="name" title="Item Name">
|
||||||
|
<font color="red">*</font>
|
||||||
|
Name :
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:TextBox alternateSize="LARGE"
|
||||||
|
placeholder="Type the project name.." b:id="url"
|
||||||
|
title="Project's name" ui:field="projectNameTextBox" />
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
|
|
||||||
|
<!-- Alert blocks for info/errors -->
|
||||||
|
<b:AlertBlock type="INFO" animation="true"
|
||||||
|
visible="false" close="false" ui:field="infoBlock"
|
||||||
|
styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||||
|
</b:Fieldset>
|
||||||
|
</b:Form>
|
||||||
|
|
||||||
|
<g:FlowPanel>
|
||||||
|
<b:Button title="Publish as New Project"
|
||||||
|
ui:field="publishNewProjectButton" visible="true" type="PRIMARY"
|
||||||
|
addStyleNames="{style.button-save-style}">Publish as New Project</b:Button>
|
||||||
|
</g:FlowPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -91,7 +91,7 @@
|
||||||
<b:NavLink ui:field="navEditMode" title="Edit"
|
<b:NavLink ui:field="navEditMode" title="Edit"
|
||||||
icon="PENCIL">Edit</b:NavLink>
|
icon="PENCIL">Edit</b:NavLink>
|
||||||
<b:NavLink ui:field="navCloneProject" title="Clone Project"
|
<b:NavLink ui:field="navCloneProject" title="Clone Project"
|
||||||
icon="TRASH">Clone Project</b:NavLink>
|
icon="COPY">Clone Project</b:NavLink>
|
||||||
<b:NavLink ui:field="navDelete" title="Delete Project"
|
<b:NavLink ui:field="navDelete" title="Delete Project"
|
||||||
icon="TRASH">Delete Project</b:NavLink>
|
icon="TRASH">Delete Project</b:NavLink>
|
||||||
</b:NavPills>
|
</b:NavPills>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.utils.ConcessioniUtils;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
|
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
|
||||||
|
@ -66,6 +67,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
|
|
||||||
public static final String GEONA_GENERIC_RESOURCE_SECONDARY_TYPE = "GEONA_GENERIC_RESOURCE_SECONDARY_TYPE";
|
public static final String GEONA_GENERIC_RESOURCE_SECONDARY_TYPE = "GEONA_GENERIC_RESOURCE_SECONDARY_TYPE";
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataEntryServiceImpl.class);
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataEntryServiceImpl.class);
|
||||||
|
// private String mongoId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the GNA data entry config profile.
|
* Gets the GNA data entry config profile.
|
||||||
|
@ -78,7 +80,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
GNADataEntryConfigProfile profile = SessionUtil.getGNADataEntryConfigProfile(getThreadLocalRequest());
|
GNADataEntryConfigProfile profile = SessionUtil.getGNADataEntryConfigProfile(getThreadLocalRequest());
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
LOG.info(GNADataEntryConfigProfile.class.getSimpleName() + " is null, loading configurations from IS");
|
LOG.info(GNADataEntryConfigProfile.class.getSimpleName() + " is null, loading configurations from IS");
|
||||||
//to be sure
|
// to be sure
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
GeoportalCommon gCommon = new GeoportalCommon();
|
GeoportalCommon gCommon = new GeoportalCommon();
|
||||||
profile = gCommon.readGNADataEntryConfig();
|
profile = gCommon.readGNADataEntryConfig();
|
||||||
|
@ -381,6 +383,45 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone the record.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param newProjectName the new project name
|
||||||
|
* @return the commit report
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommitReport cloneTheRecord(String itemId, String newProjectName) throws Exception {
|
||||||
|
|
||||||
|
try {
|
||||||
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
MongoServiceUtil serviceUtil = new MongoServiceUtil();
|
||||||
|
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||||
|
// TO be sure
|
||||||
|
Concessione concessione = clientMongo.getById(itemId);
|
||||||
|
Concessione concessioneNew = ConcessioniUtils.clone(clientMongo, concessione.getMongo_id());
|
||||||
|
// Publishing cloned Concessione
|
||||||
|
concessioneNew = clientMongo.publish(concessioneNew.getMongo_id());
|
||||||
|
// server report
|
||||||
|
ValidationReport report = concessioneNew.getReport();
|
||||||
|
LOG.info("ValidationReport: " + report);
|
||||||
|
|
||||||
|
// to client
|
||||||
|
CommitReport cRep = new CommitReport();
|
||||||
|
// cRep.setRecordId(concessione.getId());
|
||||||
|
cRep.setMongoId(concessioneNew.getMongo_id());
|
||||||
|
ValidationReportDV vr = ConvertToDataViewModel.toValidationReport(report);
|
||||||
|
cRep.setValidationReportDV(vr);
|
||||||
|
|
||||||
|
return cRep;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Error occurred during cloning the project with id: " + itemId, e);
|
||||||
|
throw new Exception("Sorry an error occurred during cloning the Project. Refresh and try again");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the geona init config.
|
* Gets the geona init config.
|
||||||
*
|
*
|
||||||
|
@ -748,7 +789,13 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
||||||
"Error occurred on updating the project with id: " + itemId + ". Error: " + e.getMessage());
|
"Error occurred on updating the project with id: " + itemId + ". Error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data viewer config.
|
||||||
|
*
|
||||||
|
* @return the GNA data entry ext config profile
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception {
|
public GNADataEntryExtConfigProfile readDataViewerConfig() throws Exception {
|
||||||
LOG.info("readDataViewerConfig called");
|
LOG.info("readDataViewerConfig called");
|
||||||
|
|
Loading…
Reference in New Issue