Code Review
/
policy
/
models.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add PfKey translation to ToscaConceptIdentifier
[policy/models.git]
/
models-tosca
/
src
/
main
/
java
/
org
/
onap
/
policy
/
models
/
tosca
/
authorative
/
concepts
/
ToscaConceptIdentifier.java
diff --git
a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
index
36e460e
..
ade1a28
100644
(file)
--- a/
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
+++ b/
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
@@
-27,6
+27,8
@@
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfKey;
/**
* Identifies a concept. Both the name and version must be non-null.
/**
* Identifies a concept. Both the name and version must be non-null.
@@
-47,6
+49,11
@@
public class ToscaConceptIdentifier implements Comparable<ToscaConceptIdentifier
this.version = version;
}
this.version = version;
}
+ public ToscaConceptIdentifier(@NonNull PfKey key) {
+ this.name = key.getName();
+ this.version = key.getVersion();
+ }
+
public ToscaConceptIdentifier(ToscaConceptIdentifier source) {
this.name = source.name;
this.version = source.version;
public ToscaConceptIdentifier(ToscaConceptIdentifier source) {
this.name = source.name;
this.version = source.version;
@@
-66,6
+73,15
@@
public class ToscaConceptIdentifier implements Comparable<ToscaConceptIdentifier
return result;
}
return result;
}
+ /**
+ * Create a PfConcceptKey from the TOSCA identifier.
+ *
+ * @return the key
+ */
+ public PfConceptKey asConceptKey() {
+ return new PfConceptKey(name, version);
+ }
+
@Override
public int compareTo(ToscaConceptIdentifier other) {
if (this == other) {
@Override
public int compareTo(ToscaConceptIdentifier other) {
if (this == other) {