return;
}
}
}
IParameterUseDAO paruseDAO = DAOFactory.getParameterUseDAO();
SessionContainer permSess = getRequestContainer().getSessionContainer().getPermanentContainer();
IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
paruseDAO.setUserProfile(profile);
if (paruseIdInt.intValue() == -1) {
// it is requested to insert a new ParameterUse
paruseDAO.insertParameterUse(paruse);
} else {
// it is requested to modify a ParameterUse.
paruseDAO.modifyParameterUse(paruse);
}
prepareParameterDetailPage(response, parameter, null, selectedParuseIdStr,
ObjectsTreeConstants.DETAIL_MOD, false, true);
return;
} else {
prepareParameterDetailPage(response, parameter, null, selectedParuseIdStr,
ObjectsTreeConstants.DETAIL_MOD, false, true);
return;
}
} else if (deleteParameterUse != null) {
// it is requested to delete the visible ParameterUse
int paruseId = findParuseId(deleteParameterUse);
checkForDependancies(new Integer(paruseId));
// if there are some 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) {
prepareParameterDetailPage(response, parameter, paruse, paruseIdStr,
ObjectsTreeConstants.DETAIL_MOD, false, false);
return;
}
}
}
IParameterUseDAO paruseDAO = DAOFactory.getParameterUseDAO();
paruse = paruseDAO.loadByUseID(new Integer(paruseId));
paruseDAO.eraseParameterUse(paruse);
selectedParuseIdStr = "";
prepareParameterDetailPage(response, parameter, null, selectedParuseIdStr,
ObjectsTreeConstants.DETAIL_MOD, false, true);
return;
} else {
// It is request to save the Parameter with also the visible ParameterUse
// If a new ParameterUse was visualized and no fields were inserted, the ParameterUse is not validated and saved
boolean paruseToBeSaved = true;
if (GenericValidator.isBlankOrNull(paruse.getLabel())
&& GenericValidator.isBlankOrNull(paruse.getName())
&& paruse.getUseID().intValue() == -1
&& paruse.getIdLov().intValue() == -1
&& paruse.getAssociatedChecks().size() == 0
&& paruse.getAssociatedRoles().size() == 0)
paruseToBeSaved = false;
if (paruseToBeSaved) {
ValidationCoordinator.validate("PAGE", "ParameterUseValidation", this);
parameterUseLabelControl(paruse, mod);
verifyForDependencies(paruse);
}
ValidationCoordinator.validate("PAGE", "ParameterValidation", this);
parameterLabelControl(parameter, mod);
// 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) {
prepareParameterDetailPage(response, parameter, paruse, paruseIdInt.toString(),
ObjectsTreeConstants.DETAIL_MOD, false, false);
return;
}
}
}
// it is requested to modify the Parameter
DAOFactory.getParameterDAO().modifyParameter(parameter);
if (paruseToBeSaved) {
IParameterUseDAO paruseDAO = DAOFactory.getParameterUseDAO();
SessionContainer permSess = getRequestContainer().getSessionContainer().getPermanentContainer();
IEngUserProfile profile = (IEngUserProfile)permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
paruseDAO.setUserProfile(profile);
if (paruseIdInt.intValue() == -1) {
// it is requested to insert a new ParameterUse
paruseDAO.insertParameterUse(paruse);
// reload the paruse with the given label
paruse = reloadParuse(parameter.getId(), paruse.getLabel());
} else {
// it is requested to modify a ParameterUse
paruseDAO.modifyParameterUse(paruse);
}
selectedParuseIdStr = paruse.getUseID().toString();
} else selectedParuseIdStr = "-1";
}