Skip to content

Commit

Permalink
Manage null value for Version #138
Browse files Browse the repository at this point in the history
  • Loading branch information
oscar9 committed Oct 6, 2022
1 parent 823e904 commit 0bf8c14
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ protected ContainedItem toContainedItemWithoutItemsProposed(RegItemproposed regI
ContainedItem containedItem = new ContainedItem();

setMainPropertiesForRegItemProposed(regItemproposed, containedItem);
// setRegistryAndRegisterItemRefProposed(regItemproposed, containedItem);
setRegistryAndRegisterItemRefProposed(regItemproposed, containedItem);
// setIsDefinedByFromRegItemProposed(regItemproposed, containedItem);
// setTopConceptsFromRegItemProposed(regItemproposed, containedItem);
// setInSchemeAndTopConceptOfFromRegItemProposed(regItemproposed, containedItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ private void writeVersions(XMLStreamWriter xml, ContainedItem item) throws XMLSt
xml.writeEndElement();

xml.writeStartElement("link");
xml.writeAttribute("href", version.getUri());
if (version!=null && version.getUri()!=null) {
xml.writeAttribute("href", version.getUri());
}
xml.writeAttribute("rel", "self");
xml.writeEndElement();

Expand All @@ -233,7 +235,7 @@ private void writeVersions(XMLStreamWriter xml, ContainedItem item) throws XMLSt
xml.writeAttribute("rel", "latest-version");
xml.writeEndElement();

if (!versionHistory.isEmpty()) {
if (versionHistory!=null && !versionHistory.isEmpty()) {
for (VersionInformation versionInformation : versionHistory) {
xml.writeStartElement("link");
xml.writeAttribute("href", versionInformation.getUri());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,10 @@ private void writeAuthorityFrequency(XMLStreamWriter xml, ContainedItem item) th
private void writeVersion(XMLStreamWriter xml, ContainedItem item) throws XMLStreamException {
List<VersionInformation> versionHistory = item.getVersionHistory();
VersionInformation version = item.getVersion();
writeEmptyElement(xml, OWL, "sameAs", RDF, "resource", version.getUri());
writeEmptyElement(xml, ADMS, "last", RDF, "resource", item.getUri());
if (version!=null && version.getUri()!=null) {
writeEmptyElement(xml, OWL, "sameAs", RDF, "resource", version.getUri());
writeEmptyElement(xml, ADMS, "last", RDF, "resource", item.getUri());
}
if (versionHistory != null && !versionHistory.isEmpty()) {
for (VersionInformation versionInformation : versionHistory) {
writeEmptyElement(xml, ADMS, "prev", RDF, "resource", versionInformation.getUri());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,12 @@ private void writeItem(OutputStream out, Item item) throws XMLStreamException {
private void writeVersions(XMLStreamWriter xml, ContainedItem item) throws XMLStreamException {
List<VersionInformation> versionHistory = item.getVersionHistory();
VersionInformation version = item.getVersion();

writeEmptyElement(xml, "thisversion", version.getUri());
writeEmptyElement(xml, "latestversion", item.getUri());
if(version!=null && version.getUri()!=null) {
writeEmptyElement(xml, "thisversion", version.getUri());
}
if(item!=null && item.getUri()!=null) {
writeEmptyElement(xml, "latestversion", item.getUri());
}
if (versionHistory != null && !versionHistory.isEmpty()) {
xml.writeStartElement("previousversions");
for (VersionInformation versionInformation : versionHistory) {
Expand Down

0 comments on commit 0bf8c14

Please sign in to comment.