diff options
author | 2016-10-24 11:13:00 +0800 | |
---|---|---|
committer | 2016-10-24 11:13:00 +0800 | |
commit | e366e9da3eec5de359ef6d3450438f2d5c9fd97b (patch) | |
tree | 47c4e49c85c2c645bbf33cd9aa951534db7df026 /catalog-core/catalog-mgr/src/main/java | |
parent | 8c845695a6807a7455597a825ef66dc51228f938 (diff) |
Add log information.
Change status of Service template from usage State to operation status.
Change-Id: I6c6df768ecb7b996cbbf484b5afd1a896bc74130
Issue-id: TOSCA-122
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
Diffstat (limited to 'catalog-core/catalog-mgr/src/main/java')
3 files changed, 30 insertions, 28 deletions
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/aria/service/AriaParserServiceConsumer.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/aria/service/AriaParserServiceConsumer.java index 4eb61d45..fe6acc2a 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/aria/service/AriaParserServiceConsumer.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/aria/service/AriaParserServiceConsumer.java @@ -61,7 +61,8 @@ public class AriaParserServiceConsumer { private static void validateResult(String strResult) throws CatalogResourceException { AriaParserExceptionResult except = new Gson().fromJson(strResult, AriaParserExceptionResult.class); if (except.getIssues() != null && except.getIssues().length > 0) { - throw new CatalogResourceException("Aria parser return failure message: " + except.getIssues()[0].getMessage()); + logger.error("Aria parser return failure message: " + strResult); + throw new CatalogResourceException("Aria parser return failure message: " + strResult); } } } diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/wrapper/ServiceTemplateWrapper.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/wrapper/ServiceTemplateWrapper.java index bee3bd6e..c381c8aa 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/wrapper/ServiceTemplateWrapper.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/wrapper/ServiceTemplateWrapper.java @@ -15,6 +15,10 @@ */ package org.openo.commontosca.catalog.model.wrapper; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import org.openo.commontosca.catalog.common.ToolUtil; import org.openo.commontosca.catalog.db.entity.NodeTemplateData; import org.openo.commontosca.catalog.db.entity.PackageData; @@ -22,6 +26,7 @@ import org.openo.commontosca.catalog.db.entity.ServiceTemplateData; import org.openo.commontosca.catalog.db.entity.ServiceTemplateMappingData; import org.openo.commontosca.catalog.db.exception.CatalogResourceException; import org.openo.commontosca.catalog.db.resource.TemplateManager; +import org.openo.commontosca.catalog.entity.EnumOperationalState; import org.openo.commontosca.catalog.model.common.TemplateDataHelper; import org.openo.commontosca.catalog.model.entity.InputParameter; import org.openo.commontosca.catalog.model.entity.NfvTemplate; @@ -36,10 +41,6 @@ import org.openo.commontosca.catalog.resources.CatalogBadRequestException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class ServiceTemplateWrapper { private static ServiceTemplateWrapper instance; @@ -83,10 +84,12 @@ public class ServiceTemplateWrapper { * @return service template list * @throws CatalogResourceException e */ - public ServiceTemplate[] getServiceTemplates(String status, boolean deletionPending) + public ServiceTemplate[] getServiceTemplates(EnumOperationalState status, boolean deletionPending) throws CatalogResourceException { PackageData pd = new PackageData(); - pd.setUsageState(status); + if (status != null) { + pd.setOperationalState(status.toString()); + } pd.setDeletionPending(String.valueOf(deletionPending)); List<ServiceTemplateData> stdList = diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/resources/TemplateResource.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/resources/TemplateResource.java index 73ae9d7f..aabeae63 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/resources/TemplateResource.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/resources/TemplateResource.java @@ -15,9 +15,27 @@ */ package org.openo.commontosca.catalog.resources; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.eclipse.jetty.http.HttpStatus; import org.openo.commontosca.catalog.common.CommonErrorResponse; import org.openo.commontosca.catalog.common.ToolUtil; import org.openo.commontosca.catalog.db.exception.CatalogResourceException; +import org.openo.commontosca.catalog.entity.EnumOperationalState; import org.openo.commontosca.catalog.model.entity.InputParameter; import org.openo.commontosca.catalog.model.entity.NodeTemplate; import org.openo.commontosca.catalog.model.entity.Parameters; @@ -26,32 +44,12 @@ import org.openo.commontosca.catalog.model.entity.ServiceTemplate; import org.openo.commontosca.catalog.model.entity.ServiceTemplateOperation; import org.openo.commontosca.catalog.model.entity.ServiceTemplateRawData; import org.openo.commontosca.catalog.model.parser.AbstractModelParser; -import org.openo.commontosca.catalog.model.parser.yaml.aria.AriaModelParser; import org.openo.commontosca.catalog.model.parser.yaml.zte.ToscaYamlModelParser; import org.openo.commontosca.catalog.model.service.ModelService; import org.openo.commontosca.catalog.model.wrapper.ServiceTemplateWrapper; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.eclipse.jetty.http.HttpStatus; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - import com.codahale.metrics.annotation.Timed; /** @@ -116,7 +114,7 @@ public class TemplateResource { response = CommonErrorResponse.class)}) @Timed public Response getServiceTemplates( - @ApiParam(value = "template status") @QueryParam("status") String status, + @ApiParam(value = "template status") @QueryParam("status") EnumOperationalState status, @ApiParam(value = "delay to delete") @QueryParam("deletionPending") boolean deletionPending) { try { ServiceTemplate[] sts = |