use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class VersionManagementService method createTempArticleOverwrite.
// TODO : 임시 게시글 만들기.
@Transactional
public BoardDTO createTempArticleOverwrite(BoardDTO tempArticle) throws IOException {
// getHistoryByRootId에서 검색이 가능하도록
tempArticle.setRoot_board_id(tempArticle.getBoard_id());
BoardDTO dbTempArticle = boardMapper.viewDetail(tempArticle.toMap());
if (dbTempArticle != null) {
int articleDeletedCnt = boardMapper.boardDelete(tempArticle.toMap());
if (articleDeletedCnt != 1) {
String json = Utils.jsonStringIfExceptionToString(tempArticle);
throw new RuntimeException("createTempArticleOverwrite메소드에서 임시 게시글 삭제 에러 tempArticle : " + json + "\n" + "articleDeletedCnt : " + articleDeletedCnt);
}
}
tempArticle.setCreated("CURTIMESTAMP 를 넣어야;;;");
int createdCnt = boardMapper.boardCreate(tempArticle);
if (createdCnt != 1) {
String json = Utils.jsonStringIfExceptionToString(tempArticle);
throw new RuntimeException("createTempArticle에서 게시글 생성 실패 : " + json);
}
return null;
}
use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class BoardHistoryMapperTest method testCreateHistory.
@Test
public void testCreateHistory() throws IOException {
BoardDTO article = new BoardDTO();
article.setBoard_id(defaultNodePtrDTO.getBoard_id());
article.setSubject("testInsert");
article.setContent("testContent");
BoardHistoryDTO createdHistoryDTO = new BoardHistoryDTO(article, defaultNodePtrDTO, BoardHistoryDTO.STATUS_CREATED);
createdHistoryDTO.setHistory_content(Compress.compressArticleContent(article));
BoardHistoryDTO check = boardHistoryMapper.getHistory(defaultNodePtrDTO);
if (check != null) {
boardHistoryMapper.deleteHistory(defaultNodePtrDTO);
}
int createdCnt = boardHistoryMapper.createHistory(createdHistoryDTO);
assertEquals(1, createdCnt);
BoardHistoryDTO insertedDTO = null;
insertedDTO = boardHistoryMapper.getHistory(createdHistoryDTO);
Utils.assertConvertToJsonObject(createdHistoryDTO, insertedDTO);
}
use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class BoardTempMapperTest method testUpdate.
@Test
public void testUpdate() throws Exception {
BoardDTO beforeVO = new BoardDTO();
beforeVO.setBoard_id(defaultNodePtr.getBoard_id());
beforeVO.setVersion(defaultNodePtr.getVersion());
beforeVO.setSubject("test1111");
beforeVO.setContent("beforeVal");
if (null != boardMapper.viewDetail(beforeVO.toMap())) {
boardMapper.boardDelete(beforeVO.toMap());
}
boardMapper.boardCreate(beforeVO);
BoardDTO afterVO = new BoardDTO();
afterVO.setBoard_id(defaultNodePtr.getBoard_id());
afterVO.setVersion(defaultNodePtr.getVersion());
afterVO.setSubject("after sub");
afterVO.setContent("after con");
boardMapper.boardUpdate(afterVO);
BoardDTO updatedVO = null;
updatedVO = boardMapper.viewDetail(afterVO.toMap());
assertEquals(afterVO, updatedVO);
}
use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class BoardTempMapperTest method testSelect.
@Test
public void testSelect() {
BoardDTO vo = null;
vo = boardMapper.viewDetail(defaultNodePtr.toMap());
assertNotNull(vo);
assertEquals(defaultNodePtr, vo);
}
use of com.worksmobile.Assignment.Domain.BoardDTO in project Assignment by WMPeople.
the class BoardTempMapperTest method testDelete.
@Test
public void testDelete() throws Exception {
BoardDTO vo = new BoardDTO();
vo.setBoard_id(defaultNodePtr.getBoard_id());
vo.setVersion(defaultNodePtr.getVersion());
vo.setSubject("delete sub");
vo.setContent("delete con");
boardMapper.boardCreate(vo);
boardMapper.boardDelete(vo.toMap());
BoardDTO deletedVO = null;
deletedVO = boardMapper.viewDetail(vo.toMap());
assertNull(deletedVO);
}
Aggregations