if(!errorHandler.isOKByCategory(EMFErrorCategory.VALIDATION_ERROR)) {
helper.fillResponse(initialPath);
prepareBIObjectDetailPage(response, obj, biObjPar, biObjPar.getId().toString(), ObjectsTreeConstants.DETAIL_MOD, false, false);
return;
}
IBIObjectParameterDAO objParDAO = DAOFactory.getBIObjectParameterDAO();
objParDAO.setUserProfile(profile);
if (biObjPar.getId().intValue() == -1) {
// it is requested to insert a new BIObjectParameter
objParDAO.insertBIObjectParameter(biObjPar);
} else {
// it is requested to modify a BIObjectParameter
objParDAO.modifyBIObjectParameter(biObjPar);
}
prepareBIObjectDetailPage(response, obj, null, selectedObjParIdStr, ObjectsTreeConstants.DETAIL_MOD, false, true);
return;
} else {
helper.fillResponse(initialPath);
prepareBIObjectDetailPage(response, obj, null, selectedObjParIdStr, ObjectsTreeConstants.DETAIL_MOD, false, true);
// exits without writing into DB
return;
}
} else if (deleteBIObjectParameter != null) {
// it is requested to delete the visible BIObjectParameter
int objParId = helper.findBIObjParId(deleteBIObjectParameter);
Integer objParIdInt = new Integer(objParId);
EMFValidationError error = checkForDependancies(objParIdInt);
if (error != null) {
errorHandler.addError(error);
}
helper.fillResponse(initialPath);
// if there are some validation errors into the errorHandler does not write into DB
if(!errorHandler.isOKByCategory(EMFErrorCategory.VALIDATION_ERROR)) {
helper.fillResponse(initialPath);
prepareBIObjectDetailPage(response, obj, biObjPar, biObjPar.getId().toString(), ObjectsTreeConstants.DETAIL_MOD, false, false);
return;
}
// deletes the BIObjectParameter
IBIObjectParameterDAO objParDAO = DAOFactory.getBIObjectParameterDAO();
BIObjectParameter objPar = objParDAO.loadForDetailByObjParId(new Integer(objParId));
objParDAO.eraseBIObjectParameter(objPar);
selectedObjParIdStr = "";
prepareBIObjectDetailPage(response, obj, null, selectedObjParIdStr, ObjectsTreeConstants.DETAIL_MOD, false, true);
return;
} else {
// It is request to save the BIObject with also the visible BIObjectParameter
biObjPar = helper.recoverBIObjectParameterDetails(obj.getId());
// If a new BIParameter was visualized and no fields were inserted, the BIParameter is not validated and saved
boolean biParameterToBeSaved = true;
if ((obj.getBiObjectTypeCode().equalsIgnoreCase(SpagoBIConstants.DOCUMENT_COMPOSITE_TYPE) && flgReloadTemp)
|| (GenericValidator.isBlankOrNull(biObjPar.getLabel()) && biObjPar.getId().intValue() == -1
&& GenericValidator.isBlankOrNull(biObjPar.getParameterUrlName()) && biObjPar.getParID().intValue() == -1))
biParameterToBeSaved = false;
if (biParameterToBeSaved) {
ValidationCoordinator.validate("PAGE", "BIObjectParameterValidation", this);
// If it's a new BIObjectParameter or if the Parameter was changed controls
// that the BIObjectParameter url name is not already in use
urlNameControl(obj.getId(), biObjPar);
}
ValidationCoordinator.validate("PAGE", "BIObjectValidation", this);
verifyForDependencies(biObjPar);
// if there are some validation errors into the errorHandler does not write into DB
if(!errorHandler.isOKByCategory(EMFErrorCategory.VALIDATION_ERROR)) {
helper.fillResponse(initialPath);
prepareBIObjectDetailPage(response, obj, biObjPar, biObjPar.getId().toString(), ObjectsTreeConstants.DETAIL_MOD, false, false);
return;
}
// it is requested to modify the main values of the BIObject
if(objTemp==null) {
biobjDAO.modifyBIObject(obj, loadParsDCClicked);
} else {
biobjDAO.modifyBIObject(obj, objTemp, loadParsDCClicked);
}
// reloads the BIObject
obj = biobjDAO.loadBIObjectForDetail(obj.getId());
// check if there's a parameter to save and in case save it
if (biParameterToBeSaved) {
IBIObjectParameterDAO objParDAO = DAOFactory.getBIObjectParameterDAO();
objParDAO.setUserProfile(profile);
if (biObjPar.getId().intValue() == -1) {
// it is requested to insert a new BIObjectParameter
objParDAO.insertBIObjectParameter(biObjPar);
// reload the BIObjectParameter with the given url name
biObjPar = reloadBIObjectParameter(obj.getId(), biObjPar.getParameterUrlName());
} else {
// it is requested to modify a BIObjectParameter
objParDAO.modifyBIObjectParameter(biObjPar);
}
selectedObjParIdStr = biObjPar.getId().toString();
} else selectedObjParIdStr = "-1";
}