001: /**
002: * LibreSource
003: * Copyright (C) 2004-2008 Artenum SARL / INRIA
004: * http://www.libresource.org - contact@artenum.com
005: *
006: * This file is part of the LibreSource software,
007: * which can be used and distributed under license conditions.
008: * The license conditions are provided in the LICENSE.TXT file
009: * at the root path of the packaging that enclose this file.
010: * More information can be found at
011: * - http://dev.libresource.org/home/license
012: *
013: * Initial authors :
014: *
015: * Guillaume Bort / INRIA
016: * Francois Charoy / Universite Nancy 2
017: * Julien Forest / Artenum
018: * Claude Godart / Universite Henry Poincare
019: * Florent Jouille / INRIA
020: * Sebastien Jourdain / INRIA / Artenum
021: * Yves Lerumeur / Artenum
022: * Pascal Molli / Universite Henry Poincare
023: * Gerald Oster / INRIA
024: * Mariarosa Penzi / Artenum
025: * Gerard Sookahet / Artenum
026: * Raphael Tani / INRIA
027: *
028: * Contributors :
029: *
030: * Stephane Bagnier / Artenum
031: * Amadou Dia / Artenum-IUP Blois
032: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
033: */package org.libresource.bugtracker;
034:
035: import org.libresource.Libresource;
036:
037: import org.libresource.bugtracker.ejb.model.IssueResourceValue;
038: import org.libresource.bugtracker.interfaces.LibresourceBugTrackerService;
039:
040: import org.libresource.xml.ImportExportLogger;
041: import org.libresource.xml.LibresourceExportHandler;
042: import org.libresource.xml.XmlDumpHelper;
043:
044: import org.xml.sax.ContentHandler;
045:
046: import java.net.URI;
047:
048: import java.text.SimpleDateFormat;
049:
050: /**
051: * LibreSource
052: *
053: * @author <a href="mailto:jouille@loria.fr">Florent Jouille</a>
054: */
055: public class IssueExportHandler extends LibresourceExportHandler {
056: private URI uri;
057:
058: public IssueExportHandler(URI uri) {
059: this .uri = uri;
060: }
061:
062: public void export(ContentHandler handler, ImportExportLogger logger)
063: throws Exception {
064: LibresourceBugTrackerService bugTrackerService = (LibresourceBugTrackerService) Libresource
065: .getService("LibresourceBugTracker");
066: IssueResourceValue issueResourceValue = bugTrackerService
067: .getIssue(uri);
068:
069: XmlDumpHelper.beginElement("bugtracker", "issue", XmlDumpHelper
070: .getEmptyAttributesSet(), handler);
071:
072: XmlDumpHelper.outputElementWithContent("issue", "issueId",
073: String.valueOf(issueResourceValue.getIssueId()),
074: XmlDumpHelper.getEmptyAttributesSet(), handler);
075: XmlDumpHelper.outputElementWithContent("issue", "summary",
076: issueResourceValue.getSummary(), XmlDumpHelper
077: .getEmptyAttributesSet(), handler);
078: XmlDumpHelper.outputElementWithContent("issue", "body",
079: issueResourceValue.getBody(), XmlDumpHelper
080: .getEmptyAttributesSet(), handler);
081: XmlDumpHelper.outputElementWithContent("issue", "author",
082: issueResourceValue.getAuthorName(), XmlDumpHelper
083: .getEmptyAttributesSet(), handler);
084: XmlDumpHelper.outputElementWithContent("issue", "type",
085: issueResourceValue.getType(), XmlDumpHelper
086: .getEmptyAttributesSet(), handler);
087: XmlDumpHelper.outputElementWithContent("issue", "priority",
088: issueResourceValue.getPriority(), XmlDumpHelper
089: .getEmptyAttributesSet(), handler);
090: XmlDumpHelper.outputElementWithContent("issue", "resolution",
091: issueResourceValue.getResolution(), XmlDumpHelper
092: .getEmptyAttributesSet(), handler);
093: XmlDumpHelper.outputElementWithContent("issue", "creationDate",
094: Libresource.formatDate(issueResourceValue
095: .getCreationDate()), XmlDumpHelper
096: .getEmptyAttributesSet(), handler);
097: XmlDumpHelper.outputElementWithContent("issue", "updateDate",
098: Libresource.formatDate(issueResourceValue
099: .getUpdateDate()), XmlDumpHelper
100: .getEmptyAttributesSet(), handler);
101: XmlDumpHelper.outputElementWithContent("issue", "assignee",
102: issueResourceValue.getAssignee(), XmlDumpHelper
103: .getEmptyAttributesSet(), handler);
104:
105: XmlDumpHelper.endElement("bugtracker", "issue", handler);
106: }
107: }
|