RequestContainer reqCont = getRequestContainer();
SessionContainer sessCont = reqCont.getSessionContainer();
SessionContainer permSess = sessCont.getPermanentContainer();
IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
ISbiGeoFeaturesDAO dao=DAOFactory.getSbiGeoFeaturesDAO();
dao.setUserProfile(profile);
GeoFeature feature = recoverFeatureDetails(request);
if (feature.getName() == null) {
response.setAttribute("mapObj", feature);
response.setAttribute("modality", mod);
return;
}
EMFErrorHandler errorHandler = getErrorHandler();
// if there are some validation errors into the errorHandler does not write into DB
Collection errors = errorHandler.getErrors();
if (errors != null && errors.size() > 0) {
Iterator iterator = errors.iterator();
while (iterator.hasNext()) {
Object error = iterator.next();
if (error instanceof EMFValidationError) {
response.setAttribute("featureObj", feature);
response.setAttribute("modality", mod);
return;
}
}
}
if (mod.equalsIgnoreCase(SpagoBIConstants.DETAIL_INS)) {
//if a feature with the same name yet exists on db: error
if (dao.loadFeatureByName(feature.getName()) != null){
HashMap params = new HashMap();
params.put(AdmintoolsConstants.PAGE, ListFeaturesModule.MODULE_PAGE);
EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 5018, new Vector(), params );
getErrorHandler().addError(error);
return;
}
dao.insertFeature(feature);
} else {
dao.modifyFeature(feature);
}
} catch (EMFUserError e){
HashMap params = new HashMap();
params.put(AdmintoolsConstants.PAGE, ListMapsModule.MODULE_PAGE);