[TRUNK][FEATURE]
- adds export capabilities for task comments - minor changes in conversion classes git-svn-id: https://svn.libreccm.org/ccm/trunk@5013 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
233938ae53
commit
8b4f093664
|
|
@ -25,6 +25,7 @@ import com.arsdigita.portation.conversion.core.security.PermissionConversion;
|
|||
import com.arsdigita.portation.conversion.core.security.RoleConversion;
|
||||
import com.arsdigita.portation.conversion.core.security.UserConversion;
|
||||
import com.arsdigita.portation.conversion.core.workflow.AssignableTaskConversion;
|
||||
import com.arsdigita.portation.conversion.core.workflow.TaskCommentConversion;
|
||||
import com.arsdigita.portation.conversion.core.workflow.WorkflowConversion;
|
||||
import com.arsdigita.portation.conversion.core.workflow.WorkflowTemplateConversion;
|
||||
import com.arsdigita.portation.modules.core.security.Permission;
|
||||
|
|
@ -70,8 +71,9 @@ public class CoreConverter extends AbstractConverter {
|
|||
}
|
||||
}
|
||||
|
||||
WorkflowConversion.convertAll();
|
||||
WorkflowTemplateConversion.convertAll();
|
||||
WorkflowConversion.convertAll();
|
||||
TaskCommentConversion.convertAll();
|
||||
AssignableTaskConversion.convertAll();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public class NgCoreCollection {
|
|||
|
||||
public static Map<Long, Workflow> workflows = new HashMap<>();
|
||||
public static Map<Long, WorkflowTemplate> workflowTemplates = new HashMap<>();
|
||||
public static Map<Long, TaskComment> taskComments = new HashMap<>();
|
||||
public static Map<Long, Task> tasks = new HashMap<>();
|
||||
public static Map<Long, AssignableTask> assignableTasks = new HashMap<>();
|
||||
public static Map<Long, TaskAssignment> taskAssignments = new HashMap<>();
|
||||
|
|
@ -106,4 +107,21 @@ public class NgCoreCollection {
|
|||
sortedCategories.add(category);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the workflow templates from the list of all workflows for
|
||||
* easier importation in ng as workflow is the parent class of all
|
||||
* templates. Now you don't have to consider the already imported
|
||||
* templates while importing all other workflows and being in danger of
|
||||
* duplications.
|
||||
*/
|
||||
public static void removeTemplatesFromWorkflows() {
|
||||
int removed = 0;
|
||||
for (long templateId : workflowTemplates.keySet()) {
|
||||
workflows.remove(templateId);
|
||||
removed++;
|
||||
}
|
||||
System.err.printf("\t\tRemoved %d templates from over all workflows." +
|
||||
"\n", removed);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ public class CategoryConversion {
|
|||
System.err.printf("\tConverting categories and categorizations...\n");
|
||||
createCategoryAndCategorizations(trunkCategories);
|
||||
setRingAssociations(trunkCategories);
|
||||
|
||||
System.err.printf("\tSorting categories...\n");
|
||||
NgCoreCollection.sortCategories();
|
||||
|
||||
|
|
@ -70,7 +69,7 @@ public class CategoryConversion {
|
|||
*/
|
||||
private static void createCategoryAndCategorizations(
|
||||
List<com.arsdigita.categorization.Category> trunkCategories) {
|
||||
long processedCategories = 0, processedCategorizations = 0;
|
||||
int processedCategories = 0, processedCategorizations = 0;
|
||||
|
||||
|
||||
for (com.arsdigita.categorization.Category
|
||||
|
|
@ -88,8 +87,9 @@ public class CategoryConversion {
|
|||
|
||||
processedCategories++;
|
||||
}
|
||||
System.err.printf("\t\tCreated %d categories and %d categorizations." +
|
||||
"\n", processedCategories, processedCategorizations);
|
||||
System.err.printf("\t\tCreated %d categories and\n" +
|
||||
"\t\tcreated %d categorizations.\n",
|
||||
processedCategories, processedCategorizations);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -106,7 +106,7 @@ public class CategoryConversion {
|
|||
private static long createCategorizations(Category category,
|
||||
CategorizedCollection
|
||||
categorizedObjects) {
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
|
||||
while (categorizedObjects.next()) {
|
||||
CcmObject categorizedObject = NgCoreCollection
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class GroupConversion {
|
|||
*/
|
||||
private static void createGroupsAndSetAssociations(
|
||||
List<com.arsdigita.kernel.Group> trunkGroups) {
|
||||
long pGroups = 0, pMemberships = 0;
|
||||
int pGroups = 0, pMemberships = 0;
|
||||
|
||||
for (com.arsdigita.kernel.Group trunkGroup : trunkGroups) {
|
||||
// create groups
|
||||
|
|
@ -75,7 +75,8 @@ public class GroupConversion {
|
|||
|
||||
pGroups++;
|
||||
}
|
||||
System.err.printf("\t\tCreated %d groups and %d group memberships.\n",
|
||||
System.err.printf("\t\tCreated %d groups and\n" +
|
||||
"\t\tcreated %d group memberships.\n",
|
||||
pGroups, pMemberships);
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +92,7 @@ public class GroupConversion {
|
|||
*/
|
||||
private static long createGroupMemberships(Group group, UserCollection
|
||||
userCollection) {
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
|
||||
while (userCollection.next()) {
|
||||
User member = NgCoreCollection.users.get(userCollection.getUser()
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class PermissionConversion {
|
|||
*/
|
||||
private static void createPermissionsAndSetAssociations(final List<com
|
||||
.arsdigita.kernel.permissions.Permission> trunkPermissions) {
|
||||
long processed = 0, skipped = 0;
|
||||
int processed = 0, skipped = 0;
|
||||
|
||||
for (com.arsdigita.kernel.permissions.Permission trunkPermission :
|
||||
trunkPermissions) {
|
||||
|
|
@ -150,7 +150,7 @@ public class PermissionConversion {
|
|||
*/
|
||||
private static void setGranteeDependency(final List<com.arsdigita.kernel
|
||||
.permissions.Permission> trunkPermissions) {
|
||||
long duplicates = 0;
|
||||
int duplicates = 0;
|
||||
|
||||
for (com.arsdigita.kernel.permissions.Permission trunkPermission :
|
||||
trunkPermissions) {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class RoleConversion {
|
|||
*/
|
||||
private static void createRolesAndSetAssociations(
|
||||
List<com.arsdigita.kernel.Role> trunkRoles) {
|
||||
long pRoles = 0, pMemberships = 0;
|
||||
int pRoles = 0, pMemberships = 0;
|
||||
|
||||
for (com.arsdigita.kernel.Role trunkRole : trunkRoles) {
|
||||
// create roles
|
||||
|
|
@ -75,7 +75,8 @@ public class RoleConversion {
|
|||
|
||||
pRoles++;
|
||||
}
|
||||
System.out.printf("\t\tCreated %d roles and %d role memberships.\n",
|
||||
System.out.printf("\t\tCreated %d roles and\n" +
|
||||
"\t\tcreated %d role memberships.\n",
|
||||
pRoles, pMemberships);
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +92,7 @@ public class RoleConversion {
|
|||
*/
|
||||
private static long createRoleMemberships(Role role, PartyCollection
|
||||
partyCollection) {
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
|
||||
while (partyCollection.next()) {
|
||||
Party member = NgCoreCollection.parties.get(partyCollection.getParty()
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class UserConversion {
|
|||
|
||||
System.err.printf("\tConverting users...\n");
|
||||
// create users
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
for (com.arsdigita.kernel.User trunkUser : trunkUsers) {
|
||||
new User(trunkUser);
|
||||
processed++;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class AssignableTaskConversion {
|
|||
*/
|
||||
private static void createAssignableTasksAndSetAssociations(List<com.arsdigita
|
||||
.workflow.simple.UserTask> trunkUserTasks) {
|
||||
long pTasks = 0, pAssignments = 0;
|
||||
int pTasks = 0, pAssignments = 0;
|
||||
|
||||
for (com.arsdigita.workflow.simple.UserTask trunkUserTask :
|
||||
trunkUserTasks) {
|
||||
|
|
@ -136,8 +136,9 @@ public class AssignableTaskConversion {
|
|||
pTasks++;
|
||||
}
|
||||
|
||||
System.err.printf("\t\tCreated %d assignable tasks and %d task " +
|
||||
"assignments.\n", pTasks, pAssignments);
|
||||
System.err.printf("\t\tCreated %d assignable tasks and\n" +
|
||||
"\t\tcreated %d task assignments.\n",
|
||||
pTasks, pAssignments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -154,7 +155,7 @@ public class AssignableTaskConversion {
|
|||
*/
|
||||
private static long createTaskAssignments(AssignableTask assignableTask,
|
||||
GroupCollection groupCollection) {
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
|
||||
while (groupCollection.next()) {
|
||||
RoleCollection roleCollection = groupCollection.getGroup().getRoles();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 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.NgCoreCollection;
|
||||
import com.arsdigita.portation.modules.core.security.User;
|
||||
import com.arsdigita.portation.modules.core.workflow.TaskComment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class for converting all
|
||||
* trunk-{@link com.arsdigita.workflow.simple.TaskComment}s into
|
||||
* ng-{@link TaskComment}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 9/27/17
|
||||
*/
|
||||
public class TaskCommentConversion {
|
||||
|
||||
/**
|
||||
* Retrieves all trunk-{@link com.arsdigita.workflow.simple.TaskComment}s
|
||||
* from the persistent storage and collects them in a list. Then calls for
|
||||
* creating the equivalent ng-{@link TaskComment}s focusing on keeping
|
||||
* all the associations in tact.
|
||||
*/
|
||||
public static void convertAll() {
|
||||
System.err.printf("\tFetching task comments from database...");
|
||||
List<com.arsdigita.workflow.simple.TaskComment> trunkTaskComments = com
|
||||
.arsdigita.workflow.simple.TaskComment.getAllTaskComments();
|
||||
System.err.println("done.");
|
||||
|
||||
System.err.printf("\tConverting task comments...\n");
|
||||
createTaskCommentsAndSetAssociations(trunkTaskComments);
|
||||
System.err.println("\tdone.\n");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the equivalent ng-class of the {@code TaskComment} and restores
|
||||
* the associations to other classes.
|
||||
*
|
||||
* @param trunkTaskComments List of all
|
||||
* {@link com.arsdigita.workflow.simple.TaskComment}s
|
||||
* from this old trunk-system.
|
||||
*/
|
||||
private static void createTaskCommentsAndSetAssociations(
|
||||
List<com.arsdigita.workflow.simple.TaskComment> trunkTaskComments) {
|
||||
int processed = 0;
|
||||
|
||||
for (com.arsdigita.workflow.simple.TaskComment trunkTaskComment :
|
||||
trunkTaskComments) {
|
||||
// create TaskComments
|
||||
TaskComment taskComment = new TaskComment(trunkTaskComment);
|
||||
|
||||
// set author associations
|
||||
com.arsdigita.kernel.User trunkAuthor = trunkTaskComment.getUser();
|
||||
if (trunkAuthor != null) {
|
||||
User author = NgCoreCollection
|
||||
.users
|
||||
.get(trunkAuthor.getID().longValue());
|
||||
taskComment.setAuthor(author);
|
||||
}
|
||||
|
||||
processed++;
|
||||
}
|
||||
|
||||
System.err.printf("\t\tCreated %d task comments.\n", processed);
|
||||
}
|
||||
}
|
||||
|
|
@ -50,12 +50,15 @@ public class WorkflowConversion {
|
|||
|
||||
System.err.printf("\tConverting workflows...\n");
|
||||
createWorkflowAndSetAssociations(trunkWorkflows);
|
||||
System.err.printf("\tRemoving workflow templates...\n");
|
||||
NgCoreCollection.removeTemplatesFromWorkflows();
|
||||
|
||||
System.err.println("\tdone.\n");
|
||||
}
|
||||
|
||||
private static void createWorkflowAndSetAssociations(
|
||||
List<com.arsdigita.workflow.simple.Workflow> trunkWorkflows) {
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
|
||||
for (com.arsdigita.workflow.simple.Workflow
|
||||
trunkWorkflow : trunkWorkflows) {
|
||||
|
|
|
|||
|
|
@ -47,14 +47,13 @@ public class WorkflowTemplateConversion {
|
|||
System.err.println("done.");
|
||||
|
||||
System.err.printf("\tConverting workflow templates...\n");
|
||||
trunkWorkflowTemplates.forEach(WorkflowTemplate::new);
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
for (com.arsdigita.workflow.simple.WorkflowTemplate
|
||||
trunkWorkflowTemplate : trunkWorkflowTemplates) {
|
||||
new WorkflowTemplate(trunkWorkflowTemplate);
|
||||
processed++;
|
||||
}
|
||||
System.out.printf("\t\t Created %d workflow templates.\n", processed);
|
||||
System.out.printf("\t\tCreated %d workflow templates.\n", processed);
|
||||
System.err.println("\tdone.\n");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,7 @@ 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 com.arsdigita.portation.modules.core.workflow.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
|
@ -49,12 +46,13 @@ public class CoreExporter extends AbstractExporter {
|
|||
exportCategories();
|
||||
exportCategorizations();
|
||||
|
||||
exportWorkflows();
|
||||
exportPermissions();
|
||||
|
||||
exportWorkflowTemplates();
|
||||
exportWorkflows();
|
||||
exportTaskComments();
|
||||
exportAssignableTasks();
|
||||
exportTaskAssignments();
|
||||
|
||||
exportPermissions();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -130,6 +128,17 @@ public class CoreExporter extends AbstractExporter {
|
|||
System.out.printf("\tdone.\n");
|
||||
}
|
||||
|
||||
private 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");
|
||||
}
|
||||
|
||||
private static void exportWorkflowTemplates() {
|
||||
System.out.printf("\tExporting workflow templates...");
|
||||
WorkflowTemplateMarshaller workflowTemplateMarshaller = new
|
||||
|
|
@ -151,6 +160,17 @@ public class CoreExporter extends AbstractExporter {
|
|||
System.out.printf("\t\tdone.\n");
|
||||
}
|
||||
|
||||
private static void exportTaskComments() {
|
||||
System.out.printf("\tExporting task comments...");
|
||||
TaskCommentMarshaller taskCommentMarshaller = new
|
||||
TaskCommentMarshaller();
|
||||
taskCommentMarshaller.prepare(
|
||||
Format.XML, pathName, "taskComments", indentation);
|
||||
taskCommentMarshaller.exportList(
|
||||
new ArrayList<>(NgCoreCollection.taskComments.values()));
|
||||
System.out.printf("\tdone.\n");
|
||||
}
|
||||
|
||||
private static void exportAssignableTasks() {
|
||||
System.out.printf("\tExporting assignable tasks...");
|
||||
AssignableTaskMarshaller assignableTaskMarshaller = new
|
||||
|
|
@ -172,15 +192,4 @@ public class CoreExporter extends AbstractExporter {
|
|||
new ArrayList<>(NgCoreCollection.taskAssignments.values()));
|
||||
System.out.printf("\tdone.\n");
|
||||
}
|
||||
|
||||
private 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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ public class Permission implements Portable {
|
|||
private CcmObject object;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private Role grantee;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private User creationUser;
|
||||
private Date creationDate;
|
||||
private String creationIp;
|
||||
|
|
|
|||
|
|
@ -64,15 +64,17 @@ public class PermissionIdGenerator extends ObjectIdGenerator<String> {
|
|||
|
||||
final Permission permission = (Permission) forPojo;
|
||||
|
||||
String id = permission.getGrantedPrivilege() +
|
||||
permission.getPermissionId();
|
||||
String privilege = permission.getGrantedPrivilege(),
|
||||
roleName = "",
|
||||
objectUuid = "";
|
||||
boolean a = false, b = false;
|
||||
if (permission.getObject() != null) {
|
||||
id += permission.getObject().getUuid();
|
||||
|
||||
if (permission.getGrantee() != null) {
|
||||
roleName = permission.getGrantee().getName();
|
||||
a = true;
|
||||
}
|
||||
if (permission.getGrantee() != null) {
|
||||
id += permission.getGrantee().getName();
|
||||
if (permission.getObject() != null) {
|
||||
objectUuid = permission.getObject().getUuid();
|
||||
b = true;
|
||||
}
|
||||
|
||||
|
|
@ -81,6 +83,7 @@ public class PermissionIdGenerator extends ObjectIdGenerator<String> {
|
|||
permission.getGrantedPrivilege());
|
||||
}
|
||||
|
||||
return id;
|
||||
return String.join("_",
|
||||
privilege, roleName, objectUuid);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.portation.Portable;
|
|||
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||
import com.arsdigita.portation.modules.core.security.User;
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
|
@ -39,10 +40,12 @@ import java.util.List;
|
|||
public class AssignableTask extends Task implements Portable {
|
||||
|
||||
private boolean locked;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private User lockingUser;
|
||||
private Date startDate;
|
||||
private Date dueDate;
|
||||
private long durationMinutes;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private User notificationSender;
|
||||
@JsonIgnore
|
||||
private List<TaskAssignment> assignments;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public class Task {
|
|||
private List<Task> dependentTasks;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private List<Task> dependsOn;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private List<TaskComment> comments;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,12 @@
|
|||
*/
|
||||
package com.arsdigita.portation.modules.core.workflow;
|
||||
|
||||
import com.arsdigita.portation.Portable;
|
||||
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||
import com.arsdigita.portation.modules.core.security.User;
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -26,11 +31,15 @@ import java.util.UUID;
|
|||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||
* @version created on 11/18/16
|
||||
*/
|
||||
public class TaskComment {
|
||||
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
|
||||
resolver = TaskCommentIdResolver.class,
|
||||
property = "uuid")
|
||||
public class TaskComment implements Portable {
|
||||
|
||||
private long commentId;
|
||||
private String uuid;
|
||||
private String comment;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private User author;
|
||||
|
||||
|
||||
|
|
@ -39,7 +48,9 @@ public class TaskComment {
|
|||
this.commentId = trunkTaskComment.getCommentID().longValue();
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.comment = trunkTaskComment.getComment();
|
||||
//author
|
||||
//this.author
|
||||
|
||||
NgCoreCollection.taskComments.put(this.getCommentId(), this);
|
||||
}
|
||||
|
||||
public long getCommentId() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package com.arsdigita.portation.modules.core.workflow;
|
||||
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdResolver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 9/27/17
|
||||
*/
|
||||
public class TaskCommentIdResolver implements ObjectIdResolver {
|
||||
@Override
|
||||
public void bindItem(ObjectIdGenerator.IdKey idKey,
|
||||
Object pojo) {
|
||||
// According to the Jackson JavaDoc, this method can be used to keep
|
||||
// track of objects directly in a resolver implementation. We don't need
|
||||
// this here therefore this method is empty.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveId(ObjectIdGenerator.IdKey id) {
|
||||
// Find the user for the id (don't confuse that with the primary key!).
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectIdResolver newForDeserialization(Object context) {
|
||||
return new TaskCommentIdResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseFor(ObjectIdResolver resolverType) {
|
||||
return resolverType instanceof TaskCommentIdResolver;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package com.arsdigita.portation.modules.core.workflow;
|
||||
|
||||
import com.arsdigita.portation.AbstractMarshaller;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 9/27/17
|
||||
*/
|
||||
public class TaskCommentMarshaller extends AbstractMarshaller<TaskComment> {
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ import com.arsdigita.portation.modules.core.core.CcmObject;
|
|||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||
import com.arsdigita.portation.modules.core.workflow.util.StateMapper;
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
|
@ -43,12 +44,14 @@ public class Workflow implements Portable {
|
|||
|
||||
private long workflowId;
|
||||
private String uuid;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private WorkflowTemplate template;
|
||||
private LocalizedString name;
|
||||
private LocalizedString description;
|
||||
private WorkflowState state;
|
||||
private boolean active;
|
||||
private TaskState tasksState;
|
||||
@JsonIdentityReference(alwaysAsId = true)
|
||||
private CcmObject object;
|
||||
@JsonIgnore
|
||||
private List<Task> tasks;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ public class WorkflowIdResolver implements ObjectIdResolver {
|
|||
|
||||
@Override
|
||||
public Object resolveId(final ObjectIdGenerator.IdKey id) {
|
||||
// Find the user for the id (don't confuse that with the primary key!).
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,16 @@
|
|||
package com.arsdigita.portation.modules.core.workflow;
|
||||
|
||||
import com.arsdigita.portation.conversion.NgCoreCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||
* @version created on 11/18/16
|
||||
*/
|
||||
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
|
||||
resolver = WorkflowTemplateIdResolver.class,
|
||||
property = "uuid")
|
||||
public class WorkflowTemplate extends Workflow {
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (C) 2015 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package com.arsdigita.portation.modules.core.workflow;
|
||||
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdResolver;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
* @version created the 9/6/17
|
||||
*/
|
||||
public class WorkflowTemplateIdResolver implements ObjectIdResolver {
|
||||
@Override
|
||||
public void bindItem(ObjectIdGenerator.IdKey idKey, Object o) {
|
||||
// According to the Jackson JavaDoc, this method can be used to keep
|
||||
// track of objects directly in a resolver implementation. We don't need
|
||||
// this here therefore this method is empty.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveId(ObjectIdGenerator.IdKey idKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectIdResolver newForDeserialization(Object o) {
|
||||
return new WorkflowTemplateIdResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseFor(ObjectIdResolver resolverType) {
|
||||
return resolverType instanceof WorkflowTemplateIdResolver;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,14 +20,15 @@ package com.arsdigita.workflow.simple;
|
|||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.arsdigita.db.Sequences;
|
||||
import com.arsdigita.domain.DomainCollection;
|
||||
import com.arsdigita.domain.ObservableDomainObject;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.PersistenceException;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.*;
|
||||
import com.arsdigita.persistence.metadata.ObjectType;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -288,4 +289,29 @@ public class TaskComment extends ObservableDomainObject {
|
|||
return (Task) DomainObjectFactory.newInstance((DataObject) get(TASK));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 taskComments
|
||||
*/
|
||||
public static List<TaskComment> getAllTaskComments() {
|
||||
List<TaskComment> taskCommentList = new ArrayList<>();
|
||||
|
||||
final Session session = SessionManager.getSession();
|
||||
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||
TaskComment.BASE_DATA_OBJECT_TYPE));
|
||||
|
||||
while (collection.next()) {
|
||||
TaskComment taskComment = (TaskComment) collection
|
||||
.getDomainObject();
|
||||
if (taskComment != null) {
|
||||
taskCommentList.add(taskComment);
|
||||
}
|
||||
}
|
||||
|
||||
collection.close();
|
||||
return taskCommentList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class DomainConversion {
|
|||
*/
|
||||
private static void createDomainsAndSetAssociations(
|
||||
List<com.arsdigita.london.terms.Domain> trunkDomains) {
|
||||
long processedDomains = 0, processedDomainOwnerships = 0;
|
||||
int processedDomains = 0, processedDomainOwnerships = 0;
|
||||
|
||||
for(com.arsdigita.london.terms.Domain trunkDomain : trunkDomains) {
|
||||
// create domains
|
||||
|
|
@ -91,7 +91,8 @@ public class DomainConversion {
|
|||
|
||||
processedDomains++;
|
||||
}
|
||||
System.err.printf("\t\tCreated %d domains and %d domain ownerships.\n",
|
||||
System.err.printf("\t\tCreated %d domains and\n" +
|
||||
"\t\tcreated %d domain ownerships.\n",
|
||||
processedDomains, processedDomainOwnerships);
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +109,7 @@ public class DomainConversion {
|
|||
*/
|
||||
private static long createDomainOwnerships(Domain domain,
|
||||
DomainCollection useContexts) {
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
|
||||
while (useContexts.next()) {
|
||||
final DomainObject obj = DomainObjectFactory
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class ResourceTypeConversion {
|
|||
|
||||
System.err.printf("\tConverting domains...\n");
|
||||
// create resource types
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
for (com.arsdigita.kernel.ResourceType trunkResourceType :
|
||||
trunkResourceTypes) {
|
||||
new ResourceType(trunkResourceType);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class CcmApplicationConversion {
|
|||
*/
|
||||
private static void createCcmApplicationsAndSetAssociations(
|
||||
List<Application> trunkApplications) {
|
||||
long processed = 0;
|
||||
int processed = 0;
|
||||
|
||||
for (Application trunkApplication : trunkApplications) {
|
||||
// create applications
|
||||
|
|
|
|||
Loading…
Reference in New Issue