return toReturn;
}
public GuiGenericDataSet toDataSet(SbiDataSetHistory hibDataSet) throws EMFUserError{
logger.debug("IN");
GuiGenericDataSet ds = new GuiGenericDataSet();
GuiDataSetDetail dsActiveDetail = null;
if(hibDataSet instanceof SbiFileDataSet){
dsActiveDetail = new FileDataSetDetail();
((FileDataSetDetail)dsActiveDetail).setFileName(((SbiFileDataSet)hibDataSet).getFileName());
dsActiveDetail.setDsType(FILE_DS_TYPE);
logger.debug("File dataset");
}
if(hibDataSet instanceof SbiQueryDataSet){
dsActiveDetail=new QueryDataSetDetail();
((QueryDataSetDetail)dsActiveDetail).setQuery(((SbiQueryDataSet)hibDataSet).getQuery());
SbiDataSource sbids=((SbiQueryDataSet)hibDataSet).getDataSource();
if(sbids!=null){
String dataSourceLabel = sbids.getLabel();
((QueryDataSetDetail)dsActiveDetail).setDataSourceLabel(dataSourceLabel);
}
dsActiveDetail.setDsType(JDBC_DS_TYPE);
logger.debug("Jdbc dataset");
}
if(hibDataSet instanceof SbiQbeDataSet){
dsActiveDetail = new QbeDataSetDetail();
QbeDataSetDetail aQbeDataSetDetail = (QbeDataSetDetail) dsActiveDetail;
SbiQbeDataSet qbeHibDataSet = (SbiQbeDataSet) hibDataSet;
aQbeDataSetDetail.setSqlQuery(qbeHibDataSet.getSqlQuery());
aQbeDataSetDetail.setJsonQuery(qbeHibDataSet.getJsonQuery());
aQbeDataSetDetail.setDatamarts(qbeHibDataSet.getDatamarts());
SbiDataSource sbids = qbeHibDataSet.getDataSource();
if (sbids!=null){
aQbeDataSetDetail.setDataSourceLabel(sbids.getLabel());
}
dsActiveDetail.setDsType(QBE_DS_TYPE);
}
if(hibDataSet instanceof SbiWSDataSet){
dsActiveDetail=new WSDataSetDetail();
((WSDataSetDetail)dsActiveDetail).setAddress(((SbiWSDataSet)hibDataSet).getAdress());
((WSDataSetDetail)dsActiveDetail).setOperation(((SbiWSDataSet)hibDataSet).getOperation());
dsActiveDetail.setDsType(WS_DS_TYPE);
logger.debug("Ws dataset");
}
if(hibDataSet instanceof SbiScriptDataSet){
dsActiveDetail=new ScriptDataSetDetail();
((ScriptDataSetDetail)dsActiveDetail).setScript(((SbiScriptDataSet)hibDataSet).getScript());
((ScriptDataSetDetail)dsActiveDetail).setLanguageScript(((SbiScriptDataSet)hibDataSet).getLanguageScript());
dsActiveDetail.setDsType(SCRIPT_DS_TYPE);
logger.debug("Script dataset");
}
if(hibDataSet instanceof SbiJClassDataSet){
dsActiveDetail=new JClassDataSetDetail();
((JClassDataSetDetail)dsActiveDetail).setJavaClassName(((SbiJClassDataSet)hibDataSet).getJavaClassName());
dsActiveDetail.setDsType(JCLASS_DS_TYPE);
logger.debug("JClass dataset");
}
if(hibDataSet.getSbiDsConfig()!=null){
ds.setDsId(hibDataSet.getSbiDsConfig().getDsId());
ds.setName(hibDataSet.getSbiDsConfig().getName());
ds.setLabel(hibDataSet.getSbiDsConfig().getLabel());
ds.setDescription(hibDataSet.getSbiDsConfig().getDescription());
ds.setMetaVersion(hibDataSet.getMetaVersion());
ds.setUserIn(hibDataSet.getUserIn());
ds.setTimeIn(new Date());
dsActiveDetail.setDsId(hibDataSet.getSbiDsConfig().getDsId());
}
dsActiveDetail.setDsHId(hibDataSet.getDsHId());
dsActiveDetail.setCategoryId((hibDataSet.getCategory()== null)? null:hibDataSet.getCategory().getValueId());
dsActiveDetail.setCategoryValueName((hibDataSet.getCategory()== null)? null:hibDataSet.getCategory().getValueNm());
dsActiveDetail.setTransformerId((hibDataSet.getTransformer()== null)? null:hibDataSet.getTransformer().getValueId());
dsActiveDetail.setTransformerCd((hibDataSet.getTransformer()== null)? null:hibDataSet.getTransformer().getValueCd());
dsActiveDetail.setPivotColumnName(hibDataSet.getPivotColumnName());
dsActiveDetail.setPivotRowName(hibDataSet.getPivotRowName());
dsActiveDetail.setPivotColumnValue(hibDataSet.getPivotColumnValue());
dsActiveDetail.setNumRows(hibDataSet.isNumRows());
dsActiveDetail.setParameters(hibDataSet.getParameters());
dsActiveDetail.setDsMetadata(hibDataSet.getDsMetadata());
dsActiveDetail.setUserIn(hibDataSet.getUserIn());
dsActiveDetail.setTimeIn(hibDataSet.getTimeIn());
dsActiveDetail.setVersionNum(hibDataSet.getVersionNum());
dsActiveDetail.setSbiVersionIn(hibDataSet.getSbiVersionIn());
dsActiveDetail.setDsHId(hibDataSet.getDsHId());
ds.setActiveDetail(dsActiveDetail);
logger.debug("OUT");
return ds;
}