[hg] main-silver: removed confusing issue create and update call...

  • From: Tomas Stupka < >
  • To:
  • Subject: [hg] main-silver: removed confusing issue create and update call...
  • Date: Thu, 04 Apr 2013 00:31:54 -0700

changeset e5edb6471104 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/e5edb6471104
description:
        removed confusing issue create and update callback logic

diffstat:

 bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueCache.java       
                         |  77 +------
 bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueStorage.java     
                         |   3 +-
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
                      |   7 +-
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/CacheTest.java
                       |  98 ++++-----
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/StorageTest.java
                     |  30 +--
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
 |  32 +--
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/selectors/RepositorySelectorTest.java
   |   3 +-
 bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java          
                         |   5 +-
 bugzilla/src/org/netbeans/modules/bugzilla/query/BugzillaQuery.java          
                         |  10 +-
 
bugzilla/src/org/netbeans/modules/bugzilla/repository/BugzillaRepository.java 
                        |  33 +--
 jira/src/org/netbeans/modules/jira/issue/IssueLinksPanel.java                
                         |   2 +-
 jira/src/org/netbeans/modules/jira/issue/IssuePanel.java                     
                         |   2 +-
 jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java                    
                         |  10 +-
 jira/src/org/netbeans/modules/jira/query/JiraQuery.java                      
                         |  11 +-
 jira/src/org/netbeans/modules/jira/repository/JiraRepository.java            
                         |  30 +--
 15 files changed, 125 insertions(+), 228 deletions(-)

diffs (993 lines):

diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueCache.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueCache.java
--- a/bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueCache.java
+++ b/bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueCache.java
@@ -58,7 +58,7 @@
  *
  * @author Tomas Stupka
  */
