diff --git a/ccm-core/src/com/arsdigita/portation/conversion/core/categorization/CategoryConversion.java b/ccm-core/src/com/arsdigita/portation/conversion/core/categorization/CategoryConversion.java index 86277a329..213af5bfa 100644 --- a/ccm-core/src/com/arsdigita/portation/conversion/core/categorization/CategoryConversion.java +++ b/ccm-core/src/com/arsdigita/portation/conversion/core/categorization/CategoryConversion.java @@ -131,13 +131,13 @@ public class CategoryConversion { defaultParent.getID().longValue()); } } catch (Exception e) {} - if (parentCategory != null) { + if (category != null && parentCategory != null) { //category.setParentCategory(parentCategory); //parentCategory.addSubCategory(category); // to avoid infinite recursion - category.setParentCategoryId(parentCategory.getObjectId()); - parentCategory.addSubCategoryId(category.getObjectId()); + category.setParentCategoryId(parentCategory.getUniqueId()); + parentCategory.addSubCategoryId(category.getUniqueId()); } } } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Category.java b/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Category.java index 365802b42..92fc5aafb 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Category.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/categorization/Category.java @@ -61,8 +61,8 @@ public class Category extends CcmObject { private long categoryOrder; // to avoid infinite recursion - private List subCategoriesId; - private long parentCategoryId; + private List subCategoriesId; + private String parentCategoryId; public Category(final com.arsdigita.categorization.Category trunkCategory) { @@ -75,17 +75,19 @@ public class Category extends CcmObject { trunkCategory.getCategoryLocalizationCollection(); if (categoryLocalizationCollection != null && categoryLocalizationCollection.next()) { - CategoryLocalization categoryLocalization = categoryLocalizationCollection.getCategoryLocalization(); - - if (categoryLocalization != null && categoryLocalization - .getLocale() != null) { - Locale locale = new Locale(categoryLocalization.getLocale()); - if (categoryLocalization.getName() != null) - this.title.addValue(locale, categoryLocalization.getName()); - if (categoryLocalization.getDescription() != null) - this.description.addValue(locale, categoryLocalization.getDescription()); + 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); + } } } @@ -220,27 +222,27 @@ public class Category extends CcmObject { } - public List getSubCategoriesId() { + public List getSubCategoriesId() { return subCategoriesId; } - public void setSubCategoriesId(List subCategoriesId) { + public void setSubCategoriesId(final List subCategoriesId) { this.subCategoriesId = subCategoriesId; } - public void addSubCategoryId(final long subCategoryId) { + public void addSubCategoryId(final String subCategoryId) { this.subCategoriesId.add(subCategoryId); } - public void removeSubCategoryId(final long subCategoryId) { + public void removeSubCategoryId(final String subCategoryId) { this.subCategoriesId.remove(subCategoryId); } - public long getParentCategoryId() { + public String getParentCategoryId() { return parentCategoryId; } - public void setParentCategoryId(long parentCategoryId) { + public void setParentCategoryId(final String parentCategoryId) { this.parentCategoryId = parentCategoryId; } }