Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/CONDEC-375' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Jcl15 committed Nov 2, 2018
2 parents 512fdec + 7f8a701 commit 85ae9e2
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import de.uhd.ifi.se.decision.management.jira.extraction.connector.ViewConnector;
import de.uhd.ifi.se.decision.management.jira.extraction.model.impl.CommentImpl;
import de.uhd.ifi.se.decision.management.jira.extraction.persistence.ActiveObjectsManager;
import de.uhd.ifi.se.decision.management.jira.model.DecisionKnowledgeElement;
import de.uhd.ifi.se.decision.management.jira.model.DecisionKnowledgeElementImpl;

/**
Expand Down Expand Up @@ -61,37 +60,39 @@ public void onIssueEvent(IssueEvent issueEvent) {
this.issueEvent = issueEvent;
this.projectKey = issueEvent.getProject().getKey();
Long eventTypeId = issueEvent.getEventTypeId();
DecisionKnowledgeElement actionElement = new DecisionKnowledgeElementImpl(issueEvent.getIssue());
if (eventTypeId.equals(EventType.ISSUE_COMMENTED_ID)) {
handleNewComment();
handleNewComment(new DecisionKnowledgeElementImpl(issueEvent.getIssue()));
}
if (eventTypeId.equals(EventType.ISSUE_COMMENT_DELETED_ID)) {
handleDeleteComment();
handleDeleteComment(new DecisionKnowledgeElementImpl(issueEvent.getIssue()));
}
if (eventTypeId.equals(EventType.ISSUE_COMMENT_EDITED_ID)) {
handleEditComment();
handleEditComment(new DecisionKnowledgeElementImpl(issueEvent.getIssue()));
}
if (eventTypeId.equals(EventType.ISSUE_DELETED_ID)) {
handleDeleteIssue();
handleDeleteIssue(new DecisionKnowledgeElementImpl(issueEvent.getIssue()));
}
// Always check if all sentences are linked correctly
ActiveObjectsManager.createLinksForNonLinkedElementsForIssue(actionElement.getId() + "");
}

private void handleDeleteIssue() {
private void handleDeleteIssue(DecisionKnowledgeElementImpl decisionKnowledgeElement) {
ActiveObjectsManager.cleanSentenceDatabaseForProject(this.projectKey);
ActiveObjectsManager.createLinksForNonLinkedElementsForIssue(decisionKnowledgeElement.getId() + "");
}

private void handleEditComment() {
private void handleEditComment(DecisionKnowledgeElementImpl decisionKnowledgeElement) {
ActiveObjectsManager.checkIfCommentBodyHasChangedOutsideOfPlugin(new CommentImpl(issueEvent.getComment()));
new ViewConnector(this.issueEvent.getIssue(), false);
ActiveObjectsManager.createLinksForNonLinkedElementsForIssue(decisionKnowledgeElement.getId() + "");
}

private void handleDeleteComment() {
private void handleDeleteComment(DecisionKnowledgeElementImpl decisionKnowledgeElement) {
ActiveObjectsManager.cleanSentenceDatabaseForProject(this.projectKey);
ActiveObjectsManager.createLinksForNonLinkedElementsForIssue(decisionKnowledgeElement.getId() + "");
}

private void handleNewComment() {
private void handleNewComment(DecisionKnowledgeElementImpl decisionKnowledgeElement) {
new ViewConnector(this.issueEvent.getIssue(), false);
ActiveObjectsManager.createLinksForNonLinkedElementsForIssue(decisionKnowledgeElement.getId() + "");
}

}

0 comments on commit 85ae9e2

Please sign in to comment.