From 6c36d78b7d18519f0e779eeb3ff72dc490da3194 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Fri, 27 May 2011 10:25:57 -0500 Subject: [PATCH] Incremental work on XML implementation. --- .hgignore | 0 build.xml | 0 libpit/build.xml | 0 libpit/project.properties | 0 libpit/release/pit-2.3.1.jar | Bin libpit/session.vim | 0 libpit/src/com/jdbernard/pit/Category.groovy | 0 libpit/src/com/jdbernard/pit/Filter.groovy | 0 .../com/jdbernard/pit/FlatProjectView.groovy | 0 libpit/src/com/jdbernard/pit/Issue.groovy | 5 +- libpit/src/com/jdbernard/pit/Project.groovy | 4 +- .../src/com/jdbernard/pit/Repository.groovy | 8 ++ libpit/src/com/jdbernard/pit/Status.groovy | 0 .../com/jdbernard/pit/file/FileIssue.groovy | 2 +- .../com/jdbernard/pit/file/FileProject.groovy | 20 ++++- .../jdbernard/pit/file/FileRepository.groovy | 22 +++++ .../com/jdbernard/pit/util/Convert1_2.groovy | 0 .../src/com/jdbernard/pit/xml/XmlIssue.groovy | 64 +++++++++++++++ .../com/jdbernard/pit/xml/XmlProject.groovy | 75 ++++++++++++++++++ .../jdbernard/pit/xml/XmlRepository.groovy | 47 +++++++++++ .../com/jdbernard/pit/CategoryTest.groovy | 0 .../test/com/jdbernard/pit/FilterTest.groovy | 0 .../test/com/jdbernard/pit/MockIssue.groovy | 0 .../test/com/jdbernard/pit/MockProject.groovy | 6 +- .../com/jdbernard/pit/MockRepository.groovy | 12 +++ .../test/com/jdbernard/pit/StatusTest.groovy | 0 .../pit/{ => file}/FileIssueTest.groovy | 3 +- .../pit/{ => file}/FileProjectTest.groovy | 3 +- .../com/jdbernard/pit/xml/XmlIssueTest.groovy | 25 ++++++ pit-cli/build.xml | 0 pit-cli/lib/commons-cli-1.2.jar | Bin pit-cli/lib/pit-2.1.0.jar | Bin pit-cli/project.properties | 0 pit-cli/release/pit-cli-2.1.0.jar | Bin .../pit/PersonalIssueTrackerCLI.groovy | 0 pit-swing/application.properties | 0 pit-swing/griffon-app/conf/Application.groovy | 0 pit-swing/griffon-app/conf/BuildConfig.groovy | 0 pit-swing/griffon-app/conf/Builder.groovy | 0 pit-swing/griffon-app/conf/Config.groovy | 0 pit-swing/griffon-app/conf/Events.groovy | 0 .../griffon-app/conf/webstart/applet.html | 0 .../griffon-app/conf/webstart/applet.jnlp | 0 .../conf/webstart/application.jnlp | 0 .../conf/webstart/griffon-icon-128x128.png | Bin .../conf/webstart/griffon-icon-16x16.png | Bin .../conf/webstart/griffon-icon-24x24.png | Bin .../conf/webstart/griffon-icon-256x256.png | Bin .../conf/webstart/griffon-icon-32x32.png | Bin .../conf/webstart/griffon-icon-48x48.png | Bin .../conf/webstart/griffon-icon-64x64.png | Bin .../griffon-app/conf/webstart/griffon.png | Bin .../pit/swing/NewIssueDialogController.groovy | 0 .../jdbernard/pit/swing/PITController.groovy | 0 .../pit/swing/ProjectPanelController.groovy | 0 .../griffon-app/i18n/messages.properties | 0 .../griffon-app/lifecycle/Initialize.groovy | 0 pit-swing/griffon-app/lifecycle/Ready.groovy | 0 .../griffon-app/lifecycle/Shutdown.groovy | 0 .../griffon-app/lifecycle/Startup.groovy | 0 pit-swing/griffon-app/lifecycle/Stop.groovy | 0 .../pit/swing/NewIssueDialogModel.groovy | 0 .../com/jdbernard/pit/swing/PITModel.groovy | 0 .../pit/swing/ProjectPanelModel.groovy | 0 pit-swing/griffon-app/resources/bug.gif | Bin .../griffon-app/resources/default-issue.css | 0 pit-swing/griffon-app/resources/icon16x16.png | Bin pit-swing/griffon-app/resources/icon32x32.png | Bin pit-swing/griffon-app/resources/icon64x64.png | Bin .../griffon-app/resources/log4j.properties | 0 pit-swing/griffon-app/resources/new.png | Bin pit-swing/griffon-app/resources/rst2xhtml.xsl | 0 pit-swing/griffon-app/resources/splash.png | Bin pit-swing/griffon-app/resources/splash.xcf | Bin .../pit/swing/NewIssueDialogView.groovy | 0 .../com/jdbernard/pit/swing/PITView.groovy | 0 .../pit/swing/ProjectPanelView.groovy | 0 pit-swing/griffonw | 0 pit-swing/griffonw.bat | 0 pit-swing/lib/commons-lang-2.4.jar | Bin pit-swing/lib/commons-logging-1.1.1.jar | Bin pit-swing/lib/commons-primitives-1.0.jar | Bin pit-swing/lib/dom4j-1.6.1.jar | Bin pit-swing/lib/jaxen-1.1.1.jar | Bin pit-swing/lib/jrst-1.1.1.jar | Bin pit-swing/lib/log4j-1.2.15.jar | Bin pit-swing/lib/miglayout-3.7.1-swing.jar | Bin pit-swing/lib/nuiton-i18n-1.1.jar | Bin pit-swing/lib/pit-2.3.1.jar | Bin pit-swing/lib/slf4j-api-1.6.0.jar | Bin pit-swing/lib/slf4j-log4j12-1.6.0.jar | Bin pit-swing/lib/substance.jar | Bin pit-swing/lib/trident.jar | Bin .../jdbernard/pit/swing/CompositeIcon.groovy | 0 .../pit/swing/IssueListCellRenderer.groovy | 0 .../pit/swing/IssueTableCellRenderer.groovy | 0 .../pit/swing/IssueTableModel.groovy | 0 .../pit/swing/NewIssueDialogTests.groovy | 0 .../test/integration/pit/swing/PITests.groovy | 0 .../pit/swing/PitSwingTests.groovy | 0 .../pit/swing/ProjectPanelTests.groovy | 0 pit-swing/wrapper/griffon-wrapper.jar | Bin pit-swing/wrapper/griffon-wrapper.properties | 0 release/lib/pit-2.3.1.jar | Bin release/pit-swing-2.5.0.jar | Bin version.properties | 0 106 files changed, 287 insertions(+), 9 deletions(-) mode change 100644 => 100755 .hgignore mode change 100644 => 100755 build.xml mode change 100644 => 100755 libpit/build.xml mode change 100644 => 100755 libpit/project.properties mode change 100644 => 100755 libpit/release/pit-2.3.1.jar mode change 100644 => 100755 libpit/session.vim mode change 100644 => 100755 libpit/src/com/jdbernard/pit/Category.groovy mode change 100644 => 100755 libpit/src/com/jdbernard/pit/Filter.groovy mode change 100644 => 100755 libpit/src/com/jdbernard/pit/FlatProjectView.groovy mode change 100644 => 100755 libpit/src/com/jdbernard/pit/Issue.groovy mode change 100644 => 100755 libpit/src/com/jdbernard/pit/Project.groovy create mode 100755 libpit/src/com/jdbernard/pit/Repository.groovy mode change 100644 => 100755 libpit/src/com/jdbernard/pit/Status.groovy mode change 100644 => 100755 libpit/src/com/jdbernard/pit/file/FileIssue.groovy mode change 100644 => 100755 libpit/src/com/jdbernard/pit/file/FileProject.groovy create mode 100755 libpit/src/com/jdbernard/pit/file/FileRepository.groovy mode change 100644 => 100755 libpit/src/com/jdbernard/pit/util/Convert1_2.groovy create mode 100755 libpit/src/com/jdbernard/pit/xml/XmlIssue.groovy mode change 100644 => 100755 libpit/src/com/jdbernard/pit/xml/XmlProject.groovy create mode 100755 libpit/src/com/jdbernard/pit/xml/XmlRepository.groovy mode change 100644 => 100755 libpit/test/com/jdbernard/pit/CategoryTest.groovy mode change 100644 => 100755 libpit/test/com/jdbernard/pit/FilterTest.groovy mode change 100644 => 100755 libpit/test/com/jdbernard/pit/MockIssue.groovy mode change 100644 => 100755 libpit/test/com/jdbernard/pit/MockProject.groovy create mode 100755 libpit/test/com/jdbernard/pit/MockRepository.groovy mode change 100644 => 100755 libpit/test/com/jdbernard/pit/StatusTest.groovy rename libpit/test/com/jdbernard/pit/{ => file}/FileIssueTest.groovy (99%) mode change 100644 => 100755 rename libpit/test/com/jdbernard/pit/{ => file}/FileProjectTest.groovy (98%) mode change 100644 => 100755 create mode 100755 libpit/test/com/jdbernard/pit/xml/XmlIssueTest.groovy mode change 100644 => 100755 pit-cli/build.xml mode change 100644 => 100755 pit-cli/lib/commons-cli-1.2.jar mode change 100644 => 100755 pit-cli/lib/pit-2.1.0.jar mode change 100644 => 100755 pit-cli/project.properties mode change 100644 => 100755 pit-cli/release/pit-cli-2.1.0.jar mode change 100644 => 100755 pit-cli/src/com/jdbernard/pit/PersonalIssueTrackerCLI.groovy mode change 100644 => 100755 pit-swing/application.properties mode change 100644 => 100755 pit-swing/griffon-app/conf/Application.groovy mode change 100644 => 100755 pit-swing/griffon-app/conf/BuildConfig.groovy mode change 100644 => 100755 pit-swing/griffon-app/conf/Builder.groovy mode change 100644 => 100755 pit-swing/griffon-app/conf/Config.groovy mode change 100644 => 100755 pit-swing/griffon-app/conf/Events.groovy mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/applet.html mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/applet.jnlp mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/application.jnlp mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/griffon-icon-128x128.png mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/griffon-icon-16x16.png mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/griffon-icon-24x24.png mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/griffon-icon-256x256.png mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/griffon-icon-32x32.png mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/griffon-icon-48x48.png mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/griffon-icon-64x64.png mode change 100644 => 100755 pit-swing/griffon-app/conf/webstart/griffon.png mode change 100644 => 100755 pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/NewIssueDialogController.groovy mode change 100644 => 100755 pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/PITController.groovy mode change 100644 => 100755 pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/ProjectPanelController.groovy mode change 100644 => 100755 pit-swing/griffon-app/i18n/messages.properties mode change 100644 => 100755 pit-swing/griffon-app/lifecycle/Initialize.groovy mode change 100644 => 100755 pit-swing/griffon-app/lifecycle/Ready.groovy mode change 100644 => 100755 pit-swing/griffon-app/lifecycle/Shutdown.groovy mode change 100644 => 100755 pit-swing/griffon-app/lifecycle/Startup.groovy mode change 100644 => 100755 pit-swing/griffon-app/lifecycle/Stop.groovy mode change 100644 => 100755 pit-swing/griffon-app/models/com/jdbernard/pit/swing/NewIssueDialogModel.groovy mode change 100644 => 100755 pit-swing/griffon-app/models/com/jdbernard/pit/swing/PITModel.groovy mode change 100644 => 100755 pit-swing/griffon-app/models/com/jdbernard/pit/swing/ProjectPanelModel.groovy mode change 100644 => 100755 pit-swing/griffon-app/resources/bug.gif mode change 100644 => 100755 pit-swing/griffon-app/resources/default-issue.css mode change 100644 => 100755 pit-swing/griffon-app/resources/icon16x16.png mode change 100644 => 100755 pit-swing/griffon-app/resources/icon32x32.png mode change 100644 => 100755 pit-swing/griffon-app/resources/icon64x64.png mode change 100644 => 100755 pit-swing/griffon-app/resources/log4j.properties mode change 100644 => 100755 pit-swing/griffon-app/resources/new.png mode change 100644 => 100755 pit-swing/griffon-app/resources/rst2xhtml.xsl mode change 100644 => 100755 pit-swing/griffon-app/resources/splash.png mode change 100644 => 100755 pit-swing/griffon-app/resources/splash.xcf mode change 100644 => 100755 pit-swing/griffon-app/views/com/jdbernard/pit/swing/NewIssueDialogView.groovy mode change 100644 => 100755 pit-swing/griffon-app/views/com/jdbernard/pit/swing/PITView.groovy mode change 100644 => 100755 pit-swing/griffon-app/views/com/jdbernard/pit/swing/ProjectPanelView.groovy mode change 100644 => 100755 pit-swing/griffonw mode change 100644 => 100755 pit-swing/griffonw.bat mode change 100644 => 100755 pit-swing/lib/commons-lang-2.4.jar mode change 100644 => 100755 pit-swing/lib/commons-logging-1.1.1.jar mode change 100644 => 100755 pit-swing/lib/commons-primitives-1.0.jar mode change 100644 => 100755 pit-swing/lib/dom4j-1.6.1.jar mode change 100644 => 100755 pit-swing/lib/jaxen-1.1.1.jar mode change 100644 => 100755 pit-swing/lib/jrst-1.1.1.jar mode change 100644 => 100755 pit-swing/lib/log4j-1.2.15.jar mode change 100644 => 100755 pit-swing/lib/miglayout-3.7.1-swing.jar mode change 100644 => 100755 pit-swing/lib/nuiton-i18n-1.1.jar mode change 100644 => 100755 pit-swing/lib/pit-2.3.1.jar mode change 100644 => 100755 pit-swing/lib/slf4j-api-1.6.0.jar mode change 100644 => 100755 pit-swing/lib/slf4j-log4j12-1.6.0.jar mode change 100644 => 100755 pit-swing/lib/substance.jar mode change 100644 => 100755 pit-swing/lib/trident.jar mode change 100644 => 100755 pit-swing/src/main/com/jdbernard/pit/swing/CompositeIcon.groovy mode change 100644 => 100755 pit-swing/src/main/com/jdbernard/pit/swing/IssueListCellRenderer.groovy mode change 100644 => 100755 pit-swing/src/main/com/jdbernard/pit/swing/IssueTableCellRenderer.groovy mode change 100644 => 100755 pit-swing/src/main/com/jdbernard/pit/swing/IssueTableModel.groovy mode change 100644 => 100755 pit-swing/test/integration/pit/swing/NewIssueDialogTests.groovy mode change 100644 => 100755 pit-swing/test/integration/pit/swing/PITests.groovy mode change 100644 => 100755 pit-swing/test/integration/pit/swing/PitSwingTests.groovy mode change 100644 => 100755 pit-swing/test/integration/pit/swing/ProjectPanelTests.groovy mode change 100644 => 100755 pit-swing/wrapper/griffon-wrapper.jar mode change 100644 => 100755 pit-swing/wrapper/griffon-wrapper.properties mode change 100644 => 100755 release/lib/pit-2.3.1.jar mode change 100644 => 100755 release/pit-swing-2.5.0.jar mode change 100644 => 100755 version.properties diff --git a/.hgignore b/.hgignore old mode 100644 new mode 100755 diff --git a/build.xml b/build.xml old mode 100644 new mode 100755 diff --git a/libpit/build.xml b/libpit/build.xml old mode 100644 new mode 100755 diff --git a/libpit/project.properties b/libpit/project.properties old mode 100644 new mode 100755 diff --git a/libpit/release/pit-2.3.1.jar b/libpit/release/pit-2.3.1.jar old mode 100644 new mode 100755 diff --git a/libpit/session.vim b/libpit/session.vim old mode 100644 new mode 100755 diff --git a/libpit/src/com/jdbernard/pit/Category.groovy b/libpit/src/com/jdbernard/pit/Category.groovy old mode 100644 new mode 100755 diff --git a/libpit/src/com/jdbernard/pit/Filter.groovy b/libpit/src/com/jdbernard/pit/Filter.groovy old mode 100644 new mode 100755 diff --git a/libpit/src/com/jdbernard/pit/FlatProjectView.groovy b/libpit/src/com/jdbernard/pit/FlatProjectView.groovy old mode 100644 new mode 100755 diff --git a/libpit/src/com/jdbernard/pit/Issue.groovy b/libpit/src/com/jdbernard/pit/Issue.groovy old mode 100644 new mode 100755 index 2d12877..ca3ce71 --- a/libpit/src/com/jdbernard/pit/Issue.groovy +++ b/libpit/src/com/jdbernard/pit/Issue.groovy @@ -63,7 +63,8 @@ public abstract class Issue { public void setDeliveryDate(Date dd) { deliveryDate = dd } @Override - public String toString() { return "${id}(${priority}-${status}): ${category} ${title}" } + public String toString() { + return "${id}(${priority}-${status}): ${category} ${title}" + } - public abstract boolean delete() } diff --git a/libpit/src/com/jdbernard/pit/Project.groovy b/libpit/src/com/jdbernard/pit/Project.groovy old mode 100644 new mode 100755 index 9c47f9a..4279b42 --- a/libpit/src/com/jdbernard/pit/Project.groovy +++ b/libpit/src/com/jdbernard/pit/Project.groovy @@ -33,5 +33,7 @@ public abstract class Project { public abstract Project createNewProject(String name) - public abstract boolean delete() + public abstract boolean deleteIssue(Issue issue) + + public abstract boolean deleteProject(Project project) } diff --git a/libpit/src/com/jdbernard/pit/Repository.groovy b/libpit/src/com/jdbernard/pit/Repository.groovy new file mode 100755 index 0000000..7851a57 --- /dev/null +++ b/libpit/src/com/jdbernard/pit/Repository.groovy @@ -0,0 +1,8 @@ +package com.jdbernard.pit + +public abstract class Repository { + + public abstract void persist() + public abstract Project[] getRootProjects() + public abstract Project createNewProject(String name) +} diff --git a/libpit/src/com/jdbernard/pit/Status.groovy b/libpit/src/com/jdbernard/pit/Status.groovy old mode 100644 new mode 100755 diff --git a/libpit/src/com/jdbernard/pit/file/FileIssue.groovy b/libpit/src/com/jdbernard/pit/file/FileIssue.groovy old mode 100644 new mode 100755 index 7c2fce6..8e385ed --- a/libpit/src/com/jdbernard/pit/file/FileIssue.groovy +++ b/libpit/src/com/jdbernard/pit/file/FileIssue.groovy @@ -84,7 +84,7 @@ public class FileIssue extends Issue { super.setText(text) } - public boolean delete() { return source.delete() } + boolean deleteFile() { return source.deleteDir() } public static boolean isValidFilename(String name) { return name ==~ fileExp diff --git a/libpit/src/com/jdbernard/pit/file/FileProject.groovy b/libpit/src/com/jdbernard/pit/file/FileProject.groovy old mode 100644 new mode 100755 index 3ec4fc5..de4ce66 --- a/libpit/src/com/jdbernard/pit/file/FileProject.groovy +++ b/libpit/src/com/jdbernard/pit/file/FileProject.groovy @@ -74,7 +74,25 @@ class FileProject extends Project { return new FileProject(newDir) } - public boolean delete() { return source.deleteDir() } + public boolean deleteIssue(Issue issue) { + if (!issues[(issue.id)]) return false + + issues.remove(issue.id) + if (issue instanceof FileIssue) + return issue.deleteFile() + + else return true + } + + public boolean deleteProject(Project project) { + if (!projects[(project.name)]) return false + + projects.remove(project.name) + if (project instanceof FileProject) + return project.source.delete() + + return true + } @Override public String toString() { return name } diff --git a/libpit/src/com/jdbernard/pit/file/FileRepository.groovy b/libpit/src/com/jdbernard/pit/file/FileRepository.groovy new file mode 100755 index 0000000..ce41b0e --- /dev/null +++ b/libpit/src/com/jdbernard/pit/file/FileRepository.groovy @@ -0,0 +1,22 @@ +package com.jdbernard.pit.file + +import com.jdbernard.pit.* + +public class FileRepository extends Repository { + + @Delegate FileProject fileProject + + public FileRepository(File dir) { + assert dir.isDirectory() + fileProject = new FileProject(dir) + } + + public void persist() {} // nothing to do + public Project[] getRootProjects() { + return fileProject.proejcts.values() as Project[] + } + + public FileProject createNewProject(String name) { + return fileProject.createNewProject() + } +} diff --git a/libpit/src/com/jdbernard/pit/util/Convert1_2.groovy b/libpit/src/com/jdbernard/pit/util/Convert1_2.groovy old mode 100644 new mode 100755 diff --git a/libpit/src/com/jdbernard/pit/xml/XmlIssue.groovy b/libpit/src/com/jdbernard/pit/xml/XmlIssue.groovy new file mode 100755 index 0000000..adfe803 --- /dev/null +++ b/libpit/src/com/jdbernard/pit/xml/XmlIssue.groovy @@ -0,0 +1,64 @@ +package com.jdbernard.pit.xml + +import com.jdbernard.pit.* + +public class XmlIssue extends Issue { + + def issueNode + XmlProject project + XmlRepository repository + + XmlIssue(def issueNode, XmlRepository repository, XmlProject project) { + super(issueNode.@id, issueNode.@category ?: Category.TASK, + issueNode.@status ?: Status.NEW, issueNode.@priority ?: 9) + + this.issueNode = issueNode + this.project = project + this.repository = repository + } + + XmlIssue(String id, Category c = Category.TASK, Status s = Status.NEW, + int p = 9, String text, XmlRepository repository, XmlProject project) { + super(id, c, s, p) + + this.project = project + this.repository = repository + + // Node constructor adds the node to the parent node + issueNode = new Node(project.projectNode, "Issue", + [id: id, category: c, status: s, priority: p]) + + this.text = text + issueNode.value = text + + repository.persist() + } + + public void setCategory(Category c) { + super.setCategory(c) + + issueNode.@category = c.name() + repository.persist() + } + + public void setStatus(Status s) { + super.setStatus(s) + + issueNode.@status = s.name() + repository.persist() + } + + public void setPriority(int p) { + super(p) + + issueNode.@priority = p + repository.persist() + + public void setText(String t) { + super.setText(t) + + issueNode.value = t + repository.persist() + } + +} diff --git a/libpit/src/com/jdbernard/pit/xml/XmlProject.groovy b/libpit/src/com/jdbernard/pit/xml/XmlProject.groovy old mode 100644 new mode 100755 index d87fce2..cf915d3 --- a/libpit/src/com/jdbernard/pit/xml/XmlProject.groovy +++ b/libpit/src/com/jdbernard/pit/xml/XmlProject.groovy @@ -4,5 +4,80 @@ import com.jdbernard.pit.* public class XmlProject extends Project { + def projectNode + XmlRepository repository + + XmlProject(def projectNode, XmlRepository repository) { + super(projectName.@name) + + this.projectNode = projectNode + this.repository = repository + } + + XmlProject(String name, def parentProject, XmlRepository repository) { + super(name) + + // Node constructor adds the node to the parent node + projectNode = new Node(parentProject.projectNode, "Project", + [name: name]) + repository.persist() + } + + public void setName(String name) { + super(name) + + projectNode.@name = name + repository.persist() + } + + public XmlIssue createNewIssue(Map options) { + if (!options) options = [:] + if (!options.category) options.category = Category.TASK + if (!options.status) options.status = Status.NEW + if (!options.priority) options.priority = 5 + if (!options.text) options.text = "Default issue title.\n" + + "====================\n" + + String id + if (issues.size() == 0) id = "0000" + else { + id = (issues.values().max { it.id.toInteger() }).id + id = (id.toInteger() + 1).toString().padLeft(id.length(), '0') + } + + // XmlIssue constructor will persist XML data + issues[(id)] = new XmlIssue(id, options.category, options.status, + options.priority, options.text, repository, this) + + return issues[(id)] + } + + public XmlProject createNewProject(String name) { + // XmlProject constructor persists the XML data + projects[(name)] = new XmlProject(name, this, repository) + return projects[(name)] + } + + public boolean deleteIssue(Issue issue) { + if (!issues[(issue.id)]) return false + + issues.remove(issue.id) + if (issue instanceof XmlIssue) + projectNode.remove(issue.issueNode) + + repository.persist() + + return true + } + + public boolean deleteProject(Project project) { + if (!projects[(project.name)]) return false + + projects.remove(project.name) + if (project instanceof XmlProject) + projectNode.remove(project.projectNode) + + repository.persist() + } } diff --git a/libpit/src/com/jdbernard/pit/xml/XmlRepository.groovy b/libpit/src/com/jdbernard/pit/xml/XmlRepository.groovy new file mode 100755 index 0000000..838642e --- /dev/null +++ b/libpit/src/com/jdbernard/pit/xml/XmlRepository.groovy @@ -0,0 +1,47 @@ +package com.jdbernard.pit.xml + +import com.jdbernard.pit.* +import groovy.xml.XmlUtil + +public class XmlRepository extends Repository { + + def repository + def projects = [] + File repoFile + + public XmlRepository(File repoFile) { + + this.repoFile = repoFile + repository = new XmlParser().parse(repoFile) + + repository.Project.each { projectNode -> + projects << new XmlProject(projectNode) + } + + } + + public synchronized void persist() { + repoFile.withOutputStream { XmlUtil.serialize(repository, it) } + } + + public XmlProject[] getRootProjects() { + return projects as XmlProject[] + } + + public XmlProject createNewProject(String name) { + def newProject = new XmlProject(name, this, null) + repository << newProject.projectNode + + persist() + return newProject + } + + public boolean deleteProject(Project p) { + if (!projects.contains(p)) return false + + projects.remove(p) + repository.remove(p.projectNode) + + return true + } +} diff --git a/libpit/test/com/jdbernard/pit/CategoryTest.groovy b/libpit/test/com/jdbernard/pit/CategoryTest.groovy old mode 100644 new mode 100755 diff --git a/libpit/test/com/jdbernard/pit/FilterTest.groovy b/libpit/test/com/jdbernard/pit/FilterTest.groovy old mode 100644 new mode 100755 diff --git a/libpit/test/com/jdbernard/pit/MockIssue.groovy b/libpit/test/com/jdbernard/pit/MockIssue.groovy old mode 100644 new mode 100755 diff --git a/libpit/test/com/jdbernard/pit/MockProject.groovy b/libpit/test/com/jdbernard/pit/MockProject.groovy old mode 100644 new mode 100755 index 9e1c2ee..2d2b984 --- a/libpit/test/com/jdbernard/pit/MockProject.groovy +++ b/libpit/test/com/jdbernard/pit/MockProject.groovy @@ -5,11 +5,13 @@ class MockProject extends Project { public MockProject(String name) { super(name) } public Issue createNewIssue(Map options) { - throw new UnsupportedOperationException() + return new MockIssue(options.id ?: 'n/a', + options.c ?: Category.TASK, options.s ?: Status.NEW, + options.p ?: 5) } public Project createNewProject(String name) { - throw new UnsupportedOperationException() + return new MockProject(name) } public boolean delete() { return true } diff --git a/libpit/test/com/jdbernard/pit/MockRepository.groovy b/libpit/test/com/jdbernard/pit/MockRepository.groovy new file mode 100755 index 0000000..a1d880c --- /dev/null +++ b/libpit/test/com/jdbernard/pit/MockRepository.groovy @@ -0,0 +1,12 @@ +package com.jdbernard.pit + +class MockRepository extends Repository { + + public void persist() {} + + public Project[] getRootProjects() { return [] as Project[] } + + public Project createNewProject(String name) { + return new MockProject(name) + } +} diff --git a/libpit/test/com/jdbernard/pit/StatusTest.groovy b/libpit/test/com/jdbernard/pit/StatusTest.groovy old mode 100644 new mode 100755 diff --git a/libpit/test/com/jdbernard/pit/FileIssueTest.groovy b/libpit/test/com/jdbernard/pit/file/FileIssueTest.groovy old mode 100644 new mode 100755 similarity index 99% rename from libpit/test/com/jdbernard/pit/FileIssueTest.groovy rename to libpit/test/com/jdbernard/pit/file/FileIssueTest.groovy index 7c9b392..8fa57a4 --- a/libpit/test/com/jdbernard/pit/FileIssueTest.groovy +++ b/libpit/test/com/jdbernard/pit/file/FileIssueTest.groovy @@ -1,5 +1,6 @@ -package com.jdbernard.pit +package com.jdbernard.pit.file +import com.jdbernard.pit.* import org.junit.* import static org.junit.Assert.assertTrue import static org.junit.Assert.assertFalse diff --git a/libpit/test/com/jdbernard/pit/FileProjectTest.groovy b/libpit/test/com/jdbernard/pit/file/FileProjectTest.groovy old mode 100644 new mode 100755 similarity index 98% rename from libpit/test/com/jdbernard/pit/FileProjectTest.groovy rename to libpit/test/com/jdbernard/pit/file/FileProjectTest.groovy index 4581880..51a99e3 --- a/libpit/test/com/jdbernard/pit/FileProjectTest.groovy +++ b/libpit/test/com/jdbernard/pit/file/FileProjectTest.groovy @@ -1,5 +1,6 @@ -package com.jdbernard.pit +package com.jdbernard.pit.file +import com.jdbernard.pit.* import org.junit.After import org.junit.Before import org.junit.Test diff --git a/libpit/test/com/jdbernard/pit/xml/XmlIssueTest.groovy b/libpit/test/com/jdbernard/pit/xml/XmlIssueTest.groovy new file mode 100755 index 0000000..b227f33 --- /dev/null +++ b/libpit/test/com/jdbernard/pit/xml/XmlIssueTest.groovy @@ -0,0 +1,25 @@ +package com.jdbernard.pit.xml + +import com.jdbernard.pit.* +import groovy.util.Node +import org.junit.Test +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertFalse +import static org.junit.Assert.assertTrue + +public class XmlIssueTest { + + Node issueNode = new Node(null, 'Issue', + [id: '0000', category: 'BUG', status: 'RESOLVED', priority: 1], + 'Test Issue') + + @Test public void testNodeConstructor() { + XmlIssue issue = new XmlIssue(issueNode, + + assertEquals issue.text, 'Test Issue' + assertEquals issue.id, '0000' + assertEquals issue.category, Category.BUG + assertEquals issue.status, Status.RESOLVED + assertEquals issue.priority, 1 + } +} diff --git a/pit-cli/build.xml b/pit-cli/build.xml old mode 100644 new mode 100755 diff --git a/pit-cli/lib/commons-cli-1.2.jar b/pit-cli/lib/commons-cli-1.2.jar old mode 100644 new mode 100755 diff --git a/pit-cli/lib/pit-2.1.0.jar b/pit-cli/lib/pit-2.1.0.jar old mode 100644 new mode 100755 diff --git a/pit-cli/project.properties b/pit-cli/project.properties old mode 100644 new mode 100755 diff --git a/pit-cli/release/pit-cli-2.1.0.jar b/pit-cli/release/pit-cli-2.1.0.jar old mode 100644 new mode 100755 diff --git a/pit-cli/src/com/jdbernard/pit/PersonalIssueTrackerCLI.groovy b/pit-cli/src/com/jdbernard/pit/PersonalIssueTrackerCLI.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/application.properties b/pit-swing/application.properties old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/Application.groovy b/pit-swing/griffon-app/conf/Application.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/BuildConfig.groovy b/pit-swing/griffon-app/conf/BuildConfig.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/Builder.groovy b/pit-swing/griffon-app/conf/Builder.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/Config.groovy b/pit-swing/griffon-app/conf/Config.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/Events.groovy b/pit-swing/griffon-app/conf/Events.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/applet.html b/pit-swing/griffon-app/conf/webstart/applet.html old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/applet.jnlp b/pit-swing/griffon-app/conf/webstart/applet.jnlp old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/application.jnlp b/pit-swing/griffon-app/conf/webstart/application.jnlp old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/griffon-icon-128x128.png b/pit-swing/griffon-app/conf/webstart/griffon-icon-128x128.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/griffon-icon-16x16.png b/pit-swing/griffon-app/conf/webstart/griffon-icon-16x16.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/griffon-icon-24x24.png b/pit-swing/griffon-app/conf/webstart/griffon-icon-24x24.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/griffon-icon-256x256.png b/pit-swing/griffon-app/conf/webstart/griffon-icon-256x256.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/griffon-icon-32x32.png b/pit-swing/griffon-app/conf/webstart/griffon-icon-32x32.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/griffon-icon-48x48.png b/pit-swing/griffon-app/conf/webstart/griffon-icon-48x48.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/griffon-icon-64x64.png b/pit-swing/griffon-app/conf/webstart/griffon-icon-64x64.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/conf/webstart/griffon.png b/pit-swing/griffon-app/conf/webstart/griffon.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/NewIssueDialogController.groovy b/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/NewIssueDialogController.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/PITController.groovy b/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/PITController.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/ProjectPanelController.groovy b/pit-swing/griffon-app/controllers/com/jdbernard/pit/swing/ProjectPanelController.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/i18n/messages.properties b/pit-swing/griffon-app/i18n/messages.properties old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/lifecycle/Initialize.groovy b/pit-swing/griffon-app/lifecycle/Initialize.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/lifecycle/Ready.groovy b/pit-swing/griffon-app/lifecycle/Ready.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/lifecycle/Shutdown.groovy b/pit-swing/griffon-app/lifecycle/Shutdown.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/lifecycle/Startup.groovy b/pit-swing/griffon-app/lifecycle/Startup.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/lifecycle/Stop.groovy b/pit-swing/griffon-app/lifecycle/Stop.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/models/com/jdbernard/pit/swing/NewIssueDialogModel.groovy b/pit-swing/griffon-app/models/com/jdbernard/pit/swing/NewIssueDialogModel.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/models/com/jdbernard/pit/swing/PITModel.groovy b/pit-swing/griffon-app/models/com/jdbernard/pit/swing/PITModel.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/models/com/jdbernard/pit/swing/ProjectPanelModel.groovy b/pit-swing/griffon-app/models/com/jdbernard/pit/swing/ProjectPanelModel.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/bug.gif b/pit-swing/griffon-app/resources/bug.gif old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/default-issue.css b/pit-swing/griffon-app/resources/default-issue.css old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/icon16x16.png b/pit-swing/griffon-app/resources/icon16x16.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/icon32x32.png b/pit-swing/griffon-app/resources/icon32x32.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/icon64x64.png b/pit-swing/griffon-app/resources/icon64x64.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/log4j.properties b/pit-swing/griffon-app/resources/log4j.properties old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/new.png b/pit-swing/griffon-app/resources/new.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/rst2xhtml.xsl b/pit-swing/griffon-app/resources/rst2xhtml.xsl old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/splash.png b/pit-swing/griffon-app/resources/splash.png old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/resources/splash.xcf b/pit-swing/griffon-app/resources/splash.xcf old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/views/com/jdbernard/pit/swing/NewIssueDialogView.groovy b/pit-swing/griffon-app/views/com/jdbernard/pit/swing/NewIssueDialogView.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/views/com/jdbernard/pit/swing/PITView.groovy b/pit-swing/griffon-app/views/com/jdbernard/pit/swing/PITView.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffon-app/views/com/jdbernard/pit/swing/ProjectPanelView.groovy b/pit-swing/griffon-app/views/com/jdbernard/pit/swing/ProjectPanelView.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/griffonw b/pit-swing/griffonw old mode 100644 new mode 100755 diff --git a/pit-swing/griffonw.bat b/pit-swing/griffonw.bat old mode 100644 new mode 100755 diff --git a/pit-swing/lib/commons-lang-2.4.jar b/pit-swing/lib/commons-lang-2.4.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/commons-logging-1.1.1.jar b/pit-swing/lib/commons-logging-1.1.1.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/commons-primitives-1.0.jar b/pit-swing/lib/commons-primitives-1.0.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/dom4j-1.6.1.jar b/pit-swing/lib/dom4j-1.6.1.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/jaxen-1.1.1.jar b/pit-swing/lib/jaxen-1.1.1.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/jrst-1.1.1.jar b/pit-swing/lib/jrst-1.1.1.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/log4j-1.2.15.jar b/pit-swing/lib/log4j-1.2.15.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/miglayout-3.7.1-swing.jar b/pit-swing/lib/miglayout-3.7.1-swing.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/nuiton-i18n-1.1.jar b/pit-swing/lib/nuiton-i18n-1.1.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/pit-2.3.1.jar b/pit-swing/lib/pit-2.3.1.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/slf4j-api-1.6.0.jar b/pit-swing/lib/slf4j-api-1.6.0.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/slf4j-log4j12-1.6.0.jar b/pit-swing/lib/slf4j-log4j12-1.6.0.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/substance.jar b/pit-swing/lib/substance.jar old mode 100644 new mode 100755 diff --git a/pit-swing/lib/trident.jar b/pit-swing/lib/trident.jar old mode 100644 new mode 100755 diff --git a/pit-swing/src/main/com/jdbernard/pit/swing/CompositeIcon.groovy b/pit-swing/src/main/com/jdbernard/pit/swing/CompositeIcon.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/src/main/com/jdbernard/pit/swing/IssueListCellRenderer.groovy b/pit-swing/src/main/com/jdbernard/pit/swing/IssueListCellRenderer.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/src/main/com/jdbernard/pit/swing/IssueTableCellRenderer.groovy b/pit-swing/src/main/com/jdbernard/pit/swing/IssueTableCellRenderer.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/src/main/com/jdbernard/pit/swing/IssueTableModel.groovy b/pit-swing/src/main/com/jdbernard/pit/swing/IssueTableModel.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/test/integration/pit/swing/NewIssueDialogTests.groovy b/pit-swing/test/integration/pit/swing/NewIssueDialogTests.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/test/integration/pit/swing/PITests.groovy b/pit-swing/test/integration/pit/swing/PITests.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/test/integration/pit/swing/PitSwingTests.groovy b/pit-swing/test/integration/pit/swing/PitSwingTests.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/test/integration/pit/swing/ProjectPanelTests.groovy b/pit-swing/test/integration/pit/swing/ProjectPanelTests.groovy old mode 100644 new mode 100755 diff --git a/pit-swing/wrapper/griffon-wrapper.jar b/pit-swing/wrapper/griffon-wrapper.jar old mode 100644 new mode 100755 diff --git a/pit-swing/wrapper/griffon-wrapper.properties b/pit-swing/wrapper/griffon-wrapper.properties old mode 100644 new mode 100755 diff --git a/release/lib/pit-2.3.1.jar b/release/lib/pit-2.3.1.jar old mode 100644 new mode 100755 diff --git a/release/pit-swing-2.5.0.jar b/release/pit-swing-2.5.0.jar old mode 100644 new mode 100755 diff --git a/version.properties b/version.properties old mode 100644 new mode 100755