From 86a812c696156d64e57b46c5e3a5d9f37ee168a5 Mon Sep 17 00:00:00 2001 From: Jochen Date: Thu, 13 Dec 2018 17:25:58 +0100 Subject: [PATCH] ConDec-430: Add correct Patch for smart linking --- .../persistence/ActiveObjectsManager.java | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/main/java/de/uhd/ifi/se/decision/management/jira/extraction/persistence/ActiveObjectsManager.java b/src/main/java/de/uhd/ifi/se/decision/management/jira/extraction/persistence/ActiveObjectsManager.java index 82317ae27d..97bc3507fd 100644 --- a/src/main/java/de/uhd/ifi/se/decision/management/jira/extraction/persistence/ActiveObjectsManager.java +++ b/src/main/java/de/uhd/ifi/se/decision/management/jira/extraction/persistence/ActiveObjectsManager.java @@ -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; @@ -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; } @@ -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);