import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.simple.concepts.ToscaDataType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaProperty;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*
* @author Chenfei Gao (cgao@research.att.com)
*/
-public class ToscaDataTypeJsonAdapter implements JsonSerializer<ToscaDataType>, JsonDeserializer<ToscaDataType> {
+public class ToscaDataTypeJsonAdapter implements JsonSerializer<JpaToscaDataType>, JsonDeserializer<JpaToscaDataType> {
private static final Logger LOGGER = LoggerFactory.getLogger(ToscaDataTypeJsonAdapter.class);
private static final String DEFAULT_VERSION = "1.0.0";
@Override
- public ToscaDataType deserialize(@NonNull final JsonElement dataTypeElement, @NonNull final Type type,
+ public JpaToscaDataType deserialize(@NonNull final JsonElement dataTypeElement, @NonNull final Type type,
@NonNull final JsonDeserializationContext context) {
// The incoming JSON
} else {
dataTypeKey = new PfConceptKey(dataTypeName, dataTypeJsonObject.get(VERSION).getAsString());
}
- ToscaDataType dataType = new ToscaDataType(dataTypeKey);
+ JpaToscaDataType dataType = new JpaToscaDataType(dataTypeKey);
// Set derived_from
dataType.setDerivedFrom(new PfConceptKey(dataTypeJsonObject.get(DERIVED_FROM).getAsString(),
if (dataTypeJsonObject.has(PROPERTIES)) {
dataType.setProperties(
new ToscaPropertiesJsonAdapter().deserializeProperties(dataTypeJsonObject.get(PROPERTIES)));
- for (ToscaProperty property : dataType.getProperties()) {
+ for (JpaToscaProperty property : dataType.getProperties()) {
property.getKey().setParentConceptKey(dataTypeKey);
property.getType().setVersion(dataType.getKey().getVersion());
}
}
@Override
- public JsonElement serialize(@NonNull final ToscaDataType dataType, @NonNull final Type type,
+ public JsonElement serialize(@NonNull final JpaToscaDataType dataType, @NonNull final Type type,
@NonNull final JsonSerializationContext context) {
JsonObject dataTypeValJsonObject = new JsonObject();