* ============LICENSE_START=======================================================
* ONAP Policy Model
* ================================================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
+import org.onap.policy.models.base.PfKey;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.base.PfNameVersion;
@Data
@NoArgsConstructor
public class ToscaEntity implements PfNameVersion {
- private String name;
-
- private String version;
+ private String name = PfKey.NULL_KEY_NAME;
+ private String version = PfKey.NULL_KEY_VERSION;
@ApiModelProperty(name = "derived_from")
@SerializedName("derived_from")
private String derivedFrom;
private Map<String, String> metadata;
-
private String description;
/**
return new ToscaEntityKey(name, version);
}
+ @Override
+ public String getDefinedName() {
+ return (PfKey.NULL_KEY_NAME.equals(name) ? null : name);
+ }
+
+ @Override
+ public String getDefinedVersion() {
+ return (PfKey.NULL_KEY_VERSION.equals(version) ? null : version);
+ }
+
/**
* Convert a list of maps of TOSCA entities into a regular map.
*
return entityMap;
}
+ /**
+ * Method that should be specialised to return the type of the entity if the entity has a type.
+ *
+ * @return the type of the entity or null if it has no type
+ */
+ public String getType() {
+ return null;
+ }
+
+ /**
+ * Method that should be specialised to return the type version of the entity if the entity has a type.
+ *
+ * @return the type of the entity or null if it has no type
+ */
+ public String getTypeVersion() {
+ return null;
+ }
}