From da731d2bb81666b9c697d9099da632e7dfcdc0f7 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 9 Sep 2014 12:13:21 +0200 Subject: Replaced int sysKey Item identifier with UUID, which is now portable. ItemPath objects are now used to identify Items throughout the kernel, replacing ints and Integers. --- .../com/c2kernel/entity/imports/ImportDependency.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/c2kernel/entity/imports/ImportDependency.java') diff --git a/src/main/java/com/c2kernel/entity/imports/ImportDependency.java b/src/main/java/com/c2kernel/entity/imports/ImportDependency.java index e6ce909..a43f6e3 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportDependency.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportDependency.java @@ -1,10 +1,12 @@ package com.c2kernel.entity.imports; import java.util.ArrayList; +import java.util.UUID; import com.c2kernel.collection.MembershipException; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.DomainPath; +import com.c2kernel.lookup.ItemPath; import com.c2kernel.property.PropertyDescription; import com.c2kernel.property.PropertyDescriptionList; import com.c2kernel.property.PropertyUtility; @@ -42,7 +44,7 @@ public class ImportDependency implements java.io.Serializable { public com.c2kernel.collection.Dependency create() throws MembershipException, ObjectNotFoundException { com.c2kernel.collection.Dependency newDep = isDescription?new com.c2kernel.collection.DependencyDescription(name):new com.c2kernel.collection.Dependency(name); if (itemDescriptionPath != null && itemDescriptionPath.length()>0) { - PropertyDescriptionList propList = PropertyUtility.getPropertyDescriptionOutcome(new DomainPath(itemDescriptionPath).getSysKey()); + PropertyDescriptionList propList = PropertyUtility.getPropertyDescriptionOutcome(new DomainPath(itemDescriptionPath).getItemPath()); StringBuffer classProps = new StringBuffer(); for (PropertyDescription pd : propList.list) { props.put(pd.getName(), pd.getDefaultValue()); @@ -54,10 +56,16 @@ public class ImportDependency implements java.io.Serializable { } for (ImportDependencyMember thisMem : dependencyMemberList) { - int syskey = new DomainPath(thisMem.itemPath).getSysKey(); - if (syskey == -1) + ItemPath itemPath; + try { + itemPath = new ItemPath(UUID.fromString(thisMem.itemPath)); + } catch (IllegalArgumentException ex) { + itemPath = new DomainPath(thisMem.itemPath).getItemPath(); + } + + if (itemPath == null) throw new MembershipException("Cannot find "+thisMem.itemPath+" specified for collection."); - com.c2kernel.collection.DependencyMember newDepMem = newDep.addMember(syskey); + com.c2kernel.collection.DependencyMember newDepMem = newDep.addMember(itemPath); newDepMem.getProperties().putAll(thisMem.props); } return newDep; -- cgit v1.2.3