* ============LICENSE_END============================================
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
-package org.onap.aai.champ.model;
+package org.onap.aai.champcore.model;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-
-import org.onap.aai.champ.model.fluent.relationship.CreateChampRelationshipable;
-import org.onap.aai.champ.model.fluent.relationship.impl.CreateChampRelationshipableImpl;
-
import java.util.Optional;
+import org.onap.aai.champcore.model.fluent.relationship.CreateChampRelationshipable;
+import org.onap.aai.champcore.model.fluent.relationship.impl.CreateChampRelationshipableImpl;
+
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
public final class ChampRelationship implements ChampElement {
- private final String type; //AKA edge label
- private final Optional<Object> key;
- private final Map<String, Object> properties;
- private final ChampObject source;
- private final ChampObject target;
+ private String type; //AKA edge label
+ private Optional<Object> key;
+ private Map<String, Object> properties;
+ private ChampObject source;
+ private ChampObject target;
public static CreateChampRelationshipable create() {
return new CreateChampRelationshipableImpl();
}
- private ChampRelationship() { //Not instantiable
- throw new RuntimeException("Cannot call ChampRelationship() constructor");
+ public ChampRelationship() { //Not instantiable
}
private ChampRelationship(Builder builder) {
@JsonIgnore
public Optional<Object> getKey() {
- return key;
+ if (key == null) {
+ return Optional.empty ();
+ } else {
+ return key;
+ }
}
@JsonProperty("key")
- public Object getKeyValue() {
- return key.orElse("");
+ public String getKeyValue() {
+ return (getKey().isPresent() ? getKey().get() : "").toString();
}
public ChampObject getSource() {