Skip to content

Commit

Permalink
ConDec-430: Add correct Patch for smart linking
Browse files Browse the repository at this point in the history
  • Loading branch information
Jcl15 committed Dec 13, 2018
1 parent 305fa39 commit 86a812c
Showing 1 changed file with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import de.uhd.ifi.se.decision.management.jira.extraction.model.impl.CommentImpl;
import de.uhd.ifi.se.decision.management.jira.extraction.model.impl.SentenceImpl;
import de.uhd.ifi.se.decision.management.jira.model.DecisionKnowledgeElement;
import de.uhd.ifi.se.decision.management.jira.model.DecisionKnowledgeElementImpl;
import de.uhd.ifi.se.decision.management.jira.model.KnowledgeType;
import de.uhd.ifi.se.decision.management.jira.model.Link;
import de.uhd.ifi.se.decision.management.jira.model.LinkImpl;
Expand Down Expand Up @@ -128,10 +129,10 @@ public static void createSmartLinkForSentence(Sentence sentence) {
}

private static boolean checkLastElementAndCreateLink(DecisionKnowledgeElement lastElement,
DecisionKnowledgeElement sentence) {
Sentence sentence) {
if (lastElement != null) {
Link link = new LinkImpl("s" + lastElement.getId(), "s" + sentence.getId(),
LinkType.getLinkTypeForKnowledgeType(sentence.getType().toString()).toString());
LinkType.getLinkTypeForKnowledgeType(sentence.getArgument().toString()).toString());
GenericLinkManager.insertLink(link, null);
return true;
}
Expand Down Expand Up @@ -644,25 +645,6 @@ public static Issue createJIRAIssueFromSentenceObject(long aoId, ApplicationUser
IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager();
long linkTypeId = JiraIssuePersistenceManager.getLinkTypeId("contain");

for(Link oldLink: GenericLinkManager.getLinksForElement("s"+aoId)) {
Link newLink = oldLink;
if(newLink.getIdOfDestinationElementWithPrefix().equals("s"+aoId)) {
newLink.setDestinationElement(new DecisionKnowledgeElementImpl(issue));
}else if(newLink.getIdOfSourceElementWithPrefix().equals("s"+aoId)) {
newLink.setSourceElement(new DecisionKnowledgeElementImpl(issue));
}
GenericLinkManager.deleteGenericLink(oldLink);
if(GenericLinkManager.isIssueLink(newLink)) {
try {
issueLinkManager.createIssueLink(element.getIssueId(), issue.getId(), linkTypeId, (long) 0, user);
} catch (CreateException e) {

}
}else {
GenericLinkManager.insertLink(newLink, user);
}
}


try {
issueLinkManager.createIssueLink(element.getIssueId(), issue.getId(), linkTypeId, (long) 0, user);
Expand Down

0 comments on commit 86a812c

Please sign in to comment.