logger.error("The Domain with value_id= "+aDataSource.getDialectId()+" does not exist.");
throw new EMFUserError(EMFErrorSeverity.ERROR, 1035);
}
//If DataSource Label has changed all LOVS with that DS need to be changed
SbiDataSource hibDataSource = (SbiDataSource) aSession.load(SbiDataSource.class,
new Integer(aDataSource.getDsId()));
if (aDataSource.getLabel() != null && hibDataSource.getLabel() != null){
if (!aDataSource.getLabel().equals(hibDataSource.getLabel())){
Query hibQuery = aSession.createQuery(" from SbiLov s where s.inputTypeCd = 'QUERY'");
List hibList = hibQuery.list();
if (!hibList.isEmpty()){
Iterator it = hibList.iterator();
while (it.hasNext()) {
SbiLov lov = (SbiLov)it.next();
String prov = lov.getLovProvider();
SourceBean sb = SourceBean.fromXMLString(prov);
SourceBean conn = (SourceBean)sb.getAttribute("CONNECTION");
String conne = conn.getCharacters();
if (conne.equals(hibDataSource.getLabel())){
int cutStart = prov.indexOf("<CONNECTION>");
cutStart = cutStart+12;
int cutEnd = prov.indexOf("</CONNECTION>");
String firstPart = prov.substring(0, cutStart);
String secondPart = prov.substring(cutEnd, prov.length());
prov = firstPart+aDataSource.getLabel()+secondPart;
lov.setLovProvider(prov);
aSession.update(lov);
}
}}
}}
hibDataSource.setLabel(aDataSource.getLabel());
hibDataSource.setDialect(dialect);
hibDataSource.setDialectDescr(dialect.getValueNm());
hibDataSource.setDescr(aDataSource.getDescr());
hibDataSource.setJndi(aDataSource.getJndi());
hibDataSource.setUrl_connection(aDataSource.getUrlConnection());
hibDataSource.setUser(aDataSource.getUser());
hibDataSource.setPwd(aDataSource.getPwd());
hibDataSource.setDriver(aDataSource.getDriver());
hibDataSource.setMultiSchema(aDataSource.getMultiSchema());
hibDataSource.setSchemaAttribute(aDataSource.getSchemaAttribute());
updateSbiCommonInfo4Update(hibDataSource);
tx.commit();
} catch (HibernateException he) {
logger.error("Error while modifing the data source with id " + ((aDataSource == null)?"":String.valueOf(aDataSource.getDsId())), he);