From fd809717ca774dfabeddd3984fbbbbdfd029601e Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 26 Aug 2019 12:20:27 -0400 Subject: Replace copyTo methods with copy constructors Deleted the copyTo() method from PfConcepts and replaced uses with deep-copy constructors. Also added mapMap() and makeCopy() methods to PfUtils to facilitate. Change-Id: Id6391bb806ef0dfab6c1089278bf2b514c7e303e Issue-ID: POLICY-1600 Signed-off-by: Jim Hahn --- .../org/onap/policy/models/base/PfConcept.java | 12 +-- .../policy/models/base/PfConceptContainer.java | 31 +++----- .../org/onap/policy/models/base/PfConceptKey.java | 18 +---- .../java/org/onap/policy/models/base/PfKeyUse.java | 23 +----- .../java/org/onap/policy/models/base/PfModel.java | 12 +-- .../onap/policy/models/base/PfReferenceKey.java | 17 +---- .../java/org/onap/policy/models/base/PfUtils.java | 85 +++++++++++++++++++++- .../policy/models/base/PfConceptContainerTest.java | 4 +- .../org/onap/policy/models/base/PfKeyUseTest.java | 9 +-- .../org/onap/policy/models/base/PfModelTest.java | 2 +- .../policy/models/base/PfReferenceKeyTest.java | 9 +-- .../org/onap/policy/models/base/PfUtilsTest.java | 65 +++++++++++++++-- .../models/base/testconcepts/DummyPfConcept.java | 18 +---- .../base/testconcepts/DummyPfConceptKeySub.java | 10 +++ .../models/base/testconcepts/DummyPfKey.java | 11 +-- .../models/base/testconcepts/DummyPfModel.java | 38 ++-------- 16 files changed, 189 insertions(+), 175 deletions(-) (limited to 'models-base') diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java index 9a376feff..a1cfac4ae 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConcept.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +45,7 @@ public abstract class PfConcept implements Serializable, Comparable { * @param copyConcept the concept to copy from */ public PfConcept(@NonNull final PfConcept copyConcept) { - copyConcept.copyTo(this); + // nothing else to do (other than @NonNull check) } /** @@ -86,15 +87,6 @@ public abstract class PfConcept implements Serializable, Comparable { @Override public abstract int hashCode(); - /** - * Copy this concept to another object. The target object must have the same class as the source - * object. - * - * @param target the target object to which this object is copied - * @return the copied object - */ - public abstract PfConcept copyTo(@NonNull PfConcept target); - /** * Gets the ID string of this concept. * diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java index 63ab14ee5..1b60932e9 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptContainer.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +30,6 @@ import java.util.Map.Entry; import java.util.NavigableMap; import java.util.Set; import java.util.TreeMap; - import javax.persistence.CascadeType; import javax.persistence.EmbeddedId; import javax.persistence.Entity; @@ -37,12 +37,9 @@ import javax.persistence.FetchType; import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.ws.rs.core.Response; - import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; - -import org.onap.policy.common.utils.validation.Assertions; import org.onap.policy.models.base.PfValidationResult.ValidationResult; // @formatter:off @@ -111,6 +108,14 @@ public class PfConceptContainer ex */ public PfConceptContainer(@NonNull final PfConceptContainer copyConcept) { super(copyConcept); + this.key = new PfConceptKey(copyConcept.key); + + this.conceptMap = new TreeMap<>(); + for (final Entry conceptMapEntry : copyConcept.conceptMap.entrySet()) { + PfConceptKey newK = new PfConceptKey(conceptMapEntry.getKey()); + C newC = PfUtils.makeCopy(conceptMapEntry.getValue()); + this.conceptMap.put(newK, newC); + } } @Override @@ -278,24 +283,6 @@ public class PfConceptContainer ex return 0; } - @Override - public PfConcept copyTo(@NonNull final PfConcept target) { - Assertions.instanceOf(target, PfConceptContainer.class); - - @SuppressWarnings("unchecked") - final PfConceptContainer copy = (PfConceptContainer) target; - copy.setKey(new PfConceptKey(key)); - final Map newConceptMap = new TreeMap<>(); - for (final Entry conceptMapEntry : conceptMap.entrySet()) { - C newC = getConceptNewInstance(); - conceptMapEntry.getValue().copyTo(newC); - newConceptMap.put(new PfConceptKey(conceptMapEntry.getKey()), newC); - } - copy.setConceptMap(newConceptMap); - - return copy; - } - @Override public C get(final PfConceptKey conceptKey) { return new PfConceptGetterImpl<>((NavigableMap) conceptMap).get(conceptKey); diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java index 17fda7cfe..f5baae7fe 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfConceptKey.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. - * ModificationsCopyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,6 +73,8 @@ public class PfConceptKey extends PfKey { */ public PfConceptKey(@NonNull final PfConceptKey copyConcept) { super(copyConcept); + this.name = copyConcept.name; + this.version = copyConcept.version; } /** @@ -288,20 +290,6 @@ public class PfConceptKey extends PfKey { version = Assertions.validateStringParameter(VERSION_TOKEN, version, VERSION_REGEXP); } - @Override - public PfConcept copyTo(final PfConcept target) { - Assertions.argumentNotNull(target, "target may not be null"); - - final PfConcept copyObject = target; - Assertions.instanceOf(copyObject, PfConceptKey.class); - - final PfConceptKey copy = ((PfConceptKey) copyObject); - copy.setName(name); - copy.setVersion(version); - - return copyObject; - } - @Override public int compareTo(@NonNull final PfConcept otherObj) { Assertions.argumentNotNull(otherObj, "comparison object may not be null"); diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java b/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java index d56b0dbab..03873236c 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfKeyUse.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,13 +22,9 @@ package org.onap.policy.models.base; import java.util.List; - -import javax.ws.rs.core.Response; - import lombok.EqualsAndHashCode; import lombok.NonNull; import lombok.ToString; - import org.onap.policy.common.utils.validation.Assertions; import org.onap.policy.models.base.PfValidationResult.ValidationResult; @@ -69,6 +66,7 @@ public class PfKeyUse extends PfKey { */ public PfKeyUse(@NonNull final PfKeyUse copyConcept) { super(copyConcept); + this.usedKey = PfUtils.makeCopy(copyConcept.usedKey); } @Override @@ -159,21 +157,4 @@ public class PfKeyUse extends PfKey { return usedKey.compareTo(other.usedKey); } - - @Override - public PfConcept copyTo(@NonNull final PfConcept target) { - final Object copyObject = target; - Assertions.instanceOf(copyObject, PfKeyUse.class); - - final PfKeyUse copy = ((PfKeyUse) copyObject); - try { - copy.usedKey = usedKey.getClass().newInstance(); - } catch (final Exception e) { - throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, - "error copying concept key: " + e.getMessage(), e); - } - usedKey.copyTo(copy.usedKey); - - return copy; - } } diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java index 07ec3af04..83ae71cca 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfModel.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfModel.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,6 +92,7 @@ public abstract class PfModel extends PfConcept { */ public PfModel(@NonNull final PfModel copyConcept) { super(copyConcept); + this.key = new PfConceptKey(copyConcept.key); } /** @@ -281,14 +283,4 @@ public abstract class PfModel extends PfConcept { return key.compareTo(other.key); } - - @Override - public PfConcept copyTo(@NonNull final PfConcept target) { - Assertions.instanceOf(target, PfModel.class); - - final PfModel copy = ((PfModel) target); - copy.setKey(new PfConceptKey(key)); - - return copy; - } } diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java index bdf16dcdf..a5ae6c51e 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfReferenceKey.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -381,22 +382,6 @@ public class PfReferenceKey extends PfKey { localName = Assertions.validateStringParameter(LOCAL_NAME, localName, LOCAL_NAME_REGEXP); } - @Override - public PfConcept copyTo(final PfConcept target) { - Assertions.argumentNotNull(target, "target may not be null"); - - final Object copyObject = target; - Assertions.instanceOf(copyObject, PfReferenceKey.class); - - final PfReferenceKey copy = ((PfReferenceKey) copyObject); - copy.setParentKeyName(parentKeyName); - copy.setParentKeyVersion(parentKeyVersion); - copy.setLocalName(localName); - copy.setParentLocalName(parentLocalName); - - return copy; - } - @Override public int compareTo(final PfConcept otherObj) { Assertions.argumentNotNull(otherObj, "comparison object may not be null"); diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java index c33271d78..8f1040bfe 100644 --- a/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java +++ b/models-base/src/main/java/org/onap/policy/models/base/PfUtils.java @@ -21,10 +21,14 @@ package org.onap.policy.models.base; -import java.util.ArrayList; +import java.lang.reflect.InvocationTargetException; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import java.util.function.Function; import java.util.stream.Collectors; +import javax.ws.rs.core.Response; /** * Utility class for Policy Framework concept utilities. @@ -69,13 +73,88 @@ public final class PfUtils { * * @param source list whose elements are to be mapped, or {@code null} * @param mapFunc mapping function + * @param defaultValue value to be returned if source is {@code null} * @return a new list, containing mappings of all of the items in the original list */ - public static List mapList(List source, Function mapFunc) { + public static List mapList(List source, Function mapFunc, List defaultValue) { if (source == null) { - return new ArrayList<>(0); + return defaultValue; } return source.stream().map(mapFunc).collect(Collectors.toList()); } + + /** + * Convenience method to apply a mapping function to all of the elements of a list, + * generating a new list. + * + * @param source list whose elements are to be mapped, or {@code null} + * @param mapFunc mapping function + * @return a new list, containing mappings of all of the items in the original list, + * or {@code null} if the source is {@code null} + */ + public static List mapList(List source, Function mapFunc) { + return mapList(source, mapFunc, null); + } + + /** + * Convenience method to apply a mapping function to all of the values of a map, + * generating a new map. + * + * @param source map whose values are to be mapped, or {@code null} + * @param mapFunc mapping function + * @param defaultValue value to be returned if source is {@code null} + * @return a new map, containing mappings of all of the items in the original map + */ + public static Map mapMap(Map source, Function mapFunc, + Map defaultValue) { + if (source == null) { + return defaultValue; + } + + Map map = new LinkedHashMap<>(); + for (Entry ent : source.entrySet()) { + map.put(ent.getKey(), mapFunc.apply(ent.getValue())); + } + + return map; + } + + /** + * Convenience method to apply a mapping function to all of the values of a map, + * generating a new map. + * + * @param source map whose values are to be mapped, or {@code null} + * @param mapFunc mapping function + * @return a new map, containing mappings of all of the items in the original map, + * or {@code null} if the source is {@code null} + */ + public static Map mapMap(Map source, Function mapFunc) { + return mapMap(source, mapFunc, null); + } + + /** + * Makes a copy of an object using the copy constructor from the object's class. + * + * @param source object to be copied + * @return a copy of the source, or {@code null} if the source is {@code null} + * @throws PfModelRuntimeException if the object cannot be copied + */ + public static T makeCopy(T source) { + if (source == null) { + return null; + } + + try { + @SuppressWarnings("unchecked") + Class clazz = (Class) source.getClass(); + + return clazz.getConstructor(clazz).newInstance(source); + + } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException + | RuntimeException e) { + throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, + "error copying concept key class: " + source.getClass().getName(), e); + } + } } diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java index 984d2b9d3..5e84dff9a 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfConceptContainerTest.java @@ -113,8 +113,8 @@ public class PfConceptContainerTest { assertEquals(0, container.compareTo(clonedContainer)); - final DummyPfConceptContainer container2 = container; - assertThatThrownBy(() -> container2.copyTo(null)).hasMessage("target is marked @NonNull but is null"); + assertThatThrownBy(() -> new DummyPfConceptContainer((DummyPfConceptContainer) null)) + .isInstanceOf(NullPointerException.class); assertFalse(container.compareTo(null) == 0); assertEquals(0, container.compareTo(container)); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java index f7d1d9a5f..3e5d738bd 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfKeyUseTest.java @@ -96,14 +96,9 @@ public class PfKeyUseTest { assertThatThrownBy(() -> keyUse.validate(null)).hasMessage("result is marked @NonNull but is null"); PfKeyUse testKeyUse = new PfKeyUse(new DummyPfConceptKeySub(new PfConceptKey())); - PfKeyUse targetKeyUse = new PfKeyUse(key); + assertEquals(testKeyUse, new PfKeyUse(testKeyUse)); - assertThatThrownBy(() -> keyUse.copyTo(null)).hasMessage("target is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - testKeyUse.copyTo(targetKeyUse); - keyUse.isCompatible(null); - }).hasMessage("error copying concept key: Some error message"); + assertThatThrownBy(() -> new PfKeyUse((PfKeyUse) null)).isInstanceOf(NullPointerException.class); assertThatThrownBy(() -> keyUse.isNewerThan(null)).hasMessage(OTHER_KEY_IS_NULL); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java index 2f4a1beb9..9b1a778ac 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfModelTest.java @@ -60,7 +60,7 @@ public class PfModelTest { dpmClone.clean(); assertEquals(dpm, dpmClone); - assertThatThrownBy(() -> dpm.copyTo(null)).hasMessage("target is marked @NonNull but is null"); + assertThatThrownBy(() -> new DummyPfModel((DummyPfModel) null)).isInstanceOf(NullPointerException.class); assertEquals(0, dpm.compareTo(dpmClone)); assertEquals(-1, dpm.compareTo(null)); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java index 21b82fcf1..b12ce4de0 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java @@ -125,14 +125,9 @@ public class PfReferenceKeyTest { assertFalse(testReferenceKey.equals(null)); - assertThatThrownBy(() -> testReferenceKey.copyTo(null)).hasMessage("target may not be null"); + assertThatThrownBy(() -> new PfReferenceKey((PfReferenceKey) null)).isInstanceOf(NullPointerException.class); - assertThatThrownBy(() -> testReferenceKey.copyTo(new PfConceptKey("Key", VERSION001))) - .hasMessage("org.onap.policy.models.base.PfConceptKey" - + " is not an instance of org.onap.policy.models.base.PfReferenceKey"); - - PfReferenceKey targetRefKey = new PfReferenceKey(); - assertEquals(testReferenceKey, testReferenceKey.copyTo(targetRefKey)); + assertEquals(testReferenceKey, new PfReferenceKey(testReferenceKey)); } @Test diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java index bd55dcd9a..a66aba2c6 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java @@ -21,12 +21,17 @@ package org.onap.policy.models.base; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNull; import java.util.Arrays; import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import lombok.Getter; +import lombok.ToString; import org.junit.Test; /** @@ -52,13 +57,7 @@ public class PfUtilsTest { List resultList = PfUtils.mapList(null, item -> { throw new RuntimeException("should not be invoked"); }); - assertTrue(resultList.isEmpty()); - - // verify that we can modify the empty list without throwing an exception - resultList.add("xyz"); - resultList.add("pdq"); - resultList.remove("xyz"); - + assertNull(resultList); List origList = Arrays.asList("abc", "def"); List newList = PfUtils.mapList(origList, text -> text + "X"); @@ -69,4 +68,54 @@ public class PfUtilsTest { newList.remove("abcX"); newList.add("something else"); } + + @Test + public void testMapMap() { + Map resultMap = PfUtils.mapMap(null, item -> { + throw new RuntimeException("should not be invoked"); + }); + assertNull(resultMap); + + Map origMap = new TreeMap<>(); + origMap.put("key2A", "xyz2"); + origMap.put("key2B", "pdq2"); + Map newMap = PfUtils.mapMap(origMap, text -> text + "X"); + + assertEquals("{key2A=xyz2X, key2B=pdq2X}", newMap.toString()); + + // verify that we can modify the map without throwing an exception + newMap.remove("abcX"); + newMap.put("something", "else"); + } + + @Test + public void testMakeCopy() { + assertNull(PfUtils.makeCopy((MyObject) null)); + + MyObject origObject = new MyObject(); + origObject.name = HELLO; + assertEquals(origObject.toString(), PfUtils.makeCopy(origObject).toString()); + + assertThatThrownBy(() -> PfUtils.makeCopy(new NoCopyConstructor())).isInstanceOf(PfModelRuntimeException.class); + } + + @Getter + @ToString + private static class MyObject { + private String name; + + public MyObject() { + // do nothing + } + + @SuppressWarnings("unused") + public MyObject(MyObject source) { + this.name = source.name; + } + } + + @Getter + private static class NoCopyConstructor { + private String name; + } } diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java index 6cb44e6b5..be398b95f 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java +++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfConcept.java @@ -22,15 +22,11 @@ package org.onap.policy.models.base.testconcepts; import java.util.List; - import javax.persistence.EmbeddedId; - import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; - import org.apache.commons.lang3.ObjectUtils; -import org.onap.policy.common.utils.validation.Assertions; import org.onap.policy.models.base.PfAuthorative; import org.onap.policy.models.base.PfConcept; import org.onap.policy.models.base.PfConceptKey; @@ -72,6 +68,8 @@ public class DummyPfConcept extends PfConcept implements PfAuthorative(); + for (final PfKey pfKey : copyConcept.keyList) { + keyList.add(PfUtils.makeCopy(pfKey)); + } } @Override @@ -147,30 +147,4 @@ public class DummyPfModel extends PfModel { return 0; } - - @Override - public PfConcept copyTo(final PfConcept targetObject) { - super.copyTo(targetObject); - - Assertions.instanceOf(targetObject, DummyPfModel.class); - - final DummyPfModel copy = ((DummyPfModel) targetObject); - - final List newKeyList = new ArrayList<>(); - for (final PfKey pfKey : keyList) { - PfKey newPfKey; - try { - newPfKey = pfKey.getClass().newInstance(); - } catch (final Exception e) { - throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, - "error copying concept key: " + e.getMessage(), e); - } - newPfKey.copyTo(pfKey); - newKeyList.add(newPfKey); - } - copy.setKeyList(newKeyList); - - - return copy; - } } -- cgit 1.2.3-korg