if (mod.equalsIgnoreCase(SpagoBIConstants.DETAIL_INS)) {
//if a ds with the same label not exists on db ok else error
if (dao.loadObjMetadataByLabel(metaNew.getLabel()) != null){
HashMap params = new HashMap();
params.put(AdmintoolsConstants.PAGE, ListObjMetadataModule.MODULE_PAGE);
EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 13004, new Vector(), params );
getErrorHandler().addError(error);
return;
}
dao.insertObjMetadata(metaNew);
ObjMetadata tmpMeta = dao.loadObjMetadataByLabel(metaNew.getLabel());
metaNew.setObjMetaId(tmpMeta.getObjMetaId());
mod = SpagoBIConstants.DETAIL_MOD;
} else {
//update metadata
dao.modifyObjMetadata(metaNew);
}
IDomainDAO domaindao = DAOFactory.getDomainDAO();
List dataTypes = domaindao.loadListDomainsByType("OBJMETA_DATA_TYPE");
serviceResponse.setAttribute(OBJMETA_DATA_TYPE, dataTypes);
if (serviceRequest.getAttribute("SUBMESSAGEDET") != null &&
((String)serviceRequest.getAttribute("SUBMESSAGEDET")).equalsIgnoreCase(MOD_SAVE)) {
serviceResponse.setAttribute("modality", mod);
serviceResponse.setAttribute("metaObj", metaNew);
return;
}
else if (serviceRequest.getAttribute("SUBMESSAGEDET") != null &&
((String)serviceRequest.getAttribute("SUBMESSAGEDET")).equalsIgnoreCase(MOD_SAVEBACK)){
serviceResponse.setAttribute("loopback", "true");
return;
}
} catch (EMFUserError e){
logger.error("Cannot fill response container" + e.getLocalizedMessage());
HashMap params = new HashMap();
params.put(AdmintoolsConstants.PAGE, ListObjMetadataModule.MODULE_PAGE);
throw new EMFUserError(EMFErrorSeverity.ERROR, 13005, new Vector(), params);
}
catch (Exception ex) {
logger.error("Cannot fill response container" , ex);
throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
}
}