use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class PluginServiceImpl method historySearch.
/**
* @Method Name : historySearch
* @Method 설명 : user sql history search
* @작성자 : ytkim
* @작성일 : 2018. 7. 24.
* @변경이력 :
* @param param
* @return
*/
public ResponseResult historySearch(SearchParameter searchParameter) {
Page<SqlHistoryEntity> result = sqlHistoryEntityRepository.findAll(SqlHistorySpec.userHisotryearch(String.valueOf(searchParameter.getCustomParam().get("conuid")), searchParameter), VarsqlUtils.convertSearchInfoToPage(searchParameter, SqlHistoryEntity.START_TIME));
ResponseResult responseResult = new ResponseResult();
responseResult.setItemList(result.getContent().stream().map(item -> {
SqlHistoryResponseDTO sqlUserHistoryInfo = SqlHistoryMapper.INSTANCE.toDto(item);
sqlUserHistoryInfo.setErrorLog(null);
sqlUserHistoryInfo.setUsrIp(null);
return sqlUserHistoryInfo;
}).collect(Collectors.toList()));
responseResult.setPage(PagingUtil.getPageObject(result.getTotalElements(), searchParameter));
return responseResult;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class BoardController method save.
@RequestMapping(value = "{" + VarsqlParamConstants.BOARD_CODE + "}/save", method = RequestMethod.POST)
@ResponseBody
public ResponseResult save(@PathVariable(required = true, name = VarsqlParamConstants.BOARD_CODE) String boardCode, @Valid BoardRequestDTO boardRequestDTO, BindingResult result, HttpServletRequest req) throws Exception {
boardCode = VarsqlUtils.getVonnid(req);
ResponseResult resultObject = new ResponseResult();
if (result.hasErrors()) {
for (ObjectError errorVal : result.getAllErrors()) {
logger.warn("### board save validation check {}", errorVal.toString());
}
return VarsqlUtils.getResponseResultValidItem(resultObject, result);
}
boardRequestDTO.setBoardCode(boardCode);
return boardService.saveBoardInfo(boardRequestDTO);
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class UserMainController method connectionInfo.
/**
* @Method Name : connectionInfo
* @Method 설명 : 사용자 권한 있는 db 정보.
* @작성자 : ytkim
* @작성일 : 2019. 8. 16.
* @변경이력 :
* @param req
* @return
* @throws Exception
*/
@RequestMapping(value = "/connectionInfo", method = RequestMethod.POST)
@ResponseBody
public ResponseResult connectionInfo(HttpServletRequest req) throws Exception {
ResponseResult resultObject = new ResponseResult();
DatabaseUtils.reloadUserDatabaseInfo();
Collection<DatabaseInfo> dataBaseInfo = SecurityUtil.loginInfo(req).getDatabaseInfo().values();
List<HashMap<String, String>> databaseList = new ArrayList<>();
dataBaseInfo.forEach(item -> {
HashMap<String, String> addMap = new HashMap<>();
addMap.put("uuid", item.getConnUUID());
addMap.put("type", item.getType());
addMap.put("name", item.getName());
databaseList.add(addMap);
});
resultObject.setItemList(databaseList);
return resultObject;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class UserPreferencesController method passwordSave.
/**
* @Method Name : passwordSave
* @Method 설명 : 비밀번호 변경.
* @작성자 : ytkim
* @작성일 : 2017. 11. 29.
* @변경이력 :
* @param passwordForm
* @param result
* @param req
* @return
* @throws Exception
*/
@RequestMapping(value = "/passwordSave", method = RequestMethod.POST)
@ResponseBody
public ResponseResult passwordSave(@Valid PasswordRequestDTO passwordForm, BindingResult result, HttpServletRequest req) throws Exception {
ResponseResult resultObject = new ResponseResult();
if (result.hasErrors()) {
for (ObjectError errorVal : result.getAllErrors()) {
logger.warn("### UserMainController passwordSave check {}", errorVal.toString());
}
resultObject = VarsqlUtils.getResponseResultValidItem(resultObject, result);
} else {
passwordForm.setViewid(SecurityUtil.userViewId(req));
resultObject = userPreferencesServiceImpl.updatePasswordInfo(passwordForm);
}
return resultObject;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class DatabaseController method dbObjectList.
/**
* @Method Name : dbObjectList
* @Method 설명 : db object list
* @작성자 : ytkim
* @작성일 : 2017. 11. 6.
* @변경이력 :
* @param databaseParamInfo
* @param mav
* @param req
* @return
* @throws Exception
*/
@RequestMapping(value = "/dbObjectList", method = RequestMethod.POST)
@ResponseBody
public ResponseResult dbObjectList(DatabaseParamInfo databaseParamInfo, HttpServletRequest req) throws Exception {
if (databaseParamInfo.isRefresh()) {
String cacheKey = CacheUtils.getObjectTypeKey(databaseParamInfo);
Cache tableMetaCache = cacheManager.getCache(CacheInfo.CacheType.OBJECT_TYPE_METADATA.getCacheName());
ValueWrapper value = tableMetaCache.get(cacheKey);
if (value != null && databaseParamInfo.getObjectNames() != null && databaseParamInfo.getObjectNames().length > 0) {
ResponseResult objValue = (ResponseResult) value.get();
ResponseResult result = databaseServiceImpl.dbObjectList(databaseParamInfo);
List<BaseObjectInfo> resultItems = result.getItems();
HashMap<String, BaseObjectInfo> newItemInfos = new HashMap<String, BaseObjectInfo>();
resultItems.stream().forEach(item -> {
newItemInfos.put(item.getName(), item);
});
List<BaseObjectInfo> cacheItems = objValue.getItems();
cacheItems = cacheItems.stream().map(item -> {
if (newItemInfos.containsKey(item.getName())) {
return newItemInfos.get(item.getName());
}
return item;
}).collect(Collectors.toList());
objValue.setItemList(cacheItems);
;
tableMetaCache.put(cacheKey, objValue);
return objValue;
} else {
tableMetaCache.evict(cacheKey);
}
}
return databaseServiceImpl.dbObjectList(databaseParamInfo);
}
Aggregations