private void writeElementIfPresent(final String elementName, final String content) throws XMLStreamException { if (content != null && !content.isEmpty()) { writeElement(elementName, content); } }
private void writeItem(final SpecificationItem item) throws XMLStreamException { final String description = processMultilineText(item.getDescription()); final String rationale = processMultilineText(item.getRationale()); final String comment = processMultilineText(item.getComment()); this.writer.writeStartElement("specobject"); writeElement("id", item.getName()); writeElementIfPresent("shortdesc", item.getTitle()); writeElement("status", item.getStatus().toString()); writeElement("version", item.getRevision()); writeLocation(item.getLocation()); writeElementIfPresent("description", description); writeElementIfPresent("rationale", rationale); writeElementIfPresent("comment", comment); writeTags(item.getTags()); writeNeedsArtifactTypes(item.getNeedsArtifactTypes()); writeCoveredIds(item.getCoveredIds()); writeDependsOnIds(item.getDependOnIds()); this.writer.writeEndElement(); }
private void writeElementIfPresent(final String elementName, final String content) throws XMLStreamException { if (content != null && !content.isEmpty()) { writeElement(elementName, content); } }
private void writeItem(final SpecificationItem item) throws XMLStreamException { final String description = processMultilineText(item.getDescription()); final String rationale = processMultilineText(item.getRationale()); final String comment = processMultilineText(item.getComment()); this.writer.writeStartElement("specobject"); writeElement("id", item.getName()); writeElementIfPresent("shortdesc", item.getTitle()); writeElement("status", item.getStatus().toString()); writeElement("version", item.getRevision()); writeLocation(item.getLocation()); writeElementIfPresent("description", description); writeElementIfPresent("rationale", rationale); writeElementIfPresent("comment", comment); writeTags(item.getTags()); writeNeedsArtifactTypes(item.getNeedsArtifactTypes()); writeCoveredIds(item.getCoveredIds()); writeDependsOnIds(item.getDependOnIds()); this.writer.writeEndElement(); }
private void writeElement(final String elementName, final int content) throws XMLStreamException { writeElement(elementName, String.valueOf(content)); }
private void writeElement(final String elementName, final int content) throws XMLStreamException { writeElement(elementName, String.valueOf(content)); }
private void writeTags(final List<String> tags) throws XMLStreamException { if (tags.isEmpty()) { return; } this.writer.writeStartElement("tags"); for (final String tag : tags) { writeElement("tag", tag); } this.writer.writeEndElement(); }
private void writeTags(final List<String> tags) throws XMLStreamException { if (tags.isEmpty()) { return; } this.writer.writeStartElement("tags"); for (final String tag : tags) { writeElement("tag", tag); } this.writer.writeEndElement(); }
private void writeNeedsArtifactTypes(final List<String> needsArtifactTypes) throws XMLStreamException { if (needsArtifactTypes.isEmpty()) { return; } this.writer.writeStartElement("needscoverage"); for (final String neededArtifactType : needsArtifactTypes) { writeElement("needsobj", neededArtifactType); } this.writer.writeEndElement(); }
private void writeNeedsArtifactTypes(final List<String> needsArtifactTypes) throws XMLStreamException { if (needsArtifactTypes.isEmpty()) { return; } this.writer.writeStartElement("needscoverage"); for (final String neededArtifactType : needsArtifactTypes) { writeElement("needsobj", neededArtifactType); } this.writer.writeEndElement(); }
private void writeDependsOnIds(final List<SpecificationItemId> dependOnIds) throws XMLStreamException { if (dependOnIds.isEmpty()) { return; } this.writer.writeStartElement("dependencies"); for (final SpecificationItemId dependsOnId : dependOnIds) { writeElement("dependson", dependsOnId.toString()); } this.writer.writeEndElement(); }
private void writeDependsOnIds(final List<SpecificationItemId> dependOnIds) throws XMLStreamException { if (dependOnIds.isEmpty()) { return; } this.writer.writeStartElement("dependencies"); for (final SpecificationItemId dependsOnId : dependOnIds) { writeElement("dependson", dependsOnId.toString()); } this.writer.writeEndElement(); }
private void writeCoveredIds(final List<SpecificationItemId> coveredIds) throws XMLStreamException { if (coveredIds.isEmpty()) { return; } this.writer.writeStartElement("providescoverage"); for (final SpecificationItemId coveredId : coveredIds) { this.writer.writeStartElement("provcov"); writeElement("linksto", coveredId.getArtifactType() + ":" + coveredId.getName()); writeElement("dstversion", coveredId.getRevision()); this.writer.writeEndElement(); } this.writer.writeEndElement(); }
private void writeCoveredIds(final List<SpecificationItemId> coveredIds) throws XMLStreamException { if (coveredIds.isEmpty()) { return; } this.writer.writeStartElement("providescoverage"); for (final SpecificationItemId coveredId : coveredIds) { this.writer.writeStartElement("provcov"); writeElement("linksto", coveredId.getArtifactType() + ":" + coveredId.getName()); writeElement("dstversion", coveredId.getRevision()); this.writer.writeEndElement(); } this.writer.writeEndElement(); }
private void writeLocation(final Location location) throws XMLStreamException { if (location != null && location.getPath() != null && !location.getPath().isEmpty()) { writeElement("sourcefile", location.getPath()); writeElement("sourceline", location.getLine()); } } }
private void writeLocation(final Location location) throws XMLStreamException { if (location != null && location.getPath() != null && !location.getPath().isEmpty()) { writeElement("sourcefile", location.getPath()); writeElement("sourceline", location.getLine()); } } }