/** 풀리퀘가 삭제될 때 이 풀리퀘와 관련있는 이슈 이벤트를 삭제한다. */ public void deleteIssueEvents() { String newValue = getNewEventValue(); List<IssueEvent> oldEvents = IssueEvent.find .where() .eq("newValue", newValue) .eq("senderLoginId", this.contributor.loginId) .eq("eventType", EventType.ISSUE_REFERRED) .findList(); for (IssueEvent event : oldEvents) { event.delete(); } }
/** 새로운 풀리퀘가 저장될때 풀리퀘의 제목과 본문에서 참조한 이슈에 이슈 이벤트를 생성한다. */ private void addNewIssueEvents() { Set<Issue> referredIsseus = IssueEvent.findReferredIssue(this.title + this.body, this.toProject); String newValue = getNewEventValue(); for (Issue issue : referredIsseus) { IssueEvent issueEvent = new IssueEvent(); issueEvent.issue = issue; issueEvent.senderLoginId = this.contributor.loginId; issueEvent.newValue = newValue; issueEvent.created = new Date(); issueEvent.eventType = EventType.ISSUE_REFERRED; issueEvent.save(); } }