diff options
Diffstat (limited to 'model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/AxModelWithReferences.java')
-rw-r--r-- | model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/AxModelWithReferences.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/AxModelWithReferences.java b/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/AxModelWithReferences.java new file mode 100644 index 000000000..e08b4482c --- /dev/null +++ b/model/basic-model/src/test/java/org/onap/apex/model/basicmodel/handling/AxModelWithReferences.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.apex.model.basicmodel.handling; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.apex.model.basicmodel.concepts.AxArtifactKey; +import org.onap.apex.model.basicmodel.concepts.AxKey; +import org.onap.apex.model.basicmodel.concepts.AxModel; +import org.onap.apex.model.basicmodel.concepts.AxReferenceKey; + +public class AxModelWithReferences extends AxModel { + private static final long serialVersionUID = -8194956638511120008L; + + private List<AxKey> extraKeyList = new ArrayList<>(); + + public AxModelWithReferences(final AxArtifactKey key) { + super(key); + } + + @Override + public List<AxKey> getKeys() { + List<AxKey> keys = super.getKeys(); + keys.addAll(extraKeyList); + + return keys; + } + + public List<AxKey> getExtraKeyList() { + return extraKeyList; + } + + public void setReferenceKeyList() { + List<AxKey> keys = super.getKeys(); + + for (AxKey key: keys) { + AxArtifactKey aKey = (AxArtifactKey)key; + AxReferenceKey keyRef = new AxReferenceKey(aKey, aKey.getName()); + extraKeyList.add(keyRef); + } + } + + public void addKey(final AxKey aKey) { + extraKeyList.add(aKey); + } + + public void removeKey(final AxKey aKey) { + extraKeyList.remove(aKey); + } +} |