logger.debug("IN");
if (spagoBiDataSet == null) {
logger.warn("SpagoBiDataSet in input is null!!");
return null;
}
SDKDataSet toReturn = null;
try {
toReturn = new SDKDataSet();
toReturn.setId(spagoBiDataSet.getDsId());
toReturn.setLabel(spagoBiDataSet.getLabel());
toReturn.setName(spagoBiDataSet.getName());
toReturn.setDescription(spagoBiDataSet.getDescription());
toReturn.setPivotColumnName(spagoBiDataSet.getPivotColumnName());
toReturn.setPivotColumnValue(spagoBiDataSet.getPivotColumnValue());
toReturn.setPivotRowName(spagoBiDataSet.getPivotRowName());
toReturn.setNumberingRows(spagoBiDataSet.isNumRows());
// file dataset
toReturn.setFileName(spagoBiDataSet.getFileName());
// jdbc dataset
toReturn.setJdbcQuery(spagoBiDataSet.getQuery());
if (spagoBiDataSet.getDataSource() != null) {
toReturn.setJdbcDataSourceId(spagoBiDataSet.getDataSource().getId());
}
// web service dataset
toReturn.setWebServiceAddress(spagoBiDataSet.getAdress());
toReturn.setWebServiceOperation(spagoBiDataSet.getOperation());
// script dataset
toReturn.setScriptText(spagoBiDataSet.getScript());
toReturn.setScriptLanguage(spagoBiDataSet.getLanguageScript());
// java dataset
toReturn.setJavaClassName(spagoBiDataSet.getJavaClassName());
toReturn.setJsonQuery(spagoBiDataSet.getJsonQuery());
toReturn.setDatamarts(spagoBiDataSet.getDatamarts());
/*
String type = null;
if ( ScriptDataSet.DS_TYPE.equals( spagoBiDataSet.getType() ) ) {
type = "SCRIPT";
} else if ( JDBCDataSet.DS_TYPE.equals( spagoBiDataSet.getType() ) ) {
type = "JDBC_QUERY";
} else if ( JavaClassDataSet.DS_TYPE.equals( spagoBiDataSet.getType() ) ) {
type = "JAVA_CLASS";
} else if ( WebServiceDataSet.DS_TYPE.equals( spagoBiDataSet.getType() ) ) {
type = "WEB_SERVICE";
} else if ( FileDataSet.DS_TYPE.equals( spagoBiDataSet.getType() ) ) {
type = "FILE";
} else {
logger.error("Dataset type [" + spagoBiDataSet.getType() + "] unknown.");
type = "UNKNOWN";
}
toReturn.setType(type);
*/
toReturn.setType(spagoBiDataSet.getType());
List dataSetParameterItemList = null;
String parametersXML=spagoBiDataSet.getParameters();
if(parametersXML!=null && !((parametersXML.trim()).equals(""))){
DataSetParametersList dsParam=new DataSetParametersList(parametersXML);
dataSetParameterItemList=dsParam.getItems();
}
SDKDataSetParameter[] parameters = null;
if (dataSetParameterItemList != null) {
parameters = this.fromDataSetParameterItemListToSDKDataSetParameterArray(dataSetParameterItemList);
} else {
parameters = new SDKDataSetParameter[0];
}
toReturn.setParameters(parameters);
} catch (Exception e) {
logger.error("Error while converting SpagoBiDataSet into SDKDataSet.", e);
logger.debug("Returning null.");
return null;