-public class IssueCache<I, D> {
+public class IssueCache<I> {
 
     public enum Status {
         /**
@@ -111,7 +111,7 @@
 
     private final Object CACHE_LOCK = new Object();
     private final long referenceTime;
-    private final IssueAccessor<I, D> issueAccessor;
+    private final IssueAccessor<I> issueAccessor;
 
     /**
      *
@@ -120,33 +120,10 @@
      *
      * @param <T>
      */
-    public interface IssueAccessor<I, T> {
+    public interface IssueAccessor<I> {
 
         /**
-         * Returns the id given by the issueData
-         *
-         * @param issueData
-         * @return id
-         */
-        public String getID(T issueData);
-
-        /**
-         * Creates a new Issue for the given taskdata
-         * @param taskData
-         * @return
-         */
-        public I createIssue(T issueData);
-
-        /**
-         * Sets new task data in the issue.
-         *
-         * @param issue
-         * @param taskData
-         */
-        public void setIssueData(I issue, T issueData);
-
-        /**
-         * Returns attributes for the given Issue
+         * Returns attributes to be stored for the given Issue once it was 
seen
          * @return
          */
         public Map<String, String> getAttributes(I issue);
@@ -175,7 +152,7 @@
      * @param nameSpace
      * @param issueAccessor
      */
-    public IssueCache(String nameSpace, IssueAccessor<I, D> issueAccessor) {
+    public IssueCache(String nameSpace, IssueAccessor<I> issueAccessor) {
         assert issueAccessor != null;
         this.nameSpace = nameSpace;
         this.issueAccessor = issueAccessor;
@@ -205,43 +182,19 @@
         IssueStorage.getInstance().cleanup(IssueCache.this.nameSpace);
     }
 
-    IssueAccessor<I, D> getIssueAccessor() {
+    IssueAccessor<I> getIssueAccessor() {
         return issueAccessor;
     }
 
     /**
-     * Sets new data into {@link Issue} with the given id. A new issue will 
be created
-     * in case it doesn't exist yet.
-     *
-     * @param issue id
-     * @param issueData data representing an issue
-     * @return the {@link Issue} with the given id
-     * @throws IOException
-     */
-    public I setIssueData(String id, D issueData) throws IOException {
-        assert issueData != null;
-        assert id != null && !id.equals("");
-        return setIssueData(id, null, issueData);
-    }
-
-    /**
      * Sets new data into the given issue
      *
      * @param issue issue
      * @param issueData data representing an issue
      * @throws IOException
      */
-    public void setIssueData(I issue, D issueData) throws IOException {
-        assert issueData != null;
-        assert issue != null;
-
-        String id = issueAccessor.getID(issueData);
+    public I setIssueData(String id, I issue) throws IOException {
         assert id != null && !id.equals("");
-        setIssueData(id, issue, issueData);
-    }
-
-    private I setIssueData(String id, I issue, D issueData) throws 
IOException {
-        assert issueData != null;
 
         synchronized(CACHE_LOCK) {
             IssueEntry entry = getCache().get(id);
@@ -250,14 +203,9 @@
                 entry = createNewEntry(id);
             }
 
-            if(entry.issue == null) {
-                if(issue != null) {
                     entry.issue = issue;
-                    LOG.log(Level.FINE, "setting task data for issue {0} ", 
new Object[] {id}); // NOI18N
-                    issueAccessor.setIssueData(entry.issue, issueData);
-                } else {
-                    entry.issue = issueAccessor.createIssue(issueData);
-                    LOG.log(Level.FINE, "created issue {0} ", new Object[] 
{id}); // NOI18N
+            LOG.log(Level.FINE, "setting issue {0} ", new Object[] {id}); // 
NOI18N
+            if(!entry.wasRead()) {
                     readIssue(entry);
                     Map<String, String> attr = entry.getSeenAttributes();
                     if(attr == null || attr.isEmpty()) {
@@ -270,10 +218,6 @@
                         }
                     }
                 }
-            } else {
-                LOG.log(Level.FINE, "setting task data for issue {0} ", new 
Object[] {id}); // NOI18N
-                issueAccessor.setIssueData(entry.issue, issueData);
-            }
 
             if(entry.seenAttributes != null) {
                 if(entry.wasSeen()) {
@@ -614,5 +558,8 @@
         public void setLastUnseenStatus(Status lastUnseenStatus) {
             this.lastUnseenStatus = lastUnseenStatus;
         }
+        private boolean wasRead() {
+            return seenAttributes != null;
     }
 }
+}
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueStorage.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueStorage.java
--- a/bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueStorage.java
+++ b/bugtracking/src/org/netbeans/modules/bugtracking/cache/IssueStorage.java
@@ -42,7 +42,6 @@
 
 package org.netbeans.modules.bugtracking.cache;
 
-import org.netbeans.modules.bugtracking.util.*;
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.DataInputStream;
@@ -70,6 +69,8 @@
 import javax.swing.SwingUtilities;
 import org.netbeans.modules.bugtracking.BugtrackingConfig;
 import org.netbeans.modules.bugtracking.BugtrackingManager;
+import org.netbeans.modules.bugtracking.util.BugtrackingUtil;
+import org.netbeans.modules.bugtracking.util.TextUtils;
 import org.openide.util.RequestProcessor.Task;
 import org.openide.modules.Places;
 
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/RecentIssuesTest.java
@@ -52,7 +52,6 @@
 import java.util.Map;
 import java.util.List;
 import java.util.logging.Level;
-import org.eclipse.core.runtime.CoreException;
 import org.netbeans.junit.NbTestCase;
 import org.netbeans.modules.bugtracking.api.Repository;
 import org.netbeans.modules.bugtracking.issuetable.IssueNode;
@@ -86,7 +85,7 @@
         if(ri != null) ri.clear();
     }
 
-    public void testGetRecentIssuesEmptyReturn() throws 
MalformedURLException, CoreException, IOException {
+    public void testGetRecentIssuesEmptyReturn() throws 
MalformedURLException, IOException {
         Map<String, List<RecentIssue>> ri = 
BugtrackingManager.getInstance().getAllRecentIssues();
         assertNotNull(ri);
         assertEquals(0, ri.size());
@@ -96,7 +95,7 @@
         assertEquals(0, ri.size());        
     }
 
-    public void testAddRecentIssues() throws MalformedURLException, 
CoreException, IOException {
+    public void testAddRecentIssues() throws MalformedURLException, 
IOException {
         final RITestRepository riTestRepo = new RITestRepository("test 
repo");
         RepositoryImpl repo = getRepository(riTestRepo);
         IssueImpl issue1 = getIssue(repo, new RITestIssue(riTestRepo, "1"));
@@ -142,7 +141,7 @@
         assertRecentIssues(allIssues.get(repo.getId()), new IssueImpl[] 
{issue2, issue1});
     }
 
-    public void testAddRecentIssuesMoreThan5() throws MalformedURLException, 
CoreException, IOException {
+    public void testAddRecentIssuesMoreThan5() throws MalformedURLException, 
IOException {
         RITestRepository riTestRepo1 = new RITestRepository("test repo");
         RepositoryImpl repo1 = getRepository(new RITestRepository("test 
repo"));
         IssueImpl repo1issue1 = getIssue(repo1, new RITestIssue(riTestRepo1, 
"r1i1"));
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/CacheTest.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/CacheTest.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/CacheTest.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/CacheTest.java
@@ -42,8 +42,6 @@
 
 package org.netbeans.modules.bugtracking.cache;
 
-import org.netbeans.modules.bugtracking.cache.IssueStorage;
-import org.netbeans.modules.bugtracking.cache.IssueCache;
 import java.awt.Image;
 import java.beans.PropertyChangeListener;
 import java.io.File;
@@ -56,7 +54,6 @@
 import java.util.HashMap;
 import java.util.Map;
 import java.util.logging.Level;
-import org.eclipse.core.runtime.CoreException;
 import org.netbeans.junit.NbTestCase;
 import org.netbeans.modules.bugtracking.*;
 import org.netbeans.modules.bugtracking.RepositoryImpl;
@@ -64,7 +61,6 @@
 import org.netbeans.modules.bugtracking.spi.*;
 import org.netbeans.modules.bugtracking.cache.IssueCache.IssueAccessor;
 import org.netbeans.modules.bugtracking.util.BugtrackingUtil;
-import org.openide.nodes.Node;
 import org.openide.util.Lookup;
 import org.openide.util.lookup.Lookups;
 
@@ -92,16 +88,18 @@
         BugtrackingUtil.deleteRecursively(wd);
     }
 
-    public void testInitialSeen2Modified2Seen() throws 
MalformedURLException, CoreException, IOException, InterruptedException {
+    public void testInitialSeen2Modified2Seen() throws 
MalformedURLException, IOException, InterruptedException {
         long tsBeforeRepo = System.currentTimeMillis();
         Thread.sleep(10);
 
         CTestRepository repo = new CTestRepository("test repo");
-        IssueCache<CTestIssue, String> cache = 
repo.getLookup().lookup(IssueCache.class);
+        IssueCache<CTestIssue> cache = repo.getCache();
         // creating issue with creation     < repo reference time;
         //                     modification < repo reference time
         // => initial status SEEN
-        CTestIssue issue = cache.setIssueData("1", "1#issue1#" + 
tsBeforeRepo + "#" + tsBeforeRepo + "#v11#v21#v31");
+        //        new 
CTestIssue(TestKit.getRepository(CTestRepository.this), issueData)
+        CTestIssue issue = new CTestIssue(TestKit.getRepository(repo), 
"1#issue1#" + tsBeforeRepo + "#" + tsBeforeRepo + "#v11#v21#v31");
+        issue = cache.setIssueData("1", issue);
         assertNotNull(issue);
         IssueCache.Status status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_SEEN, status);
@@ -111,7 +109,8 @@
 
         // setting changed data => MODIFIED, attrs stay the same
         long tsAfterRepo = System.currentTimeMillis();
-        cache.setIssueData(issue, "1#issue1#" + tsBeforeRepo + "#" + 
tsAfterRepo + "#v12#v22#v32");
+        issue.setData("1#issue1#" + tsBeforeRepo + "#" + tsAfterRepo + 
"#v12#v22#v32");
+        cache.setIssueData(issue.getID(), issue);
         status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_MODIFIED, status);
         attr = cache.getSeenAttributes(issue.getID());
@@ -127,15 +126,16 @@
         assertAttributes(attr, "v12", "v22", "v32");
     }
 
-    public void testInitialNew2RefreshChanged2Seen2Unseen() throws 
MalformedURLException, CoreException, IOException, InterruptedException {
+    public void testInitialNew2RefreshChanged2Seen2Unseen() throws 
MalformedURLException, IOException, InterruptedException {
         CTestRepository repo = new CTestRepository("test repo");
-        IssueCache<CTestIssue, String> cache = 
repo.getLookup().lookup(IssueCache.class);
+        IssueCache<CTestIssue> cache = repo.getCache();
         Thread.sleep(10);
         long tsAfterRepo = System.currentTimeMillis();
         // creating issue with creation     > repo reference time;
         //                     modification > repo reference time
         // => initial status NEW
-        CTestIssue issue = cache.setIssueData("1", "1#issue1#" + tsAfterRepo 
+ "#" + tsAfterRepo + "#v11#v21#v31");
+        CTestIssue  issue = new CTestIssue(TestKit.getRepository(repo), 
"1#issue1#" + tsAfterRepo + "#" + tsAfterRepo + "#v11#v21#v31");
+        cache.setIssueData("1", issue);
         assertNotNull(issue);
         IssueCache.Status status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_NEW, status);
@@ -144,7 +144,8 @@
 
         // refresh
         Thread.sleep(10);
-        cache.setIssueData(issue, "1#issue1#" + tsAfterRepo + "#" + 
System.currentTimeMillis()  + "#v12#v22#v32");
+        issue.setData("1#issue1#" + tsAfterRepo + "#" + 
System.currentTimeMillis()  + "#v12#v22#v32");
+        cache.setIssueData(issue.getID(), issue);
         status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_NEW, status);
         attr = cache.getSeenAttributes(issue.getID());
@@ -167,18 +168,19 @@
         assertAttributes(attr, "v12", "v22", "v32");
     }
 
-    public void testInitialModified2Seen2Unseen() throws 
MalformedURLException, CoreException, IOException, InterruptedException {
+    public void testInitialModified2Seen2Unseen() throws 
MalformedURLException, IOException, InterruptedException {
         long tsBeforeRepo = System.currentTimeMillis();
         Thread.sleep(10);
 
         CTestRepository repo = new CTestRepository("test repo");
-        IssueCache<CTestIssue, String> cache = 
repo.getLookup().lookup(IssueCache.class);
+        IssueCache<CTestIssue> cache = repo.getCache();
         Thread.sleep(10);
         long tsAfterRepo = System.currentTimeMillis();
         // creating issue with creation     < repo reference time;
         //                     modification > repo reference time
         // => initial status MODIFIED
-        CTestIssue issue = cache.setIssueData("1", "1#issue1#" + 
tsBeforeRepo + "#" + tsAfterRepo + "#v11#v21#v31");
+        CTestIssue issue = new CTestIssue(TestKit.getRepository(repo), 
"1#issue1#" + tsBeforeRepo + "#" + tsAfterRepo + "#v11#v21#v31");        
+        issue = cache.setIssueData("1", issue);
         assertNotNull(issue);
         IssueCache.Status status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_MODIFIED, status);
@@ -212,12 +214,12 @@
         assertAttributes(attr, "v11", "v21", "v31");
     }
 
-    public void testIssueModified2Seen2Restart2Unseen() throws 
MalformedURLException, CoreException, IOException, InterruptedException {
+    public void testIssueModified2Seen2Restart2Unseen() throws 
MalformedURLException, IOException, InterruptedException {
         long tsBeforeRepo = System.currentTimeMillis();
         Thread.sleep(10);
 
         CTestRepository repo = new CTestRepository("test repo");
-        IssueCache<CTestIssue, String> cache = 
repo.getLookup().lookup(IssueCache.class);
+        IssueCache<CTestIssue> cache = repo.getCache();
         Thread.sleep(10);
         long tsAfterRepo = System.currentTimeMillis();
 
@@ -225,7 +227,8 @@
         //                     modification > repo reference time
         // => initial status MODIFIED
         String data = "1#issue1#" + tsBeforeRepo + "#" + tsAfterRepo + 
"#v11#v21#v31";
-        CTestIssue issue = cache.setIssueData("1", data);
+        CTestIssue issue = new CTestIssue(TestKit.getRepository(repo), data);
+        cache.setIssueData("1", issue);
         assertNotNull(issue);
         IssueCache.Status status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_MODIFIED, status);
@@ -243,10 +246,11 @@
 
         // recreating the same repo emulates restart
         repo = new CTestRepository("test repo");
-        cache = repo.getLookup().lookup(IssueCache.class);
+        cache = repo.getCache();
         // setting the last set data emulates refresh with unchanged data
         // status is expected to be SEEN, and data the last set
-        cache.setIssueData("1", data);
+        issue.setData(data);
+        cache.setIssueData("1", issue);
         status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_SEEN, status);
         attr = cache.getSeenAttributes(issue.getID());
@@ -263,19 +267,19 @@
         assertAttributes(attr, "v11", "v21", "v31");
     }
 
-    public void testModified2RefreshChange2Seen2RefreshChange() throws 
MalformedURLException, CoreException, IOException, InterruptedException {
+    public void testModified2RefreshChange2Seen2RefreshChange() throws 
MalformedURLException, IOException, InterruptedException {
         modified2RefreshChange2Seen2RefreshChange(false);
     }
 
-    public void testModified2RefreshChange2Seen2Restart2RefreshChange() 
throws MalformedURLException, CoreException, IOException, 
InterruptedException {
+    public void testModified2RefreshChange2Seen2Restart2RefreshChange() 
throws MalformedURLException, IOException, InterruptedException {
         modified2RefreshChange2Seen2RefreshChange(true);
     }
-    public void modified2RefreshChange2Seen2RefreshChange(boolean restart) 
throws MalformedURLException, CoreException, IOException, 
InterruptedException {
+    public void modified2RefreshChange2Seen2RefreshChange(boolean restart) 
throws MalformedURLException, IOException, InterruptedException {
         long tsBeforeRepo = System.currentTimeMillis();
         Thread.sleep(10);
 
         CTestRepository repo = new CTestRepository("test repo");
-        IssueCache<CTestIssue, String> cache = 
repo.getLookup().lookup(IssueCache.class);
+        IssueCache<CTestIssue> cache = repo.getCache();
         Thread.sleep(10);
         long tsAfterRepo = System.currentTimeMillis();
 
@@ -283,7 +287,8 @@
         //                     modification > repo reference time
         // => initial status MODIFIED
         String data = "1#issue1#" + tsBeforeRepo + "#" + tsAfterRepo + 
"#v11#v21#v31";
-        CTestIssue issue = cache.setIssueData("1", data);
+        CTestIssue issue = new CTestIssue(TestKit.getRepository(repo), data);
+        issue = cache.setIssueData("1", issue);
         assertNotNull(issue);
         IssueCache.Status status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_MODIFIED, status);
@@ -293,7 +298,8 @@
 
         // one more time setting changed data => MODIFIED, attrs stay the 
same
         tsAfterRepo = System.currentTimeMillis();
-        cache.setIssueData(issue, "1#issue1#" + tsBeforeRepo + "#" + 
tsAfterRepo + "#v12#v22#v32");
+        issue.setData("1#issue1#" + tsBeforeRepo + "#" + tsAfterRepo + 
"#v12#v22#v32");
+        cache.setIssueData(issue.getID(), issue);
         status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_MODIFIED, status);
         attr = cache.getSeenAttributes(issue.getID());
@@ -311,12 +317,13 @@
         if(restart) {
             // recreating the same repo emulates restart
             repo = new CTestRepository("test repo");
-            cache = repo.getLookup().lookup(IssueCache.class);
+            cache = repo.getCache();
         }
 
         // setting changed data => MODIFIED, attrs stay the same
         tsAfterRepo = System.currentTimeMillis();
-        cache.setIssueData("1", "1#issue1#" + tsBeforeRepo + "#" + 
tsAfterRepo + "#v13#v23#v33"); // reload
+        issue.setData("1#issue1#" + tsBeforeRepo + "#" + tsAfterRepo + 
"#v13#v23#v33");
+        cache.setIssueData("1", issue); // reload
         status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_MODIFIED, status);
         attr = cache.getSeenAttributes(issue.getID());
@@ -324,16 +331,17 @@
         assertAttributes(attr, "v12", "v22", "v32");
     }
 
-    public void testInitialSeen2ModifiedNoChanges2Seen() throws 
MalformedURLException, CoreException, IOException, InterruptedException {
+    public void testInitialSeen2ModifiedNoChanges2Seen() throws 
MalformedURLException, IOException, InterruptedException {
         long tsBeforeRepo = System.currentTimeMillis();
         Thread.sleep(10);
 
         CTestRepository repo = new CTestRepository("test repo");
-        IssueCache<CTestIssue, String> cache = 
repo.getLookup().lookup(IssueCache.class);
+        IssueCache<CTestIssue> cache = repo.getCache();
         // creating issue with creation     < repo reference time;
         //                     modification < repo reference time
         // => initial status SEEN
-        CTestIssue issue = cache.setIssueData("1", "1#issue1#" + 
tsBeforeRepo + "#" + tsBeforeRepo + "#v11#v21#v31");
+        CTestIssue issue = new CTestIssue(TestKit.getRepository(repo), 
"1#issue1#" + tsBeforeRepo + "#" + tsBeforeRepo + "#v11#v21#v31");
+        issue = cache.setIssueData("1", issue);
         assertNotNull(issue);
         IssueCache.Status status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_SEEN, status);
@@ -343,7 +351,8 @@
 
         // setting changed data => MODIFIED, unchanged attrs
         long tsAfterRepo = System.currentTimeMillis();
-        cache.setIssueData(issue, "1#issue1#" + tsBeforeRepo + "#" + 
tsAfterRepo + "#v11#v21#v31");
+        issue.setData("1#issue1#" + tsBeforeRepo + "#" + tsAfterRepo + 
"#v11#v21#v31");
+        cache.setIssueData(issue.getID(), issue);
         status = cache.getStatus(issue.getID());
         assertEquals(IssueCache.Status.ISSUE_STATUS_MODIFIED, status);
         attr = cache.getSeenAttributes(issue.getID());
@@ -366,7 +375,7 @@
         }
     }
 
-    private class CTestIssue extends TestIssue {
+    private static class CTestIssue extends TestIssue {
         private String[] dataArray;
         private Map<String, String> attrs = new HashMap<String, String>(3);
         private RepositoryImpl repository;
@@ -452,11 +461,11 @@
             return info;
         }
 
-        public Lookup getLookup() {
+        public TestCache getCache() {
             if(cache == null) {
                 cache = new TestCache(name, TestKit.getRepository(this));
             }
-            return Lookups.singleton(cache);
+            return cache;
         }
 
         public TestIssue[] getIssues(String[] id) {throw new 
UnsupportedOperationException("Not supported yet.");}
@@ -473,26 +482,11 @@
         @Override
         public void addPropertyChangeListener(PropertyChangeListener 
listener) { }
 
-        private class TestCache extends IssueCache<CTestIssue, String> {
+        private class TestCache extends IssueCache<CTestIssue> {
             public TestCache(String nameSpace, RepositoryImpl repository) {
                 super(
                     nameSpace, 
-                    new IssueAccessor<CTestIssue, String>() {
-                        @Override
-                        public String getID(String issueData) {
-                            String[] a = issueData.split("#");
-                            return a[0];
-                        }
-                        @Override
-                        public CTestIssue createIssue(String issueData) {
-                            return new 
CTestIssue(TestKit.getRepository(CTestRepository.this), issueData);
-                        }
-
-                        @Override
-                        public void setIssueData(CTestIssue issue, String 
issueData) {
-                            ((CTestIssue)issue).setData(issueData);
-                        }
-
+                    new IssueAccessor<CTestIssue>() {
                         @Override
                         public Map<String, String> getAttributes(CTestIssue 
issue) {
                             return ((CTestIssue)issue).getAttributes();
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/StorageTest.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/StorageTest.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/StorageTest.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/StorageTest.java
@@ -60,7 +60,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Level;
-import org.eclipse.core.runtime.CoreException;
 import org.netbeans.junit.NbTestCase;
 import org.netbeans.modules.bugtracking.BugtrackingConfig;
 import org.netbeans.modules.bugtracking.RepositoryImpl;
@@ -94,7 +93,7 @@
         emptyStorage();
     }
 
-    public void testStorage() throws MalformedURLException, CoreException, 
IOException {
+    public void testStorage() throws MalformedURLException, IOException {
         final IssueStorage storage = IssueStorage.getInstance();
 
         Map<String, String> attr1 = new HashMap<String, String>();
@@ -116,7 +115,7 @@
         storage.storeQuery(url, qName, new String[] {id1, id2});
 
         long lm = System.currentTimeMillis();
-        IssueCache<DummyIssue, Object> cache = getCache();
+        IssueCache<DummyIssue> cache = getCache();
         IssueEntry ie1 = cache.new IssueEntry(i1, i1.id, attr1, 
IssueCache.Status.ISSUE_STATUS_UNKNOWN, 
IssueCache.Status.ISSUE_STATUS_UNKNOWN, false, lm);
         IssueEntry ie2 = cache.new IssueEntry(i2, i2.id, attr2, 
IssueCache.Status.ISSUE_STATUS_UNKNOWN, 
IssueCache.Status.ISSUE_STATUS_UNKNOWN, false, lm);
         
@@ -157,7 +156,7 @@
 
     }
 
-    public void testArchivedStorage() throws MalformedURLException, 
CoreException, IOException, NoSuchFieldException, IllegalArgumentException, 
IllegalAccessException, NoSuchMethodException, InvocationTargetException {
+    public void testArchivedStorage() throws MalformedURLException, 
IOException, NoSuchFieldException, IllegalArgumentException, 
IllegalAccessException, NoSuchMethodException, InvocationTargetException {
         IssueStorage storage = IssueStorage.getInstance();
         long ts = System.currentTimeMillis();
         String id1 = "id1";
@@ -188,7 +187,7 @@
         
     }
 
-    public void testCleanup() throws MalformedURLException, CoreException, 
IOException, NoSuchFieldException, IllegalArgumentException, 
IllegalAccessException, NoSuchMethodException, InvocationTargetException {
+    public void testCleanup() throws MalformedURLException, IOException, 
NoSuchFieldException, IllegalArgumentException, IllegalAccessException, 
NoSuchMethodException, InvocationTargetException {
         IssueStorage storage = IssueStorage.getInstance();
         long ts = System.currentTimeMillis();
         Map<String, String> attr = new HashMap<String, String>();
@@ -202,7 +201,7 @@
         DummyIssue i2 = new DummyIssue(id2, attr);
         
         long lm = System.currentTimeMillis();
-        IssueCache<DummyIssue, Object> cache = getCache();
+        IssueCache<DummyIssue> cache = getCache();
         IssueEntry ie1 = cache. new IssueEntry(i1, i1.id, attr, 
IssueCache.Status.ISSUE_STATUS_UNKNOWN, 
IssueCache.Status.ISSUE_STATUS_UNKNOWN, false, lm);
         IssueEntry ie2 = cache. new IssueEntry(i2, i2.id, attr, 
IssueCache.Status.ISSUE_STATUS_UNKNOWN, 
IssueCache.Status.ISSUE_STATUS_UNKNOWN, false, lm);
 
@@ -361,25 +360,10 @@
         }
     }
     
-    private IssueCache<DummyIssue, Object> getCache() {
+    private IssueCache<DummyIssue> getCache() {
         IssueCache.IssueAccessor ia = new IssueCache.IssueAccessor() {
 
             @Override
-            public String getID(Object issueData) {
-                throw new UnsupportedOperationException("Not supported 
yet.");
-            }
-
-            @Override
-            public Object createIssue(Object issueData) {
-                throw new UnsupportedOperationException("Not supported 
yet.");
-            }
-
-            @Override
-            public void setIssueData(Object issue, Object issueData) {
-                throw new UnsupportedOperationException("Not supported 
yet.");
-            }
-
-            @Override
             public Map getAttributes(Object issue) {
                 throw new UnsupportedOperationException("Not supported 
yet.");
             }
@@ -395,6 +379,6 @@
             }
         };
         RepositoryImpl impl = TestKit.getRepository(new 
DummyRepository(DummyBugtrackingConnector.instance, "dummy"));
-        return new IssueCache<DummyIssue, Object>("dummy", ia);
+        return new IssueCache<DummyIssue>("dummy", ia);
     }
 }
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/issuetable/QueryTableCellRendererTest.java
@@ -495,44 +495,30 @@
 
     private class RendererRepository extends TestRepository {
         private RepositoryInfo info;
-        private IssueCache<TestIssue, Object> cache;
+        private IssueCache<TestIssue> cache;
         private Lookup lookup;
         public RendererRepository() {
             info = new RepositoryInfo("testrepo", "testconnector", null, 
null, null, null, null, null, null);
             lookup = Lookups.singleton(getCache());
         }
 
-        public IssueCache<TestIssue, Object> getCache() {
+        public IssueCache<TestIssue> getCache() {
             if(cache == null) {
-                IssueAccessor<TestIssue, Object> issueAccessor = new 
IssueCache.IssueAccessor<TestIssue, Object>() {
-                    @Override
-                    public String getID(Object issueData) {
-                        return ((RendererIssue)issueData).getID();
-                    }
-                    @Override
-                    public TestIssue createIssue(Object issueData) {
-                        throw new UnsupportedOperationException("Not 
supported yet.");
-                    }
-                    @Override
-                    public void setIssueData(TestIssue issue, Object 
issueData) {
-
-                    }
+                IssueAccessor<TestIssue> issueAccessor = new 
IssueCache.IssueAccessor<TestIssue>() {
                     @Override
                     public Map<String, String> getAttributes(TestIssue 
issue) {
                         throw new UnsupportedOperationException("Not 
supported yet.");
                     }
                     @Override
                     public long getLastModified(TestIssue issue) {
-                        throw new UnsupportedOperationException("Not 
supported yet.");
+                        return System.currentTimeMillis() - 10 * 60 * 1000;
                     }
                     @Override
                     public long getCreated(TestIssue issue) {
-                        throw new UnsupportedOperationException("Not 
supported yet.");
+                        return System.currentTimeMillis() - 15 * 60 * 1000;
                     }
                 };
-                TestIssueProvider issueProvider = new TestIssueProvider();
-                RepositoryImpl repo = TestKit.getRepository(this);
-                cache = new IssueCache<TestIssue, Object>("test", 
issueAccessor);
+                cache = new IssueCache<TestIssue>("test", issueAccessor);
             }
             return cache;
         }
@@ -591,13 +577,13 @@
     };
 
     private void setEntryValues(RendererRepository repository, RendererIssue 
rendererIssue, IssueCache.Status status, boolean seen) throws 
NoSuchMethodException, IllegalAccessException, IllegalArgumentException, 
InvocationTargetException {
-        IssueCache cache = repository.getLookup().lookup(IssueCache.class);
+        IssueCache cache = repository.getCache();
         try {
-            cache.setIssueData(rendererIssue, rendererIssue); // ensure 
issue is cached
+            cache.setIssueData(rendererIssue.getID(), rendererIssue); // 
ensure issue is cached
         } catch (IOException ex) {
             Exceptions.printStackTrace(ex);
         }
-        Method m = cache.getClass().getDeclaredMethod("setEntryValues", 
String.class, int.class, boolean.class);
+        Method m = cache.getClass().getDeclaredMethod("setEntryValues", 
String.class, IssueCache.Status.class, boolean.class);
         m.setAccessible(true);
         m.invoke(cache, rendererIssue.getID(), status, seen);
     }
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/selectors/RepositorySelectorTest.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/selectors/RepositorySelectorTest.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/selectors/RepositorySelectorTest.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/ui/selectors/RepositorySelectorTest.java
@@ -55,7 +55,6 @@
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.event.ChangeListener;
-import org.eclipse.core.runtime.CoreException;
 import org.netbeans.junit.NbTestCase;
 import org.netbeans.modules.bugtracking.TestIssue;
 import org.netbeans.modules.bugtracking.TestKit;
@@ -87,7 +86,7 @@
         super.setUp();
     }
 
-    public void testRepositorySelectorBuilder() throws 
MalformedURLException, CoreException, IOException, NoSuchFieldException, 
IllegalArgumentException, IllegalAccessException, NoSuchMethodException, 
InvocationTargetException {
+    public void testRepositorySelectorBuilder() throws 
MalformedURLException, IOException, NoSuchFieldException, 
IllegalArgumentException, IllegalAccessException, NoSuchMethodException, 
InvocationTargetException {
         String errorMsg = "tpyo";
         MyRepository repo = new MyRepository();
 
diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/issue/BugzillaIssue.java
@@ -1015,7 +1015,8 @@
             if(td == null) {
                 return false;
             }
-            getRepository().getIssueCache().setIssueData(this, td); // XXX
+            setTaskData(td);
+            getRepository().getIssueCache().setIssueData(td.getTaskId(), 
this); // XXX
             getRepository().ensureConfigurationUptodate(this);
             refreshViewData(afterSubmitRefresh);
         } catch (IOException ex) {
@@ -1103,7 +1104,7 @@
 
     public void setUpToDate(boolean seen) {
         try {
-            final IssueCache<BugzillaIssue, TaskData> issueCache = 
getRepository().getIssueCache();
+            final IssueCache<BugzillaIssue> issueCache = 
getRepository().getIssueCache();
             boolean wasSeen = issueCache.wasSeen(getID());
             if(seen != wasSeen) {
                 issueCache.setSeen(getID(), seen);
diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/query/BugzillaQuery.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/query/BugzillaQuery.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/query/BugzillaQuery.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/query/BugzillaQuery.java
@@ -332,7 +332,7 @@
             ids.addAll(issues);
         }
 
-        IssueCache<BugzillaIssue, TaskData> cache = 
repository.getIssueCache();
+        IssueCache<BugzillaIssue> cache = repository.getIssueCache();
         List<BugzillaIssue> ret = new ArrayList<BugzillaIssue>();
         for (String id : ids) {
             IssueCache.Status status = getIssueStatus(id);
@@ -367,8 +367,12 @@
             
getController().addProgressUnit(BugzillaIssue.getDisplayName(taskData));
             BugzillaIssue issue;
             try {
-                IssueCache<BugzillaIssue, TaskData> cache = 
repository.getIssueCache();
-                issue = (BugzillaIssue) cache.setIssueData(id, taskData);
+                IssueCache<BugzillaIssue> cache = repository.getIssueCache();
+                issue = cache.getIssue(id);
+                if(issue != null) {
+                    issue.setTaskData(taskData);
+                }
+                issue = (BugzillaIssue) cache.setIssueData(id, issue != null 
? issue : new BugzillaIssue(taskData, repository));
             } catch (IOException ex) {
                 Bugzilla.LOG.log(Level.SEVERE, null, ex);
                 return;
diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/repository/BugzillaRepository.java
 
b/bugzilla/src/org/netbeans/modules/bugzilla/repository/BugzillaRepository.java
--- 
a/bugzilla/src/org/netbeans/modules/bugzilla/repository/BugzillaRepository.java
+++ 
b/bugzilla/src/org/netbeans/modules/bugzilla/repository/BugzillaRepository.java
@@ -107,7 +107,7 @@
     private TaskRepository taskRepository;
     private BugzillaRepositoryController controller;
     private Set<BugzillaQuery> queries = null;
-    private IssueCache<BugzillaIssue, TaskData> cache;
+    private IssueCache<BugzillaIssue> cache;
     private BugzillaExecutor executor;
     private Image icon;
     private BugzillaConfiguration bc;
@@ -270,7 +270,8 @@
             public void accept(TaskData taskData) {
                 String id = BugzillaIssue.getID(taskData);
                 try {
-                    BugzillaIssue issue = (BugzillaIssue) 
getIssueCache().setIssueData(id, taskData);
+                    BugzillaIssue issue = getIssueCache().getIssue(id);
+                    issue = (BugzillaIssue) getIssueCache().setIssueData(id, 
issue != null ? issue : new BugzillaIssue(taskData, BugzillaRepository.this));
                     if(issue != null) {
                         ret.add(issue);
                     }
@@ -297,7 +298,8 @@
             return null;
         }
         try {
-            BugzillaIssue issue = (BugzillaIssue) 
getIssueCache().setIssueData(id, taskData);
+            BugzillaIssue issue = getIssueCache().getIssue(id);
+            issue = (BugzillaIssue) getIssueCache().setIssueData(id, issue 
!= null ? issue : new BugzillaIssue(taskData, this));
             ensureConfigurationUptodate(issue);
             return issue;
         } catch (IOException ex) {
@@ -389,7 +391,7 @@
         return getQueriesIntern();
     }
 
-    public IssueCache<BugzillaIssue, TaskData> getIssueCache() {
+    public IssueCache<BugzillaIssue> getIssueCache() {
         if(cache == null) {
             cache = new Cache();
         }
@@ -757,7 +759,8 @@
             String id = BugzillaIssue.getID(taskData);
             Bugzilla.LOG.log(Level.FINE, "refreshed issue {0} - {1}", new 
Object[] {getDisplayName(), id}); // NOI18N
             try {
-                getIssueCache().setIssueData(id, taskData);
+                BugzillaIssue issue = getIssueCache().getIssue(id);
+                getIssueCache().setIssueData(id, issue != null ? issue : new 
BugzillaIssue(taskData, BugzillaRepository.this));
             } catch (IOException ex) {
                 Bugzilla.LOG.log(Level.SEVERE, null, ex);
             }
@@ -780,24 +783,13 @@
         return new QueryParameter[] {};
     }
 
-    private class Cache extends IssueCache<BugzillaIssue, TaskData> {
+    private class Cache extends IssueCache<BugzillaIssue> {
         Cache() {
             super(BugzillaRepository.this.getUrl(), new IssueAccessorImpl());
         }
     }
 
-    private class IssueAccessorImpl implements 
IssueCache.IssueAccessor<BugzillaIssue, TaskData> {
-        @Override
-        public BugzillaIssue createIssue(TaskData taskData) {
-            BugzillaIssue issue = new BugzillaIssue(taskData, 
BugzillaRepository.this);
-            
org.netbeans.modules.bugzilla.issue.BugzillaTaskListProvider.getInstance().notifyIssueCreated(issue);
-            return issue;
-        }
-        @Override
-        public void setIssueData(BugzillaIssue issue, TaskData taskData) {
-            assert issue != null && taskData != null;
-            ((BugzillaIssue)issue).setTaskData(taskData);
-        }
+    private class IssueAccessorImpl implements 
IssueCache.IssueAccessor<BugzillaIssue> {
         @Override
         public long getLastModified(BugzillaIssue issue) {
             assert issue != null;
@@ -809,11 +801,6 @@
             return ((BugzillaIssue)issue).getCreated();
         }
         @Override
-        public String getID(TaskData issueData) {
-            assert issueData != null;
-            return BugzillaIssue.getID(issueData);
-        }
-        @Override
         public Map<String, String> getAttributes(BugzillaIssue issue) {
             assert issue != null;
             return ((BugzillaIssue)issue).getAttributes();
diff --git a/jira/src/org/netbeans/modules/jira/issue/IssueLinksPanel.java 
b/jira/src/org/netbeans/modules/jira/issue/IssueLinksPanel.java
--- a/jira/src/org/netbeans/modules/jira/issue/IssueLinksPanel.java
+++ b/jira/src/org/netbeans/modules/jira/issue/IssueLinksPanel.java
@@ -122,7 +122,7 @@
     private void reloadIssueDetails() {
         summaryMap.clear();
         JiraRepository repository = issue.getRepository();
-        IssueCache<NbJiraIssue, TaskData> cache = repository.getIssueCache();
+        IssueCache<NbJiraIssue> cache = repository.getIssueCache();
         for (NbJiraIssue.LinkedIssue linkedIssue : issue.getLinkedIssues()) {
             String issueKey = linkedIssue.getIssueKey();
             NbJiraIssue izzue = cache.getIssue(issueKey);
diff --git a/jira/src/org/netbeans/modules/jira/issue/IssuePanel.java 
b/jira/src/org/netbeans/modules/jira/issue/IssuePanel.java
--- a/jira/src/org/netbeans/modules/jira/issue/IssuePanel.java
+++ b/jira/src/org/netbeans/modules/jira/issue/IssuePanel.java
@@ -1963,7 +1963,7 @@
         RP.post(new Runnable() {
             @Override
             public void run() {
-                IssueCache<NbJiraIssue, TaskData> cache = 
issue.getRepository().getIssueCache();
+                IssueCache<NbJiraIssue> cache = 
issue.getRepository().getIssueCache();
                 String parentKey = issue.getParentKey();
                 if ((parentKey != null) && (parentKey.trim().length()>0)) {
                     NbJiraIssue parentIssue = cache.getIssue(parentKey);
diff --git a/jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java 
b/jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java
--- a/jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java
+++ b/jira/src/org/netbeans/modules/jira/issue/NbJiraIssue.java
@@ -539,7 +539,7 @@
 
     public void setUpToDate(boolean seen) {
         try {
-            final IssueCache<NbJiraIssue, TaskData> issueCache = 
getRepository().getIssueCache();
+            final IssueCache<NbJiraIssue> issueCache = 
getRepository().getIssueCache();
             boolean wasSeen = issueCache.wasSeen(getID());
             if(seen != wasSeen) {
                 issueCache.setSeen(getID(), seen);
@@ -562,7 +562,9 @@
             if(td == null) {
                 return false;
             }
-            getRepository().getIssueCache().setIssueData(this, td); // XXX
+            IssueCache<NbJiraIssue> cache = getRepository().getIssueCache();
+            NbJiraIssue issue = cache.getIssue(key);
+            cache.setIssueData(td.getTaskId(), issue != null ? issue : new 
NbJiraIssue(td, repository)); // XXX
             refreshViewData(afterSubmitRefresh);
         } catch (IOException ex) {
             Jira.LOG.log(Level.SEVERE, null, ex);
@@ -582,7 +584,9 @@
             if(td == null) {
                 return false;
             }
-            getRepository().getIssueCache().setIssueData(this, td);
+            IssueCache<NbJiraIssue> cache = getRepository().getIssueCache();
+            NbJiraIssue issue = cache.getIssue(id);
+            cache.setIssueData(td.getTaskId(), issue != null ? issue : new 
NbJiraIssue(td, repository));
             refreshViewData(afterSubmitRefresh);
         } catch (IOException ex) {
             Jira.LOG.log(Level.SEVERE, null, ex);
diff --git a/jira/src/org/netbeans/modules/jira/query/JiraQuery.java 
b/jira/src/org/netbeans/modules/jira/query/JiraQuery.java
--- a/jira/src/org/netbeans/modules/jira/query/JiraQuery.java
+++ b/jira/src/org/netbeans/modules/jira/query/JiraQuery.java
@@ -306,7 +306,7 @@
             ids.addAll(issues);
         }
         
-        IssueCache<NbJiraIssue, TaskData> cache = repository.getIssueCache();
+        IssueCache<NbJiraIssue> cache = repository.getIssueCache();
         List<NbJiraIssue> ret = new ArrayList<NbJiraIssue>();
         for (String id : ids) {
             IssueCache.Status status = getIssueStatus(id);
@@ -335,13 +335,18 @@
 
     private class IssuesCollector extends TaskDataCollector {
         public IssuesCollector() {}
+        @Override
         public void accept(TaskData taskData) {
             String id = NbJiraIssue.getID(taskData);
             NbJiraIssue issue;
             try {
                 
getController().progress(NbJiraIssue.getDisplayName(taskData));
-                IssueCache<NbJiraIssue, TaskData> cache = 
repository.getIssueCache();
-                issue = (NbJiraIssue) cache.setIssueData(id, taskData);
+                IssueCache<NbJiraIssue> cache = repository.getIssueCache();
+                issue = cache.getIssue(id);
+                if(issue != null) {
+                    issue.setTaskData(taskData);
+                }
+                issue = (NbJiraIssue) cache.setIssueData(id, issue != null ? 
issue : new NbJiraIssue(taskData, repository));
                 issues.add(issue.getID());
             } catch (IOException ex) {
                 Jira.LOG.log(Level.SEVERE, null, ex);
diff --git 
a/jira/src/org/netbeans/modules/jira/repository/JiraRepository.java 
b/jira/src/org/netbeans/modules/jira/repository/JiraRepository.java
--- a/jira/src/org/netbeans/modules/jira/repository/JiraRepository.java
+++ b/jira/src/org/netbeans/modules/jira/repository/JiraRepository.java
@@ -109,7 +109,7 @@
     private JiraRepositoryController controller;
     private Set<JiraQuery> queries = null;
     private Set<JiraQuery> remoteFilters = null;
-    private IssueCache<NbJiraIssue, TaskData> cache;
+    private IssueCache<NbJiraIssue> cache;
     private Image icon;
 
     private final Set<String> issuesToRefresh = new HashSet<String>(5);
@@ -238,7 +238,8 @@
             return null;
         }
         try {
-            return getIssueCache().setIssueData(key, taskData);
+            NbJiraIssue issue = getIssueCache().getIssue(key);
+            return getIssueCache().setIssueData(key, issue != null ? issue : 
new NbJiraIssue(taskData, this));
         } catch (IOException ex) {
             Jira.LOG.log(Level.SEVERE, null, ex);
             return null;
@@ -424,7 +425,7 @@
         return issues;
     }
 
-    public IssueCache<NbJiraIssue, TaskData> getIssueCache() {
+    public IssueCache<NbJiraIssue> getIssueCache() {
         if(cache == null) {
             cache = new Cache();
         }
@@ -559,7 +560,8 @@
                             if(data == null) {
                                 Jira.LOG.log(Level.WARNING, "No task data 
available for issue with id {0}", id); // NOI18N
                             } else {
-                                getIssueCache().setIssueData(id, data);
+                                NbJiraIssue issue = 
getIssueCache().getIssue(id);
+                                getIssueCache().setIssueData(id, issue != 
null ? issue : new NbJiraIssue(data, JiraRepository.this));
                             }
                         } catch (IOException ex) {
                             Jira.LOG.log(Level.SEVERE, null, ex); // NOI18N
@@ -709,23 +711,12 @@
         return null;
     }
 
-    private class Cache extends IssueCache<NbJiraIssue, TaskData> {
+    private class Cache extends IssueCache<NbJiraIssue> {
         Cache() {
             super(JiraRepository.this.getUrl(), new IssueAccessorImpl());
         }
     }
-    private class IssueAccessorImpl implements 
IssueCache.IssueAccessor<NbJiraIssue, TaskData> {
-        @Override
-        public NbJiraIssue createIssue(TaskData taskData) {
-            NbJiraIssue issue = new NbJiraIssue(taskData, 
JiraRepository.this);
-            
org.netbeans.modules.jira.issue.JiraTaskListProvider.getInstance().notifyIssueCreated(issue);
-            return issue;
-        }
-        @Override
-        public void setIssueData(NbJiraIssue issue, TaskData taskData) {
-            assert issue != null && taskData != null;
-            ((NbJiraIssue)issue).setTaskData(taskData);
-        }
+    private class IssueAccessorImpl implements 
IssueCache.IssueAccessor<NbJiraIssue> {
         @Override
         public long getLastModified(NbJiraIssue issue) {
             assert issue != null;
@@ -737,11 +728,6 @@
             return ((NbJiraIssue)issue).getCreated();
         }
         @Override
-        public String getID(TaskData issueData) {
-            assert issueData != null;
-            return NbJiraIssue.getID(issueData);
-        }
-        @Override
         public Map<String, String> getAttributes(NbJiraIssue issue) {
             assert issue != null;
             return ((NbJiraIssue)issue).getAttributes();

[hg] main-silver: removed confusing issue create and update call...

Tomas Stupka 04/04/2013

Project Features

About this Project

ConnectedDeveloper was started in November 2009, is owned by tpavek, and has 64 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close