((SbiQueryDataSet)hibDataSet).setQuery(((QueryDataSetDetail)dsActiveDetailToSet).getQuery().toString());
}
if(((QueryDataSetDetail)dsActiveDetailToSet).getDataSourceLabel()!=null){
SbiDataSource hibDataSource = null;
String dataSourceLabel = ((QueryDataSetDetail)dsActiveDetailToSet).getDataSourceLabel();
Criterion labelCriterrion = Expression.eq("label", dataSourceLabel);
Criteria criteria = aSession.createCriteria(SbiDataSource.class);
criteria.add(labelCriterrion);
hibDataSource = (SbiDataSource) criteria.uniqueResult();
((SbiQueryDataSet)hibDataSet).setDataSource(hibDataSource);
}
}
else if (dsActiveDetailToSet instanceof QbeDataSetDetail) {
hibDataSet = new SbiQbeDataSet();
SbiQbeDataSet hibQbeDataSet = (SbiQbeDataSet) hibDataSet;
QbeDataSetDetail qbeDataSet = (QbeDataSetDetail) dsActiveDetailToSet;
hibQbeDataSet.setSqlQuery(qbeDataSet.getSqlQuery());
hibQbeDataSet.setJsonQuery(qbeDataSet.getJsonQuery());
hibQbeDataSet.setDatamarts(qbeDataSet.getDatamarts());
String dataSourceLabel = qbeDataSet.getDataSourceLabel();
Criterion labelCriterrion = Expression.eq("label", dataSourceLabel);
Criteria criteria = aSession.createCriteria(SbiDataSource.class);
criteria.add(labelCriterrion);
SbiDataSource hibDataSource = (SbiDataSource) criteria.uniqueResult();
hibQbeDataSet.setDataSource(hibDataSource);
}
else if(dsActiveDetailToSet instanceof WSDataSetDetail){
hibDataSet=new SbiWSDataSet();
if(((WSDataSetDetail)dsActiveDetailToSet).getAddress()!=null){
((SbiWSDataSet)hibDataSet).setAdress(((WSDataSetDetail)dsActiveDetailToSet).getAddress());
}
if(((WSDataSetDetail)dsActiveDetailToSet).getOperation()!=null){
((SbiWSDataSet)hibDataSet).setOperation(((WSDataSetDetail)dsActiveDetailToSet).getOperation());
}
}
else if(dsActiveDetailToSet instanceof JClassDataSetDetail){
hibDataSet=new SbiJClassDataSet();
if(((JClassDataSetDetail)dsActiveDetailToSet).getJavaClassName()!=null){
((SbiJClassDataSet)hibDataSet).setJavaClassName(((JClassDataSetDetail)dsActiveDetailToSet).getJavaClassName());
}
}
else if(dsActiveDetailToSet instanceof ScriptDataSetDetail){
hibDataSet=new SbiScriptDataSet();
if(((ScriptDataSetDetail)dsActiveDetailToSet).getScript()!=null){
((SbiScriptDataSet)hibDataSet).setScript(((ScriptDataSetDetail)dsActiveDetailToSet).getScript());
}
if(((ScriptDataSetDetail)dsActiveDetailToSet).getLanguageScript()!=null){
((SbiScriptDataSet)hibDataSet).setLanguageScript(((ScriptDataSetDetail)dsActiveDetailToSet).getLanguageScript());
}
}
SbiDomains transformer = null;
if (dsActiveDetailToSet.getTransformerId() != null){
Criterion aCriterion = Expression.eq("valueId", dsActiveDetailToSet.getTransformerId());
Criteria criteria = aSession.createCriteria(SbiDomains.class);
criteria.add(aCriterion);
transformer = (SbiDomains) criteria.uniqueResult();
if (transformer == null){
logger.error("The Domain with value_id= "+dsActiveDetailToSet.getTransformerId()+" does not exist.");
throw new EMFUserError(EMFErrorSeverity.ERROR, 1035);
}
}
SbiDomains category = null;
if (dsActiveDetailToSet.getCategoryId()!= null){
Criterion aCriterion = Expression.eq("valueId", dsActiveDetailToSet.getCategoryId());
Criteria criteria = aSession.createCriteria(SbiDomains.class);
criteria.add(aCriterion);
category = (SbiDomains) criteria.uniqueResult();
if (category == null){
logger.error("The Domain with value_id= "+dsActiveDetailToSet.getCategoryId()+" does not exist.");