use of com.netsteadfast.greenstep.vo.DataQueryVO in project bamboobsc by billchen198318.
the class DataQueryServiceImpl method findForMap.
@Override
public Map<String, String> findForMap(boolean pleaseSelect) throws ServiceException, Exception {
Map<String, String> dataMap = this.providedSelectZeroDataMap(pleaseSelect);
List<DataQueryVO> searchList = this.dataQueryDAO.findForSimple();
if (searchList == null || searchList.size() < 1) {
return dataMap;
}
for (DataQueryVO query : searchList) {
dataMap.put(query.getOid(), query.getName());
}
return dataMap;
}
use of com.netsteadfast.greenstep.vo.DataQueryVO in project bamboobsc by billchen198318.
the class QueryDataAction method update.
private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFieldsForCreate();
String dataSourceConfOid = this.getFields().get("dataSourceConfOid");
String dataQueryMapperOid = this.getFields().get("dataQueryMapperOid");
DataQueryVO dataQuery = new DataQueryVO();
this.transformFields2ValueObject(dataQuery, new String[] { "oid", "name", "queryExpression" });
DefaultResult<DataQueryVO> result = this.dataQueryLogicService.update(dataSourceConfOid, dataQueryMapperOid, dataQuery);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.DataQueryVO in project bamboobsc by billchen198318.
the class DataQueryLogicServiceImpl method update.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DataQueryVO> update(String dataSourceConfOid, String dataQueryMapperOid, DataQueryVO dataQuery) throws ServiceException, Exception {
if (super.isBlank(dataSourceConfOid) || super.isBlank(dataQueryMapperOid) || null == dataQuery || super.isBlank(dataQuery.getOid())) {
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));
}
DefaultResult<DataQueryVO> oldResult = this.dataQueryService.findObjectByOid(dataQuery);
if (oldResult.getValue() == null) {
throw new ServiceException(oldResult.getSystemMessage().getValue());
}
if (oldResult.getValue().getName().equals(dataQuery.getName()) && !oldResult.getValue().getOid().equals(dataQuery.getOid())) {
// 存在別筆資料但UK相同 , 所以不能 UPDATE
throw new ServiceException("Please change another name!");
}
oldResult.getValue().setQueryExpression(null);
// 先把BLOB 資料清掉
this.dataQueryService.updateObject(oldResult.getValue());
dataQuery.setConf(conf.getId());
dataQuery.setMapperOid(dataQueryMapperOid);
return this.dataQueryService.updateObject(dataQuery);
}
use of com.netsteadfast.greenstep.vo.DataQueryVO 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.DataQueryVO in project bamboobsc by billchen198318.
the class QueryDataAction method save.
private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFieldsForCreate();
String dataSourceConfOid = this.getFields().get("dataSourceConfOid");
String dataQueryMapperOid = this.getFields().get("dataQueryMapperOid");
DataQueryVO dataQuery = new DataQueryVO();
this.transformFields2ValueObject(dataQuery, new String[] { "name", "queryExpression" });
DefaultResult<DataQueryVO> result = this.dataQueryLogicService.create(dataSourceConfOid, dataQueryMapperOid, dataQuery);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
Aggregations