use of com.netsteadfast.greenstep.vo.DataSourceConfVO in project bamboobsc by billchen198318.
the class DataQueryLogicServiceImpl method create.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DataQueryVO> create(String dataSourceConfOid, String dataQueryMapperOid, DataQueryVO dataQuery) throws ServiceException, Exception {
if (super.isNoSelectId(dataSourceConfOid) || super.isNoSelectId(dataQueryMapperOid) || null == dataQuery) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DataSourceConfVO conf = new DataSourceConfVO();
conf.setOid(dataSourceConfOid);
DefaultResult<DataSourceConfVO> confResult = dataSourceConfService.findObjectByOid(conf);
if (confResult.getValue() == null) {
throw new ServiceException(confResult.getSystemMessage().getValue());
}
conf = confResult.getValue();
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("oid", dataQueryMapperOid);
if (this.dataQueryMapperService.countByParams(paramMap) < 1) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
}
dataQuery.setConf(conf.getId());
dataQuery.setMapperOid(dataQueryMapperOid);
return this.dataQueryService.saveObject(dataQuery);
}
use of com.netsteadfast.greenstep.vo.DataSourceConfVO in project bamboobsc by billchen198318.
the class ManualJdbcTemplateFactory method getManualJdbcTemplate.
public static NamedParameterJdbcTemplate getManualJdbcTemplate(String confOid) throws ServiceException, Exception {
if (jdbcTemplateTreadLocal.get() != null && jdbcTemplateTreadLocal.get().getDataSourceConf().getOid().equals(confOid)) {
return jdbcTemplateTreadLocal.get().getJdbcTemplate();
}
DataSourceConfVO conf = new DataSourceConfVO();
conf.setOid(confOid);
DefaultResult<DataSourceConfVO> confResult = dataSourceConfService.findObjectByOid(conf);
if (confResult.getValue() == null) {
throw new ServiceException(confResult.getSystemMessage().getValue());
}
conf = confResult.getValue();
DataSourceDriverVO driver = new DataSourceDriverVO();
driver.setId(conf.getDriverId());
DefaultResult<DataSourceDriverVO> driverResult = dataSourceDriverService.findByUK(driver);
if (driverResult.getValue() == null) {
throw new ServiceException(driverResult.getSystemMessage().getValue());
}
driver = driverResult.getValue();
NamedParameterJdbcTemplate jdbcTemplate = DataUtils.getManualJdbcTemplate(Class.forName(driver.getClassName()), conf.getJdbcUrl(), conf.getDbAccount(), conf.getDbPassword());
DataProperty dataProperty = new DataProperty();
dataProperty.setDataSourceConf(conf);
dataProperty.setJdbcTemplate(jdbcTemplate);
jdbcTemplateTreadLocal.set(dataProperty);
return jdbcTemplate;
}
use of com.netsteadfast.greenstep.vo.DataSourceConfVO in project bamboobsc by billchen198318.
the class CommonLoadDataAction method loadQueryHistory.
private void loadQueryHistory() throws ControllerException, AuthorityException, ServiceException, Exception {
this.transformFields2ValueObject(this.dataQuery, new String[] { "oid" });
DefaultResult<DataQueryVO> result = this.dataQueryService.findObjectByOid(this.dataQuery);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
this.dataQuery = result.getValue();
DataSourceConfVO conf = new DataSourceConfVO();
conf.setId(this.dataQuery.getConf());
DefaultResult<DataSourceConfVO> confResult = this.dataSourceConfService.findByUK(conf);
if (confResult.getValue() != null) {
this.dataQuery.setDataSourceConfOid(confResult.getValue().getOid());
}
this.success = IS_YES;
}
use of com.netsteadfast.greenstep.vo.DataSourceConfVO in project bamboobsc by billchen198318.
the class DataSourceConfSaveOrUpdateAction method update.
private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
DataSourceConfVO conf = new DataSourceConfVO();
this.transformFields2ValueObject(conf, new String[] { "oid", "id", "name", "jdbcUrl", "dbAccount", "dbPassword", "description" });
DefaultResult<DataSourceConfVO> result = this.dataSourceLogicService.updateConf(this.getFields().get("driverOid"), conf);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
Aggregations