adds converter for the ng-classes Workflow, Task, Category, User and Group; as well as multiple other modifications in package conversion
git-svn-id: https://svn.libreccm.org/ccm/trunk@4188 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
10f2a7a5fe
commit
e7f6f22e26
|
|
@ -20,6 +20,7 @@ package com.arsdigita.categorization;
|
||||||
|
|
||||||
import com.arsdigita.db.Sequences;
|
import com.arsdigita.db.Sequences;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.domain.DomainServiceInterfaceExposer;
|
import com.arsdigita.domain.DomainServiceInterfaceExposer;
|
||||||
import com.arsdigita.globalization.GlobalizationHelper;
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
|
|
@ -36,22 +37,22 @@ import com.arsdigita.persistence.DataOperation;
|
||||||
import com.arsdigita.persistence.DataQuery;
|
import com.arsdigita.persistence.DataQuery;
|
||||||
import com.arsdigita.persistence.DataQueryDataCollectionAdapter;
|
import com.arsdigita.persistence.DataQueryDataCollectionAdapter;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.persistence.metadata.ObjectType;
|
import com.arsdigita.persistence.metadata.ObjectType;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.util.HierarchyDenormalization;
|
import com.arsdigita.util.HierarchyDenormalization;
|
||||||
import com.arsdigita.util.StringUtils;
|
import com.arsdigita.util.StringUtils;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Collection;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* <p>Implements persistent storage of categories. See {@link
|
* <p>Implements persistent storage of categories. See {@link
|
||||||
|
|
@ -2410,4 +2411,28 @@ public class Category extends ACSObject {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 categories
|
||||||
|
*/
|
||||||
|
public static List<Category> getAllObjectCategories() {
|
||||||
|
List<Category> categoryList = new ArrayList<>();
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||||
|
Category.BASE_DATA_OBJECT_TYPE));
|
||||||
|
|
||||||
|
while (collection.next()) {
|
||||||
|
Category category = (Category) collection.getDomainObject();
|
||||||
|
if (category != null) {
|
||||||
|
categoryList.add(category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return categoryList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,10 @@ package com.arsdigita.kernel;
|
||||||
// Identity class.
|
// Identity class.
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.arsdigita.categorization.Category;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.persistence.DataAssociation;
|
import com.arsdigita.persistence.DataAssociation;
|
||||||
import com.arsdigita.persistence.DataAssociationCursor;
|
import com.arsdigita.persistence.DataAssociationCursor;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
@ -32,12 +34,14 @@ import com.arsdigita.persistence.DataQuery;
|
||||||
import com.arsdigita.persistence.Filter;
|
import com.arsdigita.persistence.Filter;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.persistence.PersistenceException;
|
import com.arsdigita.persistence.PersistenceException;
|
||||||
|
import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.persistence.metadata.ObjectType;
|
import com.arsdigita.persistence.metadata.ObjectType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a group.
|
* Represents a group.
|
||||||
|
|
@ -811,4 +815,28 @@ public class Group extends Party {
|
||||||
return SessionManager.getSession().retrieveDataOperation(name);
|
return SessionManager.getSession().retrieveDataOperation(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 groups
|
||||||
|
*/
|
||||||
|
public static List<Group> getAllObjectGroups() {
|
||||||
|
List<Group> groupList = new ArrayList<>();
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||||
|
Group.BASE_DATA_OBJECT_TYPE));
|
||||||
|
|
||||||
|
while (collection.next()) {
|
||||||
|
Group group = (Group) collection.getDomainObject();
|
||||||
|
if (group != null) {
|
||||||
|
groupList.add(group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return groupList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.kernel;
|
||||||
// Identity class.
|
// Identity class.
|
||||||
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||||
import com.arsdigita.kernel.permissions.PermissionService;
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
|
|
@ -29,6 +30,8 @@ import com.arsdigita.persistence.*;
|
||||||
import com.arsdigita.persistence.metadata.ObjectType;
|
import com.arsdigita.persistence.metadata.ObjectType;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a user.
|
* Represents a user.
|
||||||
|
|
@ -469,4 +472,28 @@ public class User extends Party {
|
||||||
public void setBanned(boolean b) {
|
public void setBanned(boolean b) {
|
||||||
set(BANNED, new Boolean(b));
|
set(BANNED, new Boolean(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 users
|
||||||
|
*/
|
||||||
|
public static List<User> getAllObjectUsers() {
|
||||||
|
List<User> userList = new ArrayList<>();
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||||
|
User.BASE_DATA_OBJECT_TYPE));
|
||||||
|
|
||||||
|
while (collection.next()) {
|
||||||
|
User user = (User) collection.getDomainObject();
|
||||||
|
if (user != null) {
|
||||||
|
userList.add(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return userList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@ 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.security.Group;
|
||||||
|
import com.arsdigita.portation.modules.core.security.GroupMembership;
|
||||||
|
import com.arsdigita.portation.modules.core.security.Party;
|
||||||
|
import com.arsdigita.portation.modules.core.security.User;
|
||||||
import com.arsdigita.portation.modules.core.workflow.Task;
|
import com.arsdigita.portation.modules.core.workflow.Task;
|
||||||
import com.arsdigita.portation.modules.core.workflow.Workflow;
|
import com.arsdigita.portation.modules.core.workflow.Workflow;
|
||||||
|
|
||||||
|
|
@ -32,11 +37,15 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class NgCollection {
|
public class NgCollection {
|
||||||
|
|
||||||
//public static Map<Long, CcmObject> ccmObjects = new HashMap<>();
|
public static Map<Long, CcmObject> ccmObjects = new HashMap<>();
|
||||||
public static Map<Long, Workflow> workflows = new HashMap<>();
|
public static Map<Long, Workflow> workflows = new HashMap<>();
|
||||||
public static Map<Long, Task> tasks = new HashMap<>();
|
public static Map<Long, Task> tasks = new HashMap<>();
|
||||||
public static Map<Long, Category> categories = new HashMap<>();
|
public static Map<Long, Category> categories = new HashMap<>();
|
||||||
public static Map<Long, Categorization> categorizations = new HashMap<>();
|
public static Map<Long, Categorization> categorizations = new HashMap<>();
|
||||||
|
public static Map<Long, Party> parties = new HashMap<>();
|
||||||
|
public static Map<Long, User> users = new HashMap<>();
|
||||||
|
public static Map<Long, Group> groups = new HashMap<>();
|
||||||
|
public static Map<Long, GroupMembership> groupMemberships = new HashMap<>();
|
||||||
|
|
||||||
private NgCollection() {}
|
private NgCollection() {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,13 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.portation.conversion.core.categorization;
|
package com.arsdigita.portation.conversion.core.categorization;
|
||||||
|
|
||||||
|
import com.arsdigita.categorization.CategorizedCollection;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.conversion.NgCollection;
|
import com.arsdigita.portation.conversion.NgCollection;
|
||||||
|
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 java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -31,32 +34,64 @@ import java.util.List;
|
||||||
public class CategoryConversion {
|
public class CategoryConversion {
|
||||||
|
|
||||||
public static void convertAll() {
|
public static void convertAll() {
|
||||||
// Todo:
|
List<com.arsdigita.categorization.Category> trunkCategories = com
|
||||||
List<com.arsdigita.categorization.Category> trunkCategories = new ArrayList<>();
|
.arsdigita.categorization.Category.getAllObjectCategories();
|
||||||
|
|
||||||
trunkCategories.forEach(Category::new);
|
trunkCategories.forEach(Category::new);
|
||||||
|
|
||||||
setParentCategory(trunkCategories);
|
setAssociations(trunkCategories);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setParentCategory(
|
/**
|
||||||
|
* Sets associations. Needs to be separate, so that all categories have
|
||||||
|
* been converted before. Otherwise it will be complex to get parent.
|
||||||
|
*
|
||||||
|
* @param trunkCategories
|
||||||
|
*/
|
||||||
|
private static void setAssociations(
|
||||||
List<com.arsdigita.categorization.Category> trunkCategories) {
|
List<com.arsdigita.categorization.Category> trunkCategories) {
|
||||||
Long id, parentId;
|
|
||||||
Category category, parentCategory;
|
Category category, parentCategory;
|
||||||
|
|
||||||
for (com.arsdigita.categorization.Category
|
for (com.arsdigita.categorization.Category
|
||||||
trunkCategory : trunkCategories) {
|
trunkCategory : trunkCategories) {
|
||||||
id = trunkCategory.getID().longValue();
|
category = NgCollection.categories.get(trunkCategory.getID()
|
||||||
parentId = trunkCategory.getDefaultParentCategory().getID()
|
.longValue());
|
||||||
.longValue();
|
|
||||||
|
|
||||||
category = NgCollection.categories.get(id);
|
// set parent associations
|
||||||
parentCategory = NgCollection.categories.get(parentId);
|
parentCategory = NgCollection.categories.get(trunkCategory
|
||||||
|
.getDefaultParentCategory().getID().longValue());
|
||||||
|
setParentCategory(category, parentCategory);
|
||||||
|
|
||||||
|
// create categorizations only for category typed objects
|
||||||
|
CategorizedCollection categorizedCollection = trunkCategory
|
||||||
|
.getObjects(com.arsdigita.categorization.Category
|
||||||
|
.BASE_DATA_OBJECT_TYPE);
|
||||||
|
createCategorizations(category, categorizedCollection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setParentCategory(Category category, Category
|
||||||
|
parentCategory) {
|
||||||
if (category != null && parentCategory != null) {
|
if (category != null && parentCategory != null) {
|
||||||
category.setParentCategory(parentCategory);
|
category.setParentCategory(parentCategory);
|
||||||
parentCategory.addSubCategory(category);
|
parentCategory.addSubCategory(category);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void createCategorizations(Category category,
|
||||||
|
CategorizedCollection
|
||||||
|
categorizedObjects) {
|
||||||
|
while (categorizedObjects.next()) {
|
||||||
|
CcmObject categorizedObject = NgCollection.ccmObjects.get((
|
||||||
|
(ACSObject) categorizedObjects.getDomainObject())
|
||||||
|
.getID().longValue());
|
||||||
|
// create categorizations
|
||||||
|
Categorization categorization = new Categorization(category,
|
||||||
|
categorizedObject);
|
||||||
|
|
||||||
|
// set adverse associations
|
||||||
|
category.addObject(categorization);
|
||||||
|
categorizedObject.addCategory(categorization);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* 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.security;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.UserCollection;
|
||||||
|
import com.arsdigita.portation.conversion.NgCollection;
|
||||||
|
import com.arsdigita.portation.modules.core.security.Group;
|
||||||
|
import com.arsdigita.portation.modules.core.security.GroupMembership;
|
||||||
|
import com.arsdigita.portation.modules.core.security.User;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||||
|
* @version created the 7/4/16
|
||||||
|
*/
|
||||||
|
public class GroupConversion {
|
||||||
|
|
||||||
|
public static void convertAll() {
|
||||||
|
List<com.arsdigita.kernel.Group> trunkGroups = com.arsdigita.kernel
|
||||||
|
.Group.getAllObjectGroups();
|
||||||
|
|
||||||
|
trunkGroups.forEach(Group::new);
|
||||||
|
|
||||||
|
setAssociations(trunkGroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setAssociations(
|
||||||
|
List<com.arsdigita.kernel.Group> trunkGroups) {
|
||||||
|
Group group;
|
||||||
|
|
||||||
|
for (com.arsdigita.kernel.Group trunkGroup : trunkGroups) {
|
||||||
|
group = NgCollection.groups.get(trunkGroup.getID().longValue());
|
||||||
|
|
||||||
|
// create groupMemberships
|
||||||
|
UserCollection userCollection = trunkGroup.getMemberUsers();
|
||||||
|
createGroupMemberships(group, userCollection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void createGroupMemberships(Group group, UserCollection
|
||||||
|
userCollection) {
|
||||||
|
while (userCollection.next()) {
|
||||||
|
User member = NgCollection.users.get(userCollection.getUser()
|
||||||
|
.getID().longValue());
|
||||||
|
|
||||||
|
// create groupMemeberships
|
||||||
|
GroupMembership groupMembership = new GroupMembership(group, member);
|
||||||
|
|
||||||
|
// set adverse associations
|
||||||
|
group.addMembership(groupMembership);
|
||||||
|
member.addGroupMembership(groupMembership);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -16,11 +16,22 @@
|
||||||
* 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.conversion.core.categorization;
|
package com.arsdigita.portation.conversion.core.security;
|
||||||
|
|
||||||
|
import com.arsdigita.portation.modules.core.security.User;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||||
* @version created the 6/29/16
|
* @version created the 7/4/16
|
||||||
*/
|
*/
|
||||||
public class CategorizationConversion {
|
public class UserConversion {
|
||||||
|
|
||||||
|
public static void convertAll() {
|
||||||
|
List<com.arsdigita.kernel.User> trunkUsers = com.arsdigita.kernel
|
||||||
|
.User.getAllObjectUsers();
|
||||||
|
|
||||||
|
trunkUsers.forEach(User::new);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -23,7 +23,6 @@ import com.arsdigita.portation.conversion.NgCollection;
|
||||||
import com.arsdigita.portation.modules.core.workflow.Task;
|
import com.arsdigita.portation.modules.core.workflow.Task;
|
||||||
import com.arsdigita.portation.modules.core.workflow.Workflow;
|
import com.arsdigita.portation.modules.core.workflow.Workflow;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -33,32 +32,22 @@ import java.util.List;
|
||||||
public class TaskConversion {
|
public class TaskConversion {
|
||||||
|
|
||||||
public static void convertAll() {
|
public static void convertAll() {
|
||||||
// Todo:
|
List<com.arsdigita.workflow.simple.Task> trunkTasks =
|
||||||
List<com.arsdigita.workflow.simple.Task> trunkTask = new ArrayList<>();
|
com.arsdigita.workflow.simple.Task.getAllObjectTasks();
|
||||||
|
|
||||||
trunkTask.forEach(Task::new);
|
|
||||||
|
|
||||||
setWorkflow(trunkTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setWorkflow(List<com.arsdigita.workflow.simple.Task>
|
|
||||||
trunkTasks) {
|
|
||||||
long id, workflowId;
|
|
||||||
Task task;
|
Task task;
|
||||||
Workflow workflow;
|
Workflow workflow;
|
||||||
|
|
||||||
for (com.arsdigita.workflow.simple.Task trunkTask : trunkTasks) {
|
for (com.arsdigita.workflow.simple.Task trunkTask : trunkTasks) {
|
||||||
id = trunkTask.getID().longValue();
|
task = new Task(trunkTask);
|
||||||
workflowId = trunkTask.getWorkflow().getID().longValue();
|
workflow = NgCollection.workflows.get(
|
||||||
|
trunkTask.getWorkflow().getID().longValue());
|
||||||
|
|
||||||
task = NgCollection.tasks.get(id);
|
// set associations
|
||||||
workflow = NgCollection.workflows.get(workflowId);
|
if (workflow != null) {
|
||||||
|
|
||||||
if (task != null && workflow != null) {
|
|
||||||
task.setWorkflow(workflow);
|
task.setWorkflow(workflow);
|
||||||
workflow.addTask(task);
|
workflow.addTask(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class WorkflowConversion {
|
||||||
|
|
||||||
public static void convertAll() {
|
public static void convertAll() {
|
||||||
List<com.arsdigita.workflow.simple.Workflow> trunkWorkflows =
|
List<com.arsdigita.workflow.simple.Workflow> trunkWorkflows =
|
||||||
com.arsdigita.workflow.simple.Workflow.getObjectWorkflows();
|
com.arsdigita.workflow.simple.Workflow.getAllObjectWorkflows();
|
||||||
|
|
||||||
trunkWorkflows.forEach(Workflow::new);
|
trunkWorkflows.forEach(Workflow::new);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,14 @@ import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||||
public class Categorization implements Identifiable {
|
public class Categorization implements Identifiable {
|
||||||
|
|
||||||
private long categorizationId;
|
private long categorizationId;
|
||||||
|
|
||||||
private Category category;
|
private Category category;
|
||||||
private CcmObject categorizedObject;
|
private CcmObject categorizedObject;
|
||||||
|
|
||||||
private boolean index;
|
private boolean index;
|
||||||
private long categoryOrder;
|
private long categoryOrder;
|
||||||
private long objectOrder;
|
private long objectOrder;
|
||||||
|
|
||||||
|
|
||||||
public Categorization(Category category, CcmObject categorizedObject) {
|
public Categorization(Category category, CcmObject categorizedObject) {
|
||||||
this.categorizationId = NgCollection.categorizations.size() + 1;
|
this.categorizationId = NgCollection.categorizations.size() + 1;
|
||||||
|
|
||||||
|
|
@ -52,7 +53,6 @@ public class Categorization implements Identifiable {
|
||||||
this.objectOrder = category.getObjects().size() + 1;
|
this.objectOrder = category.getObjects().size() + 1;
|
||||||
|
|
||||||
NgCollection.categorizations.put(this.categorizationId, this);
|
NgCollection.categorizations.put(this.categorizationId, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ public class Categorization implements Identifiable {
|
||||||
return categorizedObject;
|
return categorizedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCategorizedObject(CcmObject categorizedObject) {
|
public void setCategorizedObject(final CcmObject categorizedObject) {
|
||||||
this.categorizedObject = categorizedObject;
|
this.categorizedObject = categorizedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,7 +89,7 @@ public class Categorization implements Identifiable {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIndex(boolean index) {
|
public void setIndex(final boolean index) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,7 +97,7 @@ public class Categorization implements Identifiable {
|
||||||
return categoryOrder;
|
return categoryOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCategoryOrder(long categoryOrder) {
|
public void setCategoryOrder(final long categoryOrder) {
|
||||||
this.categoryOrder = categoryOrder;
|
this.categoryOrder = categoryOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ public class Categorization implements Identifiable {
|
||||||
return objectOrder;
|
return objectOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setObjectOrder(long objectOrder) {
|
public void setObjectOrder(final long objectOrder) {
|
||||||
this.objectOrder = objectOrder;
|
this.objectOrder = objectOrder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.portation.modules.core.core;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
import com.arsdigita.portation.AbstractMarshaller;
|
||||||
import com.arsdigita.portation.Identifiable;
|
import com.arsdigita.portation.Identifiable;
|
||||||
|
import com.arsdigita.portation.conversion.NgCollection;
|
||||||
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;
|
||||||
|
|
@ -49,20 +50,24 @@ import java.util.UUID;
|
||||||
public class CcmObject implements Identifiable {
|
public class CcmObject implements Identifiable {
|
||||||
|
|
||||||
private long objectId;
|
private long objectId;
|
||||||
|
|
||||||
private String uuid;
|
private String uuid;
|
||||||
private String displayName;
|
private String displayName;
|
||||||
|
|
||||||
private List<Permission> permissions;
|
private List<Permission> permissions;
|
||||||
private List<Categorization> categories;
|
private List<Categorization> categories;
|
||||||
|
|
||||||
|
|
||||||
public CcmObject(final ACSObject trunkObject) {
|
public CcmObject(final ACSObject trunkObject) {
|
||||||
this.objectId = trunkObject.getID().longValue();
|
this.objectId = trunkObject.getID().longValue();
|
||||||
|
|
||||||
this.uuid = UUID.randomUUID().toString();
|
this.uuid = UUID.randomUUID().toString();
|
||||||
this.displayName = trunkObject.getDisplayName();
|
this.displayName = trunkObject.getDisplayName();
|
||||||
|
|
||||||
this.permissions = new ArrayList<>();
|
this.permissions = new ArrayList<>();
|
||||||
this.categories = new ArrayList<>();
|
this.categories = new ArrayList<>();
|
||||||
|
|
||||||
//NgCollection.ccmObjects.put(this.objectId, this);
|
NgCollection.ccmObjects.put(this.objectId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,16 @@ import com.arsdigita.portation.Identifiable;
|
||||||
public class EmailAddress implements Identifiable {
|
public class EmailAddress implements Identifiable {
|
||||||
|
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
private boolean bouncing;
|
private boolean bouncing;
|
||||||
private boolean verified;
|
private boolean verified;
|
||||||
|
|
||||||
|
|
||||||
public EmailAddress(final com.arsdigita.kernel.EmailAddress
|
public EmailAddress(final com.arsdigita.kernel.EmailAddress
|
||||||
trunkEmailAddress) {
|
trunkEmailAddress) {
|
||||||
|
this.address = trunkEmailAddress.getEmailAddress();
|
||||||
|
|
||||||
|
this.bouncing = trunkEmailAddress.isBouncing();
|
||||||
|
this.verified = trunkEmailAddress.isVerified();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -46,7 +49,7 @@ public class EmailAddress implements Identifiable {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddress(String address) {
|
public void setAddress(final String address) {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +57,7 @@ public class EmailAddress implements Identifiable {
|
||||||
return bouncing;
|
return bouncing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBouncing(boolean bouncing) {
|
public void setBouncing(final boolean bouncing) {
|
||||||
this.bouncing = bouncing;
|
this.bouncing = bouncing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,7 +65,7 @@ public class EmailAddress implements Identifiable {
|
||||||
return verified;
|
return verified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVerified(boolean verified) {
|
public void setVerified(final boolean verified) {
|
||||||
this.verified = verified;
|
this.verified = verified;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
import com.arsdigita.portation.AbstractMarshaller;
|
||||||
import com.arsdigita.portation.Identifiable;
|
import com.arsdigita.portation.Identifiable;
|
||||||
|
import com.arsdigita.portation.conversion.NgCollection;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -30,10 +31,14 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public class Group extends Party {
|
public class Group extends Party {
|
||||||
|
|
||||||
private Set<GroupMembership> memberships = new HashSet<>();
|
private Set<GroupMembership> memberships;
|
||||||
|
|
||||||
public Group(final com.arsdigita.kernel.Group trunkGroup) {
|
public Group(final com.arsdigita.kernel.Group trunkGroup) {
|
||||||
super(trunkGroup);
|
super(trunkGroup);
|
||||||
|
|
||||||
|
this.memberships = new HashSet<>();
|
||||||
|
|
||||||
|
NgCollection.groups.put(this.getPartyId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -45,7 +50,15 @@ public class Group extends Party {
|
||||||
return memberships;
|
return memberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMemberships(Set<GroupMembership> memberships) {
|
public void setMemberships(final Set<GroupMembership> memberships) {
|
||||||
this.memberships = memberships;
|
this.memberships = memberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addMembership(final GroupMembership member) {
|
||||||
|
memberships.add(member);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeMembership(final GroupMembership member) {
|
||||||
|
memberships.remove(member);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
import com.arsdigita.portation.AbstractMarshaller;
|
||||||
import com.arsdigita.portation.Identifiable;
|
import com.arsdigita.portation.Identifiable;
|
||||||
|
import com.arsdigita.portation.conversion.NgCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
|
@ -31,8 +32,12 @@ public class GroupMembership implements Identifiable {
|
||||||
private Group group;
|
private Group group;
|
||||||
private User member;
|
private User member;
|
||||||
|
|
||||||
public GroupMembership() {
|
public GroupMembership(Group group, User member) {
|
||||||
|
this.membershipId = NgCollection.groupMemberships.size() + 1;
|
||||||
|
this.group = group;
|
||||||
|
this.member = member;
|
||||||
|
|
||||||
|
NgCollection.groupMemberships.put(this.membershipId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -44,7 +49,7 @@ public class GroupMembership implements Identifiable {
|
||||||
return membershipId;
|
return membershipId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMembershipId(long membershipId) {
|
public void setMembershipId(final long membershipId) {
|
||||||
this.membershipId = membershipId;
|
this.membershipId = membershipId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,7 +57,7 @@ public class GroupMembership implements Identifiable {
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGroup(Group group) {
|
public void setGroup(final Group group) {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,7 +65,7 @@ public class GroupMembership implements Identifiable {
|
||||||
return member;
|
return member;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMember(User member) {
|
public void setMember(final User member) {
|
||||||
this.member = member;
|
this.member = member;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
import com.arsdigita.portation.AbstractMarshaller;
|
||||||
import com.arsdigita.portation.Identifiable;
|
import com.arsdigita.portation.Identifiable;
|
||||||
|
import com.arsdigita.portation.conversion.NgCollection;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -32,10 +33,16 @@ public class Party implements Identifiable {
|
||||||
|
|
||||||
private long partyId;
|
private long partyId;
|
||||||
private String name;
|
private String name;
|
||||||
private Set<RoleMembership> roleMemberships = new HashSet<>();
|
|
||||||
|
private Set<RoleMembership> roleMemberships;
|
||||||
|
|
||||||
public Party(final com.arsdigita.kernel.Party trunkParty) {
|
public Party(final com.arsdigita.kernel.Party trunkParty) {
|
||||||
|
this.partyId = trunkParty.getID().longValue();
|
||||||
|
this.name = trunkParty.getName();
|
||||||
|
|
||||||
|
this.roleMemberships = new HashSet<>();
|
||||||
|
|
||||||
|
NgCollection.parties.put(this.partyId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -47,7 +54,7 @@ public class Party implements Identifiable {
|
||||||
return partyId;
|
return partyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPartyId(long partyId) {
|
public void setPartyId(final long partyId) {
|
||||||
this.partyId = partyId;
|
this.partyId = partyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +62,7 @@ public class Party implements Identifiable {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(final String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +70,15 @@ public class Party implements Identifiable {
|
||||||
return roleMemberships;
|
return roleMemberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleMemberships(Set<RoleMembership> roleMemberships) {
|
public void setRoleMemberships(final Set<RoleMembership> roleMemberships) {
|
||||||
this.roleMemberships = roleMemberships;
|
this.roleMemberships = roleMemberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addRoleMembership(final RoleMembership roleMembership) {
|
||||||
|
roleMemberships.add(roleMembership);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeRoleMembership(final RoleMembership roleMembership) {
|
||||||
|
roleMemberships.remove(roleMembership);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class Permission implements Identifiable {
|
||||||
return permissionId;
|
return permissionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPermissionId(long permissionId) {
|
public void setPermissionId(final long permissionId) {
|
||||||
this.permissionId = permissionId;
|
this.permissionId = permissionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ public class Permission implements Identifiable {
|
||||||
return grantedPrivilege;
|
return grantedPrivilege;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrantedPrivilege(String grantedPrivilege) {
|
public void setGrantedPrivilege(final String grantedPrivilege) {
|
||||||
this.grantedPrivilege = grantedPrivilege;
|
this.grantedPrivilege = grantedPrivilege;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ public class Permission implements Identifiable {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setObject(CcmObject object) {
|
public void setObject(final CcmObject object) {
|
||||||
this.object = object;
|
this.object = object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ public class Permission implements Identifiable {
|
||||||
return grantee;
|
return grantee;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGrantee(Role grantee) {
|
public void setGrantee(final Role grantee) {
|
||||||
this.grantee = grantee;
|
this.grantee = grantee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ public class Permission implements Identifiable {
|
||||||
return creationUser;
|
return creationUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreationUser(User creationUser) {
|
public void setCreationUser(final User creationUser) {
|
||||||
this.creationUser = creationUser;
|
this.creationUser = creationUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ public class Permission implements Identifiable {
|
||||||
return creationDate;
|
return creationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreationDate(Date creationDate) {
|
public void setCreationDate(final Date creationDate) {
|
||||||
this.creationDate = creationDate;
|
this.creationDate = creationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ public class Permission implements Identifiable {
|
||||||
return creationIp;
|
return creationIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreationIp(String creationIp) {
|
public void setCreationIp(final String creationIp) {
|
||||||
this.creationIp = creationIp;
|
this.creationIp = creationIp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public class Role implements Identifiable {
|
||||||
private long roleId;
|
private long roleId;
|
||||||
private String name;
|
private String name;
|
||||||
private Set<RoleMembership> memberships = new HashSet<>();
|
private Set<RoleMembership> memberships = new HashSet<>();
|
||||||
private ArrayList permissions = new ArrayList();
|
private List<Permission> permissions = new ArrayList<>();
|
||||||
private List<TaskAssignment> assignedTasks;
|
private List<TaskAssignment> assignedTasks;
|
||||||
|
|
||||||
public Role() {
|
public Role() {
|
||||||
|
|
@ -52,7 +52,7 @@ public class Role implements Identifiable {
|
||||||
return roleId;
|
return roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleId(long roleId) {
|
public void setRoleId(final long roleId) {
|
||||||
this.roleId = roleId;
|
this.roleId = roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class Role implements Identifiable {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(final String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,23 +68,47 @@ public class Role implements Identifiable {
|
||||||
return memberships;
|
return memberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMemberships(Set<RoleMembership> memberships) {
|
public void setMemberships(final Set<RoleMembership> memberships) {
|
||||||
this.memberships = memberships;
|
this.memberships = memberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList getPermissions() {
|
protected void addMembership(final RoleMembership membership) {
|
||||||
|
memberships.add(membership);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeMembership(final RoleMembership membership) {
|
||||||
|
memberships.remove(membership);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Permission> getPermissions() {
|
||||||
return permissions;
|
return permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPermissions(ArrayList permissions) {
|
public void setPermissions(final List<Permission> permissions) {
|
||||||
this.permissions = permissions;
|
this.permissions = permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void addPermission(final Permission permission) {
|
||||||
|
permissions.add(permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removePermission(final Permission permission) {
|
||||||
|
permissions.remove(permission);
|
||||||
|
}
|
||||||
|
|
||||||
public List<TaskAssignment> getAssignedTasks() {
|
public List<TaskAssignment> getAssignedTasks() {
|
||||||
return assignedTasks;
|
return assignedTasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAssignedTasks(List<TaskAssignment> assignedTasks) {
|
public void setAssignedTasks(final List<TaskAssignment> assignedTasks) {
|
||||||
this.assignedTasks = assignedTasks;
|
this.assignedTasks = assignedTasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void addAssignedTask(final TaskAssignment taskAssignment) {
|
||||||
|
assignedTasks.add(taskAssignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeAssignedTask(final TaskAssignment taskAssignment) {
|
||||||
|
assignedTasks.remove(taskAssignment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public class RoleMembership implements Identifiable {
|
||||||
return membershipId;
|
return membershipId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMembershipId(long membershipId) {
|
public void setMembershipId(final long membershipId) {
|
||||||
this.membershipId = membershipId;
|
this.membershipId = membershipId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ public class RoleMembership implements Identifiable {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRole(Role role) {
|
public void setRole(final Role role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class RoleMembership implements Identifiable {
|
||||||
return member;
|
return member;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMember(Party member) {
|
public void setMember(final Party member) {
|
||||||
this.member = member;
|
this.member = member;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,12 @@ package com.arsdigita.portation.modules.core.security;
|
||||||
|
|
||||||
import com.arsdigita.portation.AbstractMarshaller;
|
import com.arsdigita.portation.AbstractMarshaller;
|
||||||
import com.arsdigita.portation.Identifiable;
|
import com.arsdigita.portation.Identifiable;
|
||||||
|
import com.arsdigita.portation.conversion.NgCollection;
|
||||||
import com.arsdigita.portation.modules.core.core.EmailAddress;
|
import com.arsdigita.portation.modules.core.core.EmailAddress;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
@ -34,15 +37,38 @@ public class User extends Party {
|
||||||
|
|
||||||
private String givenName;
|
private String givenName;
|
||||||
private String familyName;
|
private String familyName;
|
||||||
|
|
||||||
private EmailAddress primaryEmailAddress;
|
private EmailAddress primaryEmailAddress;
|
||||||
private List<EmailAddress> emailAddresses;
|
private List<EmailAddress> emailAddresses;
|
||||||
|
|
||||||
private boolean banned;
|
private boolean banned;
|
||||||
private String password;
|
private String password;
|
||||||
private boolean passwordResetRequired;
|
private boolean passwordResetRequired;
|
||||||
private Set<GroupMembership> groupMemberships = new HashSet<>();
|
|
||||||
|
private Set<GroupMembership> groupMemberships;
|
||||||
|
|
||||||
public User(final com.arsdigita.kernel.User trunkUser) {
|
public User(final com.arsdigita.kernel.User trunkUser) {
|
||||||
super(trunkUser);
|
super(trunkUser);
|
||||||
|
|
||||||
|
this.givenName = trunkUser.getPersonName().getGivenName();
|
||||||
|
this.familyName = trunkUser.getPersonName().getFamilyName();
|
||||||
|
|
||||||
|
this.primaryEmailAddress = new EmailAddress(trunkUser.getPrimaryEmail());
|
||||||
|
this.emailAddresses = new ArrayList<>();
|
||||||
|
Iterator it = trunkUser.getEmailAddresses();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
com.arsdigita.kernel.EmailAddress trunkEmail = (com.arsdigita
|
||||||
|
.kernel.EmailAddress) it.next();
|
||||||
|
this.emailAddresses.add(new EmailAddress(trunkEmail));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.banned = trunkUser.isBanned();
|
||||||
|
this.password = "";
|
||||||
|
this.passwordResetRequired = true;
|
||||||
|
|
||||||
|
this.groupMemberships = new HashSet<>();
|
||||||
|
|
||||||
|
NgCollection.users.put(this.getPartyId(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -54,7 +80,7 @@ public class User extends Party {
|
||||||
return givenName;
|
return givenName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGivenName(String givenName) {
|
public void setGivenName(final String givenName) {
|
||||||
this.givenName = givenName;
|
this.givenName = givenName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,7 +88,7 @@ public class User extends Party {
|
||||||
return familyName;
|
return familyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFamilyName(String familyName) {
|
public void setFamilyName(final String familyName) {
|
||||||
this.familyName = familyName;
|
this.familyName = familyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,7 +96,7 @@ public class User extends Party {
|
||||||
return primaryEmailAddress;
|
return primaryEmailAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrimaryEmailAddress(EmailAddress primaryEmailAddress) {
|
public void setPrimaryEmailAddress(final EmailAddress primaryEmailAddress) {
|
||||||
this.primaryEmailAddress = primaryEmailAddress;
|
this.primaryEmailAddress = primaryEmailAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,15 +104,23 @@ public class User extends Party {
|
||||||
return emailAddresses;
|
return emailAddresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmailAddresses(List<EmailAddress> emailAddresses) {
|
public void setEmailAddresses(final List<EmailAddress> emailAddresses) {
|
||||||
this.emailAddresses = emailAddresses;
|
this.emailAddresses = emailAddresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addEmailAddress(final EmailAddress emailAddress) {
|
||||||
|
emailAddresses.add(emailAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeEmailAddress(final EmailAddress emailAddress) {
|
||||||
|
emailAddresses.remove(emailAddress);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isBanned() {
|
public boolean isBanned() {
|
||||||
return banned;
|
return banned;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBanned(boolean banned) {
|
public void setBanned(final boolean banned) {
|
||||||
this.banned = banned;
|
this.banned = banned;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +128,7 @@ public class User extends Party {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password) {
|
public void setPassword(final String password) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,7 +136,7 @@ public class User extends Party {
|
||||||
return passwordResetRequired;
|
return passwordResetRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPasswordResetRequired(boolean passwordResetRequired) {
|
public void setPasswordResetRequired(final boolean passwordResetRequired) {
|
||||||
this.passwordResetRequired = passwordResetRequired;
|
this.passwordResetRequired = passwordResetRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +144,16 @@ public class User extends Party {
|
||||||
return groupMemberships;
|
return groupMemberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGroupMemberships(Set<GroupMembership> groupMemberships) {
|
public void setGroupMemberships(final Set<GroupMembership>
|
||||||
|
groupMemberships) {
|
||||||
this.groupMemberships = groupMemberships;
|
this.groupMemberships = groupMemberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addGroupMembership(final GroupMembership groupMembership) {
|
||||||
|
groupMemberships.add(groupMembership);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeGroupMembership(final GroupMembership groupMembership) {
|
||||||
|
groupMemberships.remove(groupMembership);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class TaskAssignment implements Identifiable {
|
||||||
return taskAssignmentId;
|
return taskAssignmentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTaskAssignmentId(long taskAssignmentId) {
|
public void setTaskAssignmentId(final long taskAssignmentId) {
|
||||||
this.taskAssignmentId = taskAssignmentId;
|
this.taskAssignmentId = taskAssignmentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class TaskAssignment implements Identifiable {
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTask(UserTask task) {
|
public void setTask(final UserTask task) {
|
||||||
this.task = task;
|
this.task = task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class TaskAssignment implements Identifiable {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRole(Role role) {
|
public void setRole(final Role role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class UserTask extends Task {
|
||||||
return locked;
|
return locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocked(boolean locked) {
|
public void setLocked(final boolean locked) {
|
||||||
this.locked = locked;
|
this.locked = locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ public class UserTask extends Task {
|
||||||
return lockingUser;
|
return lockingUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLockingUser(User lockingUser) {
|
public void setLockingUser(final User lockingUser) {
|
||||||
this.lockingUser = lockingUser;
|
this.lockingUser = lockingUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ public class UserTask extends Task {
|
||||||
return startDate;
|
return startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartDate(Date startDate) {
|
public void setStartDate(final Date startDate) {
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ public class UserTask extends Task {
|
||||||
return dueDate;
|
return dueDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDueDate(Date dueDate) {
|
public void setDueDate(final Date dueDate) {
|
||||||
this.dueDate = dueDate;
|
this.dueDate = dueDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,7 +86,7 @@ public class UserTask extends Task {
|
||||||
return durationMinutes;
|
return durationMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDurationMinutes(long durationMinutes) {
|
public void setDurationMinutes(final long durationMinutes) {
|
||||||
this.durationMinutes = durationMinutes;
|
this.durationMinutes = durationMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ public class UserTask extends Task {
|
||||||
return notificationSender;
|
return notificationSender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNotificationSender(User notificationSender) {
|
public void setNotificationSender(final User notificationSender) {
|
||||||
this.notificationSender = notificationSender;
|
this.notificationSender = notificationSender;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,7 +102,15 @@ public class UserTask extends Task {
|
||||||
return assignments;
|
return assignments;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAssignments(List<TaskAssignment> assignments) {
|
public void setAssignments(final List<TaskAssignment> assignments) {
|
||||||
this.assignments = assignments;
|
this.assignments = assignments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addAssignment(final TaskAssignment assignment) {
|
||||||
|
assignments.add(assignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAssignment(final TaskAssignment assignment) {
|
||||||
|
assignments.remove(assignment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,18 @@ import java.util.Locale;
|
||||||
public class Workflow implements Identifiable {
|
public class Workflow implements Identifiable {
|
||||||
|
|
||||||
private long workflowId;
|
private long workflowId;
|
||||||
|
|
||||||
private LocalizedString name;
|
private LocalizedString name;
|
||||||
private LocalizedString description;
|
private LocalizedString description;
|
||||||
|
|
||||||
private List<Task> tasks;
|
private List<Task> tasks;
|
||||||
|
|
||||||
public Workflow(final com.arsdigita.workflow.simple.Workflow trunkWorkFlow) {
|
public Workflow(final com.arsdigita.workflow.simple.Workflow trunkWorkFlow) {
|
||||||
this.workflowId = trunkWorkFlow.getID().longValue();
|
this.workflowId = trunkWorkFlow.getID().longValue();
|
||||||
|
|
||||||
this.name.addValue(Locale.ENGLISH, trunkWorkFlow.getDisplayName());
|
this.name.addValue(Locale.ENGLISH, trunkWorkFlow.getDisplayName());
|
||||||
this.description.addValue(Locale.ENGLISH, trunkWorkFlow.getDescription());
|
this.description.addValue(Locale.ENGLISH, trunkWorkFlow.getDescription());
|
||||||
|
|
||||||
this.tasks = new ArrayList<>();
|
this.tasks = new ArrayList<>();
|
||||||
|
|
||||||
NgCollection.workflows.put(this.workflowId, this);
|
NgCollection.workflows.put(this.workflowId, this);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ package com.arsdigita.workflow.simple;
|
||||||
|
|
||||||
import com.arsdigita.auditing.AuditedACSObject;
|
import com.arsdigita.auditing.AuditedACSObject;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
import com.arsdigita.persistence.DataAssociation;
|
import com.arsdigita.persistence.DataAssociation;
|
||||||
|
|
@ -27,17 +28,18 @@ import com.arsdigita.persistence.DataAssociationCursor;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.DataQuery;
|
import com.arsdigita.persistence.DataQuery;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.persistence.metadata.ObjectType;
|
import com.arsdigita.persistence.metadata.ObjectType;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the properties of a Task.
|
* This class represents the properties of a Task.
|
||||||
|
|
@ -1187,4 +1189,27 @@ public class Task extends AuditedACSObject implements Cloneable {
|
||||||
protected void finishEvt() {
|
protected void finishEvt() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 tasks
|
||||||
|
*/
|
||||||
|
public static List<Task> getAllObjectTasks() {
|
||||||
|
List<Task> taskList = new ArrayList<>();
|
||||||
|
|
||||||
|
final Session session = SessionManager.getSession();
|
||||||
|
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||||
|
Task.BASE_DATA_OBJECT_TYPE));
|
||||||
|
|
||||||
|
while (collection.next()) {
|
||||||
|
Task task = (Task) collection.getDomainObject();
|
||||||
|
if (task != null) {
|
||||||
|
taskList.add(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return taskList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -861,7 +861,13 @@ public class Workflow extends Task {
|
||||||
return getObjectWorkflow(o.getID());
|
return getObjectWorkflow(o.getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Workflow> getObjectWorkflows() {
|
/**
|
||||||
|
* 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 workflows
|
||||||
|
*/
|
||||||
|
public static List<Workflow> getAllObjectWorkflows() {
|
||||||
List<Workflow> workflowList = new ArrayList<>();
|
List<Workflow> workflowList = new ArrayList<>();
|
||||||
|
|
||||||
final Session session = SessionManager.getSession();
|
final Session session = SessionManager.getSession();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue