[UPDATE]
- bugfixes in conversion routine from trunk to ng git-svn-id: https://svn.libreccm.org/ccm/trunk@4325 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
60ae856a4b
commit
6e6bed3468
|
|
@ -21,6 +21,7 @@ package com.arsdigita.kernel.permissions;
|
||||||
|
|
||||||
import com.arsdigita.domain.DomainCollection;
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.kernel.Group;
|
import com.arsdigita.kernel.Group;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.persistence.Session;
|
import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
|
|
@ -329,14 +330,12 @@ public class Permission extends DomainObject {
|
||||||
List<Permission> permissionList = new ArrayList<>();
|
List<Permission> permissionList = new ArrayList<>();
|
||||||
|
|
||||||
final Session session = SessionManager.getSession();
|
final Session session = SessionManager.getSession();
|
||||||
DomainCollection collection = new DomainCollection(session.retrieve(
|
DataCollection collection = session.retrieve(Permission
|
||||||
Permission.BASE_DATA_OBJECT_TYPE));
|
.BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
||||||
while (collection.next()) {
|
while (collection.next()) {
|
||||||
Permission permission = (Permission) collection.getDomainObject();
|
Permission permission = new Permission(collection.getDataObject());
|
||||||
if (permission != null) {
|
permissionList.add(permission);
|
||||||
permissionList.add(permission);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
collection.close();
|
collection.close();
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,8 @@ public class CategoryConversion {
|
||||||
categorizedObject);
|
categorizedObject);
|
||||||
|
|
||||||
// set opposed associations
|
// set opposed associations
|
||||||
category.addObject(categorization);
|
//category.addObject(categorization); Todo
|
||||||
|
category.addObjectId(categorization.getCategorizationId());
|
||||||
categorizedObject.addCategory(categorization);
|
categorizedObject.addCategory(categorization);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +136,7 @@ public class CategoryConversion {
|
||||||
//category.setParentCategory(parentCategory);
|
//category.setParentCategory(parentCategory);
|
||||||
//parentCategory.addSubCategory(category);
|
//parentCategory.addSubCategory(category);
|
||||||
|
|
||||||
// to avoid infinite recursion
|
// to avoid infinite recursion Todo
|
||||||
category.setParentCategoryId(parentCategory.getUniqueId());
|
category.setParentCategoryId(parentCategory.getUniqueId());
|
||||||
parentCategory.addSubCategoryId(category.getUniqueId());
|
parentCategory.addSubCategoryId(category.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,15 @@ public class PermissionConversion {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set creationUser
|
// set creationUser
|
||||||
User creationUser = NgCollection.users.get(trunkPermission
|
com.arsdigita.kernel.User trunkCreationUser = trunkPermission
|
||||||
.getCreationUser().getID().longValue());
|
.getCreationUser();
|
||||||
if (creationUser != null)
|
if (trunkCreationUser != null) {
|
||||||
permission.setCreationUser(creationUser);
|
User creationUser = NgCollection.users.get(trunkCreationUser
|
||||||
|
.getID().longValue());
|
||||||
|
|
||||||
|
if (creationUser != null)
|
||||||
|
permission.setCreationUser(creationUser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,9 @@ public class Category extends CcmObject {
|
||||||
private Category parentCategory;
|
private Category parentCategory;
|
||||||
private long categoryOrder;
|
private long categoryOrder;
|
||||||
|
|
||||||
// to avoid infinite recursion
|
// to avoid infinite recursion Todo
|
||||||
private List<String> subCategoriesId;
|
private List<Long> objectIds;
|
||||||
|
private List<String> subCategoryIds;
|
||||||
private String parentCategoryId;
|
private String parentCategoryId;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -71,28 +72,6 @@ public class Category extends CcmObject {
|
||||||
this.uniqueId = trunkCategory.getID().toString();
|
this.uniqueId = trunkCategory.getID().toString();
|
||||||
this.name = trunkCategory.getName();
|
this.name = trunkCategory.getName();
|
||||||
|
|
||||||
// CategoryLocalizationCollection categoryLocalizationCollection = trunkCategory.getCategoryLocalizationCollection();
|
|
||||||
//
|
|
||||||
// if (categoryLocalizationCollection != null && categoryLocalizationCollection.next()) {
|
|
||||||
//
|
|
||||||
// CategoryLocalization categoryLocalization = categoryLocalizationCollection.getCategoryLocalization();
|
|
||||||
//
|
|
||||||
// if (categoryLocalization != null) {
|
|
||||||
//
|
|
||||||
// String strLocale = categoryLocalization.getLocale();
|
|
||||||
// String name = categoryLocalization.getName();
|
|
||||||
// String description = categoryLocalization.getDescription();
|
|
||||||
//
|
|
||||||
// if (strLocale != null) {
|
|
||||||
// Locale locale = new Locale(strLocale);
|
|
||||||
// if (name != null)
|
|
||||||
// this.title.addValue(locale, name);
|
|
||||||
// if (description != null)
|
|
||||||
// this.description.addValue(locale, description);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
CategoryLocalizationCollection categoryLocalizationCollection =
|
CategoryLocalizationCollection categoryLocalizationCollection =
|
||||||
trunkCategory.getCategoryLocalizationCollection();
|
trunkCategory.getCategoryLocalizationCollection();
|
||||||
|
|
||||||
|
|
@ -127,8 +106,12 @@ public class Category extends CcmObject {
|
||||||
? defaultParent.getNumberOfChildCategories() + 1
|
? defaultParent.getNumberOfChildCategories() + 1
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
// to avoid infinite recursion
|
|
||||||
this.subCategoriesId = new ArrayList<>();
|
// to avoid infinite recursion Todo
|
||||||
|
this.objectIds = new ArrayList<>();
|
||||||
|
this.subCategoryIds = new ArrayList<>();
|
||||||
|
//this.parantCategoryId
|
||||||
|
|
||||||
|
|
||||||
NgCollection.categories.put(this.getObjectId(), this);
|
NgCollection.categories.put(this.getObjectId(), this);
|
||||||
}
|
}
|
||||||
|
|
@ -244,20 +227,37 @@ public class Category extends CcmObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<String> getSubCategoriesId() {
|
|
||||||
return subCategoriesId;
|
public List<Long> getObjectIds() {
|
||||||
|
return objectIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubCategoriesId(final List<String> subCategoriesId) {
|
public void setObjectIds(final List<Long> objectIds) {
|
||||||
this.subCategoriesId = subCategoriesId;
|
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) {
|
public void addSubCategoryId(final String subCategoryId) {
|
||||||
this.subCategoriesId.add(subCategoryId);
|
this.subCategoryIds.add(subCategoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSubCategoryId(final String subCategoryId) {
|
public void removeSubCategoryId(final String subCategoryId) {
|
||||||
this.subCategoriesId.remove(subCategoryId);
|
this.subCategoryIds.remove(subCategoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParentCategoryId() {
|
public String getParentCategoryId() {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class Permission implements Identifiable {
|
||||||
private String creationIp;
|
private String creationIp;
|
||||||
|
|
||||||
public Permission(final com.arsdigita.kernel.permissions.Permission trunkPermission) {
|
public Permission(final com.arsdigita.kernel.permissions.Permission trunkPermission) {
|
||||||
this.permissionId = trunkPermission.getID().longValue();
|
this.permissionId = NgCollection.permissions.size() + 1;
|
||||||
this.grantedPrivilege = trunkPermission.getPrivilege().getName();
|
this.grantedPrivilege = trunkPermission.getPrivilege().getName();
|
||||||
|
|
||||||
//this.object;
|
//this.object;
|
||||||
|
|
@ -55,6 +55,12 @@ public class Permission implements Identifiable {
|
||||||
NgCollection.permissions.put(this.permissionId, this);
|
NgCollection.permissions.put(this.permissionId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor to copy a given Permission. Needed for purposes of
|
||||||
|
* creating permissions for multiple grantees from the trunk object.
|
||||||
|
*
|
||||||
|
* @param ngPermission The Permission to be copied.
|
||||||
|
*/
|
||||||
public Permission(final Permission ngPermission) {
|
public Permission(final Permission ngPermission) {
|
||||||
this.permissionId = NgCollection.permissions.size() + 1;
|
this.permissionId = NgCollection.permissions.size() + 1;
|
||||||
this.grantedPrivilege = ngPermission.getGrantedPrivilege();
|
this.grantedPrivilege = ngPermission.getGrantedPrivilege();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue