diff --git a/ccm-core/src/com/arsdigita/portation/AbstractMarshaller.java b/ccm-core/src/com/arsdigita/portation/AbstractMarshaller.java index 7d63a6dfc..76c6ee5d4 100644 --- a/ccm-core/src/com/arsdigita/portation/AbstractMarshaller.java +++ b/ccm-core/src/com/arsdigita/portation/AbstractMarshaller.java @@ -39,7 +39,7 @@ import java.util.List; * @author , List> classListMap = new HashMap<>(); + private Map, List> classListMap = new HashMap<>(); /** @@ -51,11 +51,11 @@ public class Marshaller { * @param format The exportUsers 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(), @@ -64,7 +64,7 @@ public class Marshaller { } /** - * Organizes a list of different {@link Identifiable} objects into a map + * Organizes a list of different {@link Portable} 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 @@ -72,14 +72,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); } @@ -98,12 +98,12 @@ public class Marshaller { * @param type The class of the type * @param format The exportUsers 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) { + private

void exportList(List

list, Class type, Format format, String filename) { @SuppressWarnings("unchecked") - AbstractMarshaller marshaller = (AbstractMarshaller) list.get + AbstractMarshaller

marshaller = (AbstractMarshaller

) list.get (0).getMarshaller(); marshaller.prepare(format, filename + "__" + type.toString(), diff --git a/ccm-core/src/com/arsdigita/portation/Identifiable.java b/ccm-core/src/com/arsdigita/portation/Portable.java similarity index 90% rename from ccm-core/src/com/arsdigita/portation/Identifiable.java rename to ccm-core/src/com/arsdigita/portation/Portable.java index 9a75f8b15..1f13ce65f 100644 --- a/ccm-core/src/com/arsdigita/portation/Identifiable.java +++ b/ccm-core/src/com/arsdigita/portation/Portable.java @@ -22,7 +22,7 @@ package com.arsdigita.portation; * @author ( NgCollection.categories.values())); } @@ -58,22 +59,23 @@ class ExportHelper { CategorizationMarshaller categorizationMarshaller = new CategorizationMarshaller(); categorizationMarshaller.prepare(Format.XML, pathName, - "categorizations", true); + "categorizations", indentation); categorizationMarshaller.exportList(new ArrayList<>( NgCollection.categorizations.values())); } static void exportUsers() { UserMarshaller userMarshaller = new UserMarshaller(); - userMarshaller.prepare(Format.XML, pathName, "users", true); + userMarshaller.prepare(Format.XML, pathName, + "users", indentation); userMarshaller.exportList(new ArrayList<>( NgCollection.users.values())); } static void exportGroups() { GroupMarshaller groupMarshaller = new GroupMarshaller(); - groupMarshaller.prepare(Format.XML, pathName, "groups", - true); + groupMarshaller.prepare(Format.XML, pathName, + "groups", indentation); groupMarshaller.exportList(new ArrayList<>( NgCollection.groups.values())); } @@ -82,14 +84,15 @@ class ExportHelper { GroupMembershipMarshaller groupMembershipMarshaller = new GroupMembershipMarshaller(); groupMembershipMarshaller.prepare(Format.XML, pathName, - "groupMemberships", true); + "groupMemberships", indentation); groupMembershipMarshaller.exportList(new ArrayList<>( NgCollection.groupMemberships.values())); } static void exportRoles() { RoleMarshaller roleMarshaller = new RoleMarshaller(); - roleMarshaller.prepare(Format.XML, pathName, "roles", true); + roleMarshaller.prepare(Format.XML, pathName, + "roles", indentation); roleMarshaller.exportList(new ArrayList<>(NgCollection .roles.values())); } @@ -98,7 +101,7 @@ class ExportHelper { RoleMembershipMarshaller roleMembershipMarshaller = new RoleMembershipMarshaller(); roleMembershipMarshaller.prepare(Format.XML, pathName, - "roleMemberships", true); + "roleMemberships", indentation); roleMembershipMarshaller.exportList(new ArrayList<> (NgCollection.roleMemberships.values())); } @@ -107,7 +110,7 @@ class ExportHelper { WorkflowMarshaller workflowMarshaller = new WorkflowMarshaller(); workflowMarshaller.prepare(Format.XML, pathName, - "workflows", true); + "workflows", indentation); workflowMarshaller.exportList(new ArrayList<> (NgCollection.workflows.values())); } @@ -116,7 +119,7 @@ class ExportHelper { UserTaskMarshaller userTaskMarshaller = new UserTaskMarshaller(); userTaskMarshaller.prepare(Format.XML, pathName, - "userTasks", true); + "userTasks", indentation); userTaskMarshaller.exportList(new ArrayList<> (NgCollection.userTasks.values())); } @@ -125,7 +128,7 @@ class ExportHelper { TaskAssignmentMarshaller taskAssignmentMarshaller = new TaskAssignmentMarshaller(); taskAssignmentMarshaller.prepare(Format.XML, pathName, - "taskAssignments", true); + "taskAssignments", indentation); taskAssignmentMarshaller.exportList(new ArrayList<> (NgCollection.taskAssignments.values())); } @@ -134,7 +137,7 @@ class ExportHelper { PermissionMarshaller permissionMarshaller = new PermissionMarshaller(); permissionMarshaller.prepare(Format.XML, pathName, - "permissions", true); + "permissions", indentation); permissionMarshaller.exportList(new ArrayList<> (NgCollection.permissions.values())); } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Categorization.java b/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Categorization.java index 9064816db..93ea0bb4d 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Categorization.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Categorization.java @@ -19,7 +19,7 @@ package com.arsdigita.portation.modules.core.categorization; import com.arsdigita.portation.AbstractMarshaller; -import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.Portable; import com.arsdigita.portation.conversion.NgCollection; import com.arsdigita.portation.modules.core.core.CcmObject; import com.fasterxml.jackson.annotation.JsonBackReference; @@ -32,7 +32,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; * @author getMarshaller() { + public AbstractMarshaller getMarshaller() { return new CategorizationMarshaller(); } @@ -112,4 +116,12 @@ public class Categorization implements Identifiable { public void setObjectOrder(final long objectOrder) { this.objectOrder = objectOrder; } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Category.java b/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Category.java index 8f9fdcf18..319414252 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Category.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Category.java @@ -21,7 +21,7 @@ package com.arsdigita.portation.modules.core.categorization; import com.arsdigita.categorization.CategoryLocalization; import com.arsdigita.categorization.CategoryLocalizationCollection; import com.arsdigita.portation.AbstractMarshaller; -import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.Portable; import com.arsdigita.portation.conversion.NgCollection; import com.arsdigita.portation.modules.core.core.CcmObject; import com.arsdigita.portation.modules.core.l10n.LocalizedString; @@ -112,7 +112,7 @@ public class Category extends CcmObject { @Override - public AbstractMarshaller getMarshaller() { + public AbstractMarshaller getMarshaller() { return new CategoryMarshaller(); } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/core/CcmObject.java b/ccm-core/src/com/arsdigita/portation/modules/core/core/CcmObject.java index 58b459ebb..77f5a4f38 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/core/CcmObject.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/core/CcmObject.java @@ -20,7 +20,7 @@ package com.arsdigita.portation.modules.core.core; import com.arsdigita.kernel.ACSObject; import com.arsdigita.portation.AbstractMarshaller; -import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.Portable; import com.arsdigita.portation.conversion.NgCollection; import com.arsdigita.portation.modules.core.categorization.Categorization; import com.arsdigita.portation.modules.core.categorization.Category; @@ -48,7 +48,7 @@ import java.util.UUID; * @author Tobias Osmers<\a> * @version created on 6/15/16 */ -public class EmailAddress implements Identifiable { +public class EmailAddress { private String address; @@ -40,11 +37,6 @@ public class EmailAddress implements Identifiable { this.verified = trunkEmailAddress.isVerified(); } - @Override - public AbstractMarshaller getMarshaller() { - return new EmailAddressMarshaller(); - } - public String getAddress() { return address; } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/core/EmailAddressMarshaller.java b/ccm-core/src/com/arsdigita/portation/modules/core/core/EmailAddressMarshaller.java deleted file mode 100644 index 70612a7d4..000000000 --- a/ccm-core/src/com/arsdigita/portation/modules/core/core/EmailAddressMarshaller.java +++ /dev/null @@ -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 com.arsdigita.portation.modules.core.core; - -import com.arsdigita.portation.AbstractMarshaller; - -/** - * @author Tobias Osmers<\a> * @version created on 6/15/16 */ -public class LocalizedString implements Identifiable { +public class LocalizedString { private Map values; @@ -47,11 +44,6 @@ public class LocalizedString implements Identifiable { this.values = new HashMap<>(); } - @Override - public AbstractMarshaller getMarshaller() { - return new LocalizedStringMarshaller(); - } - /** * Get all localised values. * diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/l10n/LocalizedStringMarshaller.java b/ccm-core/src/com/arsdigita/portation/modules/core/l10n/LocalizedStringMarshaller.java deleted file mode 100644 index a55e0844b..000000000 --- a/ccm-core/src/com/arsdigita/portation/modules/core/l10n/LocalizedStringMarshaller.java +++ /dev/null @@ -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 com.arsdigita.portation.modules.core.l10n; - -import com.arsdigita.portation.AbstractMarshaller; - -/** - * @author Tobias Osmers<\a> * @version created on 31.05.16 */ -public class Group extends Party { +public class Group extends Party implements Portable { @JsonManagedReference private Set memberships; @@ -44,7 +44,7 @@ public class Group extends Party { } @Override - public AbstractMarshaller getMarshaller() { + public AbstractMarshaller getMarshaller() { return new GroupMarshaller(); } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/security/GroupMembership.java b/ccm-core/src/com/arsdigita/portation/modules/core/security/GroupMembership.java index f8bff8273..a3621f7f3 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/security/GroupMembership.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/security/GroupMembership.java @@ -19,7 +19,7 @@ package com.arsdigita.portation.modules.core.security; import com.arsdigita.portation.AbstractMarshaller; -import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.Portable; import com.arsdigita.portation.conversion.NgCollection; import com.fasterxml.jackson.annotation.JsonBackReference; @@ -27,7 +27,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; * @author Tobias Osmers<\a> * @version created on 01.06.16 */ -public class Party implements Identifiable { +public class Party { private long partyId; private String name; @@ -47,11 +45,6 @@ public class Party implements Identifiable { NgCollection.parties.put(this.partyId, this); } - @Override - public AbstractMarshaller getMarshaller() { - return new PartyMarshaller(); - } - public long getPartyId() { return partyId; } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/security/PartyMarshaller.java b/ccm-core/src/com/arsdigita/portation/modules/core/security/PartyMarshaller.java deleted file mode 100644 index dca7e0aba..000000000 --- a/ccm-core/src/com/arsdigita/portation/modules/core/security/PartyMarshaller.java +++ /dev/null @@ -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 com.arsdigita.portation.modules.core.security; - -import com.arsdigita.portation.AbstractMarshaller; - -/** - * @author Tobias Osmers<\a> * @version created on 6/15/16 */ -public class Permission implements Identifiable { +public class Permission implements Portable { private long permissionId; private String grantedPrivilege; @@ -89,7 +89,7 @@ public class Permission implements Identifiable { } @Override - public AbstractMarshaller getMarshaller() { + public AbstractMarshaller getMarshaller() { return new PermissionMarshaller(); } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/security/Role.java b/ccm-core/src/com/arsdigita/portation/modules/core/security/Role.java index 9d4adf932..5607bcafa 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/security/Role.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/security/Role.java @@ -19,7 +19,7 @@ package com.arsdigita.portation.modules.core.security; import com.arsdigita.portation.AbstractMarshaller; -import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.Portable; import com.arsdigita.portation.conversion.NgCollection; import com.arsdigita.portation.modules.core.l10n.LocalizedString; import com.arsdigita.portation.modules.core.workflow.TaskAssignment; @@ -35,50 +35,52 @@ import java.util.Set; * @author Tobias Osmers<\a> * @version created on 6/15/16 */ -public class RoleMembership implements Identifiable { +public class RoleMembership implements Portable { private long membershipId; @@ -46,7 +46,7 @@ public class RoleMembership implements Identifiable { } @Override - public AbstractMarshaller getMarshaller() { + public AbstractMarshaller getMarshaller() { return new RoleMembershipMarshaller(); } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/security/User.java b/ccm-core/src/com/arsdigita/portation/modules/core/security/User.java index 4acb9f530..fe3ac3c31 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/security/User.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/security/User.java @@ -19,7 +19,7 @@ package com.arsdigita.portation.modules.core.security; import com.arsdigita.portation.AbstractMarshaller; -import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.Portable; import com.arsdigita.portation.conversion.NgCollection; import com.arsdigita.portation.modules.core.core.EmailAddress; import com.fasterxml.jackson.annotation.JsonManagedReference; @@ -34,7 +34,7 @@ import java.util.Set; * @author Tobias Osmers<\a> * @version created on 6/15/16 */ -public class Task implements Identifiable { +public class Task { private long taskId; private LocalizedString label; @@ -50,6 +48,7 @@ public class Task implements Identifiable { private List dependentTasks; @JsonManagedReference private List dependsOn; + private List comments; public Task(final com.arsdigita.workflow.simple.Task trunkTask) { @@ -76,11 +75,6 @@ public class Task implements Identifiable { NgCollection.tasks.put(this.getTaskId(), this); } - @Override - public AbstractMarshaller getMarshaller() { - return new TaskMarshaller(); - } - public long getTaskId() { return taskId; } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/workflow/TaskAssignment.java b/ccm-core/src/com/arsdigita/portation/modules/core/workflow/TaskAssignment.java index 31eb00bac..c21582f87 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/workflow/TaskAssignment.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/workflow/TaskAssignment.java @@ -19,7 +19,7 @@ package com.arsdigita.portation.modules.core.workflow; import com.arsdigita.portation.AbstractMarshaller; -import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.Portable; import com.arsdigita.portation.conversion.NgCollection; import com.arsdigita.portation.modules.core.security.Role; import com.fasterxml.jackson.annotation.JsonBackReference; @@ -28,7 +28,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; * @author Tobias Osmers<\a> - * @version created on 6/15/16 - */ -public class TaskMarshaller extends AbstractMarshaller { -} diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/workflow/UserTask.java b/ccm-core/src/com/arsdigita/portation/modules/core/workflow/UserTask.java index 4ac2467f9..5722c0ef6 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/workflow/UserTask.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/workflow/UserTask.java @@ -19,7 +19,7 @@ package com.arsdigita.portation.modules.core.workflow; import com.arsdigita.portation.AbstractMarshaller; -import com.arsdigita.portation.Identifiable; +import com.arsdigita.portation.Portable; import com.arsdigita.portation.conversion.NgCollection; import com.arsdigita.portation.modules.core.security.User; import com.fasterxml.jackson.annotation.JsonManagedReference; @@ -32,7 +32,7 @@ import java.util.List; * @author Tobias Osmers<\a> * @version created on 6/15/16 */ -public class Workflow implements Identifiable { +public class Workflow implements Portable { private long workflowId; private LocalizedString name; private LocalizedString description; + //Todo: private WorkflowTemplate workflowTemplate; + @JsonManagedReference private List tasks; @@ -56,7 +58,7 @@ public class Workflow implements Identifiable { } @Override - public AbstractMarshaller getMarshaller() { + public AbstractMarshaller getMarshaller() { return new WorkflowMarshaller(); }