[UPDATE]
- adds json annotations in package portation to avoid infinite recursion - removes the manually solved infinite recursion problems git-svn-id: https://svn.libreccm.org/ccm/trunk@4373 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
2ddcb209cb
commit
f2403b0ce6
|
|
@ -326,7 +326,7 @@ public abstract class Party extends ACSObject {
|
|||
* 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
|
||||
* @return List of all parties
|
||||
*/
|
||||
public static List<Party> getAllObjectParties() {
|
||||
List<Party> partyList = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -98,8 +98,7 @@ public class CategoryConversion {
|
|||
categorizedObject);
|
||||
|
||||
// set opposed associations
|
||||
//category.addObject(categorization); Todo
|
||||
category.addObjectId(categorization.getCategorizationId());
|
||||
category.addObject(categorization);
|
||||
categorizedObject.addCategory(categorization);
|
||||
}
|
||||
}
|
||||
|
|
@ -133,12 +132,8 @@ public class CategoryConversion {
|
|||
}
|
||||
} catch (Exception e) {}
|
||||
if (category != null && parentCategory != null) {
|
||||
//category.setParentCategory(parentCategory);
|
||||
//parentCategory.addSubCategory(category);
|
||||
|
||||
// to avoid infinite recursion Todo
|
||||
category.setParentCategoryId(parentCategory.getUniqueId());
|
||||
parentCategory.addSubCategoryId(category.getUniqueId());
|
||||
category.setParentCategory(parentCategory);
|
||||
parentCategory.addSubCategory(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.arsdigita.portation.modules.core.security.Permission;
|
|||
import com.arsdigita.portation.modules.core.security.Role;
|
||||
import com.arsdigita.portation.modules.core.security.RoleMembership;
|
||||
import com.arsdigita.portation.modules.core.security.User;
|
||||
import com.arsdigita.portation.modules.core.security.util.PermissionIdMapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
|
@ -120,8 +121,11 @@ public class PermissionConversion {
|
|||
.permissions.Permission> trunkPermissions) {
|
||||
for (com.arsdigita.kernel.permissions.Permission trunkPermission :
|
||||
trunkPermissions) {
|
||||
Permission permission = NgCollection.permissions.get
|
||||
(trunkPermission.getID().longValue());
|
||||
long permissionId = PermissionIdMapper.map.get(
|
||||
((BigDecimal) trunkPermission.getACSObject().get("id")).longValue()
|
||||
+ ((BigDecimal) trunkPermission.getPartyOID().get("id")).longValue()
|
||||
);
|
||||
Permission permission = NgCollection.permissions.get(permissionId);
|
||||
|
||||
BigDecimal trunkGranteeId = (BigDecimal) trunkPermission
|
||||
.getPartyOID().get("id");
|
||||
|
|
@ -149,6 +153,12 @@ public class PermissionConversion {
|
|||
(permission);
|
||||
duplicatePermission.setGrantee(role);
|
||||
role.addPermission(duplicatePermission);
|
||||
|
||||
long oldId = duplicatePermission.getObject().getObjectId()
|
||||
+ duplicatePermission.getGrantee().getRoleId();
|
||||
PermissionIdMapper.map.put(oldId,
|
||||
duplicatePermission.getPermissionId());
|
||||
|
||||
}
|
||||
}
|
||||
// grantee instance of User, new Role necessary
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.portation.AbstractMarshaller;
|
|||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
|
||||
/**
|
||||
* Association class describing the association between a category and an
|
||||
|
|
@ -35,7 +36,9 @@ public class Categorization implements Identifiable {
|
|||
|
||||
private long categorizationId;
|
||||
|
||||
@JsonBackReference
|
||||
private Category category;
|
||||
@JsonBackReference
|
||||
private CcmObject categorizedObject;
|
||||
|
||||
private boolean index;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import com.arsdigita.portation.Identifiable;
|
|||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -54,16 +56,15 @@ public class Category extends CcmObject {
|
|||
private boolean visible;
|
||||
private boolean abstractCategory;
|
||||
|
||||
@JsonManagedReference
|
||||
private List<Categorization> objects;
|
||||
|
||||
@JsonManagedReference
|
||||
private List<Category> subCategories;
|
||||
|
||||
@JsonBackReference
|
||||
private Category parentCategory;
|
||||
private long categoryOrder;
|
||||
|
||||
// to avoid infinite recursion Todo
|
||||
private List<Long> objectIds;
|
||||
private List<String> subCategoryIds;
|
||||
private String parentCategoryId;
|
||||
private long categoryOrder;
|
||||
|
||||
|
||||
public Category(final com.arsdigita.categorization.Category trunkCategory) {
|
||||
|
|
@ -106,13 +107,6 @@ public class Category extends CcmObject {
|
|||
? defaultParent.getNumberOfChildCategories() + 1
|
||||
: 0;
|
||||
|
||||
|
||||
// to avoid infinite recursion Todo
|
||||
this.objectIds = new ArrayList<>();
|
||||
this.subCategoryIds = new ArrayList<>();
|
||||
//this.parantCategoryId
|
||||
|
||||
|
||||
NgCollection.categories.put(this.getObjectId(), this);
|
||||
}
|
||||
|
||||
|
|
@ -225,46 +219,4 @@ public class Category extends CcmObject {
|
|||
public void setCategoryOrder(final long categoryOrder) {
|
||||
this.categoryOrder = categoryOrder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Long> getObjectIds() {
|
||||
return objectIds;
|
||||
}
|
||||
|
||||
public void setObjectIds(final List<Long> objectIds) {
|
||||
this.objectIds = objectIds;
|
||||
}
|
||||
|
||||
public void addObjectId(final long object) {
|
||||
this.objectIds.add(object);
|
||||
}
|
||||
|
||||
public void removeObjectId(final long object) {
|
||||
this.objectIds.remove(object);
|
||||
}
|
||||
|
||||
public List<String> getSubCategoryIds() {
|
||||
return subCategoryIds;
|
||||
}
|
||||
|
||||
public void setSubCategoryIds(final List<String> subCategoryIds) {
|
||||
this.subCategoryIds = subCategoryIds;
|
||||
}
|
||||
|
||||
public void addSubCategoryId(final String subCategoryId) {
|
||||
this.subCategoryIds.add(subCategoryId);
|
||||
}
|
||||
|
||||
public void removeSubCategoryId(final String subCategoryId) {
|
||||
this.subCategoryIds.remove(subCategoryId);
|
||||
}
|
||||
|
||||
public String getParentCategoryId() {
|
||||
return parentCategoryId;
|
||||
}
|
||||
|
||||
public void setParentCategoryId(final String parentCategoryId) {
|
||||
this.parentCategoryId = parentCategoryId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ 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.security.Permission;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -54,7 +55,9 @@ public class CcmObject implements Identifiable {
|
|||
private String uuid;
|
||||
private String displayName;
|
||||
|
||||
@JsonManagedReference
|
||||
private List<Permission> permissions;
|
||||
@JsonManagedReference
|
||||
private List<Categorization> categories;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.portation.modules.core.security;
|
|||
import com.arsdigita.portation.AbstractMarshaller;
|
||||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -31,6 +32,7 @@ import java.util.Set;
|
|||
*/
|
||||
public class Group extends Party {
|
||||
|
||||
@JsonManagedReference
|
||||
private Set<GroupMembership> memberships;
|
||||
|
||||
public Group(final com.arsdigita.kernel.Group trunkGroup) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.portation.modules.core.security;
|
|||
import com.arsdigita.portation.AbstractMarshaller;
|
||||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
|
|
@ -30,7 +31,9 @@ public class GroupMembership implements Identifiable {
|
|||
|
||||
private long membershipId;
|
||||
|
||||
@JsonBackReference
|
||||
private Group group;
|
||||
@JsonBackReference
|
||||
private User member;
|
||||
|
||||
public GroupMembership(final Group group, final User member) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.portation.modules.core.security;
|
|||
import com.arsdigita.portation.AbstractMarshaller;
|
||||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -34,6 +35,7 @@ public class Party implements Identifiable {
|
|||
private long partyId;
|
||||
private String name;
|
||||
|
||||
@JsonManagedReference
|
||||
private Set<RoleMembership> roleMemberships;
|
||||
|
||||
public Party(final com.arsdigita.kernel.Party trunkParty) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ import com.arsdigita.portation.AbstractMarshaller;
|
|||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.arsdigita.portation.modules.core.core.CcmObject;
|
||||
import com.arsdigita.portation.modules.core.security.util.PermissionIdMapper;
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -34,15 +37,24 @@ public class Permission implements Identifiable {
|
|||
private long permissionId;
|
||||
private String grantedPrivilege;
|
||||
|
||||
@JsonBackReference
|
||||
private CcmObject object;
|
||||
@JsonBackReference
|
||||
private Role grantee;
|
||||
private User creationUser;
|
||||
|
||||
private Date creationDate;
|
||||
private String creationIp;
|
||||
|
||||
public Permission(final com.arsdigita.kernel.permissions.Permission trunkPermission) {
|
||||
public Permission(final com.arsdigita.kernel.permissions.Permission
|
||||
trunkPermission) {
|
||||
long oldId = ((BigDecimal) trunkPermission.getACSObject().get("id"))
|
||||
.longValue()
|
||||
+ ((BigDecimal) trunkPermission.getPartyOID().get("id"))
|
||||
.longValue();
|
||||
this.permissionId = NgCollection.permissions.size() + 1;
|
||||
PermissionIdMapper.map.put(oldId, this.permissionId);
|
||||
|
||||
this.grantedPrivilege = trunkPermission.getPrivilege().getName();
|
||||
|
||||
//this.object;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.portation.AbstractMarshaller;
|
|||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.arsdigita.portation.modules.core.workflow.TaskAssignment;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
|
@ -37,9 +38,12 @@ public class Role implements Identifiable {
|
|||
private long roleId;
|
||||
private String name;
|
||||
|
||||
@JsonManagedReference
|
||||
private Set<RoleMembership> memberships;
|
||||
|
||||
@JsonManagedReference
|
||||
private List<Permission> permissions;
|
||||
@JsonManagedReference
|
||||
private List<TaskAssignment> assignedTasks;
|
||||
|
||||
public Role(final com.arsdigita.kernel.Role trunkRole) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.portation.modules.core.security;
|
|||
import com.arsdigita.portation.AbstractMarshaller;
|
||||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
|
|
@ -30,7 +31,9 @@ public class RoleMembership implements Identifiable {
|
|||
|
||||
private long membershipId;
|
||||
|
||||
@JsonBackReference
|
||||
private Role role;
|
||||
@JsonBackReference
|
||||
private Party member;
|
||||
|
||||
public RoleMembership(final Role role, final Party member) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.portation.AbstractMarshaller;
|
|||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.arsdigita.portation.modules.core.core.EmailAddress;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
|
@ -45,6 +46,7 @@ public class User extends Party {
|
|||
private String password;
|
||||
private boolean passwordResetRequired;
|
||||
|
||||
@JsonManagedReference
|
||||
private Set<GroupMembership> groupMemberships;
|
||||
|
||||
public User(final com.arsdigita.kernel.User trunkUser) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ import com.arsdigita.portation.AbstractMarshaller;
|
|||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -41,9 +43,12 @@ public class Task implements Identifiable {
|
|||
private boolean active;
|
||||
private String taskState;
|
||||
|
||||
@JsonBackReference
|
||||
private Workflow workflow;
|
||||
|
||||
@JsonBackReference
|
||||
private List<Task> dependentTasks;
|
||||
@JsonManagedReference
|
||||
private List<Task> dependsOn;
|
||||
private List<String> comments;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.portation.AbstractMarshaller;
|
|||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.arsdigita.portation.modules.core.security.Role;
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||
|
|
@ -31,7 +32,9 @@ public class TaskAssignment implements Identifiable {
|
|||
|
||||
private long taskAssignmentId;
|
||||
|
||||
@JsonBackReference
|
||||
private UserTask task;
|
||||
@JsonBackReference
|
||||
private Role role;
|
||||
|
||||
public TaskAssignment(final UserTask task, final Role role) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.portation.AbstractMarshaller;
|
|||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.arsdigita.portation.modules.core.security.User;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
|
@ -42,6 +43,7 @@ public class UserTask extends Task {
|
|||
|
||||
private User notificationSender;
|
||||
|
||||
@JsonManagedReference
|
||||
private List<TaskAssignment> assignments;
|
||||
|
||||
public UserTask(final com.arsdigita.workflow.simple.UserTask
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.arsdigita.portation.AbstractMarshaller;
|
|||
import com.arsdigita.portation.Identifiable;
|
||||
import com.arsdigita.portation.conversion.NgCollection;
|
||||
import com.arsdigita.portation.modules.core.l10n.LocalizedString;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -38,6 +39,7 @@ public class Workflow implements Identifiable {
|
|||
private LocalizedString name;
|
||||
private LocalizedString description;
|
||||
|
||||
@JsonManagedReference
|
||||
private List<Task> tasks;
|
||||
|
||||
public Workflow(final com.arsdigita.workflow.simple.Workflow trunkWorkFlow) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue