adds 'Entity'Marshaller for every entity class in package docrepo
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3928 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
cdb6bc9a0d
commit
59088cb39a
|
|
@ -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 <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||
* @version created the 2/10/16
|
||||
*/
|
||||
@Marshals(AbstractResource.class)
|
||||
public class AbstractResourceMarshaller extends AbstractMarshaller<AbstractResource> {
|
||||
public abstract class AbstractResourceMarshaller<R extends AbstractResource>
|
||||
extends AbstractMarshaller<R> {
|
||||
|
||||
@Override
|
||||
protected Class<AbstractResource> getObjectClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertObjectIntoDB(AbstractResource object) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Repository class for retrieving, storing and deleting
|
||||
* Abstract Repository class for retrieving, storing and deleting
|
||||
* {@code AbstractResource}s.
|
||||
*
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||
* @version created the 3/16/16
|
||||
*/
|
||||
@RequestScoped
|
||||
@Marshals(BlobObject.class)
|
||||
public class BlobObjectMarshaller extends AbstractMarshaller<BlobObject> {
|
||||
|
||||
@Inject
|
||||
private BlobObjectRepository blobObjectRepository;
|
||||
|
||||
@Override
|
||||
protected Class<BlobObject> getObjectClass() {
|
||||
return BlobObject.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertIntoDb(BlobObject object) {
|
||||
blobObjectRepository.save(object);
|
||||
}
|
||||
}
|
||||
|
|
@ -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 File}s from the
|
||||
* system into a specified file and the other way around.
|
||||
*
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||
* @version created the 3/16/16
|
||||
*/
|
||||
@RequestScoped
|
||||
@Marshals(File.class)
|
||||
public class FileMarshaller extends AbstractResourceMarshaller<File> {
|
||||
|
||||
@Inject
|
||||
private FileRepository fileRepository;
|
||||
|
||||
@Override
|
||||
protected Class<File> getObjectClass() {
|
||||
return File.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertIntoDb(File object) {
|
||||
fileRepository.save(object);
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||
* @version created the 3/16/16
|
||||
*/
|
||||
@RequestScoped
|
||||
@Marshals(Folder.class)
|
||||
public class FolderMarshaller extends AbstractResourceMarshaller<Folder> {
|
||||
|
||||
@Inject
|
||||
private FolderRepository folderRepository;
|
||||
|
||||
@Override
|
||||
protected Class<Folder> getObjectClass() {
|
||||
return Folder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertIntoDb(Folder object) {
|
||||
folderRepository.save(object);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||
* @version created the 3/16/16
|
||||
*/
|
||||
@RequestScoped
|
||||
@Marshals(Repository.class)
|
||||
public class RepositoryMarshaller extends AbstractMarshaller<Repository> {
|
||||
|
||||
@Inject
|
||||
private RepositoryRepository repositoryRepository;
|
||||
|
||||
@Override
|
||||
protected Class<Repository> getObjectClass() {
|
||||
return Repository.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertIntoDb(Repository object) {
|
||||
repositoryRepository.save(object);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue