use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class BoardTempMapperTest method testInsert.
@Test
public void testInsert() throws Exception {
BoardDTO check = boardMapper.viewDetail(defaultBoardDTO.toMap());
if (check != null) {
boardMapper.boardDelete(defaultBoardDTO.toMap());
}
boardMapper.boardCreate(defaultBoardDTO);
BoardDTO insertedVO = null;
insertedVO = boardMapper.viewDetail(defaultBoardDTO.toMap());
assertEquals(defaultBoardDTO, insertedVO);
}
use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class VersionManagementServiceMultiThreadTest method testCreateArticle.
@Test
public void testCreateArticle() throws InterruptedException, ExecutionException, JsonProcessingException {
for (int i = 0; i < THREAD_COUNT; i++) {
Thread thread = new Thread(() -> {
try {
BoardDTO copyedBoardDTO = new BoardDTO();
copyedBoardDTO.setSubject(defaultBoardDTO.getSubject());
copyedBoardDTO.setContent(defaultBoardDTO.getContent());
BoardHistoryDTO createdHistoryDTO = versionManagementService.createArticle(copyedBoardDTO);
NodePtrDTO nodePtr = createdHistoryDTO;
BoardHistoryDTO dbHistoryDTO = boardHistoryMapper.getHistory(nodePtr);
Utils.assertConvertToJsonObject(createdHistoryDTO, dbHistoryDTO);
copyedBoardDTO.setNodePtrDTO(nodePtr);
copyedBoardDTO.setCreated(dbHistoryDTO.getCreated());
BoardDTO dbBoardDTO = boardMapper.viewDetail(nodePtr.toMap());
assertEquals(copyedBoardDTO, dbBoardDTO);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
});
threadList.add(thread);
}
}
use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class VersionManagementServiceMultiThreadTest method createDefault.
@Before
public void createDefault() throws InterruptedException, ExecutionException {
defaultBoardDTO = new BoardDTO();
defaultBoardDTO.setSubject("versionTestSub");
defaultBoardDTO.setContent("versionTestCont");
defaultCreatedDTO = versionManagementService.createArticle(defaultBoardDTO);
}
use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class RestController method history.
/**
* 이력 상세보기 입니다.
* @param board_id 상세 조회 할 게시물의 board_id
* @param version 상세 조회 할 게시물의 version
* @return modelAndView 이력의 상세 내용, board-boardHistory 구분자 , file 데이터 , viewName을 리턴합니다.
*/
@RequestMapping(value = "/history/{board_id}/{version}", method = RequestMethod.GET)
@ResponseBody
public ModelAndView history(@PathVariable(value = "board_id") int board_id, @PathVariable(value = "version") int version) {
NodePtrDTO node = new NodePtrDTO(board_id, version);
BoardHistoryDTO boardHistory = boardHistoryMapper.getHistory(node);
BoardDTO board = new BoardDTO(boardHistory);
FileDTO file = fileMapper.getFile(board.getFile_id());
String deCompreesedContent = "";
try {
deCompreesedContent = Compress.deCompress(boardHistory.getHistory_content());
} catch (IOException e) {
e.printStackTrace();
deCompreesedContent = "압축 해제 실패";
throw new RuntimeException(e);
}
board.setContent(deCompreesedContent);
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("board", board);
modelAndView.addObject("isHistory", 1);
modelAndView.addObject("file", file);
modelAndView.setViewName("boardDetail");
return modelAndView;
}
use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class RestController method show.
/**
* 게시물 상세보기 입니다.
* @param board_id 상세 조회 할 게시물의 board_id
* @param version 상세 조회 할 게시물의 version
* @return 상세보기 화면과 게시물 내용이 맵 형태로 리턴됩니다.
*/
@RequestMapping(value = "/boards/{board_id}/{version}", method = RequestMethod.GET)
@ResponseBody
public ModelAndView show(@PathVariable(value = "board_id") int board_id, @PathVariable(value = "version") int version) {
HashMap<String, Integer> params = new HashMap<String, Integer>();
params.put("board_id", board_id);
params.put("version", version);
BoardDTO board = boardMapper.viewDetail(params);
if (board == null) {
String json = Utils.jsonStringIfExceptionToString(board);
throw new RuntimeException("show 메소드에서 viewDetail 메소드 실행 에러" + json);
}
String dirty = board.getContent();
String clean = XssPreventer.escape(dirty);
board.setContent(clean);
FileDTO file = fileMapper.getFile(board.getFile_id());
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("board", board);
modelAndView.addObject("isHistory", 0);
modelAndView.addObject("file", file);
modelAndView.setViewName("boardDetail");
return modelAndView;
}
Aggregations