bug fixes beans mapping according to validation rules implemented on

server-side
This commit is contained in:
francesco 2020-10-30 15:37:08 +01:00
parent 1fc382b0c2
commit 31f2cda50a
4 changed files with 25 additions and 16 deletions

View File

@ -27,6 +27,7 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">

View File

@ -122,7 +122,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
for (GeoNaFormCardModel geonaForm : orderedCards) {
//TODO TO TEST
//if(geonaForm.getFormCardTitle().equals(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO)){
//if(geonaForm.getFormCardTitle().equals(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO)){
CreateMetadataForm baseForm = new CreateMetadataForm(Arrays.asList(geonaForm.getMetadataProfileBean()),appManagerBus);
geonaForm.setMetadataForm(baseForm);

View File

@ -205,6 +205,16 @@ public class ConvertToServiceModel {
//TODO
}
List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
if(politicaDiAccessoLst!=null && politicaDiAccessoLst.size()>0) {
try {
AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0));
relazioneScavo.setPolicy(ap);
}catch (Exception e) {
LOG.warn("I cannot cast "+politicaDiAccessoLst.get(0) +" to "+AccessPolicy.values(),e);
}
}
List<String> licenzaIdList = mapFields.get("ID Licenza");
if(licenzaIdList!=null && licenzaIdList.size()>0) {
relazioneScavo.setLicenseID(licenzaIdList.get(0));

View File

@ -16,6 +16,7 @@ import org.gcube.application.geoportal.model.content.UploadedImage;
import org.gcube.application.geoportal.model.content.WorkspaceContent;
import org.gcube.application.geoportal.model.fault.PublishException;
import org.gcube.application.geoportal.model.fault.ValidationException;
import org.gcube.application.geoportal.utils.Serialization;
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
@ -80,6 +81,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.debug(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO+" building with client obj: "+idp);
Concessione concessione = ConvertToServiceModel.toConcessione(idp, user);
LOG.debug("Built "+ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO+" as server obj: "+concessione);
//saving into back-end
manager = ManagerFactory.registerNew(concessione);
@ -162,16 +164,14 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
}
}catch (Exception e) {
LOG.error("Error on converting form data: ",e);
throw new Exception("Error occurred on saving data, try again or contact the support");
throw new Exception("Error occurred on saving data, try again or contact the support. Error: "+e.getMessage());
}
try {
//If true -> data are published into the SDI
Boolean publish=true;
Concessione registered=manager.commit(publish);
LOG.info("Registered: "+registered);
String link = null;
try {
@ -195,7 +195,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
return cRep;
}catch (ValidationException e1){
LOG.error("Error on validating data: ",e1);
throw new Exception("Error on validating data: "+e1.getReport().toString());
throw new Exception("Error on validating data: "+Serialization.prettyPrint(e1.getReport()));
}catch (PublishException e2) {
LOG.error("Error on publishing data: ",e2);
throw new Exception("Error on publishing data: "+e2.getMessage());
@ -203,17 +203,15 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.error("Error on commiting data: ",e);
throw new Exception("Error occurred on saving data, try again or contact the support. Error: "+e.getMessage());
}finally {
/*if(manager!=null) {
try {
manager.shutdown();
}catch (Exception e) {
//silent
}
}*/
// if(manager!=null) {
// try {
// manager.shutdown();
// }catch (Exception e) {
// //silent
// }
//
// }
}
}
@Override