use of org.pentaho.agilebi.modeler.ModelerException in project data-access by pentaho.
the class InlineSqlModelerSource method generateDomain.
@Override
public Domain generateDomain(boolean dualModelingMode) throws ModelerException {
try {
BusinessData bd = datasourceImpl.generateLogicalModel(datasourceName, connectionName, dbType, query, "10");
Domain domain = bd.getDomain();
return domain;
} catch (DatasourceServiceException dce) {
throw new ModelerException(dce);
}
}
use of org.pentaho.agilebi.modeler.ModelerException in project data-access by pentaho.
the class ModelerDialog method xulLoaded.
public void xulLoaded(GwtXulRunner gwtXulRunner) {
container = gwtXulRunner.getXulDomContainers().get(0);
container.addEventHandler(this);
BogoPojo bogo = new BogoPojo();
service.gwtWorkaround(bogo, new XulServiceCallback<BogoPojo>() {
public void success(BogoPojo retVal) {
}
public void error(String message, Throwable error) {
}
});
datasourceService = new DSWDatasourceServiceGwtImpl();
// connectionService = new ConnectionServiceGwtImpl();
csvService = (ICsvDatasourceServiceAsync) GWT.create(ICsvDatasourceService.class);
if (wizard == null) {
wizard = new EmbeddedWizard(false);
wizard.setDatasourceService(datasourceService);
// wizard.setConnectionService(connectionService);
wizard.setCsvDatasourceService(csvService);
wizard.init(null);
}
messages = new GwtModelerMessages((ResourceBundle) container.getResourceBundles().get(0));
try {
ModelerMessagesHolder.setMessages(messages);
} catch (Exception ignored) {
// Messages may have been set earlier, ignore.
}
IModelerWorkspaceHelper workspacehelper = model.getWorkspaceHelper();
controller = new ModelerController(model);
controller.setWorkspaceHelper(workspacehelper);
// controller.setMessages(messages);
final BindingFactory bf = new GwtBindingFactory(container.getDocumentRoot());
controller.setBindingFactory(bf);
container.addEventHandler(controller);
try {
controller.init();
} catch (ModelerException e) {
e.printStackTrace();
}
bf.setBindingType(Binding.Type.ONE_WAY);
bf.createBinding(model, "valid", "modeler_dialog_accept", "disabled", new BindingConvertor<Boolean, Boolean>() {
@Override
public Boolean sourceToTarget(Boolean value) {
return !value;
}
@Override
public Boolean targetToSource(Boolean value) {
return !value;
}
});
bf.setBindingType(Binding.Type.BI_DIRECTIONAL);
// go get the geocontext from the server. Prop forms are initialized after this call returns as they
// may need them to create the UI
datasourceService.getGeoContext(new XulServiceCallback<GeoContext>() {
public void success(GeoContext geoContext) {
model.setGeoContext(geoContext);
ModelerUiHelper.configureControllers(container, model, bf, controller, new ColResolverController());
ModelerDialog.this.constructorListener.asyncConstructorDone(ModelerDialog.this);
}
public void error(String s, Throwable throwable) {
throwable.printStackTrace();
// put in a stub to ensure the rest of the dialog works
model.setGeoContext(new GeoContext());
ModelerUiHelper.configureControllers(container, model, bf, controller, new ColResolverController());
ModelerDialog.this.constructorListener.asyncConstructorDone(ModelerDialog.this);
}
});
}
use of org.pentaho.agilebi.modeler.ModelerException in project data-access by pentaho.
the class InMemoryDSWDatasourceServiceImpl method generateQueryDomain.
@Override
public QueryDatasourceSummary generateQueryDomain(String name, String query, DatabaseConnection connection, DatasourceDTO datasourceDTO) throws DatasourceServiceException {
ModelerWorkspace modelerWorkspace = new ModelerWorkspace(new GwtModelerWorkspaceHelper(), getGeoContext());
ModelerService modelerService = new ModelerService();
modelerWorkspace.setModelName(name);
try {
Boolean securityEnabled = (getPermittedRoleList() != null && getPermittedRoleList().size() > 0) || (getPermittedUserList() != null && getPermittedUserList().size() > 0);
SerializedResultSet resultSet = DatasourceInMemoryServiceHelper.getSerializeableResultSet(connection.getName(), query, Integer.parseInt("10"), null);
SQLModelGenerator sqlModelGenerator = new SQLModelGenerator(name, connection.getName(), connection.getDatabaseType().getShortName(), resultSet.getColumnTypes(), resultSet.getColumns(), query, securityEnabled, getPermittedRoleList(), getPermittedUserList(), getDefaultAcls(), "joe");
Domain domain = sqlModelGenerator.generate();
modelerWorkspace.setDomain(domain);
modelerWorkspace.getWorkspaceHelper().autoModelFlat(modelerWorkspace);
modelerWorkspace.setModelName(datasourceDTO.getDatasourceName());
modelerWorkspace.getWorkspaceHelper().populateDomain(modelerWorkspace);
domain.getLogicalModels().get(0).setProperty("datasourceModel", serializeModelState(datasourceDTO));
domain.getLogicalModels().get(0).setProperty("DatasourceType", "SQL-DS");
QueryDatasourceSummary summary = new QueryDatasourceSummary();
modelerService.serializeModels(domain, modelerWorkspace.getModelName());
summary.setDomain(domain);
return summary;
} catch (SQLModelGeneratorException smge) {
logger.error(Messages.getErrorString("InMemoryDatasourceServiceImpl.ERROR_0016_UNABLE_TO_GENERATE_MODEL", smge.getLocalizedMessage()), smge);
throw new DatasourceServiceException(Messages.getErrorString("InMemoryDatasourceServiceImpl.ERROR_0015_UNABLE_TO_GENERATE_MODEL"), // $NON-NLS-1$
smge);
} catch (QueryValidationException e) {
logger.error(Messages.getErrorString("InMemoryDatasourceServiceImpl.ERROR_0009_QUERY_VALIDATION_FAILED", e.getLocalizedMessage()), // $NON-NLS-1$
e);
throw new DatasourceServiceException(Messages.getErrorString("InMemoryDatasourceServiceImpl.ERROR_0009_QUERY_VALIDATION_FAILED", e.getLocalizedMessage()), // $NON-NLS-1$
e);
} catch (ModelerException e) {
logger.error(Messages.getErrorString("InMemoryDatasourceServiceImpl.ERROR_0016_UNABLE_TO_GENERATE_MODEL", e.getLocalizedMessage()), e);
throw new DatasourceServiceException(Messages.getErrorString("InMemoryDatasourceServiceImpl.ERROR_0015_UNABLE_TO_GENERATE_MODEL"), // $NON-NLS-1$
e);
} catch (Exception e) {
logger.error(Messages.getErrorString("InMemoryDatasourceServiceImpl.ERROR_0016_UNABLE_TO_GENERATE_MODEL", e.getLocalizedMessage()), e);
throw new DatasourceServiceException(Messages.getErrorString("InMemoryDatasourceServiceImpl.ERROR_0015_UNABLE_TO_GENERATE_MODEL"), // $NON-NLS-1$
e);
}
}
use of org.pentaho.agilebi.modeler.ModelerException in project data-access by pentaho.
the class DSWDatasourceServiceImplTest method testGenerateQueryDomain_UnableToSerialize.
@Test(expected = DatasourceServiceException.class)
public void testGenerateQueryDomain_UnableToSerialize() throws Exception {
when(modelerService.serializeModels(any(Domain.class), anyString())).thenThrow(new ModelerException());
testGenerateQueryDomain(MODEL_NAME, VALID_QUERY, null, null);
}
use of org.pentaho.agilebi.modeler.ModelerException in project data-access by pentaho.
the class ModelerDialog method onAccept.
@Bindable
public void onAccept() {
enableWaitCursor(true);
try {
model.getWorkspaceHelper().populateDomain(model);
} catch (ModelerException e) {
e.printStackTrace();
showErrorDialog(messages.getString("ModelEditor.ERROR"), messages.getString("ModelEditor.ERROR_0001_SAVING_MODELS"));
}
boolean doOlap = true;
LogicalModel lModel = model.getLogicalModel(ModelerPerspective.ANALYSIS);
if (lModel == null) {
lModel = model.getLogicalModel(ModelerPerspective.REPORTING);
}
if (lModel.getProperty("MondrianCatalogRef") == null && (lModel.getProperty("DUAL_MODELING_SCHEMA") == null || "false".equals(lModel.getProperty("DUAL_MODELING_SCHEMA")))) {
doOlap = false;
}
service.serializeModels(model.getDomain(), model.getModelName(), doOlap, new XulServiceCallback<String>() {
public void success(String retVal) {
enableWaitCursor(false);
hideDialog();
model.getDomain().setId(retVal);
ModelerDialog.this.listener.onDialogAccept(model.getDomain());
}
public void error(String message, Throwable error) {
enableWaitCursor(false);
showErrorDialog(messages.getString("ModelEditor.ERROR"), messages.getString("ModelEditor.ERROR_0001_SAVING_MODELS"));
}
});
}
Aggregations