diff options
author | 2016-11-04 10:18:16 +0800 | |
---|---|---|
committer | 2016-11-04 10:18:16 +0800 | |
commit | 6b830fad5e84002d862658f7fd1cdaa3ad346da4 (patch) | |
tree | 56fc284d8fd7006b97adc646d5db480735d586fc /catalog-core/catalog-mgr | |
parent | f87bce9b9ef9a1dea51b6cb537804a8a316927c0 (diff) |
TOSCA-169 Fix issue
Change-Id: Idd06e0cbd0b7959356f3eb2d24ebd754ab40786e
Issue-id: TOSCA-169
Signed-off-by: sunqi310 <sun.qi310@zte.com.cn>
Diffstat (limited to 'catalog-core/catalog-mgr')
2 files changed, 10 insertions, 3 deletions
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/entity/NodeTemplateData.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/entity/NodeTemplateData.java index c6da6a72..0457e068 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/entity/NodeTemplateData.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/entity/NodeTemplateData.java @@ -17,6 +17,8 @@ package org.openo.commontosca.catalog.db.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @@ -25,14 +27,15 @@ import javax.persistence.Table; @Entity @Table(name = "catalog_node_template_table") @JsonIgnoreProperties(ignoreUnknown = true) -public class NodeTemplateData extends BaseData { +public class NodeTemplateData extends BaseData implements Serializable{ + private static final long serialVersionUID = -2512216362645538471L; @Id @Column(name = "NODETEMPLATEID") private String nodeTemplateId; @Column(name = "NAME") private String name; - + @Id @Column(name = "SERVICETEMPLATEID") private String serviceTemplateId; diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/wrapper/TemplateHandler.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/wrapper/TemplateHandler.java index 12b3987b..43b8ae64 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/wrapper/TemplateHandler.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/db/wrapper/TemplateHandler.java @@ -46,7 +46,11 @@ public class TemplateHandler extends BaseHandler<TemplateData> { templateData.getServiceTemplate().setServiceTemplateId(serviceTemplateOid); } for (NodeTemplateData nodeData : templateData.getNodeTemplates()) { - nodeData.setNodeTemplateId(CatalogDbUtil.generateId()); + String nodeTemplateOid = nodeData.getNodeTemplateId(); + if (!CatalogDbUtil.isNotEmpty(nodeTemplateOid)) { + logger.info("TemplateHandler:nodeTemplate info does not have id,generate UUID."); + nodeData.setNodeTemplateId(CatalogDbUtil.generateId()); + } nodeData.setServiceTemplateId(serviceTemplateOid); } Object result = create(templateData, CatalogResuorceType.TEMPLATE.name()); |