use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class ExportServiceImpl method selectExportDbObjectInfo.
/**
* @Method Name : selectExportDbObjectInfo
* @Method 설명 : db object info
* @작성자 : ytkim
* @작성일 : 2018. 8. 29.
* @변경이력 :
* @param preferencesInfo
* @param mode
* @param model
* @return
* @throws Exception
*/
public ResponseResult selectExportDbObjectInfo(DatabaseParamInfo databaseParam) throws Exception {
MetaControlBean dbMetaEnum = MetaControlFactory.getDbInstanceFactory(databaseParam.getDbType());
Map customParam = databaseParam.getCustom();
String ddlObjInfo = String.valueOf(customParam.get("ddlObjInfo"));
String[] objArr = ddlObjInfo.split(",");
ResponseResult result = new ResponseResult();
for (int i = 0; i < objArr.length; i++) {
String mode = objArr[i];
result.addCustoms(mode, dbMetaEnum.getDBObjectList(ObjectType.getDBObjectType(mode).getObjectTypeId(), databaseParam));
}
return result;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class BoardService method commentSave.
/**
* @Method Name : commentSave
* @Method 설명 : 코멘트 저장.
* @작성자 : ytkim
* @작성일 : 2021. 7. 8.
* @변경이력 :
* @param articleId
* @param boardCommentRequestDTO
* @return
*/
@Transactional(transactionManager = ResourceConfigConstants.APP_TRANSMANAGER, rollbackFor = Throwable.class)
public ResponseResult commentSave(long articleId, BoardCommentRequestDTO boardCommentRequestDTO) {
BoardCommentEntity boardCommentEntity;
boolean isNew = NumberUtils.isNullOrZero(boardCommentRequestDTO.getCommentId());
boolean isReComment = false;
if (isNew) {
boardCommentEntity = boardCommentRequestDTO.toEntity();
boardCommentEntity.setArticleId(articleId);
boardCommentEntity.setAuthorName(SecurityUtil.loginInfo().getFullname());
boardCommentEntity.setFileList(new ArrayList<BoardFileEntity>());
// 대댓글
isReComment = !NumberUtils.isNullOrZero(boardCommentRequestDTO.getParentCommentId());
if (isReComment) {
BoardCommentEntity parentBoardCommentEntity = boardCommentEntityRepository.findByArticleIdAndCommentId(articleId, boardCommentRequestDTO.getParentCommentId());
if (parentBoardCommentEntity == null) {
throw new BoardNotFoundException("parent comments not found : " + boardCommentRequestDTO.getParentCommentId());
}
boardCommentEntity.setIndent(parentBoardCommentEntity.getIndent() + 1);
boardCommentEntity.setGrpCommentId(parentBoardCommentEntity.getGrpCommentId());
boardCommentEntity.setGrpSeq(boardCommentEntityRepository.findByGrpSeqMaxQuery(parentBoardCommentEntity.getGrpCommentId()));
} else {
}
} else {
boardCommentEntity = boardCommentEntityRepository.findByArticleIdAndCommentId(articleId, boardCommentRequestDTO.getCommentId());
if (!isCommentModify(boardCommentEntity)) {
throw new BoardPermissionException("no permission");
}
boardCommentEntity.setContents(boardCommentRequestDTO.getContents());
String fileIds = boardCommentRequestDTO.getRemoveFileIds();
if (!StringUtils.isBlank(fileIds)) {
boardFileEntityRepository.deleteByIdInQuery(Arrays.asList(fileIds.split(",")).stream().map(item -> {
return Long.parseLong(item);
}).collect(Collectors.toList()));
}
}
if (boardCommentRequestDTO.getFile().size() > 0) {
List<BoardFileEntity> boardFileList = boardCommentEntity.getFileList();
fileUploadService.uploadFiles(UploadFileType.BOARD, boardCommentRequestDTO.getFile(), boardCommentRequestDTO.getCommentId() + "", boardCommentRequestDTO.getBoardCode(), "file", false, false).forEach(item -> {
BoardFileEntity entity = BoardFileEntity.toBoardFileEntity(item);
entity.setComment(boardCommentEntity);
entity.setContType(COMMENT_CONT_TYPE);
boardFileList.add(entity);
});
boardCommentEntity.setFileList(boardFileList);
}
BoardCommentEntity saveEntity = boardCommentEntityRepository.save(boardCommentEntity);
if (isNew) {
if (!isReComment) {
saveEntity.setGrpCommentId(saveEntity.getCommentId());
boardCommentEntityRepository.save(saveEntity);
} else {
boardCommentEntityRepository.updateGrpSeqQuery(saveEntity.getArticleId(), saveEntity.getGrpCommentId(), saveEntity.getCommentId(), saveEntity.getGrpSeq());
}
}
ResponseResult result = VarsqlUtils.getResponseResultItemList(new ArrayList());
result.setItemOne(1);
return result;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class BoardService method saveBoardInfo.
/**
* @Method Name : saveBoardInfo
* @Method 설명 : 게시물 정보 저장.
* @작성자 : ytkim
* @작성일 : 2021. 7. 1.
* @변경이력 :
* @param boardRequestDTO
* @return
*/
@Transactional(transactionManager = ResourceConfigConstants.APP_TRANSMANAGER, rollbackFor = Throwable.class)
public ResponseResult saveBoardInfo(BoardRequestDTO boardRequestDTO) {
BoardEntity boardEntity;
if (NumberUtils.isNullOrZero(boardRequestDTO.getArticleId())) {
boardEntity = boardRequestDTO.toEntity();
boardEntity.setAuthorName(SecurityUtil.loginInfo().getFullname());
boardEntity.setFileList(new ArrayList<BoardFileEntity>());
} else {
boardEntity = boardEntityRepository.findByArticleId(boardRequestDTO.getArticleId());
if (!isModify(boardEntity)) {
throw new BoardPermissionException("no permission");
}
boardEntity.setTitle(boardRequestDTO.getTitle());
boardEntity.setContents(boardRequestDTO.getContents());
String fileIds = boardRequestDTO.getRemoveFileIds();
if (!StringUtils.isBlank(fileIds)) {
boardFileEntityRepository.deleteByIdInQuery(Arrays.asList(fileIds.split(",")).stream().map(item -> {
return Long.parseLong(item);
}).collect(Collectors.toList()));
}
}
if (boardRequestDTO.getFile() != null && boardRequestDTO.getFile().size() > 0) {
List<BoardFileEntity> boardFileList = boardEntity.getFileList();
fileUploadService.uploadFiles(UploadFileType.BOARD, boardRequestDTO.getFile(), boardRequestDTO.getArticleId() + "", boardRequestDTO.getBoardCode(), "file", false, false).forEach(item -> {
BoardFileEntity entity = BoardFileEntity.toBoardFileEntity(item);
entity.setArticle(boardEntity);
entity.setContType(BOARD_CONT_TYPE);
boardFileList.add(entity);
});
boardEntity.setFileList(boardFileList);
}
boardEntityRepository.save(boardEntity);
ResponseResult result = VarsqlUtils.getResponseResultItemList(new ArrayList());
result.setItemOne(1);
return result;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class DbDiffServiceImpl method objectTypeList.
/**
* @Method Name : objectTypeList
* @Method 설명 : db object type list (table , view 등등)
* @작성자 : ytkim
* @작성일 : 2019. 1. 2.
* @변경이력 :
* @param vconnid
* @return
* @throws SQLException
*/
public ResponseResult objectTypeList(String vconnid) throws SQLException {
ResponseResult resultObject = new ResponseResult();
DBConnectionEntity vtConnRVO = dbConnectionEntityRepository.findByVconnid(vconnid);
if (vtConnRVO == null) {
resultObject.setResultCode(RequestResultCode.ERROR);
resultObject.setItemList(null);
} else {
MetaControlBean dbMetaEnum = MetaControlFactory.getDbInstanceFactory(vtConnRVO.getDbTypeDriverProvider().getDbType());
resultObject.setItemList(dbMetaEnum.getServiceMenu());
resultObject.addCustoms("schemaInfo", dbMetaEnum.getSchemas(getDatabaseParamInfo(vtConnRVO)));
}
return resultObject;
}
use of com.vartech.common.app.beans.ResponseResult in project varsql by varsqlinfo.
the class UserMgmtServiceImpl method updateAccept.
/**
* @Method Name : updateAccept
* @Method 설명 : 사용자 수락 거부 .
* @작성자 : ytkim
* @작성일 : 2017. 12. 1.
* @변경이력 :
* @param paramMap
* @return
*/
@Transactional(value = ResourceConfigConstants.APP_TRANSMANAGER, rollbackFor = Exception.class)
public ResponseResult updateAccept(String acceptyn, String selectItem) {
String[] viewidArr = StringUtils.split(selectItem, ",");
AuthorityType role = "Y".equals(acceptyn) ? AuthorityType.USER : AuthorityType.GUEST;
List<UserEntity> users = userMgmtRepository.findByViewidIn(Arrays.asList(viewidArr)).stream().map(item -> {
item.setUserRole(role.name());
item.setAcceptYn("Y".equals(acceptyn) ? true : false);
return item;
}).collect(Collectors.toList());
userMgmtRepository.saveAll(users);
return VarsqlUtils.getResponseResultItemOne(1);
}
Aggregations