in progress
This commit is contained in:
parent
0cb588a881
commit
0e30076f08
|
@ -1,5 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -36,7 +41,12 @@
|
|||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-3.0.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -73,7 +83,12 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -110,7 +125,12 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -156,7 +176,12 @@
|
|||
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -193,7 +218,12 @@
|
|||
|
||||
|
||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -230,7 +260,12 @@
|
|||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -267,7 +302,12 @@
|
|||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@ import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
|
|||
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
||||
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.LifecycleInformationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||
|
@ -284,29 +284,6 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
private void loadGeoportalConfigs(final String scope) {
|
||||
GWT.log("loading GeoportalConfigsAndBuildCards in the scope: " + scope);
|
||||
orderedCards = new ArrayList<GeoNaFormCardModel>();
|
||||
// // TODO PASS THE RIGHT ID
|
||||
// GeoportalDataEntryServiceAsync.Util.getInstance().getListDocumentConfigurationForId("id",
|
||||
// new AsyncCallback<List<DocumentConfigDV>>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(Throwable caught) {
|
||||
// GWT.log("caught: " + caught);
|
||||
// Window.alert(caught.toString());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(List<DocumentConfigDV> result) {
|
||||
// listUCDescriptors = result;
|
||||
// GWT.log("List<DocumentConfigDV>: " + result);
|
||||
//
|
||||
// if (result == null || result.size() == 0) {
|
||||
// Window.alert("No Configuration found in this scope. Please contact the support");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// setListDocumentConfig(listUCDescriptors);
|
||||
// }
|
||||
// });
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getListUseCaseDescriptors(null,
|
||||
new AsyncCallback<List<UseCaseDescriptorDV>>() {
|
||||
|
@ -372,7 +349,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
}
|
||||
|
||||
private void createNewDataEntyFor(HandlerDeclarationDV handlerDeclarationDV, List<GcubeProfileDV> listGPs) {
|
||||
private void createNewDataEntyFor(String profileID, HandlerDeclarationDV handlerDeclarationDV,
|
||||
List<GcubeProfileDV> listGPs) {
|
||||
dataEntryProjectCreated = true;
|
||||
mainTabPanel.setLoaderVisible("Loading...", true);
|
||||
orderedCards.clear();
|
||||
|
@ -383,7 +361,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
if (cardsPerIT != null) {
|
||||
orderedCards.addAll(cardsPerIT);
|
||||
buildNewCards(orderedCards, OPERATION.NEW);
|
||||
buildNewCards(profileID, orderedCards, OPERATION.NEW);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -436,7 +414,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
orderedCards.addAll(gnaCardsModels);
|
||||
mapGcubeProfilePerItemType.put(handlerDeclarationDV.getItemType(),
|
||||
new ArrayList<GeoNaFormCardModel>(gnaCardsModels));
|
||||
buildNewCards(orderedCards, OPERATION.UPDATE);
|
||||
buildNewCards(profileID, orderedCards, OPERATION.UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,7 +428,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
}
|
||||
}
|
||||
|
||||
private void buildNewCards(Collection<GeoNaFormCardModel> orderedCards, OPERATION operation) {
|
||||
private void buildNewCards(String profileID, Collection<GeoNaFormCardModel> orderedCards, OPERATION operation) {
|
||||
projectSavedWithSuccess = false; // resetting state of saving
|
||||
mainTabPanel.setLoaderVisible("Loading...", true);
|
||||
geoNaMainForm.setVisibleFormActions(true);
|
||||
|
@ -469,7 +447,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
if (geonaForm.getFormCard() != null) {
|
||||
key = geonaForm.getFormCard().getTitle();
|
||||
}
|
||||
geoNaMainForm.addForm(key, geonaForm);
|
||||
// profileID is unique for all the cards/forms
|
||||
geoNaMainForm.addForm(profileID, key, geonaForm);
|
||||
mapForms.put(key, geonaForm);
|
||||
|
||||
// }
|
||||
|
@ -507,7 +486,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
modal.add(modalContainerPanel);
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().saveGeonaDataForms(
|
||||
saveGeonaDataFormsEvent.getListGeonaDataForms(), new AsyncCallback<CommitReport>() {
|
||||
saveGeonaDataFormsEvent.getProfileID(), saveGeonaDataFormsEvent.getListGeonaDataForms(),
|
||||
new AsyncCallback<CommitReport>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -529,41 +509,56 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
public void onSuccess(CommitReport result) {
|
||||
modalContainerPanel.clear();
|
||||
modal.setCloseVisible(true);
|
||||
HTML recordPublished = new HTML();
|
||||
ValidationReportDV vr = result.getValidationReportDV();
|
||||
switch (vr.getStatus()) {
|
||||
case PASSED:
|
||||
|
||||
LifecycleInformationDV lcDV = result.getLifecycleInformation();
|
||||
|
||||
HTML htmlPhase = new HTML();
|
||||
htmlPhase.setHTML("Current phase: <b>" + lcDV.getPhase() + "</b>");
|
||||
|
||||
HTML htmlStep = new HTML();
|
||||
htmlStep.setHTML("Invoked Step: <b>" + lcDV.getLastInvokedStep() + "</b>");
|
||||
|
||||
HTML lastOperationStatus = new HTML();
|
||||
switch (lcDV.getLastOperationStatus()) {
|
||||
case OK: {
|
||||
String success = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "32CD32", null,
|
||||
"SUCCESS");
|
||||
recordPublished.setHTML("Record Published with " + success);
|
||||
String msg = lcDV.getLastInvokedStep() + "terminated with: " + success;
|
||||
lastOperationStatus.setHTML(msg);
|
||||
projectSavedWithSuccess = true;
|
||||
String msg = "Record published with success";
|
||||
geoNaMainForm.showAlertOnSaveAction(msg, AlertType.SUCCESS, true);
|
||||
purgeFileUploaded();
|
||||
break;
|
||||
case WARNING:
|
||||
}
|
||||
case WARNING: {
|
||||
String warning = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF8000", null,
|
||||
"WARNING");
|
||||
recordPublished.setHTML("Record Published with " + warning);
|
||||
String msg = lcDV.getLastInvokedStep() + "terminated with: " + warning;
|
||||
lastOperationStatus.setHTML(msg);
|
||||
geoNaMainForm.enableButtonSave(true);
|
||||
break;
|
||||
case ERROR:
|
||||
}
|
||||
case ERROR: {
|
||||
String error = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold",
|
||||
"ERROR");
|
||||
recordPublished.setHTML(error + " on publishing the Record");
|
||||
String msg = lcDV.getLastInvokedStep() + "terminated with: " + error;
|
||||
lastOperationStatus.setHTML(msg);
|
||||
geoNaMainForm.enableButtonSave(true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
modalContainerPanel.add(recordPublished);
|
||||
modalContainerPanel.add(htmlPhase);
|
||||
modalContainerPanel.add(htmlStep);
|
||||
modalContainerPanel.add(lastOperationStatus);
|
||||
|
||||
if (result.getMongoId() != null) {
|
||||
modalContainerPanel.add(new HTML("Record id: " + (result.getMongoId())));
|
||||
if (result.getProjectID() != null) {
|
||||
modalContainerPanel.add(new HTML("Record id: " + (result.getProjectID())));
|
||||
|
||||
try {
|
||||
savedMap.put(result.getMongoId(),
|
||||
savedMap.put(result.getProjectID(),
|
||||
saveGeonaDataFormsEvent.getListGeonaDataForms());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
|
@ -574,7 +569,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
hpGetLink.add(lc);
|
||||
modalContainerPanel.add(hpGetLink);
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(
|
||||
result.getMongoId(), RECORD_TYPE.CONCESSIONE,
|
||||
result.getProjectID(), saveGeonaDataFormsEvent.getProfileID(),
|
||||
new AsyncCallback<GeoNaItemRef>() {
|
||||
|
||||
@Override
|
||||
|
@ -589,7 +584,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
String theURL = result.getRestrictedLink().getShortURL() != null
|
||||
? result.getRestrictedLink().getShortURL()
|
||||
: result.getRestrictedLink().getCompleteURL();
|
||||
String htmlLink = "<div>Go to record: <a href=" + theURL
|
||||
String htmlLink = "<div>Go to project: <a href=" + theURL
|
||||
+ " target=\"_blank\">" + theURL + "</a></div>";
|
||||
HTML html = new HTML(htmlLink);
|
||||
hpGetLink.add(html);
|
||||
|
@ -601,8 +596,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
// geoNaMainForm.enableButtonSave(true);
|
||||
// resetUI();
|
||||
|
||||
if (vr.getAsJSONString() != null) {
|
||||
modalContainerPanel.add(new ReportTemplateToHTML(vr.getAsJSONString(), false));
|
||||
if (lcDV.getAsJSONString() != null) {
|
||||
modalContainerPanel.add(new ReportTemplateToHTML(lcDV.getAsJSONString(), false));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -619,9 +614,10 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onCreateNewProject(CreateNewProjectEvent newProjectEvent) {
|
||||
GWT.log("Crate new project");
|
||||
GWT.log("Create new project");
|
||||
if (!dataEntryProjectCreated) {
|
||||
createNewDataEntyFor(newProjectEvent.getHandler(), newProjectEvent.getListGcubeProfiles());
|
||||
createNewDataEntyFor(newProjectEvent.getProfileID(), newProjectEvent.getHandler(),
|
||||
newProjectEvent.getListGcubeProfiles());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -636,7 +632,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
confirm.hide();
|
||||
createNewDataEntyFor(newProjectEvent.getHandler(), newProjectEvent.getListGcubeProfiles());
|
||||
createNewDataEntyFor(newProjectEvent.getProfileID(), newProjectEvent.getHandler(),
|
||||
newProjectEvent.getListGcubeProfiles());
|
||||
// buildNewCards(orderedCards, OPERATION.NEW);
|
||||
}
|
||||
|
||||
|
@ -646,7 +643,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
} else if (projectSavedWithSuccess) {
|
||||
// means the project has been saved
|
||||
createNewDataEntyFor(newProjectEvent.getHandler(), newProjectEvent.getListGcubeProfiles());
|
||||
createNewDataEntyFor(newProjectEvent.getProfileID(), newProjectEvent.getHandler(),
|
||||
newProjectEvent.getListGcubeProfiles());
|
||||
// buildNewCards(orderedCards, OPERATION.NEW);
|
||||
} else {
|
||||
|
||||
|
@ -658,7 +656,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
confirm.hide();
|
||||
createNewDataEntyFor(newProjectEvent.getHandler(), newProjectEvent.getListGcubeProfiles());
|
||||
createNewDataEntyFor(newProjectEvent.getProfileID(), newProjectEvent.getHandler(),
|
||||
newProjectEvent.getListGcubeProfiles());
|
||||
|
||||
}
|
||||
|
||||
|
@ -752,7 +751,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
}
|
||||
|
||||
if (items == null || items.size() == 0) {
|
||||
Window.alert("You must select a record in the table");
|
||||
DialogInform di = new DialogInform(null, "No selection",
|
||||
"You must select a record in the table");
|
||||
di.center();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -813,7 +814,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open("", "_blank", "");
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(concessione.getItemId(),
|
||||
RECORD_TYPE.CONCESSIONE, new AsyncCallback<GeoNaItemRef>() {
|
||||
showItemEvent.getProfileID(), new AsyncCallback<GeoNaItemRef>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
hpGetLink.clear();
|
||||
|
@ -923,9 +924,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
alert.setClose(false);
|
||||
hp.add(alert);
|
||||
|
||||
appManagerBus.fireEvent(
|
||||
new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,grpw.getProfileID(),null,
|
||||
mainTabPanel.getCurrentSortFilter()));
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(
|
||||
RECORD_TYPE.CONCESSIONE, grpw.getProfileID(), null,
|
||||
mainTabPanel.getCurrentSortFilter()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,14 +29,7 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
|||
@RemoteServiceRelativePath("geoportaldataentryservice")
|
||||
public interface GeoportalDataEntryService extends RemoteService {
|
||||
|
||||
/**
|
||||
* Save geona data forms.
|
||||
*
|
||||
* @param listGeonaFormObjects the list geona form objects
|
||||
* @return the commit report
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception;
|
||||
CommitReport saveGeonaDataForms(String profileID, List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the geona init config.
|
||||
|
@ -45,15 +38,7 @@ public interface GeoportalDataEntryService extends RemoteService {
|
|||
*/
|
||||
GeonaISConfig getGeonaInitConfig();
|
||||
|
||||
/**
|
||||
* Gets the links for.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param recordType the record type
|
||||
* @return the links for
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
GeoNaItemRef getLinksFor(String itemId, RECORD_TYPE recordType) throws Exception;
|
||||
GeoNaItemRef getLinksFor(String itemId, String profileID) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the list projects.
|
||||
|
|
|
@ -39,14 +39,14 @@ public interface GeoportalDataEntryServiceAsync {
|
|||
}
|
||||
}
|
||||
|
||||
void saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects, AsyncCallback<CommitReport> callback);
|
||||
void saveGeonaDataForms(String profileID, List<GeoNaFormDataObject> listGeonaFormObjects, AsyncCallback<CommitReport> callback);
|
||||
|
||||
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback);
|
||||
|
||||
void getLinksFor(String itemId, RECORD_TYPE recordType, AsyncCallback<GeoNaItemRef> callback);
|
||||
void getLinksFor(String itemId, String profileID, AsyncCallback<GeoNaItemRef> callback);
|
||||
|
||||
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
|
||||
AsyncCallback<ResultSetPaginatedData> callback);
|
||||
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
|
||||
boolean reloadFromService, AsyncCallback<ResultSetPaginatedData> callback);
|
||||
|
||||
void deleteRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<Boolean> callback);
|
||||
|
||||
|
@ -64,8 +64,6 @@ public interface GeoportalDataEntryServiceAsync {
|
|||
|
||||
void readDataViewerConfig(AsyncCallback<GNADataEntryExtConfigProfile> asyncCallback);
|
||||
|
||||
// void getListDocumentConfigurationForId(String id, AsyncCallback<List<DocumentConfigDV>> callback);
|
||||
|
||||
void getListUseCaseDescriptors(List<String> handlersIds, AsyncCallback<List<UseCaseDescriptorDV>> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,16 +19,19 @@ public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItem
|
|||
public static Type<ActionOnItemEventHandler> TYPE = new Type<ActionOnItemEventHandler>();
|
||||
private List<T> selectItems;
|
||||
private ACTION_ON_ITEM action;
|
||||
private String profileID;
|
||||
|
||||
/**
|
||||
* Instantiates a new action on item event.
|
||||
*
|
||||
* @param selectItems the select items
|
||||
* @param doAction the do action
|
||||
* @param profileID the profile ID
|
||||
*/
|
||||
public ActionOnItemEvent(List<T> selectItems, ACTION_ON_ITEM doAction) {
|
||||
public ActionOnItemEvent(List<T> selectItems, ACTION_ON_ITEM doAction, String profileID) {
|
||||
this.selectItems = selectItems;
|
||||
this.action = doAction;
|
||||
this.profileID = profileID;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,11 +84,10 @@ public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItem
|
|||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -93,6 +95,8 @@ public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItem
|
|||
builder.append(selectItems);
|
||||
builder.append(", action=");
|
||||
builder.append(action);
|
||||
builder.append(", profileID=");
|
||||
builder.append(profileID);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
|||
public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>();
|
||||
private HandlerDeclarationDV handler;
|
||||
private List<GcubeProfileDV> listGcubeProfiles;
|
||||
private String profileID;
|
||||
|
||||
/**
|
||||
* Instantiates a new creates the new project event.
|
||||
|
@ -29,7 +30,9 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
|||
*/
|
||||
// (passing this second argument in order to avoid twice the casting as
|
||||
// List<GcubeProfileDV>)
|
||||
public CreateNewProjectEvent(HandlerDeclarationDV handler, List<GcubeProfileDV> listGcubeProfiles) {
|
||||
public CreateNewProjectEvent(String profileID, HandlerDeclarationDV handler,
|
||||
List<GcubeProfileDV> listGcubeProfiles) {
|
||||
this.profileID = profileID;
|
||||
this.handler = handler;
|
||||
this.listGcubeProfiles = listGcubeProfiles;
|
||||
}
|
||||
|
@ -79,4 +82,8 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
|||
return listGcubeProfiles;
|
||||
}
|
||||
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler>
|
|||
/** The type. */
|
||||
public static Type<SaveGeonaDataFormsHandler> TYPE = new Type<SaveGeonaDataFormsHandler>();
|
||||
private List<GeoNaFormDataObject> listGeonaDataForms;
|
||||
private String profileID;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -26,8 +27,9 @@ public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler>
|
|||
*
|
||||
* @param listGeonaDataForms the list geona data forms
|
||||
*/
|
||||
public SaveGeonaDataFormsEvent(List<GeoNaFormDataObject> listGeonaDataForms) {
|
||||
public SaveGeonaDataFormsEvent(String profileID, List<GeoNaFormDataObject> listGeonaDataForms) {
|
||||
this.listGeonaDataForms = listGeonaDataForms;
|
||||
this.profileID = profileID;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,5 +61,9 @@ public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler>
|
|||
public List<GeoNaFormDataObject> getListGeonaDataForms() {
|
||||
return listGeonaDataForms;
|
||||
}
|
||||
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
|||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||
import org.gcube.application.geoportalcommon.shared.WhereClause;
|
||||
import org.gcube.application.geoportalcommon.shared.config.ACTION_ON_ITEM;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.HandlerDeclarationDV;
|
||||
|
@ -17,7 +16,6 @@ import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorD
|
|||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||
|
@ -61,8 +59,6 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
*/
|
||||
public class GeonaMainTabPanel extends Composite {
|
||||
|
||||
private static final String YOU_MUST_TO_SELECT_A_PROJECT_IN_THE_TABLE = "You must to select a Project in the table";
|
||||
|
||||
private static final String LABEL_FILTER_SEPARATOR = " - ";
|
||||
|
||||
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
|
||||
|
@ -226,8 +222,9 @@ public class GeonaMainTabPanel extends Composite {
|
|||
public void onClick(ClickEvent event) {
|
||||
Window.alert("buttonReloadConcessioni MUST BE REVISITED");
|
||||
/*
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||
*/
|
||||
* appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
* getCurrentSortFilter()));
|
||||
*/
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -258,8 +255,9 @@ public class GeonaMainTabPanel extends Composite {
|
|||
alertSortBy.setText(labelASC);
|
||||
Window.alert("ASC MUST BE REVISITED");
|
||||
/*
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||
*/
|
||||
* appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
* getCurrentSortFilter()));
|
||||
*/
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -275,8 +273,9 @@ public class GeonaMainTabPanel extends Composite {
|
|||
alertSortBy.setText(labelDESC);
|
||||
Window.alert("DESC MUST BE REVISITED");
|
||||
/*
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||
*/
|
||||
* appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
* getCurrentSortFilter()));
|
||||
*/
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -308,8 +307,13 @@ public class GeonaMainTabPanel extends Composite {
|
|||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listConcessioni = grpw.getSelectItems();
|
||||
}
|
||||
appManagerBus
|
||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.VIEW_ON_MAP));
|
||||
|
||||
Window.alert("ACTION_ON_ITEM.VIEW_ON_MAP must be implemented");
|
||||
/*
|
||||
* appManagerBus .fireEvent(new
|
||||
* ActionOnItemEvent<ConcessioneDV>(listConcessioni,
|
||||
* ACTION_ON_ITEM.VIEW_ON_MAP));
|
||||
*/
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -322,8 +326,13 @@ public class GeonaMainTabPanel extends Composite {
|
|||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listConcessioni = grpw.getSelectItems();
|
||||
}
|
||||
appManagerBus
|
||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.VIEW_REPORT));
|
||||
|
||||
Window.alert("ACTION_ON_ITEM.VIEW_REPORT must be implemented");
|
||||
/*
|
||||
* appManagerBus .fireEvent(new
|
||||
* ActionOnItemEvent<ConcessioneDV>(listConcessioni,
|
||||
* ACTION_ON_ITEM.VIEW_REPORT));
|
||||
*/
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -336,8 +345,14 @@ public class GeonaMainTabPanel extends Composite {
|
|||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listConcessioni = grpw.getSelectItems();
|
||||
}
|
||||
appManagerBus
|
||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.EDIT_PROJECT));
|
||||
|
||||
Window.alert("ACTION_ON_ITEM.EDIT_PROJECT must be implemented");
|
||||
|
||||
/*
|
||||
* appManagerBus .fireEvent(new
|
||||
* ActionOnItemEvent<ConcessioneDV>(listConcessioni,
|
||||
* ACTION_ON_ITEM.EDIT_PROJECT));
|
||||
*/
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -349,8 +364,13 @@ public class GeonaMainTabPanel extends Composite {
|
|||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listConcessioni = grpw.getSelectItems();
|
||||
}
|
||||
appManagerBus.fireEvent(
|
||||
new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.DELETE_PROJECT));
|
||||
|
||||
Window.alert("ACTION_ON_ITEM.DELETE_PROJECT must be implemented");
|
||||
/*
|
||||
* appManagerBus.fireEvent( new
|
||||
* ActionOnItemEvent<ConcessioneDV>(listConcessioni,
|
||||
* ACTION_ON_ITEM.DELETE_PROJECT));
|
||||
*/
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -374,9 +394,9 @@ public class GeonaMainTabPanel extends Composite {
|
|||
searchField.setText("");
|
||||
Window.alert("resetSearch MUST BE REVISITED");
|
||||
/*
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||
resetSearch.setVisible(false);
|
||||
*/
|
||||
* appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
* getCurrentSortFilter())); resetSearch.setVisible(false);
|
||||
*/
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -394,11 +414,12 @@ public class GeonaMainTabPanel extends Composite {
|
|||
}
|
||||
|
||||
resetSearch.setVisible(true);
|
||||
|
||||
|
||||
Window.alert("doSearchEvent MUST BE REVISITED");
|
||||
/*
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||
*/
|
||||
* appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
* getCurrentSortFilter()));
|
||||
*/
|
||||
}
|
||||
|
||||
private String toLabelFilter(ItemFieldDV itemField, ORDER direction) {
|
||||
|
@ -508,9 +529,9 @@ public class GeonaMainTabPanel extends Composite {
|
|||
public void instanceAndShowListOfConcessioni() {
|
||||
Window.alert("instanceAndShowListOfConcessioni MUST BE REVISITED");
|
||||
/*
|
||||
grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, displayFields, currentSortFilter);
|
||||
showListOfConcessioniView(grpw);
|
||||
*/
|
||||
* grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE,
|
||||
* displayFields, currentSortFilter); showListOfConcessioniView(grpw);
|
||||
*/
|
||||
}
|
||||
|
||||
public void setListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
|
||||
|
@ -518,7 +539,7 @@ public class GeonaMainTabPanel extends Composite {
|
|||
this.listUCDescriptors = listUCDescriptors;
|
||||
ddCreateNewProject.clear();
|
||||
|
||||
for (UseCaseDescriptorDV ucd : listUCDescriptors) {
|
||||
for (final UseCaseDescriptorDV ucd : listUCDescriptors) {
|
||||
|
||||
HandlerDeclarationDV dataEntryHandler = getDataEntryHandler(ucd);
|
||||
|
||||
|
@ -541,7 +562,8 @@ public class GeonaMainTabPanel extends Composite {
|
|||
return;
|
||||
}
|
||||
|
||||
appManagerBus.fireEvent(new CreateNewProjectEvent(dataEntryHandler, listProfiles));
|
||||
appManagerBus.fireEvent(
|
||||
new CreateNewProjectEvent(ucd.getProfileID(), dataEntryHandler, listProfiles));
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -564,7 +586,8 @@ public class GeonaMainTabPanel extends Composite {
|
|||
if (dataEntryHandler != null) {
|
||||
ConfigurationDV<?> config = dataEntryHandler.getConfiguration();
|
||||
List<GcubeProfileDV> listGcubeProfiles = toListGcubeProfiles(config);
|
||||
appManagerBus.fireEvent(new CreateNewProjectEvent(dataEntryHandler, listGcubeProfiles));
|
||||
appManagerBus.fireEvent(new CreateNewProjectEvent(useCaseDescriptor.getProfileID(),
|
||||
dataEntryHandler, listGcubeProfiles));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<b:PageHeader subtext="data entry facility"
|
||||
styleName="{style.custom-page-header}">GNA</b:PageHeader>
|
||||
styleName="{style.custom-page-header}">GeoPortal</b:PageHeader>
|
||||
<g:Label ui:field="roleLabel"
|
||||
addStyleNames="{style.display-right}"></g:Label>
|
||||
<b:TabPanel tabPosition="above" ui:field="tabPanel">
|
||||
|
|
|
@ -72,6 +72,8 @@ public class GeonaDataEntryMainForm extends Composite {
|
|||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
private String profileID;
|
||||
|
||||
/**
|
||||
* Instantiates a new geona data entry main form.
|
||||
*
|
||||
|
@ -86,11 +88,13 @@ public class GeonaDataEntryMainForm extends Composite {
|
|||
* Adds the form.
|
||||
*
|
||||
* @param tabHeading the tab heading
|
||||
* @param key
|
||||
* @param geonFormModel the geon form model
|
||||
*/
|
||||
public void addForm(String tabHeading, GeoNaFormCardModel geonFormModel) {
|
||||
public void addForm(String profileID, String tabHeading, GeoNaFormCardModel geonFormModel) {
|
||||
this.profileID = profileID;
|
||||
listCards.add(geonFormModel);
|
||||
createNewCard(tabHeading, geonFormModel);
|
||||
createNewCard(profileID, tabHeading, geonFormModel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,7 +103,7 @@ public class GeonaDataEntryMainForm extends Composite {
|
|||
* @param tabHeading the tab heading
|
||||
* @param geonFormModel the geon form model
|
||||
*/
|
||||
private void createNewCard(String tabHeading, final GeoNaFormCardModel geonFormModel) {
|
||||
private void createNewCard(String profileID, String tabHeading, final GeoNaFormCardModel geonFormModel) {
|
||||
final Tab tab = new Tab();
|
||||
tab.setHeading(tabHeading);
|
||||
// MetadataFormCard mfc = new MetadataFormCard(tab, createMetadataForm,
|
||||
|
@ -170,7 +174,7 @@ public class GeonaDataEntryMainForm extends Composite {
|
|||
}
|
||||
listGeonaFormObjects.add(new GeoNaFormDataObject(listGDB, card.getGeonaFormModel().getGcubeProfile()));
|
||||
}
|
||||
appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(listGeonaFormObjects));
|
||||
appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(profileID, listGeonaFormObjects));
|
||||
} else {
|
||||
showAlertOnSaveAction("Detected errors, please fix it/them", AlertType.ERROR, true);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
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.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
|
||||
import org.gcube.application.geoportal.common.model.rest.TempFile;
|
||||
|
@ -31,8 +32,10 @@ import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
|||
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
|
||||
import org.gcube.application.geoportalcommon.shared.exception.GNAConfigException;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.LifecycleInformationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ProjectDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.UseCaseDescriptorDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||
|
@ -99,28 +102,45 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
/**
|
||||
* Save geona data forms.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param listGeonaFormObjects the list geona form objects
|
||||
* @return the commit report
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception {
|
||||
LOG.info("saveGeonaDataForms called");
|
||||
public CommitReport saveGeonaDataForms(String profileID, List<GeoNaFormDataObject> listGeonaFormObjects)
|
||||
throws Exception {
|
||||
LOG.info("saveGeonaDataForms called for profileID {}", profileID);
|
||||
|
||||
MongoServiceUtil mongoService = new MongoServiceUtil();
|
||||
|
||||
String theDocumentString = null;
|
||||
try {
|
||||
|
||||
FormDataObjectToJSON metadataConverter = new FormDataObjectToJSON();
|
||||
JSONObject theDocument = metadataConverter.convert(listGeonaFormObjects);
|
||||
String theDocumentString = theDocument.toString();
|
||||
theDocumentString = theDocument.toString();
|
||||
LOG.info("Got Document: " + theDocumentString);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on converting form data: ", e);
|
||||
throw new Exception(
|
||||
"Error occurred on converting data, try again or contact the support. Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
Project theProject = null;
|
||||
try {
|
||||
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
LOG.debug("Going to create the project...");
|
||||
Project theProject = mongoService.createNew("ProfileID", theDocumentString);
|
||||
theProject = mongoService.createNew(profileID, theDocumentString);
|
||||
LOG.info("Project created with id: " + theProject.getId() + " and profileID: " + theProject.getProfileID());
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on creating the project: ", e);
|
||||
throw new Exception("Error occurred on creating new project, try again or contact the support. Error: "
|
||||
+ e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
// Uploading files
|
||||
LOG.debug("Going to upload the files");
|
||||
for (GeoNaFormDataObject geoNaFormDataObject : listGeonaFormObjects) {
|
||||
|
@ -128,29 +148,28 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
GcubeProfileDV profile = geoNaFormDataObject.getGcubeProfileDV();
|
||||
|
||||
LOG.info("The profile is: " + profile);
|
||||
String sectionPath = profile.getParentName() + profile.getSectionName();
|
||||
for (GenericDatasetBean gdb : listGDB) {
|
||||
List<FileUploaded> files = gdb.getFilesUploaded();
|
||||
|
||||
if (files.size() > 0) {
|
||||
LOG.info("Uploading files in the section path: " + sectionPath);
|
||||
String parentPath = profile.getParentName();
|
||||
LOG.info("Uploading file/s in the parentPath: " + parentPath);
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
FileUploaded file = files.get(i);
|
||||
LOG.debug("Uploading file: " + file.getFileName());
|
||||
// As single object
|
||||
if (files.size() == 1) {
|
||||
String fieldName = profile.getSectionName();
|
||||
LOG.debug("Using field name: " + fieldName);
|
||||
mongoService.registerFileSet("ProfileID", theProject,
|
||||
new File(file.getTempSystemPath()), profile.getParentName(),
|
||||
profile.getSectionName(), "");
|
||||
|
||||
} else {
|
||||
// As Array of objects
|
||||
String fieldName = profile.getSectionName() + "[" + i + "]";
|
||||
LOG.debug("Using field name: " + fieldName);
|
||||
mongoService.registerFileSet("ProfileID", theProject,
|
||||
new File(file.getTempSystemPath()), profile.getParentName(), fieldName, "");
|
||||
String formFieldName = file.getFilePath().getFormFieldLabel();
|
||||
LOG.debug(
|
||||
"Uploading file: " + file.getFileName() + ", from formFieldName: " + formFieldName);
|
||||
FilePathDV filePath = retrieveFilePathForGcubeProfileFieldName(formFieldName, profile);
|
||||
LOG.info("Found {} for the form fieldName {}", filePath, formFieldName);
|
||||
if (filePath == null) {
|
||||
String error = "It is not possible to register the file " + formFieldName
|
||||
+ ", missing configuration in the filePaths config of: " + profile;
|
||||
throw new Exception(error);
|
||||
}
|
||||
|
||||
mongoService.registerFileSet(profileID, theProject, new File(file.getTempSystemPath()),
|
||||
parentPath, filePath.getFieldName(), filePath.getFieldDefinition());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -158,49 +177,31 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
LifecycleInformation lifecycleInfo = theProject.getLifecycleInformation();
|
||||
LifecycleInformationDV liDV = ConvertToDataValueObjectModel.toLifecycleInformationDV(lifecycleInfo);
|
||||
return new CommitReport(theProject.getId(), liDV);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on converting form data: ", e);
|
||||
LOG.error("Error on uploading files: ", e);
|
||||
throw new Exception(
|
||||
"Error occurred on saving data, try again or contact the support. Error: " + e.getMessage());
|
||||
"Error occurred on uploading files, try again or contact the support. Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
// try {
|
||||
//
|
||||
// Concessione concessione;
|
||||
// if (clientMongo != null && mongoId != null) {
|
||||
// SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
// concessione = clientMongo.publish(mongoId);
|
||||
// // server report
|
||||
// ValidationReport report = concessione.getReport();
|
||||
// LOG.info("ValidationReport: " + report);
|
||||
//
|
||||
// // to client
|
||||
// CommitReport cRep = new CommitReport();
|
||||
// // cRep.setRecordId(concessione.getId());
|
||||
// cRep.setMongoId(concessione.getMongo_id());
|
||||
// ValidationReportDV vr = ConvertToDataViewModel.toValidationReport(report);
|
||||
// cRep.setValidationReportDV(vr);
|
||||
//
|
||||
// return cRep;
|
||||
// } else
|
||||
// throw new Exception("MongoId or Client not found");
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// LOG.error("Error on commiting data: ", e);
|
||||
// throw new Exception("Error occurred on saving data. Error: " + e.getMessage());
|
||||
// } finally {
|
||||
//// if(manager!=null) {
|
||||
//// try {
|
||||
//// manager.shutdown();
|
||||
//// }catch (Exception e) {
|
||||
//// //silent
|
||||
//// }
|
||||
////
|
||||
//// }
|
||||
// }
|
||||
}
|
||||
|
||||
public static FilePathDV retrieveFilePathForGcubeProfileFieldName(String fieldName, GcubeProfileDV profile) {
|
||||
LOG.debug("Searching fieldDefinition for fieldName {} in the FilePaths {}", fieldName, profile.getFilePaths());
|
||||
|
||||
if (fieldName == null)
|
||||
return null;
|
||||
|
||||
for (FilePathDV path : profile.getFilePaths()) {
|
||||
if (path.getGcubeProfileFieldName().equals(fieldName)) {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -239,14 +240,14 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public GeoNaItemRef getLinksFor(String itemId, RECORD_TYPE recordType) throws Exception {
|
||||
public GeoNaItemRef getLinksFor(String itemId, String profileID) throws Exception {
|
||||
LOG.info("getLinksFor called");
|
||||
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GNADataViewerConfigProfile grViewerProfile = SessionUtil
|
||||
.getGeportalViewerResourceProfile(getThreadLocalRequest());
|
||||
GeoportalCommon gc = new GeoportalCommon(grViewerProfile);
|
||||
GeoNaItemRef item = new GeoNaItemRef(itemId, recordType.toString().toLowerCase());
|
||||
GeoNaItemRef item = new GeoNaItemRef(itemId, profileID);
|
||||
item = gc.getPublicLinksFor(item, false);
|
||||
LOG.info("Returning: " + item);
|
||||
return item;
|
||||
|
@ -778,17 +779,17 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
try {
|
||||
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||
|
||||
|
||||
if (handlersIds == null) {
|
||||
handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId());
|
||||
LOG.info("handlersIds is null, so using default: " + handlersIds);
|
||||
}
|
||||
//listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
||||
|
||||
// listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
||||
|
||||
listUseCaseDescriptor = client.getList();
|
||||
} catch (Exception e) {
|
||||
String error = "Error on contacting the Geoportal service";
|
||||
LOG.error(error+ " for handlers: " + handlersIds, e);
|
||||
LOG.error(error + " for handlers: " + handlersIds, e);
|
||||
throw new Exception(
|
||||
"Error when contacting the Geoportal service. Refresh and try again or contact the support");
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
|
||||
import org.gcube.application.geoportal.common.model.document.Project;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
|
||||
|
@ -48,14 +49,17 @@ public class MongoServiceUtil {
|
|||
UseCaseDescriptorsI client = null;
|
||||
|
||||
public UseCaseDescriptorsI useCaseDescriptorsClient() {
|
||||
LOG.debug("useCaseDescriptorsClient called");
|
||||
return useCaseDescriptors().build();
|
||||
}
|
||||
|
||||
public Projects<Project> getProjectsClient(String profileID) {
|
||||
LOG.debug("getProjectsClient called for profileID: " + profileID);
|
||||
return projects(profileID).build();
|
||||
}
|
||||
|
||||
public Project createNew(String profileID, String jsonDocument) throws RemoteException {
|
||||
LOG.debug("createNew called for profileID: " + profileID);
|
||||
Document myDocument = Document.parse(jsonDocument);
|
||||
Projects<Project> client = getProjectsClient(profileID);
|
||||
// Create project
|
||||
|
@ -64,20 +68,17 @@ public class MongoServiceUtil {
|
|||
return project;
|
||||
}
|
||||
|
||||
public void registerFileSet(String profileID, Project project, File theFile,
|
||||
String parentPath, String fieldName, String fieldDefinition)
|
||||
throws RemoteException, FileNotFoundException, JsonProcessingException {
|
||||
public void registerFileSet(String profileID, Project project, File theFile, String parentPath, String fieldName,
|
||||
String fieldDefinition) throws RemoteException, FileNotFoundException, JsonProcessingException, InvalidRequestException {
|
||||
LOG.debug("registerFileSet called for profileID: " + profileID);
|
||||
|
||||
Projects<Project> client = getProjectsClient(profileID);
|
||||
|
||||
// Prepare request
|
||||
RegisterFileSetRequest fsRequest = FileSets.prepareRequest(new StorageUtils(), parentPath, fieldName,
|
||||
fieldDefinition, theFile);
|
||||
|
||||
project = client.registerFileSet(project.getId(), fsRequest);
|
||||
|
||||
System.out.println("Resulting Project : " + project);
|
||||
System.out.println("JSON Reprepsentation : " + Serialization.write(project));
|
||||
LOG.trace("Resulting Project : " + project);
|
||||
LOG.debug("Resulting Project as JSON: " + Serialization.write(project));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.shared;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.LifecycleInformationDV;
|
||||
|
||||
/**
|
||||
* The Class CommitReport.
|
||||
|
@ -16,11 +16,9 @@ public class CommitReport implements Serializable {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -9519707669761939L;
|
||||
|
||||
public Long recordId;
|
||||
public String mongoId;
|
||||
public ValidationReportDV validationReportDV;
|
||||
private static final long serialVersionUID = -3606902201347318287L;
|
||||
public String projectID;
|
||||
private LifecycleInformationDV lifecycleInformation;
|
||||
|
||||
/**
|
||||
* Instantiates a new commit report.
|
||||
|
@ -29,46 +27,33 @@ public class CommitReport implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
public CommitReport(Long recordId, String mongoId, ValidationReportDV validationReportDV) {
|
||||
super();
|
||||
this.recordId = recordId;
|
||||
this.mongoId = mongoId;
|
||||
this.validationReportDV = validationReportDV;
|
||||
public CommitReport(String projectID, LifecycleInformationDV lifecycleInfo) {
|
||||
this.projectID = projectID;
|
||||
this.lifecycleInformation = lifecycleInfo;
|
||||
}
|
||||
|
||||
public Long getRecordId() {
|
||||
return recordId;
|
||||
public String getProjectID() {
|
||||
return projectID;
|
||||
}
|
||||
|
||||
public String getMongoId() {
|
||||
return mongoId;
|
||||
public LifecycleInformationDV getLifecycleInformation() {
|
||||
return lifecycleInformation;
|
||||
}
|
||||
|
||||
public ValidationReportDV getValidationReportDV() {
|
||||
return validationReportDV;
|
||||
public void setProjectID(String projectID) {
|
||||
}
|
||||
|
||||
public void setRecordId(Long recordId) {
|
||||
this.recordId = recordId;
|
||||
}
|
||||
|
||||
public void setMongoId(String mongoId) {
|
||||
this.mongoId = mongoId;
|
||||
}
|
||||
|
||||
public void setValidationReportDV(ValidationReportDV validationReportDV) {
|
||||
this.validationReportDV = validationReportDV;
|
||||
public void setLifecycleInformation(LifecycleInformationDV lifecycleInformation) {
|
||||
this.lifecycleInformation = lifecycleInformation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("CommitReport [recordId=");
|
||||
builder.append(recordId);
|
||||
builder.append(", mongoId=");
|
||||
builder.append(mongoId);
|
||||
builder.append(", validationReportDV=");
|
||||
builder.append(validationReportDV);
|
||||
builder.append("CommitReport [projectID=");
|
||||
builder.append(projectID);
|
||||
builder.append(", lifecycleInformation=");
|
||||
builder.append(lifecycleInformation);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue