diff --git a/ccm-core/src/com/arsdigita/portation/conversion/MainConversion.java b/ccm-core/src/com/arsdigita/portation/conversion/MainConversion.java new file mode 100644 index 000000000..f09429a42 --- /dev/null +++ b/ccm-core/src/com/arsdigita/portation/conversion/MainConversion.java @@ -0,0 +1,27 @@ +/* + * 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.conversion; + +/** + * @author Tobias Osmers + * @version created the 6/27/16 + */ +public class NgCollection { + + //public static Map ccmObjects = new HashMap<>(); + public static Map workflows = new HashMap<>(); + public static Map tasks = new HashMap<>(); + public static Map categories = new HashMap<>(); + public static Map categorizations = new HashMap<>(); + + private NgCollection() {} +} diff --git a/ccm-core/src/com/arsdigita/portation/conversion/core/categorization/CategorizationConversion.java b/ccm-core/src/com/arsdigita/portation/conversion/core/categorization/CategorizationConversion.java new file mode 100644 index 000000000..cab649e99 --- /dev/null +++ b/ccm-core/src/com/arsdigita/portation/conversion/core/categorization/CategorizationConversion.java @@ -0,0 +1,26 @@ +/* + * 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.conversion.core.categorization; + +/** + * @author Tobias Osmers + * @version created the 6/29/16 + */ +public class CategoryConversion { + + public static void convertAll() { + // Todo: + List trunkCategories = new ArrayList<>(); + + trunkCategories.forEach(Category::new); + + setParentCategory(trunkCategories); + } + + private static void setParentCategory( + List trunkCategories) { + Long id, parentId; + Category category, parentCategory; + + for (com.arsdigita.categorization.Category + trunkCategory : trunkCategories) { + id = trunkCategory.getID().longValue(); + parentId = trunkCategory.getDefaultParentCategory().getID() + .longValue(); + + category = NgCollection.categories.get(id); + parentCategory = NgCollection.categories.get(parentId); + + if (category != null && parentCategory != null) { + category.setParentCategory(parentCategory); + parentCategory.addSubCategory(category); + } + } + } +} diff --git a/ccm-core/src/com/arsdigita/portation/conversion/core/workflow/TaskConversion.java b/ccm-core/src/com/arsdigita/portation/conversion/core/workflow/TaskConversion.java new file mode 100644 index 000000000..4cb2df542 --- /dev/null +++ b/ccm-core/src/com/arsdigita/portation/conversion/core/workflow/TaskConversion.java @@ -0,0 +1,64 @@ +/* + * 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.conversion.core.workflow; + + +import com.arsdigita.portation.conversion.NgCollection; +import com.arsdigita.portation.modules.core.workflow.Task; +import com.arsdigita.portation.modules.core.workflow.Workflow; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Tobias Osmers + * @version created the 6/27/16 + */ +public class WorkflowConversion { + + public static void convertAll() { + List trunkWorkflows = + com.arsdigita.workflow.simple.Workflow.getObjectWorkflows(); + + trunkWorkflows.forEach(Workflow::new); + } +}