diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/AbstractResourceMarshaller.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/AbstractResourceMarshaller.java
index 957241734..5fdb27dbf 100644
--- a/ccm-docrepo/src/main/java/org/libreccm/docrepo/AbstractResourceMarshaller.java
+++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/AbstractResourceMarshaller.java
@@ -19,22 +19,15 @@
package org.libreccm.docrepo;
import org.libreccm.portation.AbstractMarshaller;
-import org.libreccm.portation.Marshals;
/**
+ * Abstract Marshaller class for importing and exporting the {@code
+ * AbstractResource}s.
+ *
* @author Tobias Osmers
diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObject.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObject.java
index 0442b9155..8fcd3e6e0 100644
--- a/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObject.java
+++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObject.java
@@ -34,6 +34,7 @@ import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlElement;
import java.io.Serializable;
import java.sql.Blob;
+import java.util.Arrays;
import java.util.Objects;
/**
@@ -142,7 +143,7 @@ public class BlobObject implements Identifiable, Serializable {
}
return blobObjectId == other.getBlobObjectId() &&
- Objects.equals(content, other.getContent());
+ Arrays.equals(content, other.getContent());
}
public boolean canEqual(final Object obj) {
@@ -152,12 +153,7 @@ public class BlobObject implements Identifiable, Serializable {
@Override
public String toString() {
- return String.format("%s{ "
- + "blobObjectId = %d, "
- + "content = %s, "
- + " }",
- super.toString(),
- blobObjectId,
- content.toString());
+ return String.format("%s{blobObjectId = %d, content = %s}", super
+ .toString(), blobObjectId, Arrays.toString(content));
}
}
diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObjectMarshaller.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObjectMarshaller.java
new file mode 100644
index 000000000..74b2c49cd
--- /dev/null
+++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/BlobObjectMarshaller.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.libreccm.docrepo;
+
+import org.libreccm.portation.AbstractMarshaller;
+import org.libreccm.portation.Marshals;
+
+import javax.faces.bean.RequestScoped;
+import javax.inject.Inject;
+
+/**
+ * Marshaller class for importing and exporting {@code BlobObject}s from the
+ * system into a specified file and the other way around.
+ *
+ * @author Tobias Osmers
+ * @version created the 3/16/16
+ */
+@RequestScoped
+@Marshals(File.class)
+public class FileMarshaller extends AbstractResourceMarshaller {
+
+ @Inject
+ private FileRepository fileRepository;
+
+ @Override
+ protected Class getObjectClass() {
+ return File.class;
+ }
+
+ @Override
+ protected void insertIntoDb(File object) {
+ fileRepository.save(object);
+ }
+}
diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/FolderMarshaller.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/FolderMarshaller.java
new file mode 100644
index 000000000..3ee00a000
--- /dev/null
+++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/FolderMarshaller.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2015 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.libreccm.docrepo;
+
+import org.libreccm.portation.Marshals;
+
+import javax.faces.bean.RequestScoped;
+import javax.inject.Inject;
+
+/**
+ * Marshaller class for importing and exporting {@code Folder}s from the
+ * system into a specified file and the other way around.
+ *
+ * @author Tobias Osmers
+ * @version created the 3/16/16
+ */
+@RequestScoped
+@Marshals(Repository.class)
+public class RepositoryMarshaller extends AbstractMarshaller {
+
+ @Inject
+ private RepositoryRepository repositoryRepository;
+
+ @Override
+ protected Class getObjectClass() {
+ return Repository.class;
+ }
+
+ @Override
+ protected void insertIntoDb(Repository object) {
+ repositoryRepository.save(object);
+ }
+}