Commit 84bb3525 authored by co887baqi's avatar co887baqi

Fix for regression in dptbase-common, class structures

parent 30ddd853
......@@ -680,9 +680,9 @@
<xsl:with-param name="staticURL" select="$staticURL" />
<xsl:with-param name="bold" select="true()" />
</xsl:call-template>
<!-- Versioning -->
<xsl:call-template name="printValueLineVersion">
<xsl:call-template name="printValueLineVersionSubversion">
<xsl:with-param name="nodes" select="." />
<xsl:with-param name="bold" select="true()" />
</xsl:call-template>
......
......@@ -74,25 +74,25 @@ public class MCRMetadataVersion {
* The revision number of this version
*/
@XmlAttribute(name = "r")
private long revision;
protected long revision;
/**
* The user that created this version
*/
@XmlAttribute
private String user;
protected String user;
/**
* The date this version was created
*/
@XmlAttribute
private Date date;
protected Date date;
/**
* Was this version result of a create, update or delete?
*/
@XmlAttribute()
private Type type;
protected Type type;
/**
* A version that was created in store
......
......@@ -21,18 +21,15 @@ package org.mycore.datamodel.ifs2;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Date;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jdom2.JDOMException;
import org.mycore.common.MCRUsageException;
import org.mycore.common.content.MCRByteContent;
import org.mycore.common.content.MCRContent;
......@@ -41,8 +38,9 @@ import edu.wisc.library.ocfl.api.model.VersionDetails;
/**
* Provides information about a stored version of metadata and allows to
* retrieve that version from OCFL.
* retrieve that version from OCFL. Adapted from MCRMetadataVersion
*
* @author Frank Lützenkirchen
* @author Christoph Neidahl
*/
@XmlRootElement(name = "revision")
......@@ -60,45 +58,6 @@ public class MCROCFLMetadataVersion extends MCRMetadataVersion {
@XmlTransient
private MCROCFLVersionedMetadata vm;
/**
* The revision number of this version
*/
@XmlAttribute(name = "r")
private long revision;
/**
* The user that created this version
*/
@XmlAttribute
private String user;
/**
* The date this version was created
*/
@XmlAttribute
private Date date;
/**
* Was this version result of a create, update or delete?
*/
@XmlAttribute()
private Type type;
/**
* A version that was created in store
*/
public static final char CREATED = 'A';
/**
* A version that was updated in store
*/
public static final char UPDATED = 'M';
/**
* A version that was deleted in store
*/
public static final char DELETED = 'D';
/**
* Creates a new metadata version info object
*
......@@ -135,44 +94,6 @@ public class MCROCFLMetadataVersion extends MCRMetadataVersion {
return vm;
}
/**
* Returns the type of operation this version comes from
*
* @see #CREATED
* @see #UPDATED
* @see #DELETED
*/
public char getType() {
return type.charValue;
}
/**
* Returns the SVN revision number of this version
*
* @return the SVN revision number of this version
*/
public long getRevision() {
return revision;
}
/**
* Returns the user that created this version
*
* @return the user that created this version
*/
public String getUser() {
return user;
}
/**
* Returns the date and time this version was created
*
* @return the date and time this version was created
*/
public Date getDate() {
return date;
}
/**
* Retrieves this version of the metadata
*
......@@ -180,6 +101,7 @@ public class MCROCFLMetadataVersion extends MCRMetadataVersion {
* @throws MCRUsageException if this is a deleted version, which can not be
* retrieved
*/
@Override
public MCRContent retrieve() throws IOException {
if (type == Type.deleted) {
throw new MCRUsageException("You can not retrieve a deleted version, retrieve a previous version instead");
......@@ -196,13 +118,4 @@ public class MCROCFLMetadataVersion extends MCRMetadataVersion {
throw new IOException(e);
}
}
/**
* Replaces the current version of the metadata object with this version, which
* means that a new version is created that is identical to this old version.
* The stored metadata document is updated to this old version of the metadata.
*/
public void restore() throws IOException, JDOMException {
vm.update(retrieve());
}
}
......@@ -21,7 +21,6 @@ package org.mycore.datamodel.ifs2;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
......@@ -30,7 +29,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.function.Supplier;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
......@@ -64,12 +62,6 @@ public class MCROCFLVersionedMetadata extends MCRVersionedMetadata {
protected static final Logger LOGGER = LogManager.getLogger();
/**
* The revision number of the metadata version that is currently in the local
* filesystem store.
*/
protected Supplier<Optional<Long>> revision;
protected String versionedDocType;
/**
......@@ -334,4 +326,14 @@ public class MCROCFLVersionedMetadata extends MCRVersionedMetadata {
return revision.get().orElse(-1L);
}
/**
* Checks if this version is the latest version in the OCFL repository.
*
* @return whether this version is the latest version of this metadata object
*/
@Override
public boolean isUpToDate() throws IOException {
return getRevision() == getLastRevision();
}
}
......@@ -49,8 +49,9 @@ import edu.wisc.library.ocfl.api.model.VersionId;
/**
* Stores metadata objects in a OCFL repository. Changes can be tracked and
* restored.
* restored. Adapted from MCRVersioingMetadataStore.
*
* @author Frank Lützenkirchen
* @author Christoph Neidahl (OPNA2608)
*/
public class MCROCFLVersioningMetadataStore extends MCRVersioningMetadataStore {
......@@ -74,6 +75,7 @@ public class MCROCFLVersioningMetadataStore extends MCRVersioningMetadataStore {
/**
* Compatibility with SVN parent class.
*/
@Override
protected void setupSVN(String type) {
LOGGER.warn("Unsupported: void setupSVN");
}
......@@ -108,7 +110,6 @@ public class MCROCFLVersioningMetadataStore extends MCRVersioningMetadataStore {
* @return OCFL repository
*/
public OcflRepository getOCFLRepository() {
return MCROCFLRepositoryHandler.instance().getRepository();
}
......@@ -128,6 +129,7 @@ public class MCROCFLVersioningMetadataStore extends MCRVersioningMetadataStore {
*
* @throws MCRPersistenceException if 'svn verify' used to fail
*/
@Override
public void verify() throws MCRPersistenceException {
LOGGER.warn("Unsupported: void verify()");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment