package org.pentaho.platform.dataaccess.datasource.wizard.models;

/**
 * User: nbaker
 * Date: Aug 13, 2010
 */
public class DatasourceDTOUtil {

  public static DatasourceDTO generateDTO(DatasourceModel model){
    DatasourceDTO dto = new DatasourceDTO();
    dto.setDatasourceName(model.getDatasourceName());
    dto.setCsvModelInfo(model.getModelInfo());
    dto.setDatasourceType(model.getDatasourceType());
    dto.setQuery(model.getQuery());
    dto.setConnectionName(model.getSelectedRelationalConnection().getName());
    return dto;
  }

  public static void populateModel(DatasourceDTO dto, DatasourceModel model){
    model.setDatasourceName(dto.getDatasourceName());
    model.setModelInfo(dto.getCsvModelInfo());
    model.setDatasourceType(dto.getDatasourceType());
    model.setQuery(dto.getQuery());
    model.setSelectedRelationalConnection(model.getGuiStateModel().getConnectionByName(dto.getConnectionName()));
  }

}

@@ -438,32 +438,90 @@
 etQuery());%0A    
+if(model.getSelectedRelationalConnection() != null)%7B%0A    %09
 dto.setConnectio
@@ -574,24 +574,30 @@
 getName());%0A
+    %7D%0A
     return d

Fix for BISERVER-7626 Unable to create a CSV based data source