[UPDATE]
- trying to fix nullpointer exceptions git-svn-id: https://svn.libreccm.org/ccm/trunk@4306 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
57940eedc4
commit
89a47f4a8f
|
|
@ -131,13 +131,13 @@ public class CategoryConversion {
|
||||||
defaultParent.getID().longValue());
|
defaultParent.getID().longValue());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
if (parentCategory != null) {
|
if (category != null && parentCategory != null) {
|
||||||
//category.setParentCategory(parentCategory);
|
//category.setParentCategory(parentCategory);
|
||||||
//parentCategory.addSubCategory(category);
|
//parentCategory.addSubCategory(category);
|
||||||
|
|
||||||
// to avoid infinite recursion
|
// to avoid infinite recursion
|
||||||
category.setParentCategoryId(parentCategory.getObjectId());
|
category.setParentCategoryId(parentCategory.getUniqueId());
|
||||||
parentCategory.addSubCategoryId(category.getObjectId());
|
parentCategory.addSubCategoryId(category.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ public class Category extends CcmObject {
|
||||||
private long categoryOrder;
|
private long categoryOrder;
|
||||||
|
|
||||||
// to avoid infinite recursion
|
// to avoid infinite recursion
|
||||||
private List<Long> subCategoriesId;
|
private List<String> subCategoriesId;
|
||||||
private long parentCategoryId;
|
private String parentCategoryId;
|
||||||
|
|
||||||
|
|
||||||
public Category(final com.arsdigita.categorization.Category trunkCategory) {
|
public Category(final com.arsdigita.categorization.Category trunkCategory) {
|
||||||
|
|
@ -75,17 +75,19 @@ public class Category extends CcmObject {
|
||||||
trunkCategory.getCategoryLocalizationCollection();
|
trunkCategory.getCategoryLocalizationCollection();
|
||||||
if (categoryLocalizationCollection != null &&
|
if (categoryLocalizationCollection != null &&
|
||||||
categoryLocalizationCollection.next()) {
|
categoryLocalizationCollection.next()) {
|
||||||
|
|
||||||
CategoryLocalization categoryLocalization =
|
CategoryLocalization categoryLocalization =
|
||||||
categoryLocalizationCollection.getCategoryLocalization();
|
categoryLocalizationCollection.getCategoryLocalization();
|
||||||
|
if (categoryLocalization != null) {
|
||||||
if (categoryLocalization != null && categoryLocalization
|
String strLocale = categoryLocalization.getLocale();
|
||||||
.getLocale() != null) {
|
String name = categoryLocalization.getName();
|
||||||
Locale locale = new Locale(categoryLocalization.getLocale());
|
String description = categoryLocalization.getDescription();
|
||||||
if (categoryLocalization.getName() != null)
|
if (strLocale != null) {
|
||||||
this.title.addValue(locale, categoryLocalization.getName());
|
Locale locale = new Locale(strLocale);
|
||||||
if (categoryLocalization.getDescription() != null)
|
if (name != null)
|
||||||
this.description.addValue(locale, categoryLocalization.getDescription());
|
this.title.addValue(locale, name);
|
||||||
|
if (description != null)
|
||||||
|
this.description.addValue(locale, description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,27 +222,27 @@ public class Category extends CcmObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Long> getSubCategoriesId() {
|
public List<String> getSubCategoriesId() {
|
||||||
return subCategoriesId;
|
return subCategoriesId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubCategoriesId(List<Long> subCategoriesId) {
|
public void setSubCategoriesId(final List<String> subCategoriesId) {
|
||||||
this.subCategoriesId = subCategoriesId;
|
this.subCategoriesId = subCategoriesId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSubCategoryId(final long subCategoryId) {
|
public void addSubCategoryId(final String subCategoryId) {
|
||||||
this.subCategoriesId.add(subCategoryId);
|
this.subCategoriesId.add(subCategoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSubCategoryId(final long subCategoryId) {
|
public void removeSubCategoryId(final String subCategoryId) {
|
||||||
this.subCategoriesId.remove(subCategoryId);
|
this.subCategoriesId.remove(subCategoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getParentCategoryId() {
|
public String getParentCategoryId() {
|
||||||
return parentCategoryId;
|
return parentCategoryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParentCategoryId(long parentCategoryId) {
|
public void setParentCategoryId(final String parentCategoryId) {
|
||||||
this.parentCategoryId = parentCategoryId;
|
this.parentCategoryId = parentCategoryId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue