[hg] main-silver: IssueProvider as interface

  • From: Tomas Stupka < >
  • To:
  • Subject: [hg] main-silver: IssueProvider as interface
  • Date: Fri, 11 Oct 2013 11:22:43 -0700

changeset 2c0cdb8a2b42 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/2c0cdb8a2b42
description:
        IssueProvider as interface

diffstat:

 bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java      
        |  38 ++++-----
 
bugtracking/src/org/netbeans/modules/bugtracking/team/spi/TeamIssueProvider.java
     |   2 +-
 bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java    
        |   4 +
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
    |   7 +-
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestConnector.java
 |   7 +-
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
     |   4 +
 
bugtracking/test/unit/src/org/netbeans/modules/bugtracking/cache/CacheTest.java
      |   7 +-
 jira/src/org/netbeans/modules/jira/JiraIssueProvider.java                    
        |   2 +-
 localtasks/src/org/netbeans/modules/localtasks/IssueProviderImpl.java        
        |   9 +-
 odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSIssueProvider.java        
        |   2 +-
 10 files changed, 52 insertions(+), 30 deletions(-)

diffs (291 lines):

diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java 
b/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java
--- a/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java
+++ b/bugtracking/src/org/netbeans/modules/bugtracking/spi/IssueProvider.java
@@ -53,34 +53,30 @@
  * @author Tomas Stupka
  * @param <I> the implementation specific issue type
  */
-public abstract class IssueProvider<I> {
+public interface IssueProvider<I> {
 
     /**
      * issue data were refreshed
      */
     public static final String EVENT_ISSUE_REFRESHED = "issue.data_changed"; 
// NOI18N
 
-    static {
-        SPIAccessorImpl.createAccesor();
-    }
-    
     /**
      * Returns this issues display name
      * @return
      */
-    public abstract String getDisplayName(I data);
+    public String getDisplayName(I data);
 
     /**
      * Returns this issues tooltip
      * @return
      */
-    public abstract String getTooltip(I data);
+    public String getTooltip(I data);
 
     /**
      * Returns this issues unique ID
      * @return
      */
-    public abstract String getID(I data);
+    public String getID(I data);
     
     /**
      * Returns the ID-s of all issues where this one could be consideret 
@@ -91,19 +87,19 @@
      * @param data
      * @return 
      */
-    public abstract String[] getSubtasks(I data);
+    public String[] getSubtasks(I data);
 
     /**
      * Returns this issues summary
      * @return
      */
-    public abstract String getSummary(I data);
+    public String getSummary(I data);
 
     /**
      * Returns true if the issue isn't stored in a repository yet. Otherwise 
false.
      * @return
      */
-    public abstract boolean isNew(I data);
+    public boolean isNew(I data);
     
     /**
      * Determines if the issue is considered finished 
@@ -112,14 +108,14 @@
      * @param data
      * @return true if finished, otherwise false
      */
-    public abstract boolean isFinished(I data);
+    public boolean isFinished(I data);
 
     /**
      * Refreshes this Issues data from its bugtracking repository
      *
      * @return true if the issue was refreshed, otherwise false
      */
-    public abstract boolean refresh(I data);
+    public boolean refresh(I data);
 
     /**
      * Add a comment to this issue and close it as fixed eventually.
@@ -129,7 +125,7 @@
      */
     // XXX throw exception
     // XXX provide way so that we know commit hooks are supported
-    public abstract void addComment(I data, String comment, boolean 
closeAsFixed);
+    public void addComment(I data, String comment, boolean closeAsFixed);
 
     /**
      * Attach a file to this issue
@@ -138,7 +134,7 @@
      */
     // XXX throw exception; attach Patch or attachFile?
     // XXX provide way so that we know patch attachemnts are supported
-    public abstract void attachPatch(I data, File file, String description);
+    public void attachPatch(I data, File file, String description);
 
     /**
      * Discard outgoing local changes. 
@@ -148,18 +144,18 @@
      * 
      * @param data 
      */
-    public abstract void discardOutgoing(I data);
+    public void discardOutgoing(I data);
     
     /**
      * Returns this issues controller
      * XXX we don't need this. use get component instead and get rid of the 
BugtrackingController
      * @return
      */
-    public abstract IssueController getController(I data);
+    public IssueController getController(I data);
 
-    public abstract void removePropertyChangeListener(I data, 
PropertyChangeListener listener);
+    public void removePropertyChangeListener(I data, PropertyChangeListener 
listener);
 
-    public abstract void addPropertyChangeListener(I data, 
PropertyChangeListener listener);
+    public void addPropertyChangeListener(I data, PropertyChangeListener 
listener);
     
     /**
      * Submits the issue. Override and implement if you support issue
@@ -170,8 +166,6 @@
      * submitted,<code>false</code> if the task was not submitted for any
      * reason.
      */
-    public boolean submit (I data) {
-        return false;
-    }
+    public boolean submit (I data);
     
 }
diff --git 
a/bugtracking/src/org/netbeans/modules/bugtracking/team/spi/TeamIssueProvider.java
 
b/bugtracking/src/org/netbeans/modules/bugtracking/team/spi/TeamIssueProvider.java
--- 
a/bugtracking/src/org/netbeans/modules/bugtracking/team/spi/TeamIssueProvider.java
+++ 
b/bugtracking/src/org/netbeans/modules/bugtracking/team/spi/TeamIssueProvider.java
@@ -47,7 +47,7 @@
  *
  * @author Tomas Stupka
  */
-public abstract class TeamIssueProvider<I> extends IssueProvider<I> {
+public abstract class TeamIssueProvider<I> implements IssueProvider<I> {
    
     /** 
      * Provides owner (project/component/...) info to prefill the respective 
fields.
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssue.java
@@ -113,4 +113,8 @@
         throw new UnsupportedOperationException("Not supported yet."); //To 
change body of generated methods, choose Tools | Templates.
     }
 
+    boolean submit() {
+        throw new UnsupportedOperationException("Not supported yet."); //To 
change body of generated methods, choose Tools | Templates.
 }
+
+}
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/TestIssueProvider.java
@@ -53,7 +53,7 @@
  *
  * @author tomas
  */
-public class TestIssueProvider extends IssueProvider<TestIssue> {
+public class TestIssueProvider implements IssueProvider<TestIssue> {
     @Override
     public String[] getSubtasks(TestIssue data) {
         return data.getSubtasks();
@@ -124,4 +124,9 @@
         data.discardOutgoing();
     }
     
+    @Override
+    public boolean submit(TestIssue data) {
+        return data.submit();
 }
+    
+}
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestConnector.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestConnector.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestConnector.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestConnector.java
@@ -270,7 +270,7 @@
         }
     }
 
-    public static class APITestIssueProvider extends 
IssueProvider<APITestIssue> {
+    public static class APITestIssueProvider implements 
IssueProvider<APITestIssue> {
 
         @Override
         public String[] getSubtasks(APITestIssue data) {
@@ -342,5 +342,10 @@
             data.discardOutgoing();
         }
 
+        @Override
+        public boolean submit(APITestIssue data) {
+            return data.submit();
     }    
+
 }        
+}        
diff --git 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
--- 
a/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
+++ 
b/bugtracking/test/unit/src/org/netbeans/modules/bugtracking/api/APITestIssue.java
@@ -192,4 +192,8 @@
     void discardOutgoing() {
         throw new UnsupportedOperationException("Not supported yet."); //To 
change body of generated methods, choose Tools | Templates.
     }
+
+    boolean submit() {
+        throw new UnsupportedOperationException("Not supported yet."); //To 
change body of generated methods, choose Tools | Templates.
 }
+}
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
@@ -469,7 +469,7 @@
         }
     }
 
-    public class CTestIssueProvider extends IssueProvider<CTestIssue> {
+    public class CTestIssueProvider implements IssueProvider<CTestIssue> {
 
         @Override
         public String getDisplayName(CTestIssue data) {
@@ -537,6 +537,11 @@
         public void discardOutgoing(CTestIssue data) {
             data.discardOutgoing();
         }
+
+        @Override
+        public boolean submit(CTestIssue data) {
+            throw new UnsupportedOperationException("Not supported yet."); 
//To change body of generated methods, choose Tools | Templates.
+        }
     }
 
     private void emptyStorage() throws NoSuchMethodException, 
IllegalAccessException, IllegalArgumentException, InvocationTargetException, 
NoSuchFieldException {
diff --git a/jira/src/org/netbeans/modules/jira/JiraIssueProvider.java 
b/jira/src/org/netbeans/modules/jira/JiraIssueProvider.java
--- a/jira/src/org/netbeans/modules/jira/JiraIssueProvider.java
+++ b/jira/src/org/netbeans/modules/jira/JiraIssueProvider.java
@@ -48,7 +48,7 @@
  *
  * @author Tomas Stupka
  */
-public class JiraIssueProvider extends IssueProvider<NbJiraIssue> {
+public class JiraIssueProvider implements IssueProvider<NbJiraIssue> {
 
     @Override
     public String getDisplayName(NbJiraIssue data) {
diff --git 
a/localtasks/src/org/netbeans/modules/localtasks/IssueProviderImpl.java 
b/localtasks/src/org/netbeans/modules/localtasks/IssueProviderImpl.java
--- a/localtasks/src/org/netbeans/modules/localtasks/IssueProviderImpl.java
+++ b/localtasks/src/org/netbeans/modules/localtasks/IssueProviderImpl.java
@@ -46,13 +46,13 @@
 import java.io.File;
 import org.netbeans.modules.localtasks.task.LocalTask;
 import org.netbeans.modules.bugtracking.spi.IssueController;
-import org.netbeans.modules.bugtracking.spi.IssueStatusProvider;
+import org.netbeans.modules.bugtracking.spi.IssueProvider;
 
 /**
  *
  * @author Ondrej Vrabec
  */
-public class IssueProviderImpl extends 
org.netbeans.modules.bugtracking.spi.IssueProvider<LocalTask> {
+public class IssueProviderImpl implements IssueProvider<LocalTask> {
 
     @Override
     public String getDisplayName (LocalTask data) {
@@ -124,4 +124,9 @@
         data.delete();
     }
     
+    @Override
+    public boolean submit(LocalTask data) {
+        return false;
 }
+    
+}
diff --git 
a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSIssueProvider.java 
b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSIssueProvider.java
--- a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSIssueProvider.java
+++ b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCSIssueProvider.java
@@ -52,7 +52,7 @@
  *
  * @author Tomas Stupka
  */
-public class ODCSIssueProvider extends IssueProvider<ODCSIssue> {
+public class ODCSIssueProvider implements IssueProvider<ODCSIssue> {
 
     @Override
     public String getDisplayName(ODCSIssue data) {

[hg] main-silver: IssueProvider as interface

Tomas Stupka 10/11/2013

Project Features

About this Project

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