[TRUNK][Feature]
- adds capability of converting trunks ldn-terms' domain objects to ng's core domain objects - modifies structure of portation packages and deletes Marshaller.java git-svn-id: https://svn.libreccm.org/ccm/trunk@4889 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
717a4c324b
commit
a5c1645bd8
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract super class for conversion from trunk objects to ng object. The
|
||||||
|
* class demands the implementation of the following method of the
|
||||||
|
* appropriate converters.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/28/17
|
||||||
|
*/
|
||||||
|
public abstract class AbstractConverter {
|
||||||
|
/**
|
||||||
|
* Method, to start all the different converter classes in a specific
|
||||||
|
* order, so that dependencies can only be set, where the objects have
|
||||||
|
* already been created.
|
||||||
|
*/
|
||||||
|
public abstract void startConversionToNg();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/28/17
|
||||||
|
*/
|
||||||
|
public abstract class AbstractExporter {
|
||||||
|
|
||||||
|
protected static String pathName;
|
||||||
|
protected static boolean indentation = false;
|
||||||
|
|
||||||
|
public static void setPath(String path) {
|
||||||
|
pathName = path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,115 +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;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Central class for exporting and importing objects of this system stored in
|
|
||||||
* the database.
|
|
||||||
*
|
|
||||||
* <info>Exporting or importing object classes need to implement
|
|
||||||
* interface identifiable.</info>
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
|
|
||||||
* @version created on 03.02.2016
|
|
||||||
*/
|
|
||||||
public class Marshaller {
|
|
||||||
private static final Logger log = Logger.getLogger(Marshaller.class);
|
|
||||||
|
|
||||||
// Assigns lists with objects of the same type as values to their typ as
|
|
||||||
// key.
|
|
||||||
private Map<Class<? extends Portable>, List<Portable>> classListMap = new HashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main exportUsers method. Organizes the objects into list of the same type
|
|
||||||
* and calls a second exportUsers method for each list.
|
|
||||||
*
|
|
||||||
* @param objects All objects to be exported
|
|
||||||
* @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<? extends 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 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
|
|
||||||
* the list. Guarantied through this implementation.
|
|
||||||
*
|
|
||||||
* @param objects list of all objects being organized
|
|
||||||
*/
|
|
||||||
private void putObjects(List<? extends 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 exportUsers wishes and calls the exportUsers method of
|
|
||||||
* that marshaller upon the given list of same typed objects.
|
|
||||||
*
|
|
||||||
* Naming convention for the exportUsers 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 exportUsers 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) {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
AbstractMarshaller<P> marshaller = (AbstractMarshaller<P>) list.get
|
|
||||||
(0).getMarshaller();
|
|
||||||
|
|
||||||
marshaller.prepare(format, filename + "__" + type.toString(),
|
|
||||||
false);
|
|
||||||
marshaller.exportList(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,181 +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.cmd;
|
|
||||||
|
|
||||||
import com.arsdigita.portation.Format;
|
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
|
||||||
import com.arsdigita.portation.modules.core.categorization.CategorizationMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.categorization.CategoryMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.security.GroupMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.security.GroupMembershipMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.security.PermissionMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.security.RoleMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.security.RoleMembershipMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.security.UserMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.workflow.TaskAssignmentMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.workflow.AssignableTaskMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.workflow.WorkflowMarshaller;
|
|
||||||
import com.arsdigita.portation.modules.core.workflow.WorkflowTemplateMarshaller;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper to implement the specifics for the exportation. Makes source code
|
|
||||||
* in the cli-tool shorter and more readable.
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
|
||||||
* @version created on 25.07.2016
|
|
||||||
*/
|
|
||||||
class CoreExporter {
|
|
||||||
|
|
||||||
private static String pathName;
|
|
||||||
private static boolean indentation = false;
|
|
||||||
|
|
||||||
static void setPath(String path) {
|
|
||||||
pathName = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportUsers() {
|
|
||||||
System.out.printf("\tExporting users...");
|
|
||||||
UserMarshaller userMarshaller = new UserMarshaller();
|
|
||||||
userMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"users", indentation);
|
|
||||||
userMarshaller.exportList(new ArrayList<>(
|
|
||||||
NgCollection.users.values()));
|
|
||||||
System.out.printf("\t\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportGroups() {
|
|
||||||
System.out.printf("\tExporting groups...");
|
|
||||||
GroupMarshaller groupMarshaller = new GroupMarshaller();
|
|
||||||
groupMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"groups", indentation);
|
|
||||||
groupMarshaller.exportList(new ArrayList<>(
|
|
||||||
NgCollection.groups.values()));
|
|
||||||
System.out.printf("\t\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportGroupMemberships() {
|
|
||||||
System.out.printf("\tExporting group memberships...");
|
|
||||||
GroupMembershipMarshaller groupMembershipMarshaller = new
|
|
||||||
GroupMembershipMarshaller();
|
|
||||||
groupMembershipMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"groupMemberships", indentation);
|
|
||||||
groupMembershipMarshaller.exportList(new ArrayList<>(
|
|
||||||
NgCollection.groupMemberships.values()));
|
|
||||||
System.out.printf("\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportRoles() {
|
|
||||||
System.out.printf("\tExporting roles...");
|
|
||||||
RoleMarshaller roleMarshaller = new RoleMarshaller();
|
|
||||||
roleMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"roles", indentation);
|
|
||||||
roleMarshaller.exportList(new ArrayList<>(NgCollection
|
|
||||||
.roles.values()));
|
|
||||||
System.out.printf("\t\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportRoleMemberships() {
|
|
||||||
System.out.printf("\tExporting role memberships...");
|
|
||||||
RoleMembershipMarshaller roleMembershipMarshaller = new
|
|
||||||
RoleMembershipMarshaller();
|
|
||||||
roleMembershipMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"roleMemberships", indentation);
|
|
||||||
roleMembershipMarshaller.exportList(new ArrayList<>
|
|
||||||
(NgCollection.roleMemberships.values()));
|
|
||||||
System.out.printf("\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportCategories() {
|
|
||||||
System.out.printf("\tExporting categories...");
|
|
||||||
CategoryMarshaller categoryMarshaller = new
|
|
||||||
CategoryMarshaller();
|
|
||||||
categoryMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"categories", indentation);
|
|
||||||
categoryMarshaller.exportList(NgCollection.sortedCategories);
|
|
||||||
System.out.printf("\t\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportCategorizations() {
|
|
||||||
System.out.printf("\tExporting categorizations...");
|
|
||||||
CategorizationMarshaller categorizationMarshaller = new
|
|
||||||
CategorizationMarshaller();
|
|
||||||
categorizationMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"categorizations", indentation);
|
|
||||||
categorizationMarshaller.exportList(new ArrayList<>(
|
|
||||||
NgCollection.categorizations.values()));
|
|
||||||
System.out.printf("\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportWorkflowTemplates() {
|
|
||||||
System.out.printf("\tExporting workflow templates...");
|
|
||||||
WorkflowTemplateMarshaller workflowTemplateMarshaller = new
|
|
||||||
WorkflowTemplateMarshaller();
|
|
||||||
workflowTemplateMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"workflowTemplates", indentation);
|
|
||||||
workflowTemplateMarshaller.exportList(new ArrayList<>(NgCollection
|
|
||||||
.workflowTemplates.values()));
|
|
||||||
System.out.printf("\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportWorkflows() {
|
|
||||||
System.out.printf("\tExporting workflows...");
|
|
||||||
WorkflowMarshaller workflowMarshaller = new
|
|
||||||
WorkflowMarshaller();
|
|
||||||
workflowMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"workflows", indentation);
|
|
||||||
workflowMarshaller.exportList(new ArrayList<>
|
|
||||||
(NgCollection.workflows.values()));
|
|
||||||
System.out.printf("\t\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportAssignableTasks() {
|
|
||||||
System.out.printf("\tExporting assignable tasks...");
|
|
||||||
AssignableTaskMarshaller assignableTaskMarshaller = new
|
|
||||||
AssignableTaskMarshaller();
|
|
||||||
assignableTaskMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"assignableTasks", indentation);
|
|
||||||
assignableTaskMarshaller.exportList(new ArrayList<>
|
|
||||||
(NgCollection.assignableTasks.values()));
|
|
||||||
System.out.printf("\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportTaskAssignments() {
|
|
||||||
System.out.printf("\tExporting task assignments...");
|
|
||||||
TaskAssignmentMarshaller taskAssignmentMarshaller = new
|
|
||||||
TaskAssignmentMarshaller();
|
|
||||||
taskAssignmentMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"taskAssignments", indentation);
|
|
||||||
taskAssignmentMarshaller.exportList(new ArrayList<>
|
|
||||||
(NgCollection.taskAssignments.values()));
|
|
||||||
System.out.printf("\tdone.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void exportPermissions() {
|
|
||||||
System.out.printf("\tExporting permissions...");
|
|
||||||
PermissionMarshaller permissionMarshaller = new
|
|
||||||
PermissionMarshaller();
|
|
||||||
permissionMarshaller.prepare(Format.XML, pathName,
|
|
||||||
"permissions", indentation);
|
|
||||||
permissionMarshaller.exportList(new ArrayList<>
|
|
||||||
(NgCollection.permissions.values()));
|
|
||||||
System.out.printf("\tdone.\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -19,10 +19,13 @@
|
||||||
package com.arsdigita.portation.cmd;
|
package com.arsdigita.portation.cmd;
|
||||||
|
|
||||||
import com.arsdigita.portation.conversion.CoreConverter;
|
import com.arsdigita.portation.conversion.CoreConverter;
|
||||||
|
import com.arsdigita.portation.modules.CoreExporter;
|
||||||
import com.arsdigita.util.cmd.Program;
|
import com.arsdigita.util.cmd.Program;
|
||||||
import org.apache.commons.cli.CommandLine;
|
import org.apache.commons.cli.CommandLine;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Commandline tool for exporting all the objects of specified classes to
|
* A Commandline tool for exporting all the objects of specified classes to
|
||||||
* one or many specified file types.
|
* one or many specified file types.
|
||||||
|
|
@ -83,20 +86,47 @@ public class ExportCliTool extends Program {
|
||||||
printUsage();
|
printUsage();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "export":
|
|
||||||
export(args);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "convert":
|
case "convert":
|
||||||
convert();
|
convert();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "export":
|
||||||
|
export(args);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printUsage();
|
printUsage();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method for converting all trunk objects into ng objects at once.
|
||||||
|
*/
|
||||||
|
private void convert() {
|
||||||
|
try {
|
||||||
|
System.err.println("Started conversions of systems objects to " +
|
||||||
|
"ng-objects...");
|
||||||
|
|
||||||
|
CoreConverter.getInstance().startConversionToNg();
|
||||||
|
|
||||||
|
Class cls = Class
|
||||||
|
.forName("com.arsdigita.london.terms.portation" +
|
||||||
|
".conversion.LdnTermsConverter");
|
||||||
|
if (cls != null) {
|
||||||
|
Method method = cls.getMethod("startConversionToNg");
|
||||||
|
method.invoke(cls.newInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
System.err.println("Finished conversions.");
|
||||||
|
System.out.printf("\n");
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("ERROR while converting trunk-objects to " +
|
||||||
|
"ng-objects", e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method defining the process of exporting after its command has been
|
* Method defining the process of exporting after its command has been
|
||||||
* triggered.
|
* triggered.
|
||||||
|
|
@ -119,16 +149,6 @@ public class ExportCliTool extends Program {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch (moduleClass) {
|
switch (moduleClass) {
|
||||||
case "categories":
|
|
||||||
convert();
|
|
||||||
CoreExporter.exportCategories();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "categorizations":
|
|
||||||
convert();
|
|
||||||
CoreExporter.exportCategorizations();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "users":
|
case "users":
|
||||||
convert();
|
convert();
|
||||||
CoreExporter.exportUsers();
|
CoreExporter.exportUsers();
|
||||||
|
|
@ -154,6 +174,16 @@ public class ExportCliTool extends Program {
|
||||||
CoreExporter.exportRoleMemberships();
|
CoreExporter.exportRoleMemberships();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "categories":
|
||||||
|
convert();
|
||||||
|
CoreExporter.exportCategories();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "categorizations":
|
||||||
|
convert();
|
||||||
|
CoreExporter.exportCategorizations();
|
||||||
|
break;
|
||||||
|
|
||||||
case "workflowTemplates":
|
case "workflowTemplates":
|
||||||
convert();
|
convert();
|
||||||
CoreExporter.exportWorkflowTemplates();
|
CoreExporter.exportWorkflowTemplates();
|
||||||
|
|
@ -179,16 +209,16 @@ public class ExportCliTool extends Program {
|
||||||
CoreExporter.exportPermissions();
|
CoreExporter.exportPermissions();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "all_core":
|
default:
|
||||||
convert();
|
convert();
|
||||||
System.out.println("Started exporting all ng-objects...");
|
System.out.println("Started exporting all ng-objects...");
|
||||||
CoreExporter.exportCategories();
|
|
||||||
CoreExporter.exportCategorizations();
|
|
||||||
CoreExporter.exportUsers();
|
CoreExporter.exportUsers();
|
||||||
CoreExporter.exportGroups();
|
CoreExporter.exportGroups();
|
||||||
CoreExporter.exportGroupMemberships();
|
CoreExporter.exportGroupMemberships();
|
||||||
CoreExporter.exportRoles();
|
CoreExporter.exportRoles();
|
||||||
CoreExporter.exportRoleMemberships();
|
CoreExporter.exportRoleMemberships();
|
||||||
|
CoreExporter.exportCategories();
|
||||||
|
CoreExporter.exportCategorizations();
|
||||||
CoreExporter.exportWorkflows();
|
CoreExporter.exportWorkflows();
|
||||||
CoreExporter.exportWorkflowTemplates();
|
CoreExporter.exportWorkflowTemplates();
|
||||||
CoreExporter.exportAssignableTasks();
|
CoreExporter.exportAssignableTasks();
|
||||||
|
|
@ -198,31 +228,12 @@ public class ExportCliTool extends Program {
|
||||||
System.out.printf("\n");
|
System.out.printf("\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
printUsage();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.error("ERROR while exporting", ex);
|
logger.error("ERROR while exporting", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method for converting all trunk objects into ng objects at once.
|
|
||||||
*/
|
|
||||||
private void convert() {
|
|
||||||
try {
|
|
||||||
System.err.println("Started conversions of systems objects to " +
|
|
||||||
"ng-objects...");
|
|
||||||
CoreConverter.startConversionToNg();
|
|
||||||
System.err.println("Finished conversions.");
|
|
||||||
System.out.printf("\n");
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("ERROR while converting trunk-objects to " +
|
|
||||||
"ng-objects", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -238,6 +249,8 @@ public class ExportCliTool extends Program {
|
||||||
"Available commands:\n" +
|
"Available commands:\n" +
|
||||||
"\thelp" +
|
"\thelp" +
|
||||||
"\t\t\t\t\t Shows information on how to use this tool.\n" +
|
"\t\t\t\t\t Shows information on how to use this tool.\n" +
|
||||||
|
"\tconvert" +
|
||||||
|
"\t\t\t\t\t Converts all trunk objects to ng objects.\n" +
|
||||||
"\texport <module-class> <path>" +
|
"\texport <module-class> <path>" +
|
||||||
"\t\t Exports the chosen module class to a file\n" +
|
"\t\t Exports the chosen module class to a file\n" +
|
||||||
"\t\t\t\t" +
|
"\t\t\t\t" +
|
||||||
|
|
@ -258,7 +271,7 @@ public class ExportCliTool extends Program {
|
||||||
" \t\t taskAssignments \t\t all taskAssignments of the system\n" +
|
" \t\t taskAssignments \t\t all taskAssignments of the system\n" +
|
||||||
" \t\t permissions \t\t all permissions of the system\n" +
|
" \t\t permissions \t\t all permissions of the system\n" +
|
||||||
" \n" +
|
" \n" +
|
||||||
" \t\t all_core \t\t all objects of the entire core module" +
|
" \t\t default: \t\t all objects of the entire core module" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"" +
|
"" +
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation.conversion;
|
package com.arsdigita.portation.conversion;
|
||||||
|
|
||||||
|
import com.arsdigita.portation.AbstractConverter;
|
||||||
import com.arsdigita.portation.conversion.core.categorization.CategoryConversion;
|
import com.arsdigita.portation.conversion.core.categorization.CategoryConversion;
|
||||||
import com.arsdigita.portation.conversion.core.security.GroupConversion;
|
import com.arsdigita.portation.conversion.core.security.GroupConversion;
|
||||||
import com.arsdigita.portation.conversion.core.security.PermissionConversion;
|
import com.arsdigita.portation.conversion.core.security.PermissionConversion;
|
||||||
|
|
@ -25,7 +26,6 @@ import com.arsdigita.portation.conversion.core.security.RoleConversion;
|
||||||
import com.arsdigita.portation.conversion.core.security.UserConversion;
|
import com.arsdigita.portation.conversion.core.security.UserConversion;
|
||||||
import com.arsdigita.portation.conversion.core.workflow.AssignableTaskConversion;
|
import com.arsdigita.portation.conversion.core.workflow.AssignableTaskConversion;
|
||||||
import com.arsdigita.portation.conversion.core.workflow.WorkflowConversion;
|
import com.arsdigita.portation.conversion.core.workflow.WorkflowConversion;
|
||||||
import com.arsdigita.portation.modules.core.categorization.Category;
|
|
||||||
import com.arsdigita.portation.modules.core.security.Permission;
|
import com.arsdigita.portation.modules.core.security.Permission;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,41 +33,47 @@ import com.arsdigita.portation.modules.core.security.Permission;
|
||||||
* This core converter class calls all the conversions from trunk-objects
|
* This core converter class calls all the conversions from trunk-objects
|
||||||
* to ng-objects in a specific order to guarantee a correct dependency
|
* to ng-objects in a specific order to guarantee a correct dependency
|
||||||
* recreation in the ng-objects. All the created objects are going to be
|
* recreation in the ng-objects. All the created objects are going to be
|
||||||
* stored in maps as <id, object>-pairs in the {@link NgCollection}-class.
|
* stored in maps as <id, object>-pairs in the {@link NgCoreCollection}-class.
|
||||||
*
|
*
|
||||||
* @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 6/27/16
|
* @version created on 6/27/16
|
||||||
*/
|
*/
|
||||||
public class CoreConverter {
|
public class CoreConverter extends AbstractConverter {
|
||||||
|
|
||||||
|
private static CoreConverter instance;
|
||||||
|
|
||||||
|
static {
|
||||||
|
instance = new CoreConverter();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method, to start all the different converter classes in a specific
|
* Method, to start all the different converter classes in a specific
|
||||||
* order, so that dependencies can only be set, where the objects have
|
* order, so that dependencies can only be set, where the objects have
|
||||||
* already been created.
|
* already been created.
|
||||||
*/
|
*/
|
||||||
public static void startConversionToNg() {
|
@Override
|
||||||
|
public void startConversionToNg() {
|
||||||
UserConversion.convertAll();
|
UserConversion.convertAll();
|
||||||
GroupConversion.convertAll();
|
GroupConversion.convertAll();
|
||||||
|
|
||||||
RoleConversion.convertAll();
|
RoleConversion.convertAll();
|
||||||
|
|
||||||
CategoryConversion.convertAll();
|
CategoryConversion.convertAll();
|
||||||
NgCollection.sortCategories();
|
NgCoreCollection.sortCategories();
|
||||||
// Verify categories
|
// Verify categories
|
||||||
/*for (Category category : NgCollection.sortedCategories) {
|
/*for (Category category : NgCoreCollection.sortedCategories) {
|
||||||
System.err.printf("\t\t\tCategory %s with parent category %s\n",
|
System.err.printf("\t\t\tCategory %s with parent category %s\n",
|
||||||
category.getName(), category.getParentCategory().getName()
|
category.getName(), category.getParentCategory().getName()
|
||||||
);
|
);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
WorkflowConversion.convertAll();
|
WorkflowConversion.convertAll();
|
||||||
AssignableTaskConversion.convertAll();
|
AssignableTaskConversion.convertAll();
|
||||||
|
|
||||||
PermissionConversion.convertAll();
|
PermissionConversion.convertAll();
|
||||||
|
|
||||||
// Verify permissions
|
// Verify permissions
|
||||||
for (Permission permission : NgCollection.permissions.values()) {
|
for (Permission permission : NgCoreCollection.permissions.values()) {
|
||||||
if (permission.getGrantee() == null) {
|
if (permission.getGrantee() == null) {
|
||||||
System.err.printf("CoreConverter: Grantee for permission %d " +
|
System.err.printf("CoreConverter: Grantee for permission %d " +
|
||||||
"is null.%n", permission.getPermissionId());
|
"is null.%n", permission.getPermissionId());
|
||||||
|
|
@ -75,4 +81,13 @@ public class CoreConverter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for the instance of the singleton.
|
||||||
|
*
|
||||||
|
* @return instance of this singleton
|
||||||
|
*/
|
||||||
|
public static CoreConverter getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,20 +21,13 @@ package com.arsdigita.portation.conversion;
|
||||||
import com.arsdigita.portation.modules.core.categorization.Categorization;
|
import com.arsdigita.portation.modules.core.categorization.Categorization;
|
||||||
import com.arsdigita.portation.modules.core.categorization.Category;
|
import com.arsdigita.portation.modules.core.categorization.Category;
|
||||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
import com.arsdigita.portation.modules.core.security.Group;
|
import com.arsdigita.portation.modules.core.security.*;
|
||||||
import com.arsdigita.portation.modules.core.security.GroupMembership;
|
import com.arsdigita.portation.modules.core.workflow.*;
|
||||||
import com.arsdigita.portation.modules.core.security.Party;
|
|
||||||
import com.arsdigita.portation.modules.core.security.Permission;
|
|
||||||
import com.arsdigita.portation.modules.core.security.Role;
|
|
||||||
import com.arsdigita.portation.modules.core.security.RoleMembership;
|
|
||||||
import com.arsdigita.portation.modules.core.security.User;
|
|
||||||
import com.arsdigita.portation.modules.core.workflow.AssignableTask;
|
|
||||||
import com.arsdigita.portation.modules.core.workflow.Task;
|
|
||||||
import com.arsdigita.portation.modules.core.workflow.TaskAssignment;
|
|
||||||
import com.arsdigita.portation.modules.core.workflow.Workflow;
|
|
||||||
import com.arsdigita.portation.modules.core.workflow.WorkflowTemplate;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Storage class for all ng-objects after conversion. This also helps for an
|
* Storage class for all ng-objects after conversion. This also helps for an
|
||||||
|
|
@ -43,12 +36,7 @@ import java.util.*;
|
||||||
* @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 27.6.16
|
* @version created on 27.6.16
|
||||||
*/
|
*/
|
||||||
public class NgCollection {
|
public class NgCoreCollection {
|
||||||
|
|
||||||
public static Map<Long, CcmObject> ccmObjects = new HashMap<>();
|
|
||||||
public static Map<Long, Category> categories = new TreeMap<>();
|
|
||||||
public static Map<Long, Categorization> categorizations = new HashMap<>();
|
|
||||||
|
|
||||||
public static Map<Long, Party> parties = new HashMap<>();
|
public static Map<Long, Party> parties = new HashMap<>();
|
||||||
public static Map<Long, User> users = new HashMap<>();
|
public static Map<Long, User> users = new HashMap<>();
|
||||||
public static Map<Long, Group> groups = new HashMap<>();
|
public static Map<Long, Group> groups = new HashMap<>();
|
||||||
|
|
@ -57,6 +45,10 @@ public class NgCollection {
|
||||||
public static Map<Long, Role> roles = new HashMap<>();
|
public static Map<Long, Role> roles = new HashMap<>();
|
||||||
public static Map<Long, RoleMembership> roleMemberships = new HashMap<>();
|
public static Map<Long, RoleMembership> roleMemberships = new HashMap<>();
|
||||||
|
|
||||||
|
public static Map<Long, CcmObject> ccmObjects = new HashMap<>();
|
||||||
|
public static Map<Long, Category> categories = new TreeMap<>();
|
||||||
|
public static Map<Long, Categorization> categorizations = new HashMap<>();
|
||||||
|
|
||||||
public static Map<Long, Workflow> workflows = new HashMap<>();
|
public static Map<Long, Workflow> workflows = new HashMap<>();
|
||||||
public static Map<Long, WorkflowTemplate> workflowTemplates = new HashMap<>();
|
public static Map<Long, WorkflowTemplate> workflowTemplates = new HashMap<>();
|
||||||
public static Map<Long, Task> tasks = new HashMap<>();
|
public static Map<Long, Task> tasks = new HashMap<>();
|
||||||
|
|
@ -65,14 +57,14 @@ public class NgCollection {
|
||||||
|
|
||||||
public static Map<Long, Permission> permissions = new HashMap<>();
|
public static Map<Long, Permission> permissions = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
// if lists need to be sorted in specific way to work with import
|
// if lists need to be sorted in specific way to work with import
|
||||||
private static ArrayList<Category> unsortedCategories;
|
|
||||||
public static ArrayList<Category> sortedCategories;
|
public static ArrayList<Category> sortedCategories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private constructor to prevent the instantiation of this class.
|
* Private constructor to prevent the instantiation of this class.
|
||||||
*/
|
*/
|
||||||
private NgCollection() {}
|
private NgCoreCollection() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts values of category-map to ensure that the parent-categories will
|
* Sorts values of category-map to ensure that the parent-categories will
|
||||||
|
|
@ -84,14 +76,14 @@ public class NgCollection {
|
||||||
* in this foreach run.
|
* in this foreach run.
|
||||||
*/
|
*/
|
||||||
static void sortCategories() {
|
static void sortCategories() {
|
||||||
unsortedCategories = new ArrayList<>(categories.values());
|
ArrayList<Category> unsortedCategories = new ArrayList<>(categories.values());
|
||||||
sortedCategories = new ArrayList<>(unsortedCategories.size());
|
sortedCategories = new ArrayList<>(unsortedCategories.size());
|
||||||
|
|
||||||
System.err.printf("\tSorting categorizes...\n");
|
System.err.printf("\tSorting categorizes...\n");
|
||||||
int count = 1;
|
int count = 1;
|
||||||
for (Category anUnsorted : unsortedCategories) {
|
for (Category anUnsorted : unsortedCategories) {
|
||||||
System.err.printf("\t\tNumber: %d\n", count++);
|
//System.err.printf("\t\tNumber: %d\n", count++);
|
||||||
System.err.printf("\t\tCategory: %s\n", anUnsorted.getName());
|
//System.err.printf("\t\tCategory: %s\n", anUnsorted.getName());
|
||||||
add(anUnsorted, "\t\t");
|
add(anUnsorted, "\t\t");
|
||||||
//System.err.println("");
|
//System.err.println("");
|
||||||
}
|
}
|
||||||
|
|
@ -107,22 +99,22 @@ public class NgCollection {
|
||||||
private static void add(Category category, String indent) {
|
private static void add(Category category, String indent) {
|
||||||
Category parent = category.getParentCategory();
|
Category parent = category.getParentCategory();
|
||||||
|
|
||||||
System.err.printf("%s\tHas missing parent?...", indent);
|
//System.err.printf("%s\tHas missing parent?...", indent);
|
||||||
if (parent != null && !sortedCategories.contains(parent)) {
|
if (parent != null && !sortedCategories.contains(parent)) {
|
||||||
System.err.println("YES.");
|
//System.err.println("YES.");
|
||||||
System.err.printf("%s\tParent: %s\n", indent, parent.getName());
|
//System.err.printf("%s\tParent: %s\n", indent, parent.getName());
|
||||||
|
|
||||||
add(parent, String.format("%s\t", indent));
|
add(parent, String.format("%s\t", indent));
|
||||||
} else {
|
} else {
|
||||||
System.err.println("NO.");
|
//System.err.println("NO.");
|
||||||
}
|
}
|
||||||
|
|
||||||
System.err.printf("%sAdded to sorted list?...", indent);
|
//System.err.printf("%sAdded to sorted list?...", indent);
|
||||||
if (!sortedCategories.contains(category)) {
|
if (!sortedCategories.contains(category)) {
|
||||||
sortedCategories.add(category);
|
sortedCategories.add(category);
|
||||||
System.err.println("YES.");
|
//System.err.println("YES.");
|
||||||
} else {
|
} else {
|
||||||
System.err.println("NO.");
|
//System.err.println("NO.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ package com.arsdigita.portation.conversion.core.categorization;
|
||||||
|
|
||||||
import com.arsdigita.categorization.CategorizedCollection;
|
import com.arsdigita.categorization.CategorizedCollection;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.categorization.Categorization;
|
import com.arsdigita.portation.modules.core.categorization.Categorization;
|
||||||
import com.arsdigita.portation.modules.core.categorization.Category;
|
import com.arsdigita.portation.modules.core.categorization.Category;
|
||||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
|
|
@ -103,7 +103,7 @@ public class CategoryConversion {
|
||||||
long processed = 0;
|
long processed = 0;
|
||||||
|
|
||||||
while (categorizedObjects.next()) {
|
while (categorizedObjects.next()) {
|
||||||
CcmObject categorizedObject = NgCollection.ccmObjects.get(((ACSObject)
|
CcmObject categorizedObject = NgCoreCollection.ccmObjects.get(((ACSObject)
|
||||||
categorizedObjects.getDomainObject()).getID().longValue());
|
categorizedObjects.getDomainObject()).getID().longValue());
|
||||||
|
|
||||||
if (category != null && categorizedObject != null) {
|
if (category != null && categorizedObject != null) {
|
||||||
|
|
@ -135,7 +135,7 @@ public class CategoryConversion {
|
||||||
for (com.arsdigita.categorization.Category
|
for (com.arsdigita.categorization.Category
|
||||||
trunkCategory : trunkCategories) {
|
trunkCategory : trunkCategories) {
|
||||||
|
|
||||||
Category category = NgCollection.categories.get(trunkCategory
|
Category category = NgCoreCollection.categories.get(trunkCategory
|
||||||
.getID().longValue());
|
.getID().longValue());
|
||||||
|
|
||||||
// set parent and opposed association
|
// set parent and opposed association
|
||||||
|
|
@ -145,7 +145,7 @@ public class CategoryConversion {
|
||||||
trunkCategory.getDefaultParentCategory();
|
trunkCategory.getDefaultParentCategory();
|
||||||
|
|
||||||
if (defaultParent != null) {
|
if (defaultParent != null) {
|
||||||
parentCategory = NgCollection.categories.get(
|
parentCategory = NgCoreCollection.categories.get(
|
||||||
defaultParent.getID().longValue());
|
defaultParent.getID().longValue());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
package com.arsdigita.portation.conversion.core.security;
|
package com.arsdigita.portation.conversion.core.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.UserCollection;
|
import com.arsdigita.kernel.UserCollection;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.security.Group;
|
import com.arsdigita.portation.modules.core.security.Group;
|
||||||
import com.arsdigita.portation.modules.core.security.GroupMembership;
|
import com.arsdigita.portation.modules.core.security.GroupMembership;
|
||||||
import com.arsdigita.portation.modules.core.security.User;
|
import com.arsdigita.portation.modules.core.security.User;
|
||||||
|
|
@ -96,7 +96,7 @@ public class GroupConversion {
|
||||||
long processed = 0;
|
long processed = 0;
|
||||||
|
|
||||||
while (userCollection.next()) {
|
while (userCollection.next()) {
|
||||||
User member = NgCollection.users.get(userCollection.getUser()
|
User member = NgCoreCollection.users.get(userCollection.getUser()
|
||||||
.getID().longValue());
|
.getID().longValue());
|
||||||
|
|
||||||
if (group != null && member != null) {
|
if (group != null && member != null) {
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,13 @@
|
||||||
package com.arsdigita.portation.conversion.core.security;
|
package com.arsdigita.portation.conversion.core.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.RoleCollection;
|
import com.arsdigita.kernel.RoleCollection;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
import com.arsdigita.portation.modules.core.security.Group;
|
import com.arsdigita.portation.modules.core.security.*;
|
||||||
import com.arsdigita.portation.modules.core.security.Party;
|
|
||||||
import com.arsdigita.portation.modules.core.security.Permission;
|
|
||||||
import com.arsdigita.portation.modules.core.security.Role;
|
|
||||||
import com.arsdigita.portation.modules.core.security.RoleMembership;
|
|
||||||
import com.arsdigita.portation.modules.core.security.User;
|
|
||||||
import com.arsdigita.portation.modules.core.security.util.PermissionIdMapper;
|
import com.arsdigita.portation.modules.core.security.util.PermissionIdMapper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -111,7 +105,7 @@ public class PermissionConversion {
|
||||||
Permission permission = new Permission(trunkPermission);
|
Permission permission = new Permission(trunkPermission);
|
||||||
|
|
||||||
// set object and opposed associations
|
// set object and opposed associations
|
||||||
CcmObject object = NgCollection.ccmObjects.get(((BigDecimal)
|
CcmObject object = NgCoreCollection.ccmObjects.get(((BigDecimal)
|
||||||
trunkPermission.getACSObject().get("id")).longValue());
|
trunkPermission.getACSObject().get("id")).longValue());
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
permission.setObject(object);
|
permission.setObject(object);
|
||||||
|
|
@ -122,7 +116,7 @@ public class PermissionConversion {
|
||||||
com.arsdigita.kernel.User trunkCreationUser = trunkPermission
|
com.arsdigita.kernel.User trunkCreationUser = trunkPermission
|
||||||
.getCreationUser();
|
.getCreationUser();
|
||||||
if (trunkCreationUser != null) {
|
if (trunkCreationUser != null) {
|
||||||
User creationUser = NgCollection.users.get(trunkCreationUser
|
User creationUser = NgCoreCollection.users.get(trunkCreationUser
|
||||||
.getID().longValue());
|
.getID().longValue());
|
||||||
|
|
||||||
if (creationUser != null)
|
if (creationUser != null)
|
||||||
|
|
@ -179,7 +173,7 @@ public class PermissionConversion {
|
||||||
final String oldId = Permission.genOldId(trunkPermission);
|
final String oldId = Permission.genOldId(trunkPermission);
|
||||||
final long permissionId = PermissionIdMapper.map.get(oldId);
|
final long permissionId = PermissionIdMapper.map.get(oldId);
|
||||||
// get ng permission
|
// get ng permission
|
||||||
final Permission permission = NgCollection.permissions.get(
|
final Permission permission = NgCoreCollection.permissions.get(
|
||||||
permissionId);
|
permissionId);
|
||||||
|
|
||||||
// get all parties serving as the grantee of this permission
|
// get all parties serving as the grantee of this permission
|
||||||
|
|
@ -205,7 +199,7 @@ public class PermissionConversion {
|
||||||
// if group contains 1 or more roles
|
// if group contains 1 or more roles
|
||||||
if (!roleCollection.isEmpty()) {
|
if (!roleCollection.isEmpty()) {
|
||||||
while (roleCollection.next()) {
|
while (roleCollection.next()) {
|
||||||
final Role grantee = NgCollection.roles.get(
|
final Role grantee = NgCoreCollection.roles.get(
|
||||||
roleCollection.getRole().getID().longValue());
|
roleCollection.getRole().getID().longValue());
|
||||||
|
|
||||||
// duplicate permission for found role as grantee
|
// duplicate permission for found role as grantee
|
||||||
|
|
@ -224,7 +218,7 @@ public class PermissionConversion {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// new Role for this group
|
// new Role for this group
|
||||||
final Group member = NgCollection.groups.get
|
final Group member = NgCoreCollection.groups.get
|
||||||
(trunkGranteeGroup.getID().longValue());
|
(trunkGranteeGroup.getID().longValue());
|
||||||
final Role granteeRole = getRoleIfExists(member);
|
final Role granteeRole = getRoleIfExists(member);
|
||||||
|
|
||||||
|
|
@ -237,7 +231,7 @@ public class PermissionConversion {
|
||||||
// new Role for this user
|
// new Role for this user
|
||||||
final com.arsdigita.kernel.User trunkGranteeUser = (com
|
final com.arsdigita.kernel.User trunkGranteeUser = (com
|
||||||
.arsdigita.kernel.User) trunkGranteeParty;
|
.arsdigita.kernel.User) trunkGranteeParty;
|
||||||
final User member = NgCollection.users.get
|
final User member = NgCoreCollection.users.get
|
||||||
(trunkGranteeUser.getID().longValue());
|
(trunkGranteeUser.getID().longValue());
|
||||||
final Role granteeRole = getRoleIfExists(member);
|
final Role granteeRole = getRoleIfExists(member);
|
||||||
|
|
||||||
|
|
@ -279,7 +273,7 @@ public class PermissionConversion {
|
||||||
// task assignments are missing
|
// task assignments are missing
|
||||||
String roleName = member.getName() + "_role";
|
String roleName = member.getName() + "_role";
|
||||||
|
|
||||||
List<Role> roles = new ArrayList<>(NgCollection.roles.values());
|
List<Role> roles = new ArrayList<>(NgCoreCollection.roles.values());
|
||||||
for (Role role : roles) {
|
for (Role role : roles) {
|
||||||
if (role.getName().equals(roleName))
|
if (role.getName().equals(roleName))
|
||||||
return role;
|
return role;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ package com.arsdigita.portation.conversion.core.security;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.kernel.PartyCollection;
|
import com.arsdigita.kernel.PartyCollection;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.security.Party;
|
import com.arsdigita.portation.modules.core.security.Party;
|
||||||
import com.arsdigita.portation.modules.core.security.Role;
|
import com.arsdigita.portation.modules.core.security.Role;
|
||||||
import com.arsdigita.portation.modules.core.security.RoleMembership;
|
import com.arsdigita.portation.modules.core.security.RoleMembership;
|
||||||
|
|
@ -94,7 +94,7 @@ public class RoleConversion {
|
||||||
long processed = 0;
|
long processed = 0;
|
||||||
|
|
||||||
while (partyCollection.next()) {
|
while (partyCollection.next()) {
|
||||||
Party member = NgCollection.parties.get(partyCollection.getParty()
|
Party member = NgCoreCollection.parties.get(partyCollection.getParty()
|
||||||
.getID().longValue());
|
.getID().longValue());
|
||||||
|
|
||||||
if (role != null && member != null) {
|
if (role != null && member != null) {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ package com.arsdigita.portation.conversion.core.workflow;
|
||||||
|
|
||||||
import com.arsdigita.kernel.GroupCollection;
|
import com.arsdigita.kernel.GroupCollection;
|
||||||
import com.arsdigita.kernel.RoleCollection;
|
import com.arsdigita.kernel.RoleCollection;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.security.Role;
|
import com.arsdigita.portation.modules.core.security.Role;
|
||||||
import com.arsdigita.portation.modules.core.security.User;
|
import com.arsdigita.portation.modules.core.security.User;
|
||||||
import com.arsdigita.portation.modules.core.workflow.AssignableTask;
|
import com.arsdigita.portation.modules.core.workflow.AssignableTask;
|
||||||
|
|
@ -88,7 +88,7 @@ public class AssignableTaskConversion {
|
||||||
try {
|
try {
|
||||||
userTaskWorkflow = trunkUserTask.getWorkflow();
|
userTaskWorkflow = trunkUserTask.getWorkflow();
|
||||||
if (userTaskWorkflow != null) {
|
if (userTaskWorkflow != null) {
|
||||||
Workflow workflow = NgCollection.workflows.get(
|
Workflow workflow = NgCoreCollection.workflows.get(
|
||||||
userTaskWorkflow.getID().longValue());
|
userTaskWorkflow.getID().longValue());
|
||||||
if (workflow != null) {
|
if (workflow != null) {
|
||||||
assignableTask.setWorkflow(workflow);
|
assignableTask.setWorkflow(workflow);
|
||||||
|
|
@ -104,7 +104,7 @@ public class AssignableTaskConversion {
|
||||||
.arsdigita.workflow.simple.TaskComment) commentsIt.next();
|
.arsdigita.workflow.simple.TaskComment) commentsIt.next();
|
||||||
|
|
||||||
TaskComment taskComment = new TaskComment(trunkTaskComment);
|
TaskComment taskComment = new TaskComment(trunkTaskComment);
|
||||||
User author = NgCollection.users.get(
|
User author = NgCoreCollection.users.get(
|
||||||
trunkTaskComment.getUser().getID().longValue());
|
trunkTaskComment.getUser().getID().longValue());
|
||||||
taskComment.setAuthor(author);
|
taskComment.setAuthor(author);
|
||||||
|
|
||||||
|
|
@ -114,14 +114,14 @@ public class AssignableTaskConversion {
|
||||||
|
|
||||||
// set lockingUser and notificationSender
|
// set lockingUser and notificationSender
|
||||||
if (trunkUserTask.getLockedUser() != null) {
|
if (trunkUserTask.getLockedUser() != null) {
|
||||||
User lockingUser = NgCollection.users.get(trunkUserTask
|
User lockingUser = NgCoreCollection.users.get(trunkUserTask
|
||||||
.getLockedUser()
|
.getLockedUser()
|
||||||
.getID().longValue());
|
.getID().longValue());
|
||||||
if (lockingUser != null)
|
if (lockingUser != null)
|
||||||
assignableTask.setLockingUser(lockingUser);
|
assignableTask.setLockingUser(lockingUser);
|
||||||
}
|
}
|
||||||
if (trunkUserTask.getNotificationSender() != null) {
|
if (trunkUserTask.getNotificationSender() != null) {
|
||||||
User notificationSender = NgCollection.users.get(trunkUserTask
|
User notificationSender = NgCoreCollection.users.get(trunkUserTask
|
||||||
.getNotificationSender().getID().longValue());
|
.getNotificationSender().getID().longValue());
|
||||||
if (notificationSender != null)
|
if (notificationSender != null)
|
||||||
assignableTask.setNotificationSender(notificationSender);
|
assignableTask.setNotificationSender(notificationSender);
|
||||||
|
|
@ -159,7 +159,7 @@ public class AssignableTaskConversion {
|
||||||
while (groupCollection.next()) {
|
while (groupCollection.next()) {
|
||||||
RoleCollection roleCollection = groupCollection.getGroup().getRoles();
|
RoleCollection roleCollection = groupCollection.getGroup().getRoles();
|
||||||
while (roleCollection.next()) {
|
while (roleCollection.next()) {
|
||||||
Role role = NgCollection.roles.get(roleCollection.getRole()
|
Role role = NgCoreCollection.roles.get(roleCollection.getRole()
|
||||||
.getID().longValue());
|
.getID().longValue());
|
||||||
|
|
||||||
if (assignableTask != null && role != null) {
|
if (assignableTask != null && role != null) {
|
||||||
|
|
@ -195,12 +195,12 @@ public class AssignableTaskConversion {
|
||||||
|
|
||||||
for (com.arsdigita.workflow.simple.UserTask trunkUserTask :
|
for (com.arsdigita.workflow.simple.UserTask trunkUserTask :
|
||||||
trunkUserTasks) {
|
trunkUserTasks) {
|
||||||
AssignableTask assignableTask = NgCollection.assignableTasks.get(trunkUserTask.getID()
|
AssignableTask assignableTask = NgCoreCollection.assignableTasks.get(trunkUserTask.getID()
|
||||||
.longValue());
|
.longValue());
|
||||||
|
|
||||||
Iterator it = trunkUserTask.getDependencies();
|
Iterator it = trunkUserTask.getDependencies();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
AssignableTask dependency = NgCollection.assignableTasks.get(((Task) it
|
AssignableTask dependency = NgCoreCollection.assignableTasks.get(((Task) it
|
||||||
.next())
|
.next())
|
||||||
.getID().longValue());
|
.getID().longValue());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
package com.arsdigita.portation.conversion.core.workflow;
|
package com.arsdigita.portation.conversion.core.workflow;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
import com.arsdigita.portation.modules.core.workflow.Workflow;
|
import com.arsdigita.portation.modules.core.workflow.Workflow;
|
||||||
import com.arsdigita.portation.modules.core.workflow.WorkflowTemplate;
|
import com.arsdigita.portation.modules.core.workflow.WorkflowTemplate;
|
||||||
|
|
@ -59,7 +59,6 @@ public class WorkflowConversion {
|
||||||
|
|
||||||
for (com.arsdigita.workflow.simple.Workflow
|
for (com.arsdigita.workflow.simple.Workflow
|
||||||
trunkWorkflow : trunkWorkflows) {
|
trunkWorkflow : trunkWorkflows) {
|
||||||
|
|
||||||
// create workflows
|
// create workflows
|
||||||
Workflow workflow = new Workflow(trunkWorkflow, false);
|
Workflow workflow = new Workflow(trunkWorkflow, false);
|
||||||
|
|
||||||
|
|
@ -67,7 +66,7 @@ public class WorkflowConversion {
|
||||||
com.arsdigita.workflow.simple.WorkflowTemplate
|
com.arsdigita.workflow.simple.WorkflowTemplate
|
||||||
trunkWorkflowTemplate = trunkWorkflow.getWorkflowTemplate();
|
trunkWorkflowTemplate = trunkWorkflow.getWorkflowTemplate();
|
||||||
if (trunkWorkflowTemplate != null) {
|
if (trunkWorkflowTemplate != null) {
|
||||||
WorkflowTemplate workflowTemplate = NgCollection
|
WorkflowTemplate workflowTemplate = NgCoreCollection
|
||||||
.workflowTemplates.get(trunkWorkflowTemplate.getID()
|
.workflowTemplates.get(trunkWorkflowTemplate.getID()
|
||||||
.longValue());
|
.longValue());
|
||||||
workflow.setTemplate(workflowTemplate);
|
workflow.setTemplate(workflowTemplate);
|
||||||
|
|
@ -76,7 +75,7 @@ public class WorkflowConversion {
|
||||||
// set object association
|
// set object association
|
||||||
ACSObject trunkObject = trunkWorkflow.getObject();
|
ACSObject trunkObject = trunkWorkflow.getObject();
|
||||||
if (trunkObject != null) {
|
if (trunkObject != null) {
|
||||||
CcmObject object = NgCollection.ccmObjects.get(trunkObject
|
CcmObject object = NgCoreCollection.ccmObjects.get(trunkObject
|
||||||
.getID().longValue());
|
.getID().longValue());
|
||||||
workflow.setObject(object);
|
workflow.setObject(object);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,176 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import com.arsdigita.portation.AbstractExporter;
|
||||||
|
import com.arsdigita.portation.Format;
|
||||||
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
|
import com.arsdigita.portation.modules.core.categorization.CategorizationMarshaller;
|
||||||
|
import com.arsdigita.portation.modules.core.categorization.CategoryMarshaller;
|
||||||
|
import com.arsdigita.portation.modules.core.security.*;
|
||||||
|
import com.arsdigita.portation.modules.core.workflow.AssignableTaskMarshaller;
|
||||||
|
import com.arsdigita.portation.modules.core.workflow.TaskAssignmentMarshaller;
|
||||||
|
import com.arsdigita.portation.modules.core.workflow.WorkflowMarshaller;
|
||||||
|
import com.arsdigita.portation.modules.core.workflow.WorkflowTemplateMarshaller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to implement the specifics for the exportation. Makes source code
|
||||||
|
* in the cli-tool shorter and more readable.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||||
|
* @version created on 25.07.2016
|
||||||
|
*/
|
||||||
|
public class CoreExporter extends AbstractExporter {
|
||||||
|
|
||||||
|
public static void exportUsers() {
|
||||||
|
System.out.printf("\tExporting users...");
|
||||||
|
UserMarshaller userMarshaller = new UserMarshaller();
|
||||||
|
userMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "users", indentation);
|
||||||
|
userMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.users.values()));
|
||||||
|
System.out.printf("\t\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportGroups() {
|
||||||
|
System.out.printf("\tExporting groups...");
|
||||||
|
GroupMarshaller groupMarshaller = new GroupMarshaller();
|
||||||
|
groupMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "groups", indentation);
|
||||||
|
groupMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.groups.values()));
|
||||||
|
System.out.printf("\t\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportGroupMemberships() {
|
||||||
|
System.out.printf("\tExporting group memberships...");
|
||||||
|
GroupMembershipMarshaller groupMembershipMarshaller = new
|
||||||
|
GroupMembershipMarshaller();
|
||||||
|
groupMembershipMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "groupMemberships",
|
||||||
|
indentation);
|
||||||
|
groupMembershipMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.groupMemberships
|
||||||
|
.values()));
|
||||||
|
System.out.printf("\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportRoles() {
|
||||||
|
System.out.printf("\tExporting roles...");
|
||||||
|
RoleMarshaller roleMarshaller = new RoleMarshaller();
|
||||||
|
roleMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "roles", indentation);
|
||||||
|
roleMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.roles.values()));
|
||||||
|
System.out.printf("\t\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportRoleMemberships() {
|
||||||
|
System.out.printf("\tExporting role memberships...");
|
||||||
|
RoleMembershipMarshaller roleMembershipMarshaller = new
|
||||||
|
RoleMembershipMarshaller();
|
||||||
|
roleMembershipMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "roleMemberships", indentation);
|
||||||
|
roleMembershipMarshaller.exportList(new ArrayList<>
|
||||||
|
(NgCoreCollection.roleMemberships.values()));
|
||||||
|
System.out.printf("\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportCategories() {
|
||||||
|
System.out.printf("\tExporting categories...");
|
||||||
|
CategoryMarshaller categoryMarshaller = new CategoryMarshaller();
|
||||||
|
categoryMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "categories", indentation);
|
||||||
|
categoryMarshaller
|
||||||
|
.exportList(NgCoreCollection.sortedCategories);
|
||||||
|
System.out.printf("\t\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportCategorizations() {
|
||||||
|
System.out.printf("\tExporting categorizations...");
|
||||||
|
CategorizationMarshaller categorizationMarshaller = new
|
||||||
|
CategorizationMarshaller();
|
||||||
|
categorizationMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "categorizations", indentation);
|
||||||
|
categorizationMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.categorizations
|
||||||
|
.values()));
|
||||||
|
System.out.printf("\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportWorkflowTemplates() {
|
||||||
|
System.out.printf("\tExporting workflow templates...");
|
||||||
|
WorkflowTemplateMarshaller workflowTemplateMarshaller = new
|
||||||
|
WorkflowTemplateMarshaller();
|
||||||
|
workflowTemplateMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "workflowTemplates",
|
||||||
|
indentation);
|
||||||
|
workflowTemplateMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.workflowTemplates
|
||||||
|
.values()));
|
||||||
|
System.out.printf("\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportWorkflows() {
|
||||||
|
System.out.printf("\tExporting workflows...");
|
||||||
|
WorkflowMarshaller workflowMarshaller = new WorkflowMarshaller();
|
||||||
|
workflowMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "workflows", indentation);
|
||||||
|
workflowMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.workflows.values()));
|
||||||
|
System.out.printf("\t\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportAssignableTasks() {
|
||||||
|
System.out.printf("\tExporting assignable tasks...");
|
||||||
|
AssignableTaskMarshaller assignableTaskMarshaller = new
|
||||||
|
AssignableTaskMarshaller();
|
||||||
|
assignableTaskMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "assignableTasks", indentation);
|
||||||
|
assignableTaskMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.assignableTasks
|
||||||
|
.values()));
|
||||||
|
System.out.printf("\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportTaskAssignments() {
|
||||||
|
System.out.printf("\tExporting task assignments...");
|
||||||
|
TaskAssignmentMarshaller taskAssignmentMarshaller = new
|
||||||
|
TaskAssignmentMarshaller();
|
||||||
|
taskAssignmentMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "taskAssignments", indentation);
|
||||||
|
taskAssignmentMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.taskAssignments
|
||||||
|
.values()));
|
||||||
|
System.out.printf("\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void exportPermissions() {
|
||||||
|
System.out.printf("\tExporting permissions...");
|
||||||
|
PermissionMarshaller permissionMarshaller = new
|
||||||
|
PermissionMarshaller();
|
||||||
|
permissionMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "permissions", indentation);
|
||||||
|
permissionMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.permissions.values()));
|
||||||
|
System.out.printf("\tdone.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,9 +19,8 @@
|
||||||
package com.arsdigita.portation.modules.core.categorization;
|
package com.arsdigita.portation.modules.core.categorization;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
|
|
@ -62,15 +61,10 @@ public class Categorization implements Portable {
|
||||||
|
|
||||||
this.type = "";
|
this.type = "";
|
||||||
|
|
||||||
NgCollection.categorizations.put(this.categorizationId, this);
|
NgCoreCollection.categorizations.put(this.categorizationId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new CategorizationMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getCategorizationId() {
|
public long getCategorizationId() {
|
||||||
return categorizationId;
|
return categorizationId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,8 @@ package com.arsdigita.portation.modules.core.categorization;
|
||||||
|
|
||||||
import com.arsdigita.categorization.CategoryLocalization;
|
import com.arsdigita.categorization.CategoryLocalization;
|
||||||
import com.arsdigita.categorization.CategoryLocalizationCollection;
|
import com.arsdigita.categorization.CategoryLocalizationCollection;
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
|
@ -107,15 +106,10 @@ public class Category extends CcmObject implements Portable {
|
||||||
? defaultParent.getNumberOfChildCategories() + 1
|
? defaultParent.getNumberOfChildCategories() + 1
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
NgCollection.categories.put(this.getObjectId(), this);
|
NgCoreCollection.categories.put(this.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new CategoryMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUniqueId() {
|
public String getUniqueId() {
|
||||||
return uniqueId;
|
return uniqueId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
package com.arsdigita.portation.modules.core.core;
|
package com.arsdigita.portation.modules.core.core;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.categorization.Categorization;
|
import com.arsdigita.portation.modules.core.categorization.Categorization;
|
||||||
import com.arsdigita.portation.modules.core.categorization.Category;
|
import com.arsdigita.portation.modules.core.categorization.Category;
|
||||||
import com.arsdigita.portation.modules.core.security.Permission;
|
import com.arsdigita.portation.modules.core.security.Permission;
|
||||||
|
|
@ -71,9 +71,22 @@ public class CcmObject {
|
||||||
this.permissions = new ArrayList<>();
|
this.permissions = new ArrayList<>();
|
||||||
this.categories = new ArrayList<>();
|
this.categories = new ArrayList<>();
|
||||||
|
|
||||||
NgCollection.ccmObjects.put(this.objectId, this);
|
NgCoreCollection.ccmObjects.put(this.objectId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CcmObject() {}
|
||||||
|
/*public CcmObject(final Domain trunkDomain) {
|
||||||
|
this.objectId = ACSObject.generateID().longValue();
|
||||||
|
|
||||||
|
this.uuid = UUID.randomUUID().toString();
|
||||||
|
this.displayName = trunkDomain.getKey() + "_DName";
|
||||||
|
|
||||||
|
this.permissions = new ArrayList<>();
|
||||||
|
this.categories = new ArrayList<>();
|
||||||
|
|
||||||
|
NgCoreCollection.ccmObjects.put(this.objectId, this);
|
||||||
|
}*/
|
||||||
|
|
||||||
public long getObjectId() {
|
public long getObjectId() {
|
||||||
return objectId;
|
return objectId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,7 @@ package com.arsdigita.portation.modules.core.l10n;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class for localisable string properties. This class is declared as
|
* A helper class for localisable string properties. This class is declared as
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation.modules.core.security;
|
package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
|
@ -45,13 +44,9 @@ public class Group extends Party implements Portable {
|
||||||
super(trunkGroup);
|
super(trunkGroup);
|
||||||
this.memberships = new HashSet<>();
|
this.memberships = new HashSet<>();
|
||||||
|
|
||||||
NgCollection.groups.put(this.getPartyId(), this);
|
NgCoreCollection.groups.put(this.getPartyId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new GroupMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<GroupMembership> getMemberships() {
|
public Set<GroupMembership> getMemberships() {
|
||||||
return memberships;
|
return memberships;
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,8 @@
|
||||||
package com.arsdigita.portation.modules.core.security;
|
package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
|
|
||||||
|
|
@ -45,13 +44,9 @@ public class GroupMembership implements Portable {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.member = member;
|
this.member = member;
|
||||||
|
|
||||||
NgCollection.groupMemberships.put(this.membershipId, this);
|
NgCoreCollection.groupMemberships.put(this.membershipId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new GroupMembershipMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getMembershipId() {
|
public long getMembershipId() {
|
||||||
return membershipId;
|
return membershipId;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation.modules.core.security;
|
package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
|
@ -51,7 +51,7 @@ public class Party {
|
||||||
|
|
||||||
this.roleMemberships = new HashSet<>();
|
this.roleMemberships = new HashSet<>();
|
||||||
|
|
||||||
NgCollection.parties.put(this.partyId, this);
|
NgCoreCollection.parties.put(this.partyId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPartyId() {
|
public long getPartyId() {
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,8 @@
|
||||||
package com.arsdigita.portation.modules.core.security;
|
package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
import com.arsdigita.portation.modules.core.security.util.PermissionIdMapper;
|
import com.arsdigita.portation.modules.core.security.util.PermissionIdMapper;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
|
@ -62,7 +61,7 @@ public class Permission implements Portable {
|
||||||
this.creationDate = trunkPermission.getCreationDate();
|
this.creationDate = trunkPermission.getCreationDate();
|
||||||
this.creationIp = trunkPermission.getCreationIP();
|
this.creationIp = trunkPermission.getCreationIP();
|
||||||
|
|
||||||
NgCollection.permissions.put(this.permissionId, this);
|
NgCoreCollection.permissions.put(this.permissionId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -108,14 +107,10 @@ public class Permission implements Portable {
|
||||||
this.creationDate = ngPermission.getCreationDate();
|
this.creationDate = ngPermission.getCreationDate();
|
||||||
this.creationIp = ngPermission.getCreationIp();
|
this.creationIp = ngPermission.getCreationIp();
|
||||||
|
|
||||||
NgCollection.permissions.put(this.permissionId, this);
|
NgCoreCollection.permissions.put(this.permissionId, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new PermissionMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPermissionId() {
|
public long getPermissionId() {
|
||||||
return permissionId;
|
return permissionId;
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,15 @@
|
||||||
package com.arsdigita.portation.modules.core.security;
|
package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||||
import com.arsdigita.portation.modules.core.workflow.TaskAssignment;
|
import com.arsdigita.portation.modules.core.workflow.TaskAssignment;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
|
@ -66,7 +61,7 @@ public class Role implements Portable {
|
||||||
this.description = new LocalizedString();
|
this.description = new LocalizedString();
|
||||||
this.description.addValue(local, trunkRole.getDescription());
|
this.description.addValue(local, trunkRole.getDescription());
|
||||||
|
|
||||||
NgCollection.roles.put(this.roleId, this);
|
NgCoreCollection.roles.put(this.roleId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Role(final String name) {
|
public Role(final String name) {
|
||||||
|
|
@ -80,13 +75,9 @@ public class Role implements Portable {
|
||||||
|
|
||||||
this.description = new LocalizedString();
|
this.description = new LocalizedString();
|
||||||
|
|
||||||
NgCollection.roles.put(this.roleId, this);
|
NgCoreCollection.roles.put(this.roleId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new RoleMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getRoleId() {
|
public long getRoleId() {
|
||||||
return roleId;
|
return roleId;
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,8 @@
|
||||||
package com.arsdigita.portation.modules.core.security;
|
package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
|
|
||||||
|
|
@ -45,13 +44,9 @@ public class RoleMembership implements Portable {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
this.member = member;
|
this.member = member;
|
||||||
|
|
||||||
NgCollection.roleMemberships.put(this.membershipId, this);
|
NgCoreCollection.roleMemberships.put(this.membershipId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new RoleMembershipMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getMembershipId() {
|
public long getMembershipId() {
|
||||||
return membershipId;
|
return membershipId;
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,14 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation.modules.core.security;
|
package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.core.EmailAddress;
|
import com.arsdigita.portation.modules.core.core.EmailAddress;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
|
@ -72,13 +67,9 @@ public class User extends Party implements Portable {
|
||||||
|
|
||||||
this.groupMemberships = new HashSet<>();
|
this.groupMemberships = new HashSet<>();
|
||||||
|
|
||||||
NgCollection.users.put(this.getPartyId(), this);
|
NgCoreCollection.users.put(this.getPartyId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new UserMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGivenName() {
|
public String getGivenName() {
|
||||||
return givenName;
|
return givenName;
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation.modules.core.workflow;
|
package com.arsdigita.portation.modules.core.workflow;
|
||||||
|
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.security.User;
|
import com.arsdigita.portation.modules.core.security.User;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
@ -64,13 +63,9 @@ public class AssignableTask extends Task implements Portable {
|
||||||
|
|
||||||
this.assignments = new ArrayList<>();
|
this.assignments = new ArrayList<>();
|
||||||
|
|
||||||
NgCollection.assignableTasks.put(this.getTaskId(), this);
|
NgCoreCollection.assignableTasks.put(this.getTaskId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new AssignableTaskMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLocked() {
|
public boolean isLocked() {
|
||||||
return locked;
|
return locked;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation.modules.core.workflow;
|
package com.arsdigita.portation.modules.core.workflow;
|
||||||
|
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||||
import com.arsdigita.portation.modules.core.workflow.util.StateMapper;
|
import com.arsdigita.portation.modules.core.workflow.util.StateMapper;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
|
@ -73,7 +73,7 @@ public class Task {
|
||||||
this.dependsOn = new ArrayList<>();
|
this.dependsOn = new ArrayList<>();
|
||||||
this.comments = new ArrayList<>();
|
this.comments = new ArrayList<>();
|
||||||
|
|
||||||
NgCollection.tasks.put(this.getTaskId(), this);
|
NgCoreCollection.tasks.put(this.getTaskId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTaskId() {
|
public long getTaskId() {
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,8 @@
|
||||||
package com.arsdigita.portation.modules.core.workflow;
|
package com.arsdigita.portation.modules.core.workflow;
|
||||||
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.security.Role;
|
import com.arsdigita.portation.modules.core.security.Role;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
|
|
@ -47,13 +46,9 @@ public class TaskAssignment implements Portable {
|
||||||
this.task = task;
|
this.task = task;
|
||||||
this.role = role;
|
this.role = role;
|
||||||
|
|
||||||
NgCollection.taskAssignments.put(this.taskAssignmentId, this);
|
NgCoreCollection.taskAssignments.put(this.taskAssignmentId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new TaskAssignmentMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTaskAssignmentId() {
|
public long getTaskAssignmentId() {
|
||||||
return taskAssignmentId;
|
return taskAssignmentId;
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation.modules.core.workflow;
|
package com.arsdigita.portation.modules.core.workflow;
|
||||||
|
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
|
||||||
import com.arsdigita.portation.Portable;
|
import com.arsdigita.portation.Portable;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||||
import com.arsdigita.portation.modules.core.workflow.util.StateMapper;
|
import com.arsdigita.portation.modules.core.workflow.util.StateMapper;
|
||||||
|
|
@ -60,7 +59,7 @@ public class Workflow implements Portable {
|
||||||
this.workflowId = trunkWorkFlow.getID().longValue();
|
this.workflowId = trunkWorkFlow.getID().longValue();
|
||||||
this.uuid = UUID.randomUUID().toString();
|
this.uuid = UUID.randomUUID().toString();
|
||||||
|
|
||||||
//template
|
//this.template
|
||||||
|
|
||||||
this.name = new LocalizedString();
|
this.name = new LocalizedString();
|
||||||
this.name.addValue(Locale.getDefault(), trunkWorkFlow.getDisplayName());
|
this.name.addValue(Locale.getDefault(), trunkWorkFlow.getDisplayName());
|
||||||
|
|
@ -73,18 +72,14 @@ public class Workflow implements Portable {
|
||||||
this.active = trunkWorkFlow.isActive();
|
this.active = trunkWorkFlow.isActive();
|
||||||
this.tasksState = StateMapper.mapTaskState(trunkWorkFlow.getState());
|
this.tasksState = StateMapper.mapTaskState(trunkWorkFlow.getState());
|
||||||
|
|
||||||
//object
|
//this.object
|
||||||
|
|
||||||
this.tasks = new ArrayList<>();
|
this.tasks = new ArrayList<>();
|
||||||
|
|
||||||
if (!template)
|
if (!template)
|
||||||
NgCollection.workflows.put(this.workflowId, this);
|
NgCoreCollection.workflows.put(this.workflowId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractMarshaller<? extends Portable> getMarshaller() {
|
|
||||||
return new WorkflowMarshaller();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getWorkflowId() {
|
public long getWorkflowId() {
|
||||||
return workflowId;
|
return workflowId;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation.modules.core.workflow;
|
package com.arsdigita.portation.modules.core.workflow;
|
||||||
|
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||||
|
|
@ -30,6 +30,6 @@ public class WorkflowTemplate extends Workflow {
|
||||||
public WorkflowTemplate(com.arsdigita.workflow.simple.WorkflowTemplate
|
public WorkflowTemplate(com.arsdigita.workflow.simple.WorkflowTemplate
|
||||||
trunkWorkFlowTemplate) {
|
trunkWorkFlowTemplate) {
|
||||||
super(trunkWorkFlowTemplate, true);
|
super(trunkWorkFlowTemplate, true);
|
||||||
NgCollection.workflowTemplates.put(this.getWorkflowId(), this);
|
NgCoreCollection.workflowTemplates.put(this.getWorkflowId(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,11 @@ package com.arsdigita.london.terms;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.arsdigita.persistence.*;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.arsdigita.categorization.Category;
|
import com.arsdigita.categorization.Category;
|
||||||
|
|
@ -31,12 +34,6 @@ import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.domain.ObservableDomainObject;
|
import com.arsdigita.domain.ObservableDomainObject;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
|
||||||
import com.arsdigita.persistence.DataObject;
|
|
||||||
import com.arsdigita.persistence.DataQuery;
|
|
||||||
import com.arsdigita.persistence.DataQueryDataCollectionAdapter;
|
|
||||||
import com.arsdigita.persistence.PersistenceException;
|
|
||||||
import com.arsdigita.persistence.SessionManager;
|
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
||||||
|
|
@ -483,4 +480,28 @@ public class Domain extends ObservableDomainObject {
|
||||||
}
|
}
|
||||||
throw new DataObjectNotFoundException("Domain with model " + rootCategory + " not found");
|
throw new DataObjectNotFoundException("Domain with model " + rootCategory + " not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all objects of this type stored in the database. Very
|
||||||
|
* necessary for exporting all entities of the current work environment.
|
||||||
|
*
|
||||||
|
* @return List of all domains
|
||||||
|
*/
|
||||||
|
public static List<Domain> getAllObjectDomains() {
|
||||||
|
List<Domain> domainList = new ArrayList<>();
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||||
|
Domain.BASE_DATA_OBJECT_TYPE));
|
||||||
|
|
||||||
|
while (collection.next()) {
|
||||||
|
Domain domain = (Domain) collection.getDomainObject();
|
||||||
|
if (domain != null) {
|
||||||
|
domainList.add(domain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return domainList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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.london.terms.portation.conversion;
|
||||||
|
|
||||||
|
import com.arsdigita.london.terms.portation.conversion.core.categorization.DomainConversion;
|
||||||
|
import com.arsdigita.portation.AbstractConverter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This core converter class calls all the conversions from trunk-objects
|
||||||
|
* to ng-objects in a specific order to guarantee a correct dependency
|
||||||
|
* recreation in the ng-objects. All the created objects are going to be
|
||||||
|
* stored in maps as <id, object>-pairs in the {@link NgCoreCollection}-class.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/28/17
|
||||||
|
*/
|
||||||
|
public class LdnTermsConverter extends AbstractConverter {
|
||||||
|
|
||||||
|
private static LdnTermsConverter instance;
|
||||||
|
|
||||||
|
static {
|
||||||
|
instance = new LdnTermsConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method, to start all the different converter classes in a specific
|
||||||
|
* order, so that dependencies can only be set, where the objects have
|
||||||
|
* already been created.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void startConversionToNg() {
|
||||||
|
DomainConversion.convertAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for the instance of the singleton.
|
||||||
|
*
|
||||||
|
* @return instance of this singleton
|
||||||
|
*/
|
||||||
|
public static LdnTermsConverter getInstance() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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.london.terms.portation.conversion;
|
||||||
|
|
||||||
|
import com.arsdigita.london.terms.portation.modules.core.categorization.Domain;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/28/17
|
||||||
|
*/
|
||||||
|
public class NgCoreCollection {
|
||||||
|
public static Map<Long, Domain> domains = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private constructor to prevent the instantiation of this class.
|
||||||
|
*/
|
||||||
|
private NgCoreCollection() {}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* 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.london.terms.portation.conversion.core.categorization;
|
||||||
|
|
||||||
|
import com.arsdigita.london.terms.portation.modules.core.categorization.Domain;
|
||||||
|
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||||
|
import com.arsdigita.portation.modules.core.categorization.Category;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for converting all trunk-{@link com.arsdigita.london.terms.Domain}s
|
||||||
|
* into ng-{@link Domain}s as preparation for a successful export of all trunk
|
||||||
|
* classes into the new ng-system.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/27/17
|
||||||
|
*/
|
||||||
|
public class DomainConversion {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all trunk-{@link com.arsdigita.london.terms.Domain}s from
|
||||||
|
* the persistent storage and collects them in a list. Then calls for
|
||||||
|
* creating the equivalent ng-{@link Domain}s focusing on keeping all the
|
||||||
|
* associations in tact.
|
||||||
|
*/
|
||||||
|
public static void convertAll() {
|
||||||
|
System.err.printf("\tFetching domains from database...");
|
||||||
|
List<com.arsdigita.london.terms.Domain> trunkDomains = com
|
||||||
|
.arsdigita.london.terms.Domain.getAllObjectDomains();
|
||||||
|
System.err.println("done.");
|
||||||
|
|
||||||
|
System.err.printf("\tConverting domains...\n");
|
||||||
|
createDomainsAndSetAssociations(trunkDomains);
|
||||||
|
System.err.printf("\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void createDomainsAndSetAssociations(
|
||||||
|
List<com.arsdigita.london.terms.Domain> trunkDomains) {
|
||||||
|
long processed = 0;
|
||||||
|
|
||||||
|
for(com.arsdigita.london.terms.Domain trunkDomain : trunkDomains) {
|
||||||
|
// create domains
|
||||||
|
Domain domain = new Domain(trunkDomain);
|
||||||
|
|
||||||
|
// set root (category) association
|
||||||
|
com.arsdigita.categorization.Category model = trunkDomain
|
||||||
|
.getModel();
|
||||||
|
if (model != null) {
|
||||||
|
Category root = NgCoreCollection
|
||||||
|
.categories
|
||||||
|
.get(model.getID().longValue());
|
||||||
|
domain.setRoot(root);
|
||||||
|
}
|
||||||
|
|
||||||
|
processed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.err.printf("\t\tCreated %d domains.\n", processed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.london.terms.portation.modules;
|
||||||
|
|
||||||
|
import com.arsdigita.london.terms.portation.conversion.NgCoreCollection;
|
||||||
|
import com.arsdigita.london.terms.portation.modules.core.categorization.DomainMarshaller;
|
||||||
|
import com.arsdigita.portation.AbstractExporter;
|
||||||
|
import com.arsdigita.portation.Format;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to implement the specifics for the exportation. Makes source code
|
||||||
|
* in the cli-tool shorter and more readable.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/28/17
|
||||||
|
*/
|
||||||
|
public class LdnTermsExporter extends AbstractExporter {
|
||||||
|
|
||||||
|
public static void exportUsers() {
|
||||||
|
System.out.printf("\tExporting domains...");
|
||||||
|
DomainMarshaller domainMarshaller = new DomainMarshaller();
|
||||||
|
domainMarshaller
|
||||||
|
.prepare(Format.XML, pathName, "domains", indentation);
|
||||||
|
domainMarshaller
|
||||||
|
.exportList(new ArrayList<>(NgCoreCollection.domains.values()));
|
||||||
|
System.out.printf("\t\tdone.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* 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.london.terms.portation.modules.core.categorization;
|
||||||
|
|
||||||
|
import com.arsdigita.london.terms.portation.conversion.NgCoreCollection;
|
||||||
|
import com.arsdigita.london.terms.portation.modules.core.web.CcmApplication;
|
||||||
|
import com.arsdigita.portation.Portable;
|
||||||
|
import com.arsdigita.portation.modules.core.categorization.Category;
|
||||||
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
|
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A domain is collection of categories designed a specific purpose. This entity
|
||||||
|
* replaces the {@code Domain} entity from the old
|
||||||
|
* {@link com.arsdigita.london.terms.Domain} module as well as the {@code
|
||||||
|
* CategoryPurpose} entity from the old {@code ccm-core module}.
|
||||||
|
*
|
||||||
|
* A {@code Domain} can be mapped to multiple {@link CcmApplication}s. Normally
|
||||||
|
* This is used to make a {@code Domain} available in the application. The
|
||||||
|
* {@link CcmApplication}s to which a {@code Domain} is mapped are called
|
||||||
|
* <em>owners</em> of the domain.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/27/17
|
||||||
|
*/
|
||||||
|
public class Domain extends CcmObject implements Portable {
|
||||||
|
|
||||||
|
private String domainKey;
|
||||||
|
private String uri;
|
||||||
|
private LocalizedString title;
|
||||||
|
private LocalizedString description;
|
||||||
|
private String version;
|
||||||
|
private Date released;
|
||||||
|
private Category root;
|
||||||
|
private List<DomainOwnership> owners;
|
||||||
|
|
||||||
|
|
||||||
|
public Domain(com.arsdigita.london.terms.Domain trunkDomain) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.domainKey = trunkDomain.getKey();
|
||||||
|
this.uri = trunkDomain.getURL().toString();
|
||||||
|
|
||||||
|
this.title = new LocalizedString();
|
||||||
|
this.title.addValue(Locale.getDefault(), trunkDomain.getTitle());
|
||||||
|
this.description = new LocalizedString();
|
||||||
|
this.description.addValue(Locale.getDefault(), trunkDomain
|
||||||
|
.getDescription());
|
||||||
|
|
||||||
|
this.version = trunkDomain.getVersion();
|
||||||
|
this.released = trunkDomain.getReleased();
|
||||||
|
|
||||||
|
//this.root
|
||||||
|
|
||||||
|
this.owners = new ArrayList<>();
|
||||||
|
|
||||||
|
NgCoreCollection.domains.put(this.getObjectId(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getDomainKey() {
|
||||||
|
return domainKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDomainKey(final String domainKey) {
|
||||||
|
this.domainKey = domainKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUri(final String uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalizedString getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(final LocalizedString title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalizedString getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final LocalizedString description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(final String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getReleased() {
|
||||||
|
return released;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReleased(final Date released) {
|
||||||
|
this.released = released;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Category getRoot() {
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoot(final Category root) {
|
||||||
|
this.root = root;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DomainOwnership> getOwners() {
|
||||||
|
return owners;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwners(final List<DomainOwnership> owners) {
|
||||||
|
this.owners = owners;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,16 +16,13 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
* MA 02110-1301 USA
|
* MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation;
|
package com.arsdigita.london.terms.portation.modules.core.categorization;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.arsdigita.portation.AbstractMarshaller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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 5/9/16
|
* @version created the 7/27/17
|
||||||
*/
|
*/
|
||||||
public interface Portable {
|
public class DomainMarshaller extends AbstractMarshaller<Domain> {
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
AbstractMarshaller<? extends Portable> getMarshaller();
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* 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.london.terms.portation.modules.core.categorization;
|
||||||
|
|
||||||
|
import com.arsdigita.london.terms.portation.modules.core.web.CcmApplication;
|
||||||
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Association class for the association between a {@link Domain} and a
|
||||||
|
* {@link CcmObject}. Instances of this class should not be created manually.
|
||||||
|
* Instead the methods provided by the {@code DomainManager} manager class
|
||||||
|
* should be used.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/27/17
|
||||||
|
*/
|
||||||
|
public class DomainOwnership {
|
||||||
|
|
||||||
|
private long ownershipId;
|
||||||
|
private CcmApplication owner;
|
||||||
|
private Domain domain;
|
||||||
|
private String context;
|
||||||
|
private long ownerOrder;
|
||||||
|
private long domainOrder;
|
||||||
|
|
||||||
|
|
||||||
|
public long getOwnershipId() {
|
||||||
|
return ownershipId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwnershipId(final long ownershipId) {
|
||||||
|
this.ownershipId = ownershipId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CcmApplication getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwner(final CcmApplication owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Domain getDomain() {
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDomain(final Domain domain) {
|
||||||
|
this.domain = domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContext() {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContext(final String context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getOwnerOrder() {
|
||||||
|
return ownerOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwnerOrder(final long ownerOrder) {
|
||||||
|
this.ownerOrder = ownerOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDomainOrder() {
|
||||||
|
return domainOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDomainOrder(final long domainOrder) {
|
||||||
|
this.domainOrder = domainOrder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
* 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.london.terms.portation.modules.core.core;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.london.terms.portation.modules.core.web.CcmApplication;
|
||||||
|
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
|
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@code Resource} class is a base class for several other classes, for
|
||||||
|
* example the {@link CcmApplication} class.
|
||||||
|
*
|
||||||
|
* Resources can be nested, a resource can have multiple child resources.
|
||||||
|
*
|
||||||
|
* This class is an adopted variant of the class
|
||||||
|
* {@code com.arsdigita.kernel.Resource} from the old structure. This class is
|
||||||
|
* maybe removed in future releases. Therefore it is strictly recommend not to
|
||||||
|
* use this class directly.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/27/17
|
||||||
|
*/
|
||||||
|
public class Resource extends CcmObject {
|
||||||
|
|
||||||
|
private LocalizedString title;
|
||||||
|
private LocalizedString description;
|
||||||
|
private ResourceType resourceType;
|
||||||
|
private Date created;
|
||||||
|
private List<Resource> childs;
|
||||||
|
private Resource parent;
|
||||||
|
|
||||||
|
|
||||||
|
public Resource(ACSObject trunkObject) {
|
||||||
|
super(trunkObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public LocalizedString getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(final LocalizedString title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalizedString getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final LocalizedString description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceType getResourceType() {
|
||||||
|
return resourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourceType(final ResourceType resourceType) {
|
||||||
|
this.resourceType = resourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreated(final Date created) {
|
||||||
|
this.created = created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Resource> getChilds() {
|
||||||
|
return childs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChilds(final List<Resource> childs) {
|
||||||
|
this.childs = childs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Resource getParent() {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(final Resource parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* 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.london.terms.portation.modules.core.core;
|
||||||
|
|
||||||
|
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is a port of the old {@code ResourceType} entity.
|
||||||
|
*
|
||||||
|
* @deprecated The real purpose of this class is not clear. Also the
|
||||||
|
* informations provided by the entities of this class are all quite static or
|
||||||
|
* can be interfered from the classes itself. In modern Java most if not all the
|
||||||
|
* informations provided by the entities of this class would be expressed as
|
||||||
|
* annotations. At the moment it is not clear of we can remove this class
|
||||||
|
* completely therefore it is still here but will maybe removed very soon.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/27/17
|
||||||
|
*/
|
||||||
|
public class ResourceType {
|
||||||
|
|
||||||
|
private long resourceTypeId;
|
||||||
|
private String title;
|
||||||
|
private LocalizedString description;
|
||||||
|
private boolean workspaceApplication;
|
||||||
|
private boolean viewableAsFullPage;
|
||||||
|
private boolean viewableAsEmbedded;
|
||||||
|
private boolean singleton;
|
||||||
|
|
||||||
|
|
||||||
|
public long getResourceTypeId() {
|
||||||
|
return resourceTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourceTypeId(final long resourceTypeId) {
|
||||||
|
this.resourceTypeId = resourceTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(final String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalizedString getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final LocalizedString description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWorkspaceApplication() {
|
||||||
|
return workspaceApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkspaceApplication(final boolean workspaceApplication) {
|
||||||
|
this.workspaceApplication = workspaceApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isViewableAsFullPage() {
|
||||||
|
return viewableAsFullPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setViewableAsFullPage(final boolean viewableAsFullPage) {
|
||||||
|
this.viewableAsFullPage = viewableAsFullPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isViewableAsEmbedded() {
|
||||||
|
return viewableAsEmbedded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setViewableAsEmbedded(final boolean viewableAsEmbedded) {
|
||||||
|
this.viewableAsEmbedded = viewableAsEmbedded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSingleton() {
|
||||||
|
return singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSingleton(final boolean singleton) {
|
||||||
|
this.singleton = singleton;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* 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.london.terms.portation.modules.core.web;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.london.terms.portation.modules.core.categorization.DomainOwnership;
|
||||||
|
import com.arsdigita.london.terms.portation.modules.core.core.Resource;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 7/27/17
|
||||||
|
*/
|
||||||
|
public class CcmApplication extends Resource {
|
||||||
|
|
||||||
|
private String applicationType;
|
||||||
|
private String primaryUrl;
|
||||||
|
private List<DomainOwnership> domains;
|
||||||
|
|
||||||
|
|
||||||
|
public CcmApplication(ACSObject trunkObject) {
|
||||||
|
super(trunkObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getApplicationType() {
|
||||||
|
return applicationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplicationType(final String applicationType) {
|
||||||
|
this.applicationType = applicationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrimaryUrl() {
|
||||||
|
return primaryUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrimaryUrl(final String primaryUrl) {
|
||||||
|
this.primaryUrl = primaryUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DomainOwnership> getDomains() {
|
||||||
|
return domains;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDomains(final List<DomainOwnership> domains) {
|
||||||
|
this.domains = domains;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue