Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-06-14 01:16:34 +0000
committerspingel2009-06-14 01:16:34 +0000
commit648314ee511a0bc376b23e3a8b9dc40415acae9b (patch)
treea59cb0b09aa25d6a4928e4b56ac8bca433530ffb /org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model
parent44c2a5df795179f2750fa3f84cc4b9f58a92c113 (diff)
downloadorg.eclipse.mylyn.tasks-648314ee511a0bc376b23e3a8b9dc40415acae9b.tar.gz
org.eclipse.mylyn.tasks-648314ee511a0bc376b23e3a8b9dc40415acae9b.tar.xz
org.eclipse.mylyn.tasks-648314ee511a0bc376b23e3a8b9dc40415acae9b.zip
NEW - bug 175211: Support Trac 0.11
https://bugs.eclipse.org/bugs/show_bug.cgi?id=175211
Diffstat (limited to 'org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model')
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracAction.java79
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracRepositoryInfo.java105
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java6
3 files changed, 187 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracAction.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracAction.java
new file mode 100644
index 000000000..632c73916
--- /dev/null
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracAction.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Steffen Pingel and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Steffen Pingel - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.trac.core.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Steffen Pingel
+ */
+public class TracAction {
+
+ private List<TracTicketField> fields;
+
+ private String hint;
+
+ private String id;
+
+ private String label;
+
+ public TracAction(String id) {
+ this.id = id;
+ }
+
+ public void addField(TracTicketField field) {
+ if (fields == null) {
+ fields = new ArrayList<TracTicketField>();
+ }
+ fields.add(field);
+ }
+
+ public List<TracTicketField> getFields() {
+ if (fields == null) {
+ return Collections.emptyList();
+ }
+ return new ArrayList<TracTicketField>(fields);
+ }
+
+ public String getHint() {
+ return hint;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void removeField(TracTicketField field) {
+ if (fields != null) {
+ fields.remove(field);
+ }
+ }
+
+ public void setHint(String hint) {
+ this.hint = hint;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracRepositoryInfo.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracRepositoryInfo.java
new file mode 100644
index 000000000..974357129
--- /dev/null
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracRepositoryInfo.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Steffen Pingel and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Steffen Pingel - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.trac.core.model;
+
+/**
+ * The version of the Trac repository is defined by three numbers: epoch.major.minor. The default value is
+ * <code>-1.-1.-1</code> which indicates the version is not known.
+ *
+ * <pre>
+ * [0.0.0] Trac 0.9.6
+ * [0.0.1, 1.0.0) Trac 0.10
+ * [1.0.0, 2.0.0) Trac 0.11
+ * </pre>
+ *
+ * @author Steffen Pingel
+ */
+public class TracRepositoryInfo {
+
+ private final int apiEpoch;
+
+ private final int apiMajor;
+
+ private final int apiMinor;
+
+ private String version;
+
+ public TracRepositoryInfo() {
+ this(null);
+ }
+
+ public TracRepositoryInfo(int apiEpoch, int apiMajor, int apiMinor) {
+ this(apiEpoch, apiMajor, apiMinor, null);
+ }
+
+ public TracRepositoryInfo(int apiEpoch, int apiMajor, int apiMinor, String version) {
+ this.apiEpoch = apiEpoch;
+ this.apiMajor = apiMajor;
+ this.apiMinor = apiMinor;
+ this.version = version;
+ }
+
+ public TracRepositoryInfo(String version) {
+ this(-1, -1, -1, version);
+ }
+
+ public int getApiEpoch() {
+ return apiEpoch;
+ }
+
+ public int getApiMajor() {
+ return apiMajor;
+ }
+
+ public int getApiMinor() {
+ return apiMinor;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public boolean isApiVersion(int epoch, int major, int minor) {
+ return apiEpoch == epoch && apiMajor == major && apiMinor == minor;
+ }
+
+ public boolean isApiVersionOrHigher(int epoch, int major, int minor) {
+ return apiEpoch > epoch //
+ || apiEpoch == epoch && (apiMajor > major //
+ || apiMajor == major && apiMinor >= minor);
+ }
+
+ public boolean isStale() {
+ return apiEpoch == -1 || apiMajor == -1 || apiMinor == -1;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(apiEpoch);
+ sb.append("."); //$NON-NLS-1$
+ sb.append(apiMajor);
+ sb.append("."); //$NON-NLS-1$
+ sb.append(apiMinor);
+ if (version != null) {
+ sb.append(" ("); //$NON-NLS-1$
+ sb.append(version);
+ sb.append(")"); //$NON-NLS-1$
+ }
+ return sb.toString();
+ }
+
+}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java
index 4fe44673c..dbd8b604a 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java
@@ -84,7 +84,7 @@ public class TracTicket {
private List<TracAttachment> attachments;
- private String[] actions;
+ private TracAction[] actions;
private String[] resolutions;
@@ -206,11 +206,11 @@ public class TracTicket {
return (attachments != null) ? attachments.toArray(new TracAttachment[0]) : null;
}
- public void setActions(String[] actions) {
+ public void setActions(TracAction[] actions) {
this.actions = actions;
}
- public String[] getActions() {
+ public TracAction[] getActions() {
return actions;
}

Back to the top