CCM NG: Various adjustments for import/export

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5710 8810af33-2d31-482b-a856-94f89814c4df

Former-commit-id: 2e7fbbebf6
pull/2/head
jensp 2018-10-03 12:33:14 +00:00
parent b9cf3d14ee
commit cfc1416f73
93 changed files with 527 additions and 923 deletions

View File

@ -124,7 +124,6 @@ public class AssetManagerTest {
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -121,7 +121,6 @@ public class AssetRepositoryTest {
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -113,7 +113,6 @@ public class AttachmentListManagerTest {
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -115,7 +115,6 @@ public class ContentItemL10NManagerTest {
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -138,7 +138,6 @@ public class ContentItemManagerTest {
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.bebop.Component.class.getPackage())

View File

@ -122,7 +122,6 @@ public class ContentItemPermissionTest {
.addClass(org.libreccm.workflow.TaskAssignment.class)
//Classes used by Role.class, User.class,
//org.libreccm.core.CcmObject.class
.addClass(org.libreccm.portation.Portable.class)
//Classes used by Shiro.class
.addClass(org.libreccm.security.UserRepository.class)
//Class used by User.class

View File

@ -120,7 +120,6 @@ public class ContentItemRepositoryTest {
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -139,7 +139,6 @@ public class ContentSectionManagerTest {
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addPackage(org.libreccm.portation.Portable.class.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class.
getPackage())
.addPackage(org.libreccm.security.Permission.class.getPackage())
@ -164,7 +163,6 @@ public class ContentSectionManagerTest {
com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane.class)
.addClass(org.libreccm.modules.Module.class)
.addClass(org.libreccm.modules.RequiredModule.class)
.addClass(org.libreccm.portation.Marshals.class)
.addPackage(org.librecms.dispatcher.ItemResolver.class.getPackage())
.addPackage(com.arsdigita.util.Lockable.class.getPackage())
.addPackage(com.arsdigita.web.BaseServlet.class.getPackage())

View File

@ -343,7 +343,6 @@ public class ContentTypeRepositoryTest {
.addClass(org.libreccm.pagemodel.PageModelComponentModel.class)
.addClass(org.libreccm.pagemodel.PageModelVersion.class)
.addPackage(org.libreccm.pagemodel.styles.Styles.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addClass(org.libreccm.security.AuthorizationInterceptor.class)
.addClass(org.libreccm.security.AuthorizationRequired.class)
.addClass(org.libreccm.security.CcmShiroRealm.class)

View File

@ -108,7 +108,6 @@ public class FolderManagerTest {
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class.
getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -120,7 +120,6 @@ public class ItemAttachmentManagerTest {
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -21,7 +21,6 @@ package org.libreccm.categorization;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import org.libreccm.core.CcmObject;
import org.libreccm.portation.Portable;
import org.libreccm.security.Relation;
import java.io.Serializable;

View File

@ -25,7 +25,6 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.validator.constraints.NotBlank;
import org.libreccm.core.CcmObject;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.portation.Portable;
import org.libreccm.security.RecursivePermissions;
import javax.xml.bind.annotation.XmlElement;

View File

@ -26,7 +26,6 @@ import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.URL;
import org.libreccm.core.CcmObject;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.portation.Portable;
import org.libreccm.security.RecursivePermissions;
import org.libreccm.web.CcmApplication;

View File

@ -21,14 +21,27 @@ package org.libreccm.core;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.portation.Portable;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import org.libreccm.imexport.Exportable;
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
* This class is a port of the old {@code ResourceType} entity.
*
@ -46,18 +59,21 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
@Table(name = "RESOURCE_TYPES", schema = DB_SCHEMA)
@Inheritance(strategy = InheritanceType.JOINED)
@NamedQueries({
@NamedQuery(name = "ResourceType.findByUuid",
query = "SELECT r FROM ResourceType r WHERE r.uuid = :uuid")
,
@NamedQuery(name = "ResourceType.findByTitle",
query = "SELECT r FROM ResourceType r WHERE r.title = :title")
})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = ResourceTypeIdResolver.class,
property = "title")
property = "uuid")
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity",
"PMD.LongVariable"})
public class ResourceType implements Serializable, Portable {
public class ResourceType implements Serializable, Exportable {
private static final long serialVersionUID = 4563584142251370627L;
@ -65,6 +81,9 @@ public class ResourceType implements Serializable, Portable {
@Column(name = "RESOURCE_TYPE_ID")
private long resourceTypeId;
@Column(name = "UUID", unique = true, nullable = false)
private String uuid;
@Column(name = "TITLE", length = 254, nullable = false)
private String title;
@ -97,10 +116,19 @@ public class ResourceType implements Serializable, Portable {
return resourceTypeId;
}
public void setResourceTypeId(final long resourceTypeId) {
protected void setResourceTypeId(final long resourceTypeId) {
this.resourceTypeId = resourceTypeId;
}
@Override
public String getUuid() {
return uuid;
}
protected void setUuid(final String uuid) {
this.uuid = uuid;
}
public String getTitle() {
return title;
}

View File

@ -47,10 +47,11 @@ public class ResourceTypeIdResolver implements Serializable, ObjectIdResolver {
.findBean(ResourceTypeRepository.class);
return resourceTypeRepository
.findByTitle(id.key.toString())
.findByUuid(id.key.toString())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No ResourceType with title %s in the " +
"database.", id.key.toString())));
.format("No ResourceType with uuid %s in the " +
"database.",
id.key.toString())));
}
@Override

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
* Copyright (C) 2018 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -18,32 +18,34 @@
*/
package org.libreccm.core;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.portation.Marshals;
import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 8/22/17
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Marshals(ResourceType.class)
public class ResourceTypeMarshaller extends AbstractMarshaller<ResourceType> {
private static final long serialVersionUID = 79174993117568181L;
@Processes(ResourceType.class)
public class ResourceTypeImExporter
extends AbstractEntityImExporter<ResourceType>{
@Inject
private ResourceTypeRepository resourceTypeRepository;
private ResourceTypeRepository repository;
@Override
protected Class<ResourceType> getObjectClass() {
protected Class<ResourceType> getEntityClass() {
return ResourceType.class;
}
@Override
protected void insertIntoDb(ResourceType portableObject) {
resourceTypeRepository.save(portableObject);
protected void saveImportedEntity(final ResourceType entity) {
repository.save(entity);
}
}

View File

@ -21,7 +21,9 @@ package org.libreccm.core;
import javax.enterprise.context.RequestScoped;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import java.util.Optional;
import java.util.UUID;
/**
* A repository for executing CRUD operations on {@link ResourceType} objects.
@ -30,7 +32,7 @@ import java.util.Optional;
* {@link ResourceType}s from the database. This is the responsibility of the
* application using the {@link ResourceType}.
*
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
*
*/
@RequestScoped
@ -59,6 +61,28 @@ public class ResourceTypeRepository
return entity.getTitle() == null;
}
@Override
public void initNewEntity(final ResourceType entity) {
if (entity.getResourceTypeId() == 0) {
if (entity.getUuid() == null) {
entity.setUuid(UUID.randomUUID().toString());
}
}
}
public Optional<ResourceType> findByUuid(final String uuid) {
final TypedQuery<ResourceType> query = getEntityManager()
.createNamedQuery("ResourceType.findByUuid", ResourceType.class);
query.setParameter("uuid", uuid);
return getSingleResult(query);
}
/**
* Finds a {@link ResourceType} by its title.
*

View File

@ -1,241 +0,0 @@
/*
* 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.portation;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Serializable;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
/**
* Abstract class responsible for ex- and importing entity-objects to several
* file-formats. Every entity-class (e.g. DocRepo.File) needs to have its own
* extension of this class to override the abstract methods, making it possible
* to ex- or import that extending entity-class (e.g. DocRepo .FileMarshal).
*
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @version created the 2/10/16
* @param <P>
*/
public abstract class AbstractMarshaller<P extends Portable> implements Serializable {
private static final long serialVersionUID = -5796378713915256691L;
private static final Logger LOGGER = LogManager.getLogger(
AbstractMarshaller.class);
private Format format;
private String filename;
// XML specifics
ObjectMapper xmlMapper;
/**
* Prepares import and export routine. Sets the format in which the ex- or
* import will take place and sets the name of the file exported to or
* imported from. Furthermore it is possible to decide for or against
* indentation in the output file.
*
* @param format The format of the ex-/import
* @param filename The filename of the file exported to or imported from
* @param indentation whether or not indentation
*/
public void prepare(final Format format,
String filename,
boolean indentation) {
this.format = format;
this.filename = filename;
switch (this.format) {
case XML:
// for additional configuration
JacksonXmlModule module = new JacksonXmlModule();
module.setDefaultUseWrapper(false);
xmlMapper = new XmlMapper(module);
if (indentation) {
xmlMapper.enable(SerializationFeature.INDENT_OUTPUT);
}
//xmlMapper.registerModule(new JaxbAnnotationModule());
xmlMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
break;
default:
break;
}
}
/**
* Same as {@code prepare}-methode above. Adds distinction between path and
* filename.
*
* @param format The format of the ex-/import
* @param folderPath The folderPath of the file exported to or imported
* from
* @param filename The filename of the file exported to or imported from
* @param indentation whether or not indentation
*
public void prepare(final Format format,
String folderPath, String filename,
boolean indentation) {
File file = new File(folderPath);
if (file.exists() || file.mkdirs()) {
prepare(format, folderPath + "/" + filename, indentation);
}
}*/
/**
* Export routine for lists with the same object type {@code P}. Creates a
* new file with the prepared filename and starts, depending on the set
* format, the export process, object after object.
*
* @param exportList List of equally typed objects.
*/
public void exportList(final List<P> exportList) {
File file = new File(filename);
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(file);
} catch (IOException e) {
LOGGER.error("Unable to open a fileWriter for the file"
+ " with the name {}.", file.getName());
LOGGER.error(e);
}
if (fileWriter != null) {
for (P object : exportList) {
String line = null;
switch (format) {
case XML:
try {
line = xmlMapper.writeValueAsString(object);
//LOGGER.info(line);
} catch (IOException e) {
LOGGER.error("Unable to write objetct "
+ "of class {} as XML string with name {}.",
object.getClass(), file.getName());
LOGGER.error(e);
}
break;
default:
break;
}
if (line != null) {
try {
fileWriter.write(line);
fileWriter.write(System.getProperty("line.separator"));
} catch (IOException e) {
LOGGER.error("Unable to write to file with"
+ " the name {}.", file.getName());
LOGGER.error(e);
}
}
}
try {
fileWriter.close();
} catch (IOException e) {
LOGGER.error("Unable to close a fileWriter for the"
+ " file with the name {}.", file.getName());
LOGGER.error(e);
}
}
}
/**
* Import routine for files containing objects of the same type {@code P}.
* Creates a new list of strings to read the file line by line. Each line of
* the list represents an object of the file. Then retrieves each object
* from the corresponding string in the list.
*
* @return If error occurs true, otherwise false.
*/
public boolean importFile() {
boolean error = false;
File file = new File(filename);
List<String> lines = null;
try {
lines = Files.readAllLines(file.toPath());
} catch (IOException e) {
LOGGER.error("Unable to read lines of the file with " + "name {}.",
file.getName());
LOGGER.error(e);
error = true;
}
List<P> objects = new ArrayList<>();
if (lines != null) {
int emptyObjects = 0;
for (String line : lines) {
P object = null;
switch (format) {
case XML:
try {
object = xmlMapper.readValue(line, getObjectClass());
} catch (IOException e) {
LOGGER.error("Unable to read objects "
+ "from XML line:\n \"{}\"", line);
LOGGER.error("Exception: ", e);
error = true;
}
break;
default:
break;
}
if (object != null) {
insertIntoDb(object);
objects.add(object);
} else {
emptyObjects += 1;
LOGGER.info("Count of empty objects: {}", emptyObjects);
error = true;
}
}
}
return error;
}
/**
* Abstract method to get the object class to determine the type {@code P}.
*
* @return The object class
*/
protected abstract Class<P> getObjectClass();
/**
* Abstract method to insert every imported object into the database.
*
* @param portableObject An object of type {@code P}
*/
protected abstract void insertIntoDb(P portableObject);
}

View File

@ -1,27 +0,0 @@
/*
* 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.portation;
/**
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @version created the 03.02.2016
*/
public enum Format {
XML
}

View File

@ -1,225 +0,0 @@
/*
* 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.portation;
import org.libreccm.core.Identifiable;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
import javax.enterprise.util.AnnotationLiteral;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Central class for exporting and importing objects of this system stored in
* the database. Retrieves all available implementations of
* {@link AbstractMarshaller} using CDI. The implementations have to be CDI
* beans of course. Also they must be annotated with the {@link Marshals}
* annotation.
*
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @version created the 03.02.2016
*/
@RequestScoped
@Deprecated /*needs to be reviewed when integrating import/export in gui*/
public class Marshaller implements Serializable {
private static final long serialVersionUID = 6769177147719834999L;
@Inject
@Any
private Instance<AbstractMarshaller<? extends Portable>> marshallerInstances;
// Maps lists with objects of the same type to their typ.
// The type represents the key, the lists the values
private Map<Class<? extends Portable>, List<Portable>> classListMap;
/**
* Main export method. Organizes the objects into list of the same type
* and calls a second export method for each list.
*
* @param objects All objects to be exported
* @param format The export style/format e.g. CSV or JSON
* @param filename The name of the file to be exported to
*/
public void exportObjects(List<Portable> objects,
Format format,
String filename) {
putObjects(objects);
for (Map.Entry<Class<? extends Portable>, List<Portable>>
classListEntry : classListMap.entrySet()) {
exportList(classListEntry.getValue(), classListEntry.getKey(),
format, filename);
}
}
/**
* Organizes a list of different {@link Identifiable} objects into a map
* assigning lists of the same type to their type as values to a key. The
* type which all objects of that list have in common is their key.
* That opens the possibility of being certain of the objects types in
* the list. Guarantied through this implementation.
*
* @param objects list of all objects being organized
*/
private void putObjects(List<Portable> objects) {
for (Portable object : objects) {
Class<? extends Portable> type = object.getClass();
if (classListMap.containsKey(type)) {
classListMap.get(type).add(object);
} else {
List<Portable> values = new ArrayList<>();
values.add(object);
classListMap.put(type, values);
}
}
}
/**
* Selects the right marshaller for the given type, initializes that
* marshaller for the given export wishes and calls the export method of
* that marshaller upon the given list of same typed objects.
*
* Naming convention for the export file name:
* <basic file name>__<type/class name>.<format>
*
* @param list List of objects to be exported of the same type
* @param type The class of the type
* @param format The export style
* @param filename The filename
* @param <P> The type of the current marshaller
*/
private <P extends Portable> void exportList(List<P> list,
Class<? extends P> type,
Format format,
String filename)
throws IllegalArgumentException {
final Instance<AbstractMarshaller<? extends Portable>>
marshallerInstance = marshallerInstances.select(new
MarshalsLiteral(type));
if (marshallerInstance.isUnsatisfied()) {
//If there are no marshallers we have a problem...
throw new IllegalArgumentException(String.format(
"No marshallers for \"%s\" found.", type.getName()));
} else if (marshallerInstance.isAmbiguous()) {
//If there is more than one marshaller something is wrong...
throw new IllegalArgumentException(String.format(
"More than one marshaller for \"%s\" found.", type
.getName()));
} else {
// Get the marshaller for this list and call the export method.
final Iterator<AbstractMarshaller<? extends Portable>>
iterator = marshallerInstance.iterator();
@SuppressWarnings("unchecked")
final AbstractMarshaller<P> marshaller = (AbstractMarshaller<P>)
iterator.next();
marshaller.prepare(format, filename + "__" + type.toString(),
false);
marshaller.exportList(list);
}
}
/**
* Selects the right marshaller for each file being imported depending on
* the filename. Therefore the filename has to contain the name of the
* class this file stores objects for. The marshaller will then be
* initialized and be called for importing the objects contained in the
* file being processed.
*
* Naming convention for the import file name:
* <basic file name>__<type/class name>.<format>
*
* @param filenames List of filenames for the files wishing to be imported
* @param format The import style
* @param <P> The type of the current marshaller
*/
public <P extends Portable> void importFiles(List<String> filenames,
Format format)
throws IllegalArgumentException {
for (String filename : filenames) {
String[] splitFilename = filename.split("__");
String className =
splitFilename[splitFilename.length].split(".")[0];
try {
Class clazz = Class.forName(className);
@SuppressWarnings("unchecked")
Class<P> type = clazz.asSubclass(Portable.class);
final Instance<AbstractMarshaller<? extends Portable>>
marshallerInstance = marshallerInstances.select(new
MarshalsLiteral(type));
if (marshallerInstance.isUnsatisfied()) {
//If there are no marshallers we have a problem...
throw new IllegalArgumentException(String.format(
"No marshallers for \"%s\" found.", type.getName()));
} else if (marshallerInstance.isAmbiguous()) {
//If there is more than one marshaller something is wrong...
throw new IllegalArgumentException(String.format(
"More than one marshaller for \"%s\" found.", type
.getName()));
} else {
// Get the marshaller for this list and call the export method.
final Iterator<AbstractMarshaller<? extends Portable>>
iterator = marshallerInstance.iterator();
@SuppressWarnings("unchecked")
final AbstractMarshaller<P> marshaller = (AbstractMarshaller<P>)
iterator.next();
marshaller.prepare(format, filename, false);
marshaller.importFile();
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
/**
* {@link AnnotationLiteral} used for filtering the available marshallers.
*/
private class MarshalsLiteral extends AnnotationLiteral<Marshals>
implements Marshals {
private static final long serialVersionUID = -8093783826632252875L;
private final Class<? extends Portable> entityClass;
public MarshalsLiteral(Class<? extends Portable> entityClass) {
this.entityClass = entityClass;
}
@Override
public Class<? extends Portable> value() {
return entityClass;
}
}
}

View File

@ -1,46 +0,0 @@
/*
* 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.portation;
import org.libreccm.core.Identifiable;
import javax.inject.Qualifier;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Qualifier annotation for implementations of {@link AbstractMarshaller}. The
* value is the implementation of {@link Identifiable} for which the annotated
* {@link AbstractMarshaller} implementation exports and imports its instances.
*
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @version created the 2/24/16
*/
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
@Target({ElementType.TYPE,
ElementType.PARAMETER,
ElementType.FIELD,
ElementType.METHOD})
public @interface Marshals {
Class<? extends Portable> value();
}

View File

@ -1,28 +0,0 @@
/*
* 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.portation;
/**
* Interface for the ex-/import routine. With this interface any object class
* can declare itself ex- or im{@code portable}.
*
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @version created on 11/3/16
*/
public interface Portable {}

View File

@ -25,7 +25,6 @@ import org.libreccm.categorization.Domain;
import org.libreccm.categorization.DomainManager;
import org.libreccm.categorization.DomainOwnership;
import org.libreccm.core.Resource;
import org.libreccm.portation.Portable;
import javax.persistence.FetchType;
import javax.xml.bind.annotation.XmlElement;

View File

@ -22,15 +22,31 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.portation.Portable;
import org.libreccm.security.User;
import javax.persistence.*;
import java.io.Serializable;
import java.util.*;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import org.libreccm.imexport.Exportable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* A task which can be assigned to a user. Also a {@code AssignableTask} can be
* locked by a user to indicate that the user is currently working on the object
@ -86,7 +102,7 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = AssignableTaskIdResolver.class,
property = "uuid")
public class AssignableTask extends Task implements Serializable, Portable {
public class AssignableTask extends Task implements Serializable, Exportable {
private static final long serialVersionUID = 4188064584389893019L;

View File

@ -32,6 +32,7 @@ import java.io.Serializable;
@RequestScoped
public class AssignableTaskIdResolver implements Serializable,
ObjectIdResolver {
private static final long serialVersionUID = -4634332219001315735L;
@Override
@ -51,8 +52,8 @@ public class AssignableTaskIdResolver implements Serializable,
return assignableTaskRepository
.findByUuid(id.key.toString())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No assignable tasks with uuid %s in the " +
"database.", id.key.toString())));
.format("No assignable tasks with uuid %s in the " + "database.",
id.key.toString())));
}
@Override
@ -64,4 +65,5 @@ public class AssignableTaskIdResolver implements Serializable,
public boolean canUseFor(final ObjectIdResolver resolverType) {
return resolverType instanceof AssignableTaskIdResolver;
}
}

View File

@ -18,33 +18,38 @@
*/
package org.libreccm.workflow;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.portation.Marshals;
import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.imexport.DependsOn;
import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @version created on 11/18/16
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*
*/
@RequestScoped
@Marshals(AssignableTask.class)
public class AssignableTaskMarshaller extends AbstractMarshaller<AssignableTask> {
private static final long serialVersionUID = -2787744872933470651L;
@Processes(AssignableTask.class)
@DependsOn(Workflow.class)
public class AssignableTaskImExporter
extends AbstractEntityImExporter<AssignableTask> {
@Inject
private AssignableTaskRepository assignableTaskRepository;
@Override
protected Class<AssignableTask> getObjectClass() {
protected Class<AssignableTask> getEntityClass() {
return AssignableTask.class;
}
@Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(AssignableTask portableObject) {
assignableTaskRepository.save(portableObject);
protected void saveImportedEntity(final AssignableTask entity) {
assignableTaskRepository.save(entity);
}
}

View File

@ -20,15 +20,25 @@ package org.libreccm.workflow;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import org.libreccm.portation.Portable;
import org.libreccm.security.Role;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.imexport.Exportable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* Represents the assignment of a {@link AssignableTask} to a {@link Role}.
*
@ -36,9 +46,9 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
*/
@Entity
@Table(name = "WORKFLOW_TASK_ASSIGNMENTS", schema = DB_SCHEMA)
@JsonIdentityInfo(generator = TaskAssignmentIdGenerator.class,
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "customAssignId")
public class TaskAssignment implements Serializable, Portable {
public class TaskAssignment implements Serializable, Exportable {
private static final long serialVersionUID = -4427537363301565707L;
@ -50,6 +60,9 @@ public class TaskAssignment implements Serializable, Portable {
@GeneratedValue(strategy = GenerationType.AUTO)
private long taskAssignmentId;
@Column(name = "UUID", unique = true, nullable = false)
private String uuid;
/**
* The task.
*/
@ -74,6 +87,16 @@ public class TaskAssignment implements Serializable, Portable {
this.taskAssignmentId = taskAssignmentId;
}
@Override
public String getUuid() {
return uuid;
}
protected void setUuid(final String uuid) {
this.uuid = uuid;
}
public AssignableTask getTask() {
return task;
}

View File

@ -1,71 +0,0 @@
/*
* 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.workflow;
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @version created on 3/23/17
*/
public class TaskAssignmentIdGenerator extends ObjectIdGenerator<String> {
private static final long serialVersionUID = -5493483256068253010L;
@Override
public Class<?> getScope() {
return TaskAssignment.class;
}
@Override
public boolean canUseFor(final ObjectIdGenerator<?> gen) {
return gen instanceof TaskAssignmentIdGenerator;
}
@Override
public ObjectIdGenerator<String> forScope(final Class<?> scope) {
return this;
}
@Override
public ObjectIdGenerator<String> newForSerialization(final Object context) {
return this;
}
@Override
public IdKey key(final Object key) {
if (key == null) {
return null;
}
return new IdKey(TaskAssignment.class, TaskAssignment.class, key);
}
@Override
public String generateId(final Object forPojo) {
if (!(forPojo instanceof TaskAssignment)) {
throw new IllegalArgumentException(
"Only TaskAssignment instances are supported.");
}
final TaskAssignment assignment = (TaskAssignment) forPojo;
return String.format("{%s}{%s}",
assignment.getTask().getUuid(),
assignment.getRole().getName());
}
}

View File

@ -18,8 +18,9 @@
*/
package org.libreccm.workflow;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.portation.Marshals;
import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.imexport.DependsOn;
import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
@ -27,29 +28,29 @@ import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @version created on 11/7/16
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Marshals(TaskAssignment.class)
public class TaskAssignmentMarshaller extends AbstractMarshaller<TaskAssignment> {
private static final long serialVersionUID = 3717946510122661215L;
@Processes(TaskAssignment.class)
@DependsOn({AssignableTask.class})
public class TaskAssignmentMarshaller
extends AbstractEntityImExporter<TaskAssignment> {
@Inject
private EntityManager entityManager;
@Override
protected Class<TaskAssignment> getObjectClass() {
protected Class<TaskAssignment> getEntityClass() {
return TaskAssignment.class;
}
@Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(TaskAssignment portableObject) {
if (portableObject.getTaskAssignmentId() == 0) {
entityManager.persist(portableObject);
} else {
entityManager.merge(portableObject);
}
protected void saveImportedEntity(final TaskAssignment entity) {
entityManager.persist(entity);
}
}

View File

@ -24,14 +24,27 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.annotations.Type;
import org.libreccm.core.CoreConstants;
import org.libreccm.core.Identifiable;
import org.libreccm.portation.Portable;
import org.libreccm.imexport.Exportable;
import org.libreccm.security.User;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
* A comment for a task. Comments are intended for other users, for example to
* inform them about problems etc. with the object.
@ -48,7 +61,7 @@ import java.util.Objects;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = TaskCommentIdResolver.class,
property = "uuid")
public class TaskComment implements Identifiable, Serializable, Portable {
public class TaskComment implements Identifiable, Serializable, Exportable {
private static final long serialVersionUID = 3842991529698351698L;

View File

@ -18,31 +18,34 @@
*/
package org.libreccm.workflow;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.portation.Marshals;
import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.imexport.DependsOn;
import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 9/27/17
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @author <a href="mailto:jens.pelzetter@uni-bremen.de">Jens Pelzetter</a>
*/
@RequestScoped
@Marshals(TaskComment.class)
public class TaskCommentMarshaller extends AbstractMarshaller<TaskComment> {
private static final long serialVersionUID = -3259560130798503811L;
@Processes(TaskComment.class)
@DependsOn(AssignableTask.class)
public class TaskCommentImExporter extends AbstractEntityImExporter<TaskComment> {
@Inject
private TaskCommentRepository taskCommentRepository;
@Override
protected Class<TaskComment> getObjectClass() {
protected Class<TaskComment> getEntityClass() {
return TaskComment.class;
}
@Override
protected void insertIntoDb(TaskComment portableObject) {
taskCommentRepository.save(portableObject);
@Transactional(Transactional.TxType.REQUIRED)
protected void saveImportedEntity(TaskComment entity) {
taskCommentRepository.save(entity);
}
}

View File

@ -20,8 +20,9 @@ package org.libreccm.workflow;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.core.CoreConstants;
import org.libreccm.portation.Portable;
import org.libreccm.imexport.Exportable;
import java.io.Serializable;
import java.util.Objects;
@ -41,9 +42,9 @@ import javax.persistence.Table;
*/
@Entity
@Table(name = "WORKFLOW_TASK_DEPENDENCIES", schema = CoreConstants.DB_SCHEMA)
@JsonIdentityInfo(generator = TaskDependencyIdGenerator.class,
property = "customDepId")
public class TaskDependency implements Serializable, Portable {
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "uuid")
public class TaskDependency implements Serializable, Exportable {
private static final long serialVersionUID = -4383255770131633943L;
@ -52,6 +53,9 @@ public class TaskDependency implements Serializable, Portable {
@GeneratedValue(strategy = GenerationType.AUTO)
private long taskDependencyId;
@Column(name = "uuid", unique = true, nullable = false)
private String uuid;
@ManyToOne
@JoinColumn(name = "BLOCKED_TASK_ID")
@JsonIdentityReference(alwaysAsId = true)
@ -66,10 +70,19 @@ public class TaskDependency implements Serializable, Portable {
return taskDependencyId;
}
public void setTaskDependencyId(final long taskDependencyId) {
protected void setTaskDependencyId(final long taskDependencyId) {
this.taskDependencyId = taskDependencyId;
}
@Override
public String getUuid() {
return uuid;
}
protected void setUuid(final String uuid) {
this.uuid = uuid;
}
public Task getBlockedTask() {
return blockedTask;
}

View File

@ -1,71 +0,0 @@
/*
* 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.workflow;
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 12/12/17
*/
public class TaskDependencyIdGenerator extends ObjectIdGenerator<String> {
private static final long serialVersionUID = -419865429626554749L;
@Override
public Class<?> getScope() {
return TaskDependency.class;
}
@Override
public boolean canUseFor(ObjectIdGenerator<?> gen) {
return gen instanceof TaskDependencyIdGenerator;
}
@Override
public ObjectIdGenerator<String> forScope(Class<?> scope) {
return this;
}
@Override
public ObjectIdGenerator<String> newForSerialization(Object context) {
return this;
}
@Override
public IdKey key(Object key) {
if (key == null) {
return null;
}
return new IdKey(TaskDependency.class, TaskDependency.class, key);
}
@Override
public String generateId(Object forPojo) {
if (!(forPojo instanceof TaskDependency)) {
throw new IllegalArgumentException(
"Only TaskDependency instances are supported.");
}
final TaskDependency dependency = (TaskDependency) forPojo;
return String.format("{%s}{%s}",
dependency.getBlockedTask().getUuid(),
dependency.getBlockingTask().getUuid());
}
}

View File

@ -18,38 +18,38 @@
*/
package org.libreccm.workflow;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.portation.Marshals;
import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.imexport.DependsOn;
import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 12/12/17
*/
@RequestScoped
@Marshals(TaskDependency.class)
public class TaskDependencyMarshaller extends AbstractMarshaller<TaskDependency> {
private static final long serialVersionUID = 2753329911463298832L;
@Processes(TaskDependency.class)
@DependsOn({AssignableTask.class})
public class TaskDependencyMarshaller
extends AbstractEntityImExporter<TaskDependency> {
@Inject
private EntityManager entityManager;
@Override
protected Class<TaskDependency> getObjectClass() {
protected Class<TaskDependency> getEntityClass() {
return TaskDependency.class;
}
@Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(TaskDependency portableObject) {
portableObject.setTaskDependencyId(portableObject
.getTaskDependencyId() * -1);
entityManager.merge(portableObject);
entityManager.flush();
protected void saveImportedEntity(final TaskDependency entity) {
entityManager.persist(entity);
}
}

View File

@ -25,7 +25,6 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.core.CcmObject;
import org.libreccm.core.Identifiable;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.portation.Portable;
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
@ -48,6 +47,7 @@ import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
@ -56,6 +56,8 @@ import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import org.libreccm.imexport.Exportable;
/**
* A workflow is a collection of tasks which are performed on an object. Tasks
* can depend on each other.
@ -78,7 +80,7 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = WorkflowIdResolver.class,
property = "uuid")
public class Workflow implements Identifiable, Serializable, Portable {
public class Workflow implements Identifiable, Serializable, Exportable {
private static final long serialVersionUID = 4322500264543325829L;

View File

@ -26,11 +26,12 @@ import javax.enterprise.context.RequestScoped;
import java.io.Serializable;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @version created on 3/23/17
*/
@RequestScoped
public class WorkflowIdResolver implements Serializable, ObjectIdResolver {
private static final long serialVersionUID = 1951611806946125510L;
@Override
@ -50,8 +51,9 @@ public class WorkflowIdResolver implements Serializable, ObjectIdResolver {
return workflowRepository
.findByUuid(id.key.toString())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No workflows with uuid %s in the " +
"database.", id.key.toString())));
.format("No workflows with uuid %s in the "
+ "database.",
id.key.toString())));
}
@Override
@ -63,4 +65,5 @@ public class WorkflowIdResolver implements Serializable, ObjectIdResolver {
public boolean canUseFor(final ObjectIdResolver resolverType) {
return resolverType instanceof WorkflowIdResolver;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
* Copyright (C) 2018 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -18,33 +18,35 @@
*/
package org.libreccm.workflow;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.portation.Marshals;
import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @version created on 11/7/16
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Marshals(Workflow.class)
public class WorkflowMarshaller extends AbstractMarshaller<Workflow> {
private static final long serialVersionUID = 9126827334328274556L;
@Processes(Workflow.class)
public class WorkflowImExporter extends AbstractEntityImExporter<Workflow> {
@Inject
private WorkflowRepository workflowRepository;
@Override
protected Class<Workflow> getObjectClass() {
protected Class<Workflow> getEntityClass() {
return Workflow.class;
}
@Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(Workflow portableObject) {
workflowRepository.save(portableObject);
protected void saveImportedEntity(final Workflow entity) {
workflowRepository.save(entity);
}
}

View File

@ -0,0 +1,10 @@
alter table CCM_CORE.RESOURCE_TYPES
add column UUID varchar(255) not null;
alter table CCM_CORE.RESOURCE_TYPES
add constraint UK_ioax2ix2xmq3nw7el5k6orggb unique (UUID);

View File

@ -0,0 +1,11 @@
alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS
add column UUID varchar(255) not null;
alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS
add constraint UK_gv93k167pe9qy3go9vjau1q2t unique (UUID);

View File

@ -0,0 +1,12 @@
alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES
add column UUID varchar(255) not null;
alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES
add constraint UK_787va2ep8ucoul29qgsoaxnub unique (UUID);

View File

@ -0,0 +1,10 @@
alter table CCM_CORE.RESOURCE_TYPES
add column UUID varchar(255) not null;
alter table CCM_CORE.RESOURCE_TYPES
add constraint UK_ioax2ix2xmq3nw7el5k6orggb unique (UUID);

View File

@ -142,7 +142,6 @@ public class CategoryManagerTest {
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addAsLibraries(getModuleDependencies())

View File

@ -128,7 +128,6 @@ public class CategoryRepositoryTest {
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addAsLibraries(getModuleDependencies())

View File

@ -110,7 +110,6 @@ public class ConfigurationManagerTest {
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -128,8 +128,6 @@ public class CcmObjectRepositoryTest {
.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
// .addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.portation.Portable.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addAsLibraries(getModuleDependencies())

View File

@ -129,7 +129,6 @@ public class AuthorizationInterceptorTest {
.addPackage(com.arsdigita.xml.formatters.DateTimeFormatter.class
.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(org.libreccm.portation.Portable.class)
.addClass(com.arsdigita.util.UncheckedWrapperException.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",

View File

@ -132,7 +132,6 @@ public class ChallengeManagerTest {
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addAsLibraries(getModuleDependencies())

View File

@ -123,7 +123,6 @@ public class GroupManagerTest {
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -123,7 +123,6 @@ public class GroupRepositoryTest {
.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -127,7 +127,6 @@ public class OneTimeAuthManagerTest {
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -128,7 +128,6 @@ public class PartyRepositoryTest {
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -131,7 +131,6 @@ public class PermissionCheckerTest {
.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -132,7 +132,6 @@ public class PermissionManagerTest {
addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -120,7 +120,6 @@ public class RoleManagerTest {
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -129,7 +129,6 @@ public class RoleRepositoryTest {
getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -147,7 +147,6 @@ public class SecuredCollectionTest {
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -149,7 +149,6 @@ public class SecuredIteratorTest {
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -121,7 +121,6 @@ public class ShiroTest {
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addClass(org.libreccm.security.authorization.LabBean.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",

View File

@ -123,7 +123,6 @@ public class UserManagerTest {
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -128,7 +128,6 @@ public class UserRepositoryTest {
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -4,7 +4,6 @@ drop sequence if exists HIBERNATE_SEQUENCE;
create schema CCM_CORE;
create table CCM_CORE.APPLICATIONS (
APPLICATION_TYPE varchar(1024) not null,
PRIMARY_URL varchar(1024) not null,
@ -40,6 +39,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
CATEGORY_INDEX boolean,
OBJECT_ORDER bigint,
TYPE varchar(255),
UUID varchar(255) not null,
OBJECT_ID bigint,
CATEGORY_ID bigint,
primary key (CATEGORIZATION_ID)
@ -123,6 +123,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
CONTEXT varchar(255),
DOMAIN_ORDER bigint,
OWNER_ORDER bigint,
UUID varchar(255) not null,
domain_OBJECT_ID bigint not null,
owner_OBJECT_ID bigint not null,
primary key (OWNERSHIP_ID)
@ -297,6 +298,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
create table CCM_CORE.GROUP_MEMBERSHIPS (
MEMBERSHIP_ID bigint not null,
UUID varchar(255) not null,
GROUP_ID bigint,
MEMBER_ID bigint,
primary key (MEMBERSHIP_ID)
@ -452,6 +454,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
CREATION_IP varchar(255),
GRANTED_PRIVILEGE varchar(255),
INHERITED boolean,
UUID varchar(255) not null,
CREATION_USER_ID bigint,
GRANTEE_ID bigint,
INHERITED_FROM_ID bigint,
@ -510,6 +513,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
RESOURCE_TYPE_ID bigint not null,
SINGLETON boolean,
TITLE varchar(254) not null,
UUID varchar(255) not null,
EMBEDDED_VIEW boolean,
FULL_PAGE_VIEW boolean,
WORKSPACE_APP boolean,
@ -533,6 +537,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
create table CCM_CORE.ROLE_MEMBERSHIPS (
MEMBERSHIP_ID bigint not null,
UUID varchar(255) not null,
MEMBER_ID bigint,
ROLE_ID bigint,
primary key (MEMBERSHIP_ID)
@ -543,11 +548,11 @@ drop sequence if exists HIBERNATE_SEQUENCE;
SETTING_ID bigint not null,
CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null,
SETTING_VALUE_LONG bigint,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_DOUBLE double,
SETTING_VALUE_LONG bigint,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_DOUBLE double,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
primary key (SETTING_ID)
);
@ -708,6 +713,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
create table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS (
TASK_ASSIGNMENT_ID bigint not null,
UUID varchar(255) not null,
ROLE_ID bigint,
TASK_ID bigint,
primary key (TASK_ASSIGNMENT_ID)
@ -724,6 +730,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
create table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES (
TASK_DEPENDENCY_ID bigint not null,
uuid varchar(255) not null,
BLOCKED_TASK_ID bigint,
BLOCKING_TASK_ID bigint,
primary key (TASK_DEPENDENCY_ID)
@ -764,6 +771,9 @@ drop sequence if exists HIBERNATE_SEQUENCE;
primary key (WORKFLOW_ID)
);
alter table CCM_CORE.CATEGORIZATIONS
add constraint UK_da7jus3wn1tr8poyaw9btxbrc unique (UUID);
alter table CCM_CORE.CATEGORY_DOMAINS
add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY);
@ -776,6 +786,12 @@ drop sequence if exists HIBERNATE_SEQUENCE;
alter table CCM_CORE.CCM_ROLES
add constraint UK_rfmsjqsq6kagolsod3ufkugll unique (UUID);
alter table CCM_CORE.DOMAIN_OWNERSHIPS
add constraint UK_j86gai9740v9hshascbsboudb unique (UUID);
alter table CCM_CORE.GROUP_MEMBERSHIPS
add constraint UK_kkdoia60bmiwhhdru169p3n9g unique (UUID);
alter table CCM_CORE.HOSTS
add constraint UK9ramlv6uxwt13v0wj7q0tucsx unique (SERVER_NAME, SERVER_PORT);
@ -785,15 +801,30 @@ drop sequence if exists HIBERNATE_SEQUENCE;
alter table CCM_CORE.PARTIES
add constraint UK_1hv061qace2mn4loroe3fwdel unique (UUID);
alter table CCM_CORE.PERMISSIONS
add constraint UK_p50se7rdexv7xnkiqsl6ijyti unique (UUID);
alter table CCM_CORE.RESOURCE_TYPES
add constraint UK_ioax2ix2xmq3nw7el5k6orggb unique (UUID);
alter table CCM_CORE.ROLE_MEMBERSHIPS
add constraint UK_82wdq214bfs99eii71fp50s97 unique (UUID);
alter table CCM_CORE.SETTINGS
add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME);
alter table CCM_CORE.SITES
add constraint UK_kou1h4y4st2m173he44yy8grx unique (DOMAIN_OF_SITE);
alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS
add constraint UK_gv93k167pe9qy3go9vjau1q2t unique (UUID);
alter table CCM_CORE.WORKFLOW_TASK_COMMENTS
add constraint UK_4nnedf08odyjxalfkg16fmjoi unique (UUID);
alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES
add constraint UK_787va2ep8ucoul29qgsoaxnub unique (uuid);
alter table CCM_CORE.WORKFLOW_TASKS
add constraint UK_2u6ruatxij8wfojl8a1eigqqd unique (UUID);

View File

@ -2,6 +2,8 @@ drop schema if exists CCM_CORE cascade;
drop sequence if exists HIBERNATE_SEQUENCE;
create schema CCM_CORE;
create table CCM_CORE.APPLICATIONS (
APPLICATION_TYPE varchar(1024) not null,
PRIMARY_URL varchar(1024) not null,
@ -37,6 +39,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
CATEGORY_INDEX boolean,
OBJECT_ORDER int8,
TYPE varchar(255),
UUID varchar(255) not null,
OBJECT_ID int8,
CATEGORY_ID int8,
primary key (CATEGORIZATION_ID)
@ -120,6 +123,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
CONTEXT varchar(255),
DOMAIN_ORDER int8,
OWNER_ORDER int8,
UUID varchar(255) not null,
domain_OBJECT_ID int8 not null,
owner_OBJECT_ID int8 not null,
primary key (OWNERSHIP_ID)
@ -294,6 +298,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
create table CCM_CORE.GROUP_MEMBERSHIPS (
MEMBERSHIP_ID int8 not null,
UUID varchar(255) not null,
GROUP_ID int8,
MEMBER_ID int8,
primary key (MEMBERSHIP_ID)
@ -449,6 +454,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
CREATION_IP varchar(255),
GRANTED_PRIVILEGE varchar(255),
INHERITED boolean,
UUID varchar(255) not null,
CREATION_USER_ID int8,
GRANTEE_ID int8,
INHERITED_FROM_ID int8,
@ -507,6 +513,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
RESOURCE_TYPE_ID int8 not null,
SINGLETON boolean,
TITLE varchar(254) not null,
UUID varchar(255) not null,
EMBEDDED_VIEW boolean,
FULL_PAGE_VIEW boolean,
WORKSPACE_APP boolean,
@ -530,6 +537,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
create table CCM_CORE.ROLE_MEMBERSHIPS (
MEMBERSHIP_ID int8 not null,
UUID varchar(255) not null,
MEMBER_ID int8,
ROLE_ID int8,
primary key (MEMBERSHIP_ID)
@ -540,11 +548,11 @@ drop sequence if exists HIBERNATE_SEQUENCE;
SETTING_ID int8 not null,
CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null,
SETTING_VALUE_LONG int8,
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_DOUBLE float8,
SETTING_VALUE_LONG int8,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_DOUBLE float8,
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
primary key (SETTING_ID)
);
@ -705,6 +713,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
create table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS (
TASK_ASSIGNMENT_ID int8 not null,
UUID varchar(255) not null,
ROLE_ID int8,
TASK_ID int8,
primary key (TASK_ASSIGNMENT_ID)
@ -721,6 +730,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
create table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES (
TASK_DEPENDENCY_ID int8 not null,
uuid varchar(255) not null,
BLOCKED_TASK_ID int8,
BLOCKING_TASK_ID int8,
primary key (TASK_DEPENDENCY_ID)
@ -761,6 +771,9 @@ drop sequence if exists HIBERNATE_SEQUENCE;
primary key (WORKFLOW_ID)
);
alter table CCM_CORE.CATEGORIZATIONS
add constraint UK_da7jus3wn1tr8poyaw9btxbrc unique (UUID);
alter table CCM_CORE.CATEGORY_DOMAINS
add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY);
@ -773,6 +786,12 @@ drop sequence if exists HIBERNATE_SEQUENCE;
alter table CCM_CORE.CCM_ROLES
add constraint UK_rfmsjqsq6kagolsod3ufkugll unique (UUID);
alter table CCM_CORE.DOMAIN_OWNERSHIPS
add constraint UK_j86gai9740v9hshascbsboudb unique (UUID);
alter table CCM_CORE.GROUP_MEMBERSHIPS
add constraint UK_kkdoia60bmiwhhdru169p3n9g unique (UUID);
alter table CCM_CORE.HOSTS
add constraint UK9ramlv6uxwt13v0wj7q0tucsx unique (SERVER_NAME, SERVER_PORT);
@ -782,15 +801,30 @@ drop sequence if exists HIBERNATE_SEQUENCE;
alter table CCM_CORE.PARTIES
add constraint UK_1hv061qace2mn4loroe3fwdel unique (UUID);
alter table CCM_CORE.PERMISSIONS
add constraint UK_p50se7rdexv7xnkiqsl6ijyti unique (UUID);
alter table CCM_CORE.RESOURCE_TYPES
add constraint UK_ioax2ix2xmq3nw7el5k6orggb unique (UUID);
alter table CCM_CORE.ROLE_MEMBERSHIPS
add constraint UK_82wdq214bfs99eii71fp50s97 unique (UUID);
alter table CCM_CORE.SETTINGS
add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME);
alter table CCM_CORE.SITES
add constraint UK_kou1h4y4st2m173he44yy8grx unique (DOMAIN_OF_SITE);
alter table CCM_CORE.WORKFLOW_TASK_ASSIGNMENTS
add constraint UK_gv93k167pe9qy3go9vjau1q2t unique (UUID);
alter table CCM_CORE.WORKFLOW_TASK_COMMENTS
add constraint UK_4nnedf08odyjxalfkg16fmjoi unique (UUID);
alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES
add constraint UK_787va2ep8ucoul29qgsoaxnub unique (uuid);
alter table CCM_CORE.WORKFLOW_TASKS
add constraint UK_2u6ruatxij8wfojl8a1eigqqd unique (UUID);

View File

@ -66,25 +66,31 @@ ccm_core.groups:
ccm_core.group_memberships:
# admins <-> jdoe
- membership_id: -100
uuid: 1f9dad0a-c51a-49e7-8720-c3c669cde67e
group_id: -40
member_id: -10
# users <-> mmuster
- membership_id: -200
uuid: 3837b1c2-b4e4-44b9-a92f-2330d76b51df
group_id: -50
member_id: -20
# users <-> joe
- membership_id: -300
uuid: cf8ffbc6-96d3-4e23-9503-4b396ea112aa
group_id: -50
member_id: -30
# editors <-> joe
- membership_id: -400
uuid: 610ad227-cc55-4a8f-b532-3a5204f9d2dd
group_id: -60
member_id: -30
# admins <-> mmuster
- membership_id: -500
uuid: 555657c8-e8ce-41e1-a327-f853901c8813
group_id: -40
member_id: -20
# editors <-> jdoe
- membership_id: -600
uuid: ed78b175-3ff3-4f34-8a5f-829e2113c593
group_id: -60
member_id: -10

View File

@ -66,9 +66,11 @@ ccm_core.groups:
ccm_core.group_memberships:
# users <-> joe
- membership_id: -300
uuid: cf8ffbc6-96d3-4e23-9503-4b396ea112aa
group_id: -50
member_id: -30
# editors <-> joe
- membership_id: -400
uuid: 610ad227-cc55-4a8f-b532-3a5204f9d2dd
group_id: -60
member_id: -30

View File

@ -66,17 +66,21 @@ ccm_core.groups:
ccm_core.group_memberships:
# admins <-> jdoe
- membership_id: -100
uuid: 1f9dad0a-c51a-49e7-8720-c3c669cde67e
group_id: -40
member_id: -10
# users <-> mmuster
- membership_id: -200
uuid: 3837b1c2-b4e4-44b9-a92f-2330d76b51df
group_id: -50
member_id: -20
# users <-> joe
- membership_id: -300
uuid: cf8ffbc6-96d3-4e23-9503-4b396ea112aa
group_id: -50
member_id: -30
# editors <-> joe
- membership_id: -400
uuid: 610ad227-cc55-4a8f-b532-3a5204f9d2dd
group_id: -60
member_id: -30

View File

@ -17,20 +17,24 @@ ccm_core.ccm_objects:
uuid: 1c31700a-f9db-4188-812f-12dba4186c75
ccm_core.permissions:
- permission_id: -30001
uuid: 0b6b8076-f88b-4111-880a-780103d06a55
granted_privilege: privilege1
grantee_id: -10001
inherited: false
- permission_id: -30002
uuid: 58210e1f-482c-4d69-9746-dd4d0d587491
granted_privilege: privilege2
object_id: -20001
grantee_id: -10001
inherited: false
- permission_id: -30003
uuid: 350d8860-e6b1-4788-82e5-6e579996c983
granted_privilege: privilege2
object_id: -20002
grantee_id: -10002
inherited: false
- permission_id: -30004
uuid: 94efe5ec-94f0-4ffb-a6b1-720018915fd4
granted_privilege: privilege2
object_id: -20003
grantee_id: -10002

View File

@ -43,40 +43,48 @@ ccm_core.categories:
parent_category_id: -20002
ccm_core.categorizations:
- categorization_id: -40001
uuid: 3da32dd7-4f5f-4637-b87e-e431c44d5c14
category_id: -20003
object_id: -20004
ccm_core.permissions:
- permission_id: -30001
uuid: 0b6b8076-f88b-4111-880a-780103d06a55
granted_privilege: privilege1
grantee_id: -10001
inherited: false
- permission_id: -30002
uuid: 58210e1f-482c-4d69-9746-dd4d0d587491
granted_privilege: privilege2
object_id: -20001
grantee_id: -10001
inherited: false
- permission_id: -30003
uuid: 350d8860-e6b1-4788-82e5-6e579996c983
granted_privilege: privilege2
object_id: -20002
grantee_id: -10002
inherited: false
- permission_id: -30004
uuid: 94efe5ec-94f0-4ffb-a6b1-720018915fd4
granted_privilege: privilege4
object_id: -20001
grantee_id: -10001
inherited: false
- permission_id: -30005
uuid: a5e89679-6a93-4336-a802-d7120ba1ef5a
granted_privilege: privilege4
object_id: -20002
grantee_id: -10001
inherited: false
- permission_id: -30006
uuid: db46a965-c6a9-490a-8dfb-28ddef1aa69a
granted_privilege: privilege4
object_id: -20003
grantee_id: -10001
inherited: true
inherited_from_id: -20002
- permission_id: -30007
uuid: 152bbdeb-834a-49ea-8087-44e1286ea5c2
granted_privilege: privilege4
object_id: -20004
grantee_id: -10001

View File

@ -43,6 +43,7 @@ ccm_core.categories:
parent_category_id: -20002
ccm_core.categorizations:
- categorization_id: -40001
uuid: 3da32dd7-4f5f-4637-b87e-e431c44d5c14
category_id: -20003
object_id: -20004
category_index: false
@ -50,37 +51,44 @@ ccm_core.categorizations:
object_order: 0
ccm_core.permissions:
- permission_id: -30001
uuid: 0b6b8076-f88b-4111-880a-780103d06a55
granted_privilege: privilege1
grantee_id: -10001
inherited: false
- permission_id: -30002
uuid: 58210e1f-482c-4d69-9746-dd4d0d587491
granted_privilege: privilege2
object_id: -20001
grantee_id: -10001
inherited: false
- permission_id: -30003
uuid: 350d8860-e6b1-4788-82e5-6e579996c983
granted_privilege: privilege2
object_id: -20002
grantee_id: -10002
inherited: false
- permission_id: -30004
uuid: 94efe5ec-94f0-4ffb-a6b1-720018915fd4
granted_privilege: privilege4
object_id: -20001
grantee_id: -10001
inherited: false
- permission_id: -30005
uuid: a5e89679-6a93-4336-a802-d7120ba1ef5a
granted_privilege: privilege4
object_id: -20002
grantee_id: -10001
inherited: true
inherited_from_id: -20001
- permission_id: -30006
uuid: db46a965-c6a9-490a-8dfb-28ddef1aa69a
granted_privilege: privilege4
object_id: -20003
grantee_id: -10001
inherited: true
inherited_from_id: -20001
- permission_id: -30007
uuid: 152bbdeb-834a-49ea-8087-44e1286ea5c2
granted_privilege: privilege4
object_id: -20004
grantee_id: -10001

View File

@ -17,21 +17,26 @@ ccm_core.ccm_objects:
uuid: 1c31700a-f9db-4188-812f-12dba4186c75
ccm_core.permissions:
- permission_id: -30001
uuid: 0b6b8076-f88b-4111-880a-780103d06a55
granted_privilege: privilege1
grantee_id: -10001
- permission_id: -30002
uuid: 58210e1f-482c-4d69-9746-dd4d0d587491
granted_privilege: privilege2
object_id: -20001
grantee_id: -10001
- permission_id: -30003
uuid: 350d8860-e6b1-4788-82e5-6e579996c983
granted_privilege: privilege2
object_id: -20002
grantee_id: -10002
- permission_id: -30004
uuid: 94efe5ec-94f0-4ffb-a6b1-720018915fd4
granted_privilege: privilege2
object_id: -20003
grantee_id: -10002
- permission_id: -30005
uuid: 598beccb-a891-46e3-95c7-47e91d24668f
granted_privilege: privilege3
grantee_id: -10002

View File

@ -43,19 +43,23 @@ ccm_core.categories:
parent_category_id: -20002
ccm_core.categorizations:
- categorization_id: -40001
uuid: 3da32dd7-4f5f-4637-b87e-e431c44d5c14
category_id: -20003
object_id: -20004
ccm_core.permissions:
- permission_id: -30001
uuid: 0b6b8076-f88b-4111-880a-780103d06a55
granted_privilege: privilege1
grantee_id: -10001
inherited: false
- permission_id: -30002
uuid: 58210e1f-482c-4d69-9746-dd4d0d587491
granted_privilege: privilege2
object_id: -20001
grantee_id: -10001
inherited: false
- permission_id: -30003
uuid: 350d8860-e6b1-4788-82e5-6e579996c983
granted_privilege: privilege2
object_id: -20002
grantee_id: -10002

View File

@ -17,6 +17,7 @@ ccm_core.ccm_objects:
uuid: 1c31700a-f9db-4188-812f-12dba4186c75
ccm_core.permissions:
- permission_id: -30003
uuid: 350d8860-e6b1-4788-82e5-6e579996c983
granted_privilege: privilege2
object_id: -20002
grantee_id: -10002

View File

@ -43,6 +43,7 @@ ccm_core.categories:
parent_category_id: -20002
ccm_core.categorizations:
- categorization_id: -40001
uuid: 3da32dd7-4f5f-4637-b87e-e431c44d5c14
category_id: -20003
object_id: -20004
category_index: false
@ -50,15 +51,18 @@ ccm_core.categorizations:
object_order: 0
ccm_core.permissions:
- permission_id: -30001
uuid: 0b6b8076-f88b-4111-880a-780103d06a55
granted_privilege: privilege1
grantee_id: -10001
inherited: false
- permission_id: -30002
uuid: 58210e1f-482c-4d69-9746-dd4d0d587491
granted_privilege: privilege2
object_id: -20001
grantee_id: -10001
inherited: false
- permission_id: -30003
uuid: 350d8860-e6b1-4788-82e5-6e579996c983
granted_privilege: privilege2
object_id: -20002
grantee_id: -10002

View File

@ -17,15 +17,18 @@ ccm_core.ccm_objects:
uuid: 1c31700a-f9db-4188-812f-12dba4186c75
ccm_core.permissions:
- permission_id: -30001
uuid: 0b6b8076-f88b-4111-880a-780103d06a55
granted_privilege: privilege1
grantee_id: -10001
inherited: false
- permission_id: -30002
uuid: 58210e1f-482c-4d69-9746-dd4d0d587491
granted_privilege: privilege2
object_id: -20001
grantee_id: -10001
inherited: false
- permission_id: -30003
uuid: 350d8860-e6b1-4788-82e5-6e579996c983
granted_privilege: privilege2
object_id: -20002
grantee_id: -10002

View File

@ -66,18 +66,22 @@ ccm_core.groups:
ccm_core.group_memberships:
# group1 <-> mmuster
- membership_id: -1000
uuid: db6c2569-f97d-4668-b2a0-406cb9c8edd6
group_id: -100
member_id: -20
# group2 <-> jdoe
- membership_id: -1100
uuid: d82c3896-e574-49f6-b123-ed517a50f4be
group_id: -200
member_id: -10
# group3 <-> mmuster
- membership_id: -1200
uuid: 7d7395b9-48f9-4076-9a98-7fde98123bfd
group_id: -300
member_id: -20
# group3 <-> joe
- membership_id: -1300
uuid: 258610b3-96b0-434a-bc08-3d58ed7525e9
group_id: -300
member_id: -30
ccm_core.ccm_roles:
@ -93,25 +97,31 @@ ccm_core.ccm_roles:
ccm_core.role_memberships:
# role1 <-> jdoe
- membership_id: -3000
uuid: 364220da-f24d-448f-aed5-633e316acc29
role_id: -2000
member_id: -10
# role1 <-> group3
- membership_id: -3100
uuid: 28b9ee03-645d-4b8d-9b4e-9cc7442ffe77
role_id: -2000
member_id: -300
# role2 <-> group1
- membership_id: -3200
uuid: da515fdc-560d-44fb-8f6b-8dbc37fca39d
role_id: -2100
member_id: -100
# role3 <-> joe
- membership_id: -3300
uuid: 9ee86a1a-5aaf-4e8c-bfd5-77bfc846d0b5
role_id: -2200
member_id: -30
# role1 <-> joe
- membership_id: -3400
uuid: 8d3e7346-afa5-44b0-ae86-aafad4a8ebdd
role_id: -2000
member_id: -30
# role3 <-> group1
- membership_id: -3500
uuid: 4c5007e9-fefc-4f2d-82de-2154c48fd908
role_id: -2200
member_id: -100

View File

@ -66,18 +66,22 @@ ccm_core.groups:
ccm_core.group_memberships:
# group1 <-> mmuster
- membership_id: -1000
uuid: db6c2569-f97d-4668-b2a0-406cb9c8edd6
group_id: -100
member_id: -20
# group2 <-> jdoe
- membership_id: -1100
uuid: d82c3896-e574-49f6-b123-ed517a50f4be
group_id: -200
member_id: -10
# group3 <-> mmuster
- membership_id: -1200
uuid: 7d7395b9-48f9-4076-9a98-7fde98123bfd
group_id: -300
member_id: -20
# group3 <-> joe
- membership_id: -1300
uuid: 258610b3-96b0-434a-bc08-3d58ed7525e9
group_id: -300
member_id: -30
ccm_core.ccm_roles:
@ -93,9 +97,11 @@ ccm_core.ccm_roles:
ccm_core.role_memberships:
# role1 <-> group3
- membership_id: -3100
uuid: 28b9ee03-645d-4b8d-9b4e-9cc7442ffe77
role_id: -2000
member_id: -300
# role3 <-> joe
- membership_id: -3300
uuid: 9ee86a1a-5aaf-4e8c-bfd5-77bfc846d0b5
role_id: -2200
member_id: -30

View File

@ -66,18 +66,22 @@ ccm_core.groups:
ccm_core.group_memberships:
# group1 <-> mmuster
- membership_id: -1000
uuid: db6c2569-f97d-4668-b2a0-406cb9c8edd6
group_id: -100
member_id: -20
# group2 <-> jdoe
- membership_id: -1100
uuid: d82c3896-e574-49f6-b123-ed517a50f4be
group_id: -200
member_id: -10
# group3 <-> mmuster
- membership_id: -1200
uuid: 7d7395b9-48f9-4076-9a98-7fde98123bfd
group_id: -300
member_id: -20
# group3 <-> joe
- membership_id: -1300
uuid: 258610b3-96b0-434a-bc08-3d58ed7525e9
group_id: -300
member_id: -30
ccm_core.ccm_roles:
@ -93,17 +97,21 @@ ccm_core.ccm_roles:
ccm_core.role_memberships:
# role1 <-> jdoe
- membership_id: -3000
uuid: 364220da-f24d-448f-aed5-633e316acc29
role_id: -2000
member_id: -10
# role1 <-> group3
- membership_id: -3100
uuid: 28b9ee03-645d-4b8d-9b4e-9cc7442ffe77
role_id: -2000
member_id: -300
# role2 <-> group1
- membership_id: -3200
uuid: da515fdc-560d-44fb-8f6b-8dbc37fca39d
role_id: -2100
member_id: -100
# role3 <-> joe
- membership_id: -3300
uuid: 9ee86a1a-5aaf-4e8c-bfd5-77bfc846d0b5
role_id: -2200
member_id: -30

View File

@ -82,18 +82,22 @@ ccm_core.groups:
ccm_core.group_memberships:
# group1 <-> mmuster
- membership_id: -50001
uuid: 488f36d0-f947-4fd9-b31b-98f3aa031d1f
group_id: -42001
member_id: -41002
# group2 <-> jdoe
- membership_id: -50002
uuid: ed169bec-cf86-4b74-9614-69fa93f9dde0
group_id: -42002
member_id: -41001
# group3 <-> mmuster
- membership_id: -50003
uuid: 9bde3956-c622-41d8-bad6-17074e6b2c6c
group_id: -42003
member_id: -41002
# group3 <-> joe
- membership_id: -50004
uuid: 59424686-dddd-4574-b1f3-8abee245fce4
group_id: -42003
member_id: -41003
ccm_core.ccm_roles:
@ -109,14 +113,17 @@ ccm_core.ccm_roles:
ccm_core.role_memberships:
# role1 <-> group1
- membership_id: -60001
uuid: a0da173a-8825-4262-923f-61b0944d74e5
role_id: -10001
member_id: -42001
# role2 <-> jdoe
- membership_id: -60002
uuid: d4f4b611-7048-4239-9aa1-dd79e4a22980
role_id: -10002
member_id: -41001
# public-role <-> public-user
- membership_id: -60003
uuid: 5bee29d5-11d0-4015-b91a-27199ce5190a
role_id: -10003
member_id: -41004
ccm_core.ccm_objects:
@ -132,23 +139,27 @@ ccm_core.ccm_objects:
ccm_core.permissions:
# permission for privilege1 granted to role1
- permission_id: -30001
uuid: fb5f1353-5138-4570-9143-38bd96d1481e
granted_privilege: privilege1
grantee_id: -10001
inherited: false
# permission for privilege2 granted on object1 to role1
- permission_id: -30002
uuid: d1d06a40-3394-44d5-910d-a003215f1a7e
granted_privilege: privilege2
object_id: -20001
grantee_id: -10001
inherited: false
# permission for privilege2 granted on object2 to role2
- permission_id: -30003
uuid: a714cb3d-af1e-4ee7-bd6e-2c184d629472
granted_privilege: privilege2
object_id: -20002
grantee_id: -10002
inherited: false
# permission for privilege3 granted on object1 to public-role
- permission_id: -30004
uuid: 4a724998-28cd-4060-a92a-a6225e7260e4
granted_privilege: privilege3
object_id: -20001
grantee_id: -10003

View File

@ -22,7 +22,7 @@ import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.hibernate.validator.constraints.NotBlank;
import org.libreccm.core.CcmObject;
import org.libreccm.portation.Portable;
import org.libreccm.imexport.Exportable;
import org.libreccm.security.User;
import javax.persistence.Column;
@ -33,6 +33,7 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
@ -47,7 +48,7 @@ import java.util.Date;
*/
@Entity
@Table(schema = "CCM_DOCREPO", name = "RESOURCES")
public abstract class AbstractResource extends CcmObject implements Portable {
public abstract class AbstractResource extends CcmObject implements Exportable {
private static final Logger log = LogManager.getLogger(AbstractResource.class);

View File

@ -18,16 +18,17 @@
*/
package org.libreccm.docrepo;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.imexport.AbstractEntityImExporter;
/**
* Abstract Marshaller class for importing and exporting the {@code
* Abstract Im/Exporter 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
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @author <a href="mailto:jens.pelzetter@uni-bremen.de">Jens Pelzetter</a>
* @param <R> Type of resource
*/
public abstract class AbstractResourceMarshaller<R extends AbstractResource>
extends AbstractMarshaller<R> {
public abstract class AbstractResourceImExporter<R extends AbstractResource>
extends AbstractEntityImExporter<R> {
}

View File

@ -21,7 +21,7 @@ package org.libreccm.docrepo;
import org.hibernate.validator.constraints.NotEmpty;
import org.libreccm.core.Identifiable;
import org.libreccm.portation.Portable;
import org.libreccm.imexport.Exportable;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -46,7 +46,7 @@ import java.util.Objects;
*/
@Entity
@Table(schema = "CCM_DOCREPO", name = "BLOB_OBJECTS")
public class BlobObject implements Identifiable, Serializable, Portable {
public class BlobObject implements Identifiable, Serializable, Exportable {
private static final long serialVersionUID = -7468014879548796218L;

View File

@ -18,33 +18,37 @@
*/
package org.libreccm.docrepo;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.portation.Marshals;
import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.imexport.Processes;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
/**
* Marshaller class for importing and exporting {@code BlobObject}s from the
* Im/Exporter 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
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*
*/
@RequestScoped
@Marshals(BlobObject.class)
public class BlobObjectMarshaller extends AbstractMarshaller<BlobObject> {
@Processes(BlobObject.class)
public class BlobObjectImExporter extends AbstractEntityImExporter<BlobObject> {
@Inject
private BlobObjectRepository blobObjectRepository;
@Override
protected Class<BlobObject> getObjectClass() {
protected Class<BlobObject> getEntityClass() {
return BlobObject.class;
}
@Override
protected void insertIntoDb(BlobObject portableObject) {
blobObjectRepository.save(portableObject);
@Transactional(Transactional.TxType.REQUIRED)
protected void saveImportedEntity(final BlobObject entity) {
blobObjectRepository.save(entity);
}
}

View File

@ -19,8 +19,6 @@
package org.libreccm.docrepo;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

View File

@ -18,33 +18,37 @@
*/
package org.libreccm.docrepo;
import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import org.libreccm.portation.Marshals;
import javax.inject.Inject;
import javax.transaction.Transactional;
/**
* Marshaller class for importing and exporting {@code File}s from the
* Im/Exporter 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
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Marshals(File.class)
public class FileMarshaller extends AbstractResourceMarshaller<File> {
@Processes(File.class)
public class FileImExporter extends AbstractEntityImExporter<File> {
@Inject
private FileRepository fileRepository;
@Override
protected Class<File> getObjectClass() {
protected Class<File> getEntityClass() {
return File.class;
}
@Override
protected void insertIntoDb(File portableObject) {
@Transactional(Transactional.TxType.REQUIRED)
protected void saveImportedEntity(final File portableObject) {
fileRepository.save(portableObject);
}
}

View File

@ -18,32 +18,34 @@
*/
package org.libreccm.docrepo;
import org.libreccm.portation.Marshals;
import org.libreccm.imexport.Processes;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
/**
* Marshaller class for importing and exporting {@code Folder}s from the
* Im/Exporter for importing and exporting {@link 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
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @author <a href="mailto:jens.pelzetter@uni-bremen.de">Jens Pelzetter</a>
*/
@RequestScoped
@Marshals(Folder.class)
public class FolderMarshaller extends AbstractResourceMarshaller<Folder> {
@Processes(Folder.class)
public class FolderImExporter extends AbstractResourceImExporter<Folder> {
@Inject
private FolderRepository folderRepository;
@Override
protected Class<Folder> getObjectClass() {
protected Class<Folder> getEntityClass() {
return Folder.class;
}
@Override
protected void insertIntoDb(Folder portableObject) {
folderRepository.save(portableObject);
@Transactional(Transactional.TxType.REQUIRED)
protected void saveImportedEntity(final Folder entity) {
folderRepository.save(entity);
}
}

View File

@ -19,7 +19,7 @@
package org.libreccm.docrepo;
import org.hibernate.validator.constraints.NotBlank;
import org.libreccm.portation.Portable;
import org.libreccm.imexport.Exportable;
import org.libreccm.security.User;
import org.libreccm.web.CcmApplication;
@ -31,6 +31,7 @@ import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import java.util.List;
/**
@ -46,7 +47,7 @@ import java.util.List;
@NamedQuery(name = "DocRepo.findRepositoriesForOwner",
query = "SELECT r FROM Repository r WHERE r.owner = :owner")
})
public class Repository extends CcmApplication implements Portable {
public class Repository extends CcmApplication implements Exportable {
private static final long serialVersionUID = 6673243021462798036L;

View File

@ -18,30 +18,30 @@
*/
package org.libreccm.docrepo;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.portation.Marshals;
import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.imexport.Processes;
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
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Marshals(Repository.class)
public class RepositoryMarshaller extends AbstractMarshaller<Repository> {
@Processes(Repository.class)
public class RepositoryImExporter extends AbstractEntityImExporter<Repository> {
@Inject
private RepositoryRepository repositoryRepository;
@Override
protected Class<Repository> getObjectClass() {
protected Class<Repository> getEntityClass() {
return Repository.class;
}
@Override
protected void insertIntoDb(Repository portableObject) {
protected void saveImportedEntity(final Repository portableObject) {
repositoryRepository.save(portableObject);
}
}

View File

@ -116,7 +116,6 @@ public class ShortcutManagerTest {
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class

View File

@ -104,7 +104,6 @@ public class ShortcutRepositoryTest {
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<ccm_core.parties party_id="-100"
uuid="5141f8b6-cade-46c1-b64a-d1556aa285ad"
name="public-user" />
<ccm_core.parties party_id="-110"
uuid="7d98ad7e-b27c-401e-a116-217130ee5774"
name="jdoe" />
<ccm_core.users party_id="-100"
@ -25,13 +27,16 @@
password_reset_required="false" />
<ccm_core.ccm_roles role_id="-200"
uuid="54a64f55-7f10-4cfb-b36d-2c1b5c2c18f5"
name="shortcuts-manager"/>
<ccm_core.role_memberships membership_id="-300"
uuid="8a9c84fd-2fe2-45b6-aab4-a5aa68aba656"
role_id="-200"
member_id="-110" />
<ccm_core.permissions permission_id="-400"
uuid="b8d46b90-3014-407c-9942-4776061dd292"
granted_privilege="manage_shortcuts"
grantee_id="-200"
inherited="false" />

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<ccm_core.parties party_id="-100"
uuid="5141f8b6-cade-46c1-b64a-d1556aa285ad"
name="public-user" />
<ccm_core.parties party_id="-110"
uuid="7d98ad7e-b27c-401e-a116-217130ee5774"
name="jdoe" />
<ccm_core.users party_id="-100"
@ -25,13 +27,16 @@
password_reset_required="false" />
<ccm_core.ccm_roles role_id="-200"
uuid="54a64f55-7f10-4cfb-b36d-2c1b5c2c18f5"
name="shortcuts-manager"/>
<ccm_core.role_memberships membership_id="-300"
uuid="8a9c84fd-2fe2-45b6-aab4-a5aa68aba656"
role_id="-200"
member_id="-110" />
<ccm_core.permissions permission_id="-400"
uuid="b8d46b90-3014-407c-9942-4776061dd292"
granted_privilege="manage_shortcuts"
grantee_id="-200"
inherited="false" />