[FEATURE]

- bugfixes for object conversion from trunk to ng

git-svn-id: https://svn.libreccm.org/ccm/trunk@4309 8810af33-2d31-482b-a856-94f89814c4df
master
tosmers 2016-09-19 16:52:45 +00:00
parent 89a47f4a8f
commit 33af4f199a
7 changed files with 64 additions and 28 deletions

View File

@ -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 =

View File

@ -517,6 +517,7 @@ public class Role extends DomainObject {
while (collection.next()) {
Role role = (Role) collection.getDomainObject();
if (role != null) {
roleList.add(role);
}

View File

@ -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();

View File

@ -76,23 +76,29 @@ public class UserTaskConversion {
UserTask userTask = new UserTask(trunkUserTask);
// set workflow and opposed associations
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
if (trunkUserTask.getLockedUser() != null) {
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 (trunkUserTask.getNotificationSender() != null) {
User notificationSender = NgCollection.users.get(trunkUserTask
.getNotificationSender().getID().longValue());
if (notificationSender != null)
userTask.setNotificationSender(notificationSender);
}
// taskAssignments
GroupCollection groupCollection = trunkUserTask

View File

@ -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);
}

View File

@ -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();

View File

@ -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<>();