org.pentaho.platform.dataaccess.datasource.wizard.service.impl
Class DatasourceServiceImpl

java.lang.Object
  extended by org.pentaho.platform.dataaccess.datasource.wizard.service.impl.DatasourceServiceImpl
All Implemented Interfaces:
IDatasourceService

public class DatasourceServiceImpl
extends Object
implements IDatasourceService


Constructor Summary
DatasourceServiceImpl()
           
 
Method Summary
 boolean deleteLogicalModel(String domainId, String modelName)
          Delete the Logical Mode identified by the Domain ID and the Model Name
 DatasourceDTO deSerializeModelState(String dtoStr)
          Returns a DatasourceDTO from a serialized string.
 SerializedResultSet doPreview(String connectionName, String query, String previewLimit)
          Returns the serialized version of SQL ResultSet.
 BusinessData generateLogicalModel(String modelName, String connectionName, String dbType, String query, String previewLimit)
          This method gets the business data which are the business columns, columns types and sample preview data
 List<LogicalModelSummary> getLogicalModels()
          Returns the list of Logical Models.
 org.pentaho.metadata.repository.IMetadataDomainRepository getMetadataDomainRepository()
           
 BogoPojo gwtWorkaround(BogoPojo pojo)
          This is a method for the Gwt workaround.
 boolean hasPermission()
          Returns whether the current user has the authority to create/edit/delete datasources
 BusinessData loadBusinessData(String domainId, String modelId)
          Returns the save logical model for a given Domain ID and Model ID
 boolean saveLogicalModel(org.pentaho.metadata.model.Domain domain, boolean overwrite)
          Save the generated model.
 String serializeModelState(DatasourceDTO dto)
          Returns a serialized version of the DatasourceDTO class.
 void setMetadataDomainRepository(org.pentaho.metadata.repository.IMetadataDomainRepository metadataDomainRepository)
           
 boolean testDataSourceConnection(String connectionName)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatasourceServiceImpl

public DatasourceServiceImpl()
Method Detail

deleteLogicalModel

public boolean deleteLogicalModel(String domainId,
                                  String modelName)
                           throws DatasourceServiceException
Description copied from interface: IDatasourceService
Delete the Logical Mode identified by the Domain ID and the Model Name

Specified by:
deleteLogicalModel in interface IDatasourceService
Returns:
true if the deletion of model was successful otherwise false.
Throws:
DatasourceServiceException

doPreview

public SerializedResultSet doPreview(String connectionName,
                                     String query,
                                     String previewLimit)
                              throws DatasourceServiceException
Description copied from interface: IDatasourceService
Returns the serialized version of SQL ResultSet.

Specified by:
doPreview in interface IDatasourceService
Parameters:
connectionName - - Name of the connection
query - - Query which needs to be executed
previewLimit - - Number of row which needs to be returned for this query
Returns:
SerializedResultSet - This object contains the data, column name and column types
Throws:
DatasourceServiceException

testDataSourceConnection

public boolean testDataSourceConnection(String connectionName)
                                 throws DatasourceServiceException
Throws:
DatasourceServiceException

generateLogicalModel

public BusinessData generateLogicalModel(String modelName,
                                         String connectionName,
                                         String dbType,
                                         String query,
                                         String previewLimit)
                                  throws DatasourceServiceException
This method gets the business data which are the business columns, columns types and sample preview data

Specified by:
generateLogicalModel in interface IDatasourceService
Parameters:
modelName, - connection, query, previewLimit
Returns:
BusinessData
Throws:
DatasourceServiceException

getMetadataDomainRepository

public org.pentaho.metadata.repository.IMetadataDomainRepository getMetadataDomainRepository()

setMetadataDomainRepository

public void setMetadataDomainRepository(org.pentaho.metadata.repository.IMetadataDomainRepository metadataDomainRepository)

saveLogicalModel

public boolean saveLogicalModel(org.pentaho.metadata.model.Domain domain,
                                boolean overwrite)
                         throws DatasourceServiceException
Description copied from interface: IDatasourceService
Save the generated model. This could be either Relational or CSV based model

Specified by:
saveLogicalModel in interface IDatasourceService
Parameters:
domain - - generated Domain
overwrite - - should the domain be overwritten or not
Returns:
true if the model was saved successfully otherwise false
Throws:
DatasourceServiceException

hasPermission

public boolean hasPermission()
Description copied from interface: IDatasourceService
Returns whether the current user has the authority to create/edit/delete datasources

Specified by:
hasPermission in interface IDatasourceService
Returns:
true if the user has permission otherwise false

getLogicalModels

public List<LogicalModelSummary> getLogicalModels()
                                           throws DatasourceServiceException
Description copied from interface: IDatasourceService
Returns the list of Logical Models. This method is used by the client app to display list of models

Specified by:
getLogicalModels in interface IDatasourceService
Returns:
List of LogicalModelSummary.
Throws:
DatasourceServiceException

loadBusinessData

public BusinessData loadBusinessData(String domainId,
                                     String modelId)
                              throws DatasourceServiceException
Description copied from interface: IDatasourceService
Returns the save logical model for a given Domain ID and Model ID

Specified by:
loadBusinessData in interface IDatasourceService
Parameters:
domainId - - ID of the domain to be generated
modelId - - ID of the model to be generated
Returns:
BusinessData - This object contains the data, column name, column types and sample data
Throws:
DatasourceServiceException

gwtWorkaround

public BogoPojo gwtWorkaround(BogoPojo pojo)
Description copied from interface: IDatasourceService
This is a method for the Gwt workaround. This should not be used by any client at all

Specified by:
gwtWorkaround in interface IDatasourceService
Returns:
BogoPojo

serializeModelState

public String serializeModelState(DatasourceDTO dto)
                           throws DatasourceServiceException
Description copied from interface: IDatasourceService
Returns a serialized version of the DatasourceDTO class.

Specified by:
serializeModelState in interface IDatasourceService
Parameters:
dto - - Datasource data transfer object to serialize
Throws:
DatasourceServiceException

deSerializeModelState

public DatasourceDTO deSerializeModelState(String dtoStr)
                                    throws DatasourceServiceException
Description copied from interface: IDatasourceService
Returns a DatasourceDTO from a serialized string.

Specified by:
deSerializeModelState in interface IDatasourceService
Parameters:
dtoStr - - Datasource data transfer object to serialize
Throws:
DatasourceServiceException