diff --git a/ccm-core/src/com/arsdigita/kernel/ACSObjectInstantiator.java b/ccm-core/src/com/arsdigita/kernel/ACSObjectInstantiator.java index b30185989..3a784691b 100755 --- a/ccm-core/src/com/arsdigita/kernel/ACSObjectInstantiator.java +++ b/ccm-core/src/com/arsdigita/kernel/ACSObjectInstantiator.java @@ -23,6 +23,7 @@ import com.arsdigita.domain.DomainObjectInstantiator; import com.arsdigita.domain.ReflectionInstantiator; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObject ; +import com.arsdigita.persistence.metadata.ObjectType; /** * Defines the instantiator that should be @@ -123,7 +124,8 @@ public class ACSObjectInstantiator extends DomainObjectInstantiator { * @see com.arsdigita.domain.DomainObjectFactory */ public DomainObjectInstantiator resolveInstantiator(DataObject dataObject) { - String type = (String) dataObject.get(ACSObject.OBJECT_TYPE); + //String type = (String) dataObject.get(ACSObject.OBJECT_TYPE); + ObjectType type = dataObject.getObjectType(); dataObject.specialize(type); DomainObjectInstantiator instantiator = diff --git a/ccm-core/src/com/arsdigita/kernel/Role.java b/ccm-core/src/com/arsdigita/kernel/Role.java index 6770c4c4c..b16de85d8 100755 --- a/ccm-core/src/com/arsdigita/kernel/Role.java +++ b/ccm-core/src/com/arsdigita/kernel/Role.java @@ -517,6 +517,7 @@ public class Role extends DomainObject { while (collection.next()) { Role role = (Role) collection.getDomainObject(); + if (role != null) { roleList.add(role); } diff --git a/ccm-core/src/com/arsdigita/kernel/permissions/Permission.java b/ccm-core/src/com/arsdigita/kernel/permissions/Permission.java index 53f489b9c..ee2b68db0 100755 --- a/ccm-core/src/com/arsdigita/kernel/permissions/Permission.java +++ b/ccm-core/src/com/arsdigita/kernel/permissions/Permission.java @@ -330,7 +330,7 @@ public class Permission extends DomainObject { final Session session = SessionManager.getSession(); DomainCollection collection = new DomainCollection(session.retrieve( - Group.BASE_DATA_OBJECT_TYPE)); + Permission.BASE_DATA_OBJECT_TYPE)); while (collection.next()) { Permission permission = (Permission) collection.getDomainObject(); diff --git a/ccm-core/src/com/arsdigita/portation/conversion/core/workflow/UserTaskConversion.java b/ccm-core/src/com/arsdigita/portation/conversion/core/workflow/UserTaskConversion.java index 1efab988c..ef9cd2187 100644 --- a/ccm-core/src/com/arsdigita/portation/conversion/core/workflow/UserTaskConversion.java +++ b/ccm-core/src/com/arsdigita/portation/conversion/core/workflow/UserTaskConversion.java @@ -76,23 +76,29 @@ public class UserTaskConversion { UserTask userTask = new UserTask(trunkUserTask); // set workflow and opposed associations - Workflow workflow = NgCollection.workflows.get( - trunkUserTask.getWorkflow().getID().longValue()); - if (workflow != null) { - userTask.setWorkflow(workflow); - workflow.addTask(userTask); + if (trunkUserTask.getWorkflow() != null) { + Workflow workflow = NgCollection.workflows.get( + trunkUserTask.getWorkflow().getID().longValue()); + if (workflow != null) { + userTask.setWorkflow(workflow); + workflow.addTask(userTask); + } } // set lockingUser and notificationSender - User lockingUser = NgCollection.users.get(trunkUserTask - .getLockedUser() - .getID().longValue()); - User notificationSender = NgCollection.users.get(trunkUserTask - .getNotificationSender().getID().longValue()); - if (lockingUser != null) - userTask.setLockingUser(lockingUser); - if (notificationSender != null) - userTask.setNotificationSender(notificationSender); + if (trunkUserTask.getLockedUser() != null) { + User lockingUser = NgCollection.users.get(trunkUserTask + .getLockedUser() + .getID().longValue()); + if (lockingUser != null) + userTask.setLockingUser(lockingUser); + } + if (trunkUserTask.getNotificationSender() != null) { + User notificationSender = NgCollection.users.get(trunkUserTask + .getNotificationSender().getID().longValue()); + if (notificationSender != null) + userTask.setNotificationSender(notificationSender); + } // taskAssignments GroupCollection groupCollection = trunkUserTask 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 92fc5aafb..46050fc41 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 @@ -71,23 +71,42 @@ public class Category extends CcmObject { this.uniqueId = trunkCategory.getID().toString(); 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 = 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); - } + Locale locale = new Locale(categoryLocalization.getLocale()); + this.title = new LocalizedString(); + this.title.addValue(locale, categoryLocalization.getName()); + this.description = new LocalizedString(); + this.description.addValue(locale, categoryLocalization.getDescription()); } } @@ -108,6 +127,9 @@ public class Category extends CcmObject { ? defaultParent.getNumberOfChildCategories() + 1 : 0; + // to avoid infinite recursion + this.subCategoriesId = new ArrayList<>(); + NgCollection.categories.put(this.getObjectId(), this); } diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/workflow/Task.java b/ccm-core/src/com/arsdigita/portation/modules/core/workflow/Task.java index b27a82edd..9daaa4b75 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/workflow/Task.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/workflow/Task.java @@ -49,8 +49,11 @@ public class Task implements Identifiable { public Task(final com.arsdigita.workflow.simple.Task trunkTask) { this.taskId = trunkTask.getID().longValue(); - label.addValue(Locale.ENGLISH, trunkTask.getLabel()); - description.addValue(Locale.ENGLISH, trunkTask.getDescription()); + + this.label = new LocalizedString(); + this.label.addValue(Locale.ENGLISH, trunkTask.getLabel()); + this.description = new LocalizedString(); + this.description.addValue(Locale.ENGLISH, trunkTask.getDescription()); this.active = trunkTask.isActive(); this.taskState = trunkTask.getStateString(); diff --git a/ccm-core/src/com/arsdigita/portation/modules/core/workflow/Workflow.java b/ccm-core/src/com/arsdigita/portation/modules/core/workflow/Workflow.java index 5b0ecd08d..1e845e044 100644 --- a/ccm-core/src/com/arsdigita/portation/modules/core/workflow/Workflow.java +++ b/ccm-core/src/com/arsdigita/portation/modules/core/workflow/Workflow.java @@ -43,7 +43,9 @@ public class Workflow implements Identifiable { public Workflow(final com.arsdigita.workflow.simple.Workflow trunkWorkFlow) { this.workflowId = trunkWorkFlow.getID().longValue(); + this.name = new LocalizedString(); this.name.addValue(Locale.ENGLISH, trunkWorkFlow.getDisplayName()); + this.description = new LocalizedString(); this.description.addValue(Locale.ENGLISH, trunkWorkFlow.getDescription()); this.tasks = new ArrayList<>();