From 5fb80631c9c8002240e12e9dfe809c95058b3fe7 Mon Sep 17 00:00:00 2001 From: tosmers Date: Mon, 21 Nov 2016 17:39:45 +0000 Subject: [PATCH] [FEATURE] - adds implementation of abstract marshaller class to every exportable class - adds interface tag 'Portable' to each class with wishes of being ex- or imported git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4448 8810af33-2d31-482b-a856-94f89814c4df --- .svnignore | 2 +- .../categorization/Categorization.java | 15 ++-- .../CategorizationMarshaller.java | 50 +++++++++++ .../org/libreccm/categorization/Category.java | 8 +- .../categorization/CategoryMarshaller.java | 43 +++++++++ .../java/org/libreccm/core/CcmObject.java | 12 +-- .../portation/AbstractMarshaller.java | 90 ++++++++++--------- .../java/org/libreccm/portation/Format.java | 2 +- .../org/libreccm/portation/Marshaller.java | 58 ++++++------ .../java/org/libreccm/portation/Marshals.java | 2 +- .../java/org/libreccm/portation/Portable.java | 28 ++++++ .../java/org/libreccm/security/Group.java | 5 +- .../libreccm/security/GroupMarshaller.java | 43 +++++++++ .../libreccm/security/GroupMembership.java | 7 +- .../security/GroupMembershipMarshaller.java | 48 ++++++++++ .../java/org/libreccm/security/Party.java | 3 + .../org/libreccm/security/Permission.java | 21 +++-- .../security/PermissionMarshaller.java | 48 ++++++++++ .../main/java/org/libreccm/security/Role.java | 27 +++--- .../org/libreccm/security/RoleMarshaller.java | 43 +++++++++ .../org/libreccm/security/RoleMembership.java | 7 +- .../security/RoleMembershipMarshaller.java | 48 ++++++++++ .../main/java/org/libreccm/security/User.java | 5 +- .../org/libreccm/security/UserMarshaller.java | 43 +++++++++ .../org/libreccm/workflow/AssignableTask.java | 5 +- .../workflow/AssignableTaskMarshaller.java | 43 +++++++++ .../org/libreccm/workflow/TaskAssignment.java | 6 +- .../workflow/TaskAssignmentMarshaller.java | 48 ++++++++++ .../java/org/libreccm/workflow/Workflow.java | 9 +- .../libreccm/workflow/WorkflowMarshaller.java | 43 +++++++++ .../libreccm/workflow/WorkflowTemplate.java | 18 ++-- .../workflow/WorkflowTemplateMarshaller.java | 44 +++++++++ .../libreccm/docrepo/AbstractResource.java | 4 +- .../java/org/libreccm/docrepo/BlobObject.java | 3 +- .../docrepo/BlobObjectMarshaller.java | 4 +- .../org/libreccm/docrepo/FileMarshaller.java | 4 +- .../libreccm/docrepo/FolderMarshaller.java | 4 +- .../java/org/libreccm/docrepo/Repository.java | 3 +- .../docrepo/RepositoryMarshaller.java | 4 +- .../docrepo/FilePortationTest/test2.xml | 2 +- .../docrepo/FilePortationTest/test3.xml | 6 +- .../docrepo/FilePortationTest/test4.xml | 6 +- 42 files changed, 773 insertions(+), 141 deletions(-) create mode 100644 ccm-core/src/main/java/org/libreccm/categorization/CategorizationMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/categorization/CategoryMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/portation/Portable.java create mode 100644 ccm-core/src/main/java/org/libreccm/security/GroupMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/security/GroupMembershipMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/security/PermissionMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/security/RoleMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/security/RoleMembershipMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/security/UserMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/workflow/TaskAssignmentMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/workflow/WorkflowMarshaller.java create mode 100644 ccm-core/src/main/java/org/libreccm/workflow/WorkflowTemplateMarshaller.java diff --git a/.svnignore b/.svnignore index 57e6ec717..d7014a6bf 100644 --- a/.svnignore +++ b/.svnignore @@ -2,4 +2,4 @@ *.iml target nb-configuration.xml -*.log \ No newline at end of file +*.log diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java b/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java index ad7bf1397..de1e90bd5 100644 --- a/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java +++ b/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java @@ -18,12 +18,9 @@ */ package org.libreccm.categorization; -import static org.libreccm.core.CoreConstants.*; - +import com.fasterxml.jackson.annotation.JsonBackReference; import org.libreccm.core.CcmObject; - -import java.io.Serializable; -import java.util.Objects; +import org.libreccm.portation.Portable; import javax.persistence.Column; import javax.persistence.Entity; @@ -35,6 +32,10 @@ import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; +import java.io.Serializable; +import java.util.Objects; + +import static org.libreccm.core.CoreConstants.DB_SCHEMA; /** * Association class describing the association between a category and an @@ -66,7 +67,7 @@ import javax.persistence.Table; + "WHERE c.category = :category " + "AND c.index = TRUE") }) -public class Categorization implements Serializable { +public class Categorization implements Serializable, Portable { private static final long serialVersionUID = 201504301320L; @@ -83,6 +84,7 @@ public class Categorization implements Serializable { */ @ManyToOne @JoinColumn(name = "CATEGORY_ID") + @JsonBackReference private Category category; /** @@ -90,6 +92,7 @@ public class Categorization implements Serializable { */ @ManyToOne @JoinColumn(name = "OBJECT_ID") + @JsonBackReference private CcmObject categorizedObject; /** diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategorizationMarshaller.java b/ccm-core/src/main/java/org/libreccm/categorization/CategorizationMarshaller.java new file mode 100644 index 000000000..1c9bd23c3 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/categorization/CategorizationMarshaller.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.categorization; + +import org.libreccm.portation.AbstractMarshaller; + +import javax.inject.Inject; +import javax.persistence.EntityManager; +import javax.transaction.Transactional; + +/** + * @author objects; /** @@ -187,6 +191,7 @@ public class Category extends CcmObject implements InheritsPermissions, @OneToMany(mappedBy = "parentCategory") @XmlElementWrapper(name = "subcategories", namespace = CAT_XML_NS) @XmlElement(name = "category") + @JsonManagedReference private List subCategories; /** @@ -195,6 +200,7 @@ public class Category extends CcmObject implements InheritsPermissions, */ @ManyToOne @JoinColumn(name = "PARENT_CATEGORY_ID") + @JsonBackReference private Category parentCategory; /** diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategoryMarshaller.java b/ccm-core/src/main/java/org/libreccm/categorization/CategoryMarshaller.java new file mode 100644 index 000000000..c5aaec025 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/categorization/CategoryMarshaller.java @@ -0,0 +1,43 @@ +/* + * 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.categorization; + +import org.libreccm.portation.AbstractMarshaller; + +import javax.inject.Inject; + +/** + * @author permissions; /** @@ -125,6 +126,7 @@ public class CcmObject implements Identifiable, Serializable { @OneToMany(mappedBy = "categorizedObject") @XmlElementWrapper(name = "categories", namespace = CORE_XML_NS) @XmlElement(name = "category", namespace = CORE_XML_NS) + @JsonManagedReference private List categories; public CcmObject() { @@ -164,7 +166,7 @@ public class CcmObject implements Identifiable, Serializable { * @return Returns all permissions for this {@code CcmObject}. Please note * that the returned {@link List} can't be modified. For adding and * removing permissions use the methods provided by the - * {@link CcmObjectManager}. + * {@code CcmObjectManager}. */ public List getPermissions() { return Collections.unmodifiableList(permissions); @@ -311,7 +313,7 @@ public class CcmObject implements Identifiable, Serializable { * * @param obj The object to check. * - * @return {@code true} if {@link obj} can equal this, false otherwise. + * @return {@code true} if {@code obj} can equal this, false otherwise. */ public boolean canEqual(final Object obj) { return obj instanceof CcmObject; diff --git a/ccm-core/src/main/java/org/libreccm/portation/AbstractMarshaller.java b/ccm-core/src/main/java/org/libreccm/portation/AbstractMarshaller.java index 800f4d3dd..1d654eb14 100644 --- a/ccm-core/src/main/java/org/libreccm/portation/AbstractMarshaller.java +++ b/ccm-core/src/main/java/org/libreccm/portation/AbstractMarshaller.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import org.apache.log4j.Logger; -import org.libreccm.core.Identifiable; import java.io.File; import java.io.FileWriter; @@ -42,7 +41,7 @@ import java.util.List; * @author { } break; - case JSON: - break; - - case CSV: - break; - default: break; } - if (line != null) { try { fileWriter.write(line); fileWriter.write(System.getProperty("line.separator")); } catch (IOException e) { - log.error(String.format("Unable to write to file with the" + - " name %s.", file.getName())); + log.error(String.format("Unable to write to file with" + + " the name %s.", file.getName())); } } } - try { fileWriter.close(); } catch (IOException e) { log.error(String.format("Unable to close a fileWriter for the" + " file with the name %s.", file.getName())); } - } } - protected abstract Class getObjectClass(); - protected abstract void insertIntoDb(I object); - - public List importFile() { + /** + * 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 List of imported objects. + */ + public List

importFile() { File file = new File(filename); List lines = null; @@ -157,10 +158,10 @@ public abstract class AbstractMarshaller { "name %s.", file.getName())); } - List objects = new ArrayList(); + List

objects = new ArrayList<>(); if (lines != null) { for (String line : lines) { - I object = null; + P object = null; switch (format) { case XML: try { @@ -171,12 +172,6 @@ public abstract class AbstractMarshaller { } break; - case JSON: - break; - - case CSV: - break; - default: break; } @@ -189,4 +184,17 @@ public abstract class AbstractMarshaller { return objects; } + /** + * Abstract method to get the object class to determine the type {@code P}. + * + * @return The object class + */ + protected abstract Class

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); } diff --git a/ccm-core/src/main/java/org/libreccm/portation/Format.java b/ccm-core/src/main/java/org/libreccm/portation/Format.java index 34b371b7f..31277e9ae 100644 --- a/ccm-core/src/main/java/org/libreccm/portation/Format.java +++ b/ccm-core/src/main/java/org/libreccm/portation/Format.java @@ -23,5 +23,5 @@ package org.libreccm.portation; * @version created the 03.02.2016 */ public enum Format { - CSV, XML, JSON + XML } diff --git a/ccm-core/src/main/java/org/libreccm/portation/Marshaller.java b/ccm-core/src/main/java/org/libreccm/portation/Marshaller.java index 761698646..dc379ce17 100644 --- a/ccm-core/src/main/java/org/libreccm/portation/Marshaller.java +++ b/ccm-core/src/main/java/org/libreccm/portation/Marshaller.java @@ -45,13 +45,11 @@ public class Marshaller { @Inject @Any - private Instance> - marshallerInstances; - - // Assigns lists with objects of the same type as values to their typ as - // key. - private Map, List> classListMap; + private Instance> marshallerInstances; + // Assigns lists with objects of the same type as values to their typ. + // The type represents the key + private Map, List> classListMap; /** * Main export method. Organizes the objects into list of the same type @@ -61,11 +59,12 @@ public class Marshaller { * @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 objects, Format format, - String filename) { + public void exportObjects(List objects, + Format format, + String filename) { putObjects(objects); - for (Map.Entry, List> + for (Map.Entry, List> classListEntry : classListMap.entrySet()) { exportList(classListEntry.getValue(), classListEntry.getKey(), format, filename); @@ -81,14 +80,14 @@ public class Marshaller { * * @param objects list of all objects being organized */ - private void putObjects(List objects) { - for (Identifiable object : objects) { - Class type = object.getClass(); + private void putObjects(List objects) { + for (Portable object : objects) { + Class type = object.getClass(); if (classListMap.containsKey(type)) { classListMap.get(type).add(object); } else { - List values = new ArrayList<>(); + List values = new ArrayList<>(); values.add(object); classListMap.put(type, values); } @@ -107,12 +106,13 @@ public class Marshaller { * @param type The class of the type * @param format The export style * @param filename The filename - * @param The type of the current marshaller + * @param

The type of the current marshaller */ - private void exportList(List list, Class type, Format format, String filename) { - - final Instance> + private

void exportList(List

list, + Class type, + Format format, + String filename) { + final Instance> marshallerInstance = marshallerInstances.select(new MarshalsLiteral(type)); @@ -127,10 +127,10 @@ public class Marshaller { .getName())); } else { // Get the marshaller for this list and call the export method. - final Iterator> + final Iterator> iterator = marshallerInstance.iterator(); @SuppressWarnings("unchecked") - final AbstractMarshaller marshaller = (AbstractMarshaller) + final AbstractMarshaller

marshaller = (AbstractMarshaller

) iterator.next(); marshaller.prepare(format, filename + "__" + type.toString(), @@ -151,9 +151,9 @@ public class Marshaller { * * @param filenames List of filenames for the files wishing to be imported * @param format The import style - * @param The type of the current marshaller + * @param

The type of the current marshaller */ - public void importObjects( + public

void importObjects( List filenames, Format format) { for (String filename : filenames) { String[] splitFilename = filename.split("__"); @@ -163,9 +163,9 @@ public class Marshaller { try { Class clazz = Class.forName(className); @SuppressWarnings("unchecked") - Class type = clazz.asSubclass(Identifiable.class); + Class

type = clazz.asSubclass(Portable.class); - final Instance> + final Instance> marshallerInstance = marshallerInstances.select(new MarshalsLiteral(type)); @@ -180,10 +180,10 @@ public class Marshaller { .getName())); } else { // Get the marshaller for this list and call the export method. - final Iterator> + final Iterator> iterator = marshallerInstance.iterator(); @SuppressWarnings("unchecked") - final AbstractMarshaller marshaller = (AbstractMarshaller) + final AbstractMarshaller

marshaller = (AbstractMarshaller

) iterator.next(); marshaller.prepare(format, filename, false); @@ -202,14 +202,14 @@ public class Marshaller { implements Marshals { private static final long serialVersionUID = -8093783826632252875L; - private final Class entityClass; + private final Class entityClass; - public MarshalsLiteral(Class entityClass) { + public MarshalsLiteral(Class entityClass) { this.entityClass = entityClass; } @Override - public Class value() { + public Class value() { return entityClass; } } diff --git a/ccm-core/src/main/java/org/libreccm/portation/Marshals.java b/ccm-core/src/main/java/org/libreccm/portation/Marshals.java index 636c78a0c..c1c34c0af 100644 --- a/ccm-core/src/main/java/org/libreccm/portation/Marshals.java +++ b/ccm-core/src/main/java/org/libreccm/portation/Marshals.java @@ -42,5 +42,5 @@ import java.lang.annotation.Target; ElementType.METHOD}) public @interface Marshals { - Class value(); + Class value(); } diff --git a/ccm-core/src/main/java/org/libreccm/portation/Portable.java b/ccm-core/src/main/java/org/libreccm/portation/Portable.java new file mode 100644 index 000000000..a27d3632c --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/portation/Portable.java @@ -0,0 +1,28 @@ +/* + * 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 memberships = new HashSet<>(); public Group() { diff --git a/ccm-core/src/main/java/org/libreccm/security/GroupMarshaller.java b/ccm-core/src/main/java/org/libreccm/security/GroupMarshaller.java new file mode 100644 index 000000000..58afaab8f --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/security/GroupMarshaller.java @@ -0,0 +1,43 @@ +/* + * 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.security; + +import org.libreccm.portation.AbstractMarshaller; + +import javax.inject.Inject; + +/** + * @author roleMemberships = new HashSet<>(); protected Party() { diff --git a/ccm-core/src/main/java/org/libreccm/security/Permission.java b/ccm-core/src/main/java/org/libreccm/security/Permission.java index c54286153..c92cb239d 100644 --- a/ccm-core/src/main/java/org/libreccm/security/Permission.java +++ b/ccm-core/src/main/java/org/libreccm/security/Permission.java @@ -18,13 +18,9 @@ */ package org.libreccm.security; -import static org.libreccm.core.CoreConstants.*; - +import com.fasterxml.jackson.annotation.JsonBackReference; import org.libreccm.core.CcmObject; - -import java.io.Serializable; -import java.util.Date; -import java.util.Objects; +import org.libreccm.portation.Portable; import javax.persistence.Column; import javax.persistence.Entity; @@ -35,7 +31,6 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @@ -43,6 +38,12 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.Date; +import java.util.Objects; + +import static org.libreccm.core.CoreConstants.CORE_XML_NS; +import static org.libreccm.core.CoreConstants.DB_SCHEMA; /** * A permission grants a privilege on an object or system wide to {@link Role}. @@ -71,7 +72,7 @@ import javax.xml.bind.annotation.XmlRootElement; }) @XmlRootElement(name = "permission", namespace = CORE_XML_NS) @XmlAccessorType(XmlAccessType.FIELD) -public class Permission implements Serializable { +public class Permission implements Serializable, Portable { private static final long serialVersionUID = -5178045844045517958L; @@ -94,8 +95,9 @@ public class Permission implements Serializable { /** * The object on which the privilege is granted. My be {@code null}. */ - @OneToOne + @ManyToOne @JoinColumn(name = "OBJECT_ID") + @JsonBackReference private CcmObject object; /** @@ -103,6 +105,7 @@ public class Permission implements Serializable { */ @ManyToOne @JoinColumn(name = "GRANTEE_ID") + @JsonBackReference private Role grantee; /** diff --git a/ccm-core/src/main/java/org/libreccm/security/PermissionMarshaller.java b/ccm-core/src/main/java/org/libreccm/security/PermissionMarshaller.java new file mode 100644 index 000000000..63f408535 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/security/PermissionMarshaller.java @@ -0,0 +1,48 @@ +/* + * 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.security; + +import org.libreccm.portation.AbstractMarshaller; + +import javax.inject.Inject; +import javax.persistence.EntityManager; + +/** + * @author memberships = new HashSet<>(); /** @@ -156,9 +159,11 @@ public class Role implements Serializable { @OneToMany(mappedBy = "grantee") @XmlElementWrapper(name = "permissions", namespace = CORE_XML_NS) @XmlElement(name = "permission", namespace = CORE_XML_NS) + @JsonManagedReference private List permissions = new ArrayList<>(); @OneToMany(mappedBy = "role") + @JsonManagedReference private List assignedTasks; /** diff --git a/ccm-core/src/main/java/org/libreccm/security/RoleMarshaller.java b/ccm-core/src/main/java/org/libreccm/security/RoleMarshaller.java new file mode 100644 index 000000000..024302276 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/security/RoleMarshaller.java @@ -0,0 +1,43 @@ +/* + * 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.security; + +import org.libreccm.portation.AbstractMarshaller; + +import javax.inject.Inject; + +/** + * @author groupMemberships = new HashSet<>(); protected User() { diff --git a/ccm-core/src/main/java/org/libreccm/security/UserMarshaller.java b/ccm-core/src/main/java/org/libreccm/security/UserMarshaller.java new file mode 100644 index 000000000..51b93cc16 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/security/UserMarshaller.java @@ -0,0 +1,43 @@ +/* + * 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.security; + +import org.libreccm.portation.AbstractMarshaller; + +import javax.inject.Inject; + +/** + * @author assignments; public AssignableTask() { diff --git a/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskMarshaller.java b/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskMarshaller.java new file mode 100644 index 000000000..ce452f808 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskMarshaller.java @@ -0,0 +1,43 @@ +/* + * 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 org.libreccm.portation.AbstractMarshaller; + +import javax.inject.Inject; + +/** + * @author { } @Override - protected void insertIntoDb(BlobObject object) { - blobObjectRepository.save(object); + protected void insertIntoDb(BlobObject portableObject) { + blobObjectRepository.save(portableObject); } } diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/FileMarshaller.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/FileMarshaller.java index 564114c6a..dd7c9f5c7 100644 --- a/ccm-docrepo/src/main/java/org/libreccm/docrepo/FileMarshaller.java +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/FileMarshaller.java @@ -44,7 +44,7 @@ public class FileMarshaller extends AbstractResourceMarshaller { } @Override - protected void insertIntoDb(File object) { - fileRepository.save(object); + protected void insertIntoDb(File portableObject) { + fileRepository.save(portableObject); } } diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/FolderMarshaller.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/FolderMarshaller.java index 3ee00a000..517d771ee 100644 --- a/ccm-docrepo/src/main/java/org/libreccm/docrepo/FolderMarshaller.java +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/FolderMarshaller.java @@ -43,7 +43,7 @@ public class FolderMarshaller extends AbstractResourceMarshaller { } @Override - protected void insertIntoDb(Folder object) { - folderRepository.save(object); + protected void insertIntoDb(Folder portableObject) { + folderRepository.save(portableObject); } } diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/Repository.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/Repository.java index 5612b3c40..1ad2460ca 100644 --- a/ccm-docrepo/src/main/java/org/libreccm/docrepo/Repository.java +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/Repository.java @@ -19,6 +19,7 @@ package org.libreccm.docrepo; import org.hibernate.validator.constraints.NotBlank; +import org.libreccm.portation.Portable; import org.libreccm.security.User; import org.libreccm.web.CcmApplication; @@ -45,7 +46,7 @@ import java.util.List; @NamedQuery(name = "DocRepo.findRepositoriesForOwner", query = "SELECT r FROM Repository r WHERE r.owner = :owner") }) -public class Repository extends CcmApplication { +public class Repository extends CcmApplication implements Portable { private static final long serialVersionUID = 6673243021462798036L; diff --git a/ccm-docrepo/src/main/java/org/libreccm/docrepo/RepositoryMarshaller.java b/ccm-docrepo/src/main/java/org/libreccm/docrepo/RepositoryMarshaller.java index 424f3499c..adc74dbbf 100644 --- a/ccm-docrepo/src/main/java/org/libreccm/docrepo/RepositoryMarshaller.java +++ b/ccm-docrepo/src/main/java/org/libreccm/docrepo/RepositoryMarshaller.java @@ -41,7 +41,7 @@ public class RepositoryMarshaller extends AbstractMarshaller { } @Override - protected void insertIntoDb(Repository object) { - repositoryRepository.save(object); + protected void insertIntoDb(Repository portableObject) { + repositoryRepository.save(portableObject); } } diff --git a/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test2.xml b/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test2.xml index becdfe6b5..5ea1e7e53 100644 --- a/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test2.xml +++ b/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test2.xml @@ -1 +1 @@ -1bcf940f3-c43a-47da-a029-4ee136757a01testnamethis is a text description/home/tosmers/Svn/libreccm/ccm_ng/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/filename.txt014618361033321461836103332 +13edb95ff-85cc-4af8-aa30-92e4029bfe57testnamethis is a text description/home/tosmers/Svn/libreccm/ccm_ng/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/filename.txt014767195811621476719581162 diff --git a/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test3.xml b/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test3.xml index 52c35fa49..9a570021b 100644 --- a/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test3.xml +++ b/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test3.xml @@ -1,14 +1,14 @@ 1 - bcf940f3-c43a-47da-a029-4ee136757a01 + 3edb95ff-85cc-4af8-aa30-92e4029bfe57 testname this is a text description /home/tosmers/Svn/libreccm/ccm_ng/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/filename.txt 0 - 1461836103332 - 1461836103332 + 1476719581162 + 1476719581162 diff --git a/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test4.xml b/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test4.xml index 52c35fa49..9a570021b 100644 --- a/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test4.xml +++ b/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/test4.xml @@ -1,14 +1,14 @@ 1 - bcf940f3-c43a-47da-a029-4ee136757a01 + 3edb95ff-85cc-4af8-aa30-92e4029bfe57 testname this is a text description /home/tosmers/Svn/libreccm/ccm_ng/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/filename.txt 0 - 1461836103332 - 1461836103332 + 1476719581162 + 1476719581162