diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-10-01 21:09:06 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-10-01 21:09:06 +0200 |
| commit | 9c5d6e82b5ce733cf23e4317e3bafaa42c2221ba (patch) | |
| tree | 64657888b5ff52cd8759c6feb15c6087b96d37c6 /src/main/java/com/c2kernel/entity/imports/ImportDependency.java | |
| parent | 8afca6b565edfa0e32aa8e12f30bfff5598abdd4 (diff) | |
Collection version support, stored as a new final component of the
Collection path. Null version implies "last".
Diffstat (limited to 'src/main/java/com/c2kernel/entity/imports/ImportDependency.java')
| -rw-r--r-- | src/main/java/com/c2kernel/entity/imports/ImportDependency.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/com/c2kernel/entity/imports/ImportDependency.java b/src/main/java/com/c2kernel/entity/imports/ImportDependency.java index c235ba4..dc26551 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportDependency.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportDependency.java @@ -2,6 +2,8 @@ package com.c2kernel.entity.imports; import java.util.ArrayList;
+import com.c2kernel.collection.Dependency;
+import com.c2kernel.collection.DependencyDescription;
import com.c2kernel.collection.MembershipException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.lookup.DomainPath;
@@ -16,8 +18,10 @@ import com.c2kernel.utils.KeyValuePair; public class ImportDependency {
public String name;
+ public Integer version;
public boolean isDescription;
public String itemDescriptionPath;
+ public String itemDescriptionVersion = null;
public ArrayList<ImportDependencyMember> dependencyMemberList = new ArrayList<ImportDependencyMember>();
public CastorHashMap props = new CastorHashMap();
@@ -42,9 +46,17 @@ public class ImportDependency { * @return
*/
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);
+ Dependency newDep = isDescription?new DependencyDescription(name):new Dependency(name);
+ if (version!= null) newDep.setVersion(version);
if (itemDescriptionPath != null && itemDescriptionPath.length()>0) {
- PropertyDescriptionList propList = PropertyUtility.getPropertyDescriptionOutcome(new DomainPath(itemDescriptionPath).getItemPath());
+ ItemPath itemPath;
+ try {
+ itemPath = new ItemPath(itemDescriptionPath);
+ } catch (InvalidItemPathException ex) {
+ itemPath = new DomainPath(itemDescriptionPath).getItemPath();
+ }
+ String descVer = itemDescriptionVersion==null?"last":itemDescriptionVersion;
+ PropertyDescriptionList propList = PropertyUtility.getPropertyDescriptionOutcome(itemPath, descVer);
StringBuffer classProps = new StringBuffer();
for (PropertyDescription pd : propList.list) {
props.put(pd.getName(), pd.getDefaultValue());
|
