Hotfix for compilation errors 35/82435/1
authorChenfei Gao <cgao@research.att.com>
Fri, 15 Mar 2019 15:28:16 +0000 (11:28 -0400)
committerChenfei Gao <cgao@research.att.com>
Fri, 15 Mar 2019 15:28:29 +0000 (11:28 -0400)
Added hotfix for compilation errors due to model package name change.

Issue-ID: POLICY-1515
Change-Id: Ia58671234bc5a5cfe201ee448d38adca870333b3
Signed-off-by: Chenfei Gao <cgao@research.att.com>
main/pom.xml
main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
main/src/main/java/org/onap/policy/api/main/rest/ApiRestServer.java
main/src/main/java/org/onap/policy/api/main/rest/provider/PolicyProvider.java
main/src/main/java/org/onap/policy/api/main/rest/provider/PolicyTypeProvider.java

index c1ac173..db30611 100644 (file)
             <artifactId>policy-models-tosca</artifactId>
             <version>${policy.models.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.onap.policy.models</groupId>
+            <artifactId>policy-models-provider</artifactId>
+            <version>${policy.models.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
index d3ff046..9ec97bd 100644 (file)
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest;
-
-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 io.swagger.annotations.Authorization;
-import io.swagger.annotations.BasicAuthDefinition;
-import io.swagger.annotations.Extension;
-import io.swagger.annotations.ExtensionProperty;
-import io.swagger.annotations.Info;
-import io.swagger.annotations.ResponseHeader;
-import io.swagger.annotations.SecurityDefinition;
-import io.swagger.annotations.SwaggerDefinition;
-import java.util.UUID;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-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 javax.ws.rs.core.Response.ResponseBuilder;
-import org.onap.policy.api.main.rest.provider.HealthCheckProvider;
-import org.onap.policy.api.main.rest.provider.PolicyProvider;
-import org.onap.policy.api.main.rest.provider.PolicyTypeProvider;
-import org.onap.policy.api.main.rest.provider.StatisticsProvider;
-import org.onap.policy.common.endpoints.report.HealthCheckReport;
-import org.onap.policy.models.tosca.ToscaPolicy;
-import org.onap.policy.models.tosca.ToscaPolicyList;
-import org.onap.policy.models.tosca.ToscaPolicyType;
-import org.onap.policy.models.tosca.ToscaPolicyTypeList;
-
-/**
- * Class to provide REST API services.
- */
-@Path("/policy/api/v1")
-@Api(value = "Policy Design API")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-@SwaggerDefinition(info = @Info(
-        description = "Policy Design API is publicly exposed for clients to Create/Read/Update/Delete"
-                    + " policy types, policy type implementation and policies which can be recognized"
-                    + " and executable by incorporated policy engines. It is an"
-                    + " independent component running rest service that takes all policy design API calls"
-                    + " from clients and then assign them to different API working functions. Besides"
-                    + " that, API is also exposed for clients to retrieve healthcheck status of this API"
-                    + " rest service and the statistics report including the counters of API invocation.",
-        version = "1.0.0",
-        title = "Policy Design",
-        extensions = {
-                @Extension(properties = {
-                        @ExtensionProperty(name = "planned-retirement-date", value = "tbd"),
-                        @ExtensionProperty(name = "component", value = "Policy Framework")
-                })
-        }),
-        schemes = { SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS },
-        securityDefinition = @SecurityDefinition(basicAuthDefinitions = { @BasicAuthDefinition(key = "basicAuth") }))
-public class ApiRestController {
-
-    /**
-     * Retrieves the healthcheck status of the API component.
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @GET
-    @Path("/healthcheck")
-    @ApiOperation(value = "Perform a system healthcheck",
-            notes = "Returns healthy status of the Policy API component",
-            response = HealthCheckReport.class,
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            },
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "HealthCheck", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response getHealthCheck(
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new HealthCheckProvider().performHealthCheck()).build();
-    }
-
-    /**
-     * Retrieves the statistics report of the API component.
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @GET
-    @Path("/statistics")
-    @ApiOperation(value = "Retrieve current statistics",
-            notes = "Returns current statistics including the counters of API invocation",
-            response = StatisticsReport.class,
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            },
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "Statistics", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response getStatistics(
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new StatisticsProvider().fetchCurrentStatistics()).build();
-    }
-
-    /**
-     * Retrieves all available policy types.
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @GET
-    @Path("/policytypes")
-    @ApiOperation(value = "Retrieve existing policy types",
-            notes = "Returns a list of existing policy types stored in Policy Framework",
-            response = ToscaPolicyTypeList.class,
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            },
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "PolicyType", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response getAllPolicyTypes(
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyTypeProvider().fetchPolicyTypes(null, null)).build();
-    }
-
-    /**
-     * Retrieves all versions of a particular policy type.
-     *
-     * @param policyTypeId the ID of specified policy type
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @GET
-    @Path("/policytypes/{policyTypeId}")
-    @ApiOperation(value = "Retrieve all available versions of a policy type",
-            notes = "Returns a list of all available versions for the specified policy type",
-            response = ToscaPolicyTypeList.class,
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            },
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "PolicyType", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response getAllVersionsOfPolicyType(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyTypeProvider().fetchPolicyTypes(policyTypeId, null)).build();
-    }
-
-    /**
-     * Retrieves specified version of a particular policy type.
-     *
-     * @param policyTypeId the ID of specified policy type
-     * @param versionId the version of specified policy type
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @GET
-    @Path("/policytypes/{policyTypeId}/versions/{versionId}")
-    @ApiOperation(value = "Retrieve one particular version of a policy type",
-            notes = "Returns a particular version for the specified policy type",
-            response = ToscaPolicyTypeList.class,
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            },
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "PolicyType", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response getSpecificVersionOfPolicyType(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @PathParam("versionId") @ApiParam(value = "Version of policy type", required = true) String versionId,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyTypeProvider().fetchPolicyTypes(policyTypeId, versionId)).build();
-    }
-
-    /**
-     * Creates a new policy type.
-     *
-     * @param body the body of policy type following TOSCA definition
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @POST
-    @Path("/policytypes")
-    @ApiOperation(value = "Create a new policy type",
-            notes = "Client should provide TOSCA body of the new policy type",
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "PolicyType", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 201, message = "Resource successfully created",
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            }),
-            @ApiResponse(code = 400, message = "Invalid Body"),
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response createPolicyType(
-            @ApiParam(value = "Entity body of policy type", required = true) ToscaPolicyType body,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyTypeProvider().createPolicyType(body)).build();
-    }
-
-    /**
-     * Deletes all versions of a particular policy type.
-     *
-     * @param policyTypeId the ID of specified policy type
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @DELETE
-    @Path("/policytypes/{policyTypeId}")
-    @ApiOperation(value = "Delete all versions of a policy type",
-            notes = "Rule 1: pre-defined policy types cannot be deleted;"
-                  + "Rule 2: policy types that are in use (parameterized by a TOSCA policy) cannot be deleted."
-                  + "The parameterizing TOSCA policies must be deleted first;",
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "PolicyType", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 204, message = "Resources successfully deleted, no content returned",
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            }),
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response deleteAllVersionsOfPolicyType(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyTypeProvider().deletePolicyTypes(policyTypeId, null)).build();
-    }
-
-    /**
-     * Deletes specified version of a particular policy type.
-     *
-     * @param policyTypeId the ID of specified policy type
-     * @param versionId the version of specified policy type
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @DELETE
-    @Path("/policytypes/{policyTypeId}/versions/{versionId}")
-    @ApiOperation(value = "Delete one version of a policy type",
-            notes = "Rule 1: pre-defined policy types cannot be deleted;"
-                  + "Rule 2: policy types that are in use (parameterized by a TOSCA policy) cannot be deleted."
-                  + "The parameterizing TOSCA policies must be deleted first;",
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "PolicyType", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 204, message = "Resource successfully deleted, no content returned",
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            }),
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response deleteSpecificVersionOfPolicyType(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @PathParam("versionId") @ApiParam(value = "Version of policy type", required = true) String versionId,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyTypeProvider().deletePolicyTypes(policyTypeId, versionId)).build();
-    }
-
-    /**
-     * Retrieves all versions of a particular policy.
-     *
-     * @param policyTypeId the ID of specified policy type
-     * @param policyTypeVersion the version of specified policy type
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @GET
-    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies")
-    @ApiOperation(value = "Retrieve all versions of a policy created for a particular policy type version",
-            notes = "Returns a list of all versions of specified policy created for the specified policy type version",
-            response = ToscaPolicyList.class,
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            },
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "Policy", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response getAllPolicies(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @PathParam("policyTypeVersion")
-                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyProvider().fetchPolicies(policyTypeId, policyTypeVersion, null, null)).build();
-    }
-
-    /**
-     * Retrieves all versions of a particular policy.
-     *
-     * @param policyTypeId the ID of specified policy type
-     * @param policyTypeVersion the version of specified policy type
-     * @param policyId the ID of specified policy
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @GET
-    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}")
-    @ApiOperation(value = "Retrieve all version details of a policy created for a particular policy type version",
-            notes = "Returns a list of all version details of the specified policy",
-            response = ToscaPolicyList.class,
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            },
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "Policy", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response getAllVersionsOfPolicy(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @PathParam("policyTypeVersion")
-                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,
-            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyProvider().fetchPolicies(policyTypeId, policyTypeVersion, policyId, null)).build();
-    }
-
-    /**
-     * Retrieves the specified version of a particular policy.
-     *
-     * @param policyTypeId the ID of specified policy type
-     * @param policyTypeVersion the version of specified policy type
-     * @param policyId the ID of specified policy
-     * @param policyVersion the version of specified policy
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @GET
-    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}")
-    @ApiOperation(value = "Retrieve one version of a policy created for a particular policy type version",
-            notes = "Returns a particular version of specified policy created for the specified policy type version",
-            response = ToscaPolicyList.class,
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            },
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "Policy", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response getSpecificVersionOfPolicy(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @PathParam("policyTypeVersion")
-                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,
-            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,
-            @PathParam("policyVersion") @ApiParam(value = "Version of policy", required = true) String policyVersion,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyProvider().fetchPolicies(policyTypeId, policyTypeVersion,
-                                                       policyId, policyVersion)).build();
-    }
-
-    /**
-     * Retrieves either latest or deployed version of a particular policy depending on query parameter.
-     *
-     * @param policyTypeId the ID of specified policy type
-     * @param policyTypeVersion the version of specified policy type
-     * @param policyId the ID of specified policy
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @GET
-    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions")
-    @ApiOperation(value = "Retrieve either latest or deployed version of a particular policy depending on query param",
-            notes = "Returns either latest or deployed version of specified policy depending on query param",
-            response = ToscaPolicyList.class,
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            },
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "Policy", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response getEitherLatestOrDeployedVersionOfPolicy(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @PathParam("policyTypeVersion")
-                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,
-            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,
-            @QueryParam("type")
-                @ApiParam(value = "Version that can only be 'latest' or 'deployed'", required = true) String type,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyProvider().fetchPolicies(policyTypeId, policyTypeVersion, policyId, type)).build();
-    }
-
-    /**
-     * Creates a new policy for a particular policy type and version.
-     *
-     * @param policyTypeId the ID of specified policy type
-     * @param policyTypeVersion the version of specified policy type
-     * @param body the body of policy following TOSCA definition
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @POST
-    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies")
-    @ApiOperation(value = "Create a new policy for a policy type version",
-            notes = "Client should provide TOSCA body of the new policy",
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "Policy", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 201, message = "Resource successfully created",
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            }),
-            @ApiResponse(code = 400, message = "Invalid Body"),
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response createPolicy(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @PathParam("policyTypeVersion")
-                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId,
-            @ApiParam(value = "Entity body of policy", required = true) ToscaPolicy body) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyProvider().createPolicy(policyTypeId, policyTypeVersion, body)).build();
-    }
-
-    /**
-     * Deletes all versions of a particular policy.
-     *
-     * @param policyTypeId the ID of specified policy type
-     * @param policyTypeVersion the version of specified policy type
-     * @param policyId the ID of specified policy
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @DELETE
-    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}")
-    @ApiOperation(value = "Delete all versions of a policy",
-            notes = "Rule: the version that has been deployed in PDP group(s) cannot be deleted",
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "Policy", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 204, message = "Resources successfully deleted, no content returned",
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            }),
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response deleteAllVersionsOfPolicy(
-            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,
-            @PathParam("policyTypeVersion")
-                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,
-            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyProvider().deletePolicies(policyTypeId, policyTypeVersion, policyId, null)).build();
-    }
-
-    /**
-     * Deletes the specified version of a particular policy.
-     *
-     * @param policyTypeId the ID of specified policy type
-     * @param policyTypeVersion the version of specified policy type
-     * @param policyId the ID of specified policy
-     * @param policyVersion the version of specified policy
-     *
-     * @return the Response object containing the results of the API operation
-     */
-    @DELETE
-    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}")
-    @ApiOperation(value = "Delete a particular version of a policy",
-            notes = "Rule: the version that has been deployed in PDP group(s) cannot be deleted",
-            authorizations = @Authorization(value = "basicAuth"),
-            tags = { "Policy", },
-            extensions = {
-                    @Extension(name = "interface info", properties = {
-                            @ExtensionProperty(name = "api-version", value = "1.0.0"),
-                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")
-                    })
-            })
-    @ApiResponses(value = {
-            @ApiResponse(code = 204, message = "Resource successfully deleted, no content returned",
-            responseHeaders = {
-                    @ResponseHeader(name = "X-MinorVersion",
-                                    description = "Used to request or communicate a MINOR version back from the client"
-                                                + " to the server, and from the server back to the client",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-PatchVersion",
-                                    description = "Used only to communicate a PATCH version in a response for"
-                                                + " troubleshooting purposes only, and will not be provided by"
-                                                + " the client on request",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-LatestVersion",
-                                    description = "Used only to communicate an API's latest version",
-                                    response = String.class),
-                    @ResponseHeader(name = "X-ONAP-RequestID",
-                                    description = "Used to track REST transactions for logging purpose",
-                                    response = UUID.class)
-            }),
-            @ApiResponse(code = 401, message = "Authentication Error"),
-            @ApiResponse(code = 403, message = "Authorization Error"),
-            @ApiResponse(code = 404, message = "Resource Not Found"),
-            @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),
-            @ApiResponse(code = 500, message = "Internal Server Error")
-        })
-    public Response deleteSpecificVersionOfPolicy(
-            @PathParam("policyTypeId") @ApiParam(value = "PolicyType ID", required = true) String policyTypeId,
-            @PathParam("policyTypeVersion")
-                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,
-            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,
-            @PathParam("policyVersion") @ApiParam(value = "Version of policy", required = true) String policyVersion,
-            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {
-        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
-            .entity(new PolicyProvider().deletePolicies(policyTypeId, policyTypeVersion,
-                                                        policyId, policyVersion)).build();
-    }
-
-    private ResponseBuilder addVersionControlHeaders(ResponseBuilder rb) {
-        return rb.header("X-MinorVersion", "0").header("X-PatchVersion", "0").header("X-LatestVersion", "1.0.0");
-    }
-
-    private ResponseBuilder addLoggingHeaders(ResponseBuilder rb, UUID requestId) {
-        if (requestId == null) {
-            // Generate a random uuid if client does not embed requestId in rest request
-            return rb.header("X-ONAP-RequestID", UUID.randomUUID());
-        }
-        return rb.header("X-ONAP-RequestID", requestId);
-    }
-}
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy API\r
+ * ================================================================================\r
+ * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.\r
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * SPDX-License-Identifier: Apache-2.0\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.onap.policy.api.main.rest;\r
+\r
+import io.swagger.annotations.Api;\r
+import io.swagger.annotations.ApiOperation;\r
+import io.swagger.annotations.ApiParam;\r
+import io.swagger.annotations.ApiResponse;\r
+import io.swagger.annotations.ApiResponses;\r
+import io.swagger.annotations.Authorization;\r
+import io.swagger.annotations.BasicAuthDefinition;\r
+import io.swagger.annotations.Extension;\r
+import io.swagger.annotations.ExtensionProperty;\r
+import io.swagger.annotations.Info;\r
+import io.swagger.annotations.ResponseHeader;\r
+import io.swagger.annotations.SecurityDefinition;\r
+import io.swagger.annotations.SwaggerDefinition;\r
+import java.util.UUID;\r
+import javax.ws.rs.Consumes;\r
+import javax.ws.rs.DELETE;\r
+import javax.ws.rs.GET;\r
+import javax.ws.rs.HeaderParam;\r
+import javax.ws.rs.POST;\r
+import javax.ws.rs.Path;\r
+import javax.ws.rs.PathParam;\r
+import javax.ws.rs.Produces;\r
+import javax.ws.rs.QueryParam;\r
+import javax.ws.rs.core.MediaType;\r
+import javax.ws.rs.core.Response;\r
+import javax.ws.rs.core.Response.ResponseBuilder;\r
+import org.onap.policy.api.main.rest.provider.HealthCheckProvider;\r
+import org.onap.policy.api.main.rest.provider.PolicyProvider;\r
+import org.onap.policy.api.main.rest.provider.PolicyTypeProvider;\r
+import org.onap.policy.api.main.rest.provider.StatisticsProvider;\r
+import org.onap.policy.common.endpoints.report.HealthCheckReport;\r
+import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;\r
+\r
+/**\r
+ * Class to provide REST API services.\r
+ */\r
+@Path("/policy/api/v1")\r
+@Api(value = "Policy Design API")\r
+@Produces(MediaType.APPLICATION_JSON)\r
+@Consumes(MediaType.APPLICATION_JSON)\r
+@SwaggerDefinition(info = @Info(\r
+        description = "Policy Design API is publicly exposed for clients to Create/Read/Update/Delete"\r
+                    + " policy types, policy type implementation and policies which can be recognized"\r
+                    + " and executable by incorporated policy engines. It is an"\r
+                    + " independent component running rest service that takes all policy design API calls"\r
+                    + " from clients and then assign them to different API working functions. Besides"\r
+                    + " that, API is also exposed for clients to retrieve healthcheck status of this API"\r
+                    + " rest service and the statistics report including the counters of API invocation.",\r
+        version = "1.0.0",\r
+        title = "Policy Design",\r
+        extensions = {\r
+                @Extension(properties = {\r
+                        @ExtensionProperty(name = "planned-retirement-date", value = "tbd"),\r
+                        @ExtensionProperty(name = "component", value = "Policy Framework")\r
+                })\r
+        }),\r
+        schemes = { SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS },\r
+        securityDefinition = @SecurityDefinition(basicAuthDefinitions = { @BasicAuthDefinition(key = "basicAuth") }))\r
+public class ApiRestController {\r
+\r
+    /**\r
+     * Retrieves the healthcheck status of the API component.\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @GET\r
+    @Path("/healthcheck")\r
+    @ApiOperation(value = "Perform a system healthcheck",\r
+            notes = "Returns healthy status of the Policy API component",\r
+            response = HealthCheckReport.class,\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            },\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "HealthCheck", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response getHealthCheck(\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new HealthCheckProvider().performHealthCheck()).build();\r
+    }\r
+\r
+    /**\r
+     * Retrieves the statistics report of the API component.\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @GET\r
+    @Path("/statistics")\r
+    @ApiOperation(value = "Retrieve current statistics",\r
+            notes = "Returns current statistics including the counters of API invocation",\r
+            response = StatisticsReport.class,\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            },\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "Statistics", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response getStatistics(\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new StatisticsProvider().fetchCurrentStatistics()).build();\r
+    }\r
+\r
+    /**\r
+     * Retrieves all available policy types.\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @GET\r
+    @Path("/policytypes")\r
+    @ApiOperation(value = "Retrieve existing policy types",\r
+            notes = "Returns a list of existing policy types stored in Policy Framework",\r
+            response = ToscaServiceTemplate.class,\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            },\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "PolicyType", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response getAllPolicyTypes(\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyTypeProvider().fetchPolicyTypes(null, null)).build();\r
+    }\r
+\r
+    /**\r
+     * Retrieves all versions of a particular policy type.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @GET\r
+    @Path("/policytypes/{policyTypeId}")\r
+    @ApiOperation(value = "Retrieve all available versions of a policy type",\r
+            notes = "Returns a list of all available versions for the specified policy type",\r
+            response = ToscaServiceTemplate.class,\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            },\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "PolicyType", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response getAllVersionsOfPolicyType(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyTypeProvider().fetchPolicyTypes(policyTypeId, null)).build();\r
+    }\r
+\r
+    /**\r
+     * Retrieves specified version of a particular policy type.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     * @param versionId the version of specified policy type\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @GET\r
+    @Path("/policytypes/{policyTypeId}/versions/{versionId}")\r
+    @ApiOperation(value = "Retrieve one particular version of a policy type",\r
+            notes = "Returns a particular version for the specified policy type",\r
+            response = ToscaServiceTemplate.class,\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            },\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "PolicyType", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response getSpecificVersionOfPolicyType(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @PathParam("versionId") @ApiParam(value = "Version of policy type", required = true) String versionId,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyTypeProvider().fetchPolicyTypes(policyTypeId, versionId)).build();\r
+    }\r
+\r
+    /**\r
+     * Creates a new policy type.\r
+     *\r
+     * @param body the body of policy type following TOSCA definition\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @POST\r
+    @Path("/policytypes")\r
+    @ApiOperation(value = "Create a new policy type",\r
+            notes = "Client should provide TOSCA body of the new policy type",\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "PolicyType", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 201, message = "Resource successfully created",\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            }),\r
+            @ApiResponse(code = 400, message = "Invalid Body"),\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response createPolicyType(\r
+            @ApiParam(value = "Entity body of policy type", required = true) ToscaServiceTemplate body,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyTypeProvider().createPolicyType(body)).build();\r
+    }\r
+\r
+    /**\r
+     * Deletes all versions of a particular policy type.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @DELETE\r
+    @Path("/policytypes/{policyTypeId}")\r
+    @ApiOperation(value = "Delete all versions of a policy type",\r
+            notes = "Rule 1: pre-defined policy types cannot be deleted;"\r
+                  + "Rule 2: policy types that are in use (parameterized by a TOSCA policy) cannot be deleted."\r
+                  + "The parameterizing TOSCA policies must be deleted first;",\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "PolicyType", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 204, message = "Resources successfully deleted, no content returned",\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            }),\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response deleteAllVersionsOfPolicyType(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyTypeProvider().deletePolicyTypes(policyTypeId, null)).build();\r
+    }\r
+\r
+    /**\r
+     * Deletes specified version of a particular policy type.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     * @param versionId the version of specified policy type\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @DELETE\r
+    @Path("/policytypes/{policyTypeId}/versions/{versionId}")\r
+    @ApiOperation(value = "Delete one version of a policy type",\r
+            notes = "Rule 1: pre-defined policy types cannot be deleted;"\r
+                  + "Rule 2: policy types that are in use (parameterized by a TOSCA policy) cannot be deleted."\r
+                  + "The parameterizing TOSCA policies must be deleted first;",\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "PolicyType", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 204, message = "Resource successfully deleted, no content returned",\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            }),\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response deleteSpecificVersionOfPolicyType(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @PathParam("versionId") @ApiParam(value = "Version of policy type", required = true) String versionId,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyTypeProvider().deletePolicyTypes(policyTypeId, versionId)).build();\r
+    }\r
+\r
+    /**\r
+     * Retrieves all versions of a particular policy.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     * @param policyTypeVersion the version of specified policy type\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @GET\r
+    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies")\r
+    @ApiOperation(value = "Retrieve all versions of a policy created for a particular policy type version",\r
+            notes = "Returns a list of all versions of specified policy created for the specified policy type version",\r
+            response = ToscaServiceTemplate.class,\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            },\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "Policy", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response getAllPolicies(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @PathParam("policyTypeVersion")\r
+                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyProvider().fetchPolicies(policyTypeId, policyTypeVersion, null, null)).build();\r
+    }\r
+\r
+    /**\r
+     * Retrieves all versions of a particular policy.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     * @param policyTypeVersion the version of specified policy type\r
+     * @param policyId the ID of specified policy\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @GET\r
+    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}")\r
+    @ApiOperation(value = "Retrieve all version details of a policy created for a particular policy type version",\r
+            notes = "Returns a list of all version details of the specified policy",\r
+            response = ToscaServiceTemplate.class,\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            },\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "Policy", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response getAllVersionsOfPolicy(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @PathParam("policyTypeVersion")\r
+                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,\r
+            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyProvider().fetchPolicies(policyTypeId, policyTypeVersion, policyId, null)).build();\r
+    }\r
+\r
+    /**\r
+     * Retrieves the specified version of a particular policy.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     * @param policyTypeVersion the version of specified policy type\r
+     * @param policyId the ID of specified policy\r
+     * @param policyVersion the version of specified policy\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @GET\r
+    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}")\r
+    @ApiOperation(value = "Retrieve one version of a policy created for a particular policy type version",\r
+            notes = "Returns a particular version of specified policy created for the specified policy type version",\r
+            response = ToscaServiceTemplate.class,\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            },\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "Policy", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response getSpecificVersionOfPolicy(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @PathParam("policyTypeVersion")\r
+                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,\r
+            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
+            @PathParam("policyVersion") @ApiParam(value = "Version of policy", required = true) String policyVersion,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyProvider().fetchPolicies(policyTypeId, policyTypeVersion,\r
+                                                       policyId, policyVersion)).build();\r
+    }\r
+\r
+    /**\r
+     * Retrieves either latest or deployed version of a particular policy depending on query parameter.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     * @param policyTypeVersion the version of specified policy type\r
+     * @param policyId the ID of specified policy\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @GET\r
+    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions")\r
+    @ApiOperation(value = "Retrieve either latest or deployed version of a particular policy depending on query param",\r
+            notes = "Returns either latest or deployed version of specified policy depending on query param",\r
+            response = ToscaServiceTemplate.class,\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            },\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "Policy", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response getEitherLatestOrDeployedVersionOfPolicy(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @PathParam("policyTypeVersion")\r
+                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,\r
+            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
+            @QueryParam("type")\r
+                @ApiParam(value = "Version that can only be 'latest' or 'deployed'", required = true) String type,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyProvider().fetchPolicies(policyTypeId, policyTypeVersion, policyId, type)).build();\r
+    }\r
+\r
+    /**\r
+     * Creates a new policy for a particular policy type and version.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     * @param policyTypeVersion the version of specified policy type\r
+     * @param body the body of policy following TOSCA definition\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @POST\r
+    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies")\r
+    @Consumes("application/json")\r
+    @Produces("application/json")\r
+    @ApiOperation(value = "Create a new policy for a policy type version",\r
+            notes = "Client should provide TOSCA body of the new policy",\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "Policy", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 201, message = "Resource successfully created",\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            }),\r
+            @ApiResponse(code = 400, message = "Invalid Body"),\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response createPolicy(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @PathParam("policyTypeVersion")\r
+                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId,\r
+            @ApiParam(value = "Entity body of policy", required = true) ToscaServiceTemplate body) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyProvider().createPolicy(policyTypeId, policyTypeVersion, body)).build();\r
+    }\r
+\r
+    /**\r
+     * Deletes all versions of a particular policy.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     * @param policyTypeVersion the version of specified policy type\r
+     * @param policyId the ID of specified policy\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @DELETE\r
+    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}")\r
+    @ApiOperation(value = "Delete all versions of a policy",\r
+            notes = "Rule: the version that has been deployed in PDP group(s) cannot be deleted",\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "Policy", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 204, message = "Resources successfully deleted, no content returned",\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            }),\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response deleteAllVersionsOfPolicy(\r
+            @PathParam("policyTypeId") @ApiParam(value = "ID of policy type", required = true) String policyTypeId,\r
+            @PathParam("policyTypeVersion")\r
+                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,\r
+            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyProvider().deletePolicies(policyTypeId, policyTypeVersion, policyId, null)).build();\r
+    }\r
+\r
+    /**\r
+     * Deletes the specified version of a particular policy.\r
+     *\r
+     * @param policyTypeId the ID of specified policy type\r
+     * @param policyTypeVersion the version of specified policy type\r
+     * @param policyId the ID of specified policy\r
+     * @param policyVersion the version of specified policy\r
+     *\r
+     * @return the Response object containing the results of the API operation\r
+     */\r
+    @DELETE\r
+    @Path("/policytypes/{policyTypeId}/versions/{policyTypeVersion}/policies/{policyId}/versions/{policyVersion}")\r
+    @ApiOperation(value = "Delete a particular version of a policy",\r
+            notes = "Rule: the version that has been deployed in PDP group(s) cannot be deleted",\r
+            authorizations = @Authorization(value = "basicAuth"),\r
+            tags = { "Policy", },\r
+            extensions = {\r
+                    @Extension(name = "interface info", properties = {\r
+                            @ExtensionProperty(name = "api-version", value = "1.0.0"),\r
+                            @ExtensionProperty(name = "last-mod-release", value = "Dublin")\r
+                    })\r
+            })\r
+    @ApiResponses(value = {\r
+            @ApiResponse(code = 204, message = "Resource successfully deleted, no content returned",\r
+            responseHeaders = {\r
+                    @ResponseHeader(name = "X-MinorVersion",\r
+                                    description = "Used to request or communicate a MINOR version back from the client"\r
+                                                + " to the server, and from the server back to the client",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-PatchVersion",\r
+                                    description = "Used only to communicate a PATCH version in a response for"\r
+                                                + " troubleshooting purposes only, and will not be provided by"\r
+                                                + " the client on request",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-LatestVersion",\r
+                                    description = "Used only to communicate an API's latest version",\r
+                                    response = String.class),\r
+                    @ResponseHeader(name = "X-ONAP-RequestID",\r
+                                    description = "Used to track REST transactions for logging purpose",\r
+                                    response = UUID.class)\r
+            }),\r
+            @ApiResponse(code = 401, message = "Authentication Error"),\r
+            @ApiResponse(code = 403, message = "Authorization Error"),\r
+            @ApiResponse(code = 404, message = "Resource Not Found"),\r
+            @ApiResponse(code = 409, message = "Delete Conflict, Rule Violation"),\r
+            @ApiResponse(code = 500, message = "Internal Server Error")\r
+        })\r
+    public Response deleteSpecificVersionOfPolicy(\r
+            @PathParam("policyTypeId") @ApiParam(value = "PolicyType ID", required = true) String policyTypeId,\r
+            @PathParam("policyTypeVersion")\r
+                @ApiParam(value = "Version of policy type", required = true) String policyTypeVersion,\r
+            @PathParam("policyId") @ApiParam(value = "ID of policy", required = true) String policyId,\r
+            @PathParam("policyVersion") @ApiParam(value = "Version of policy", required = true) String policyVersion,\r
+            @HeaderParam("X-ONAP-RequestID") @ApiParam("RequestID for http transaction") UUID requestId) {\r
+        return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)\r
+            .entity(new PolicyProvider().deletePolicies(policyTypeId, policyTypeVersion,\r
+                                                        policyId, policyVersion)).build();\r
+    }\r
+\r
+    private ResponseBuilder addVersionControlHeaders(ResponseBuilder rb) {\r
+        return rb.header("X-MinorVersion", "0").header("X-PatchVersion", "0").header("X-LatestVersion", "1.0.0");\r
+    }\r
+\r
+    private ResponseBuilder addLoggingHeaders(ResponseBuilder rb, UUID requestId) {\r
+        if (requestId == null) {\r
+            // Generate a random uuid if client does not embed requestId in rest request\r
+            return rb.header("X-ONAP-RequestID", UUID.randomUUID());\r
+        }\r
+        return rb.header("X-ONAP-RequestID", requestId);\r
+    }\r
+}\r
index cf27bac..a78649d 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
- * ONAP Policy API 
- * ================================================================================ 
+ * ONAP Policy API
+ * ================================================================================
  * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
@@ -30,18 +30,18 @@ import org.onap.policy.api.main.parameters.RestServerParameters;
 import org.onap.policy.api.main.rest.aaf.AafApiFilter;
 import org.onap.policy.common.capabilities.Startable;
 import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
+import org.onap.policy.models.tosca.serialization.simple.ToscaServiceTemplateMessageBodyHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 /**
  * Class to manage life cycle of api rest server.
  *
  */
 public class ApiRestServer implements Startable {
 
-    private static final String SEPARATOR = ".";
-    private static final String HTTP_SERVER_SERVICES = "http.server.services";
-    
     private static final Logger LOGGER = LoggerFactory.getLogger(ApiRestServer.class);
 
     private List<HttpServletServer> servers = new ArrayList<>();
@@ -76,7 +76,7 @@ public class ApiRestServer implements Startable {
         }
         return true;
     }
-    
+
     /**
      * Creates the server properties object using restServerParameters.
      *
@@ -84,23 +84,28 @@ public class ApiRestServer implements Startable {
      */
     private Properties getServerProperties() {
         final Properties props = new Properties();
-        props.setProperty(HTTP_SERVER_SERVICES, restServerParameters.getName());
-        props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".host",
-                restServerParameters.getHost());
-        props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".port",
-                Integer.toString(restServerParameters.getPort()));
-        props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".restClasses",
-                ApiRestController.class.getCanonicalName());
-        props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".managed", "false");
-        props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".swagger", "true");
-        props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".userName",
-                restServerParameters.getUserName());
-        props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".password",
-                restServerParameters.getPassword());
-        props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".https",
-                String.valueOf(restServerParameters.isHttps()));
-        props.setProperty(HTTP_SERVER_SERVICES + SEPARATOR + restServerParameters.getName() + ".aaf",
-                String.valueOf(restServerParameters.isAaf()));
+        final String svcpfx =
+                PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + restServerParameters.getName();
+
+        props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, restServerParameters.getName());
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, restServerParameters.getHost());
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX,
+                        Integer.toString(restServerParameters.getPort()));
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX,
+                        ApiRestController.class.getCanonicalName());
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false");
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX, "true");
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX,
+                        restServerParameters.getUserName());
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX,
+                        restServerParameters.getPassword());
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HTTPS_SUFFIX,
+                        String.valueOf(restServerParameters.isHttps()));
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_AAF_SUFFIX,
+                        String.valueOf(restServerParameters.isAaf()));
+        props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
+                        ToscaServiceTemplateMessageBodyHandler.class.getName());
+
         return props;
     }
 
index c02ce6c..4181f98 100644 (file)
@@ -1,81 +1,83 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest.provider;
-
-import org.onap.policy.models.tosca.ToscaPolicy;
-import org.onap.policy.models.tosca.ToscaPolicyList;
-
-/**
- * Class to provide all kinds of policy operations.
- */
-public class PolicyProvider {
-
-    private static final String POST_OK = "Successfully created";
-    private static final String DELETE_OK = "Successfully deleted";
-
-    /**
-     * Retrieves a list of policies matching specified ID and version of both policy type and policy.
-     *
-     * @param policyTypeId the ID of policy type
-     * @param policyTypeVersion the version of policy type
-     * @param policyId the ID of policy
-     * @param policyVersion the version of policy
-     *
-     * @return the ToscaPolicyList object containing a list of policies matching specified fields
-     */
-    public ToscaPolicyList fetchPolicies(String policyTypeId, String policyTypeVersion,
-                                         String policyId, String policyVersion) {
-        // placeholder
-        return new ToscaPolicyList();
-    }
-
-    /**
-     * Creates a new policy for a policy type ID and version.
-     *
-     * @param policyTypeId the ID of policy type
-     * @param policyTypeVersion the version of policy type
-     * @param body the entity body of policy
-     *
-     * @return a string message indicating the operation results
-     */
-    public String createPolicy(String policyTypeId, String policyTypeVersion, ToscaPolicy body) {
-        // placeholder
-        return POST_OK;
-    }
-
-    /**
-     * Deletes the policies matching specified ID and version of both policy type and policy.
-     *
-     * @param policyTypeId the ID of policy type
-     * @param policyTypeVersion the version of policy type
-     * @param policyId the ID of policy
-     * @param policyVersion the version of policy
-     *
-     * @return a string message indicating the operation results
-     */
-    public String deletePolicies(String policyTypeId, String policyTypeVersion,
-                                 String policyId, String policyVersion) {
-        // placeholder
-        return DELETE_OK;
-    }
-}
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy API\r
+ * ================================================================================\r
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * SPDX-License-Identifier: Apache-2.0\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.onap.policy.api.main.rest.provider;\r
+\r
+import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;\r
+\r
+/**\r
+ * Class to provide all kinds of policy operations.\r
+ */\r
+public class PolicyProvider {\r
+\r
+    private static final String POST_OK = "Successfully created";\r
+    private static final String DELETE_OK = "Successfully deleted";\r
+\r
+    /**\r
+     * Retrieves a list of policies matching specified ID and version of both policy type and policy.\r
+     *\r
+     * @param policyTypeId the ID of policy type\r
+     * @param policyTypeVersion the version of policy type\r
+     * @param policyId the ID of policy\r
+     * @param policyVersion the version of policy\r
+     *\r
+     * @return the ToscaPolicyList object containing a list of policies matching specified fields\r
+     */\r
+    public ToscaServiceTemplate fetchPolicies(String policyTypeId, String policyTypeVersion,\r
+                                         String policyId, String policyVersion) {\r
+        // placeholder\r
+        // something like return new PolicyModelProvider().getPolicies(<blah>);\r
+        return new ToscaServiceTemplate();\r
+    }\r
+\r
+    /**\r
+     * Creates a new policy for a policy type ID and version.\r
+     *\r
+     * @param policyTypeId the ID of policy type\r
+     * @param policyTypeVersion the version of policy type\r
+     * @param body the entity body of policy\r
+     *\r
+     * @return a string message indicating the operation results\r
+     */\r
+    public String createPolicy(String policyTypeId, String policyTypeVersion, ToscaServiceTemplate body) {\r
+        // placeholder\r
+        // something like return new PolicyModelProvider().createPolicies(<blah>);\r
+        return POST_OK;\r
+    }\r
+\r
+    /**\r
+     * Deletes the policies matching specified ID and version of both policy type and policy.\r
+     *\r
+     * @param policyTypeId the ID of policy type\r
+     * @param policyTypeVersion the version of policy type\r
+     * @param policyId the ID of policy\r
+     * @param policyVersion the version of policy\r
+     *\r
+     * @return a string message indicating the operation results\r
+     */\r
+    public String deletePolicies(String policyTypeId, String policyTypeVersion,\r
+                                 String policyId, String policyVersion) {\r
+        // placeholder\r
+        // something like return new PolicyModelProvider().deletePolicies(<blah>);\r
+        return DELETE_OK;\r
+    }\r
+}\r
index 67c4237..32d16dd 100644 (file)
@@ -1,73 +1,75 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest.provider;
-
-import org.onap.policy.models.tosca.ToscaPolicyType;
-import org.onap.policy.models.tosca.ToscaPolicyTypeList;
-
-/**
- * Class to provide all kinds of policy type operations.
- */
-public class PolicyTypeProvider {
-
-    private static final String POST_OK = "Successfully created";
-    private static final String DELETE_OK = "Successfully deleted";
-
-    /**
-     * Retrieves a list of policy types matching specified policy type ID and version.
-     *
-     * @param policyTypeId the ID of policy type
-     * @param policyTypeVersion the version of policy type
-     *
-     * @return the ToscaPolicyTypeList object containing a list of policy types matching specified fields
-     */
-    public ToscaPolicyTypeList fetchPolicyTypes(String policyTypeId, String policyTypeVersion) {
-        // placeholder
-        return new ToscaPolicyTypeList();
-    }
-
-    /**
-     * Creates a new policy type.
-     *
-     * @param body the entity body of policy type
-     *
-     * @return a string message indicating the operation results
-     */
-    public String createPolicyType(ToscaPolicyType body) {
-        // placeholder
-        return POST_OK;
-    }
-
-    /**
-     * Delete the policy types matching specified policy type ID and version.
-     *
-     * @param policyTypeId the ID of policy type
-     * @param policyTypeVersion the version of policy type
-     *
-     * @return a string message indicating the operation results
-     */
-    public String deletePolicyTypes(String policyTypeId, String policyTypeVersion) {
-        // placeholder
-        return DELETE_OK;
-    }
-}
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy API\r
+ * ================================================================================\r
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * SPDX-License-Identifier: Apache-2.0\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.onap.policy.api.main.rest.provider;\r
+\r
+import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;\r
+\r
+/**\r
+ * Class to provide all kinds of policy type operations.\r
+ */\r
+public class PolicyTypeProvider {\r
+\r
+    private static final String POST_OK = "Successfully created";\r
+    private static final String DELETE_OK = "Successfully deleted";\r
+\r
+    /**\r
+     * Retrieves a list of policy types matching specified policy type ID and version.\r
+     *\r
+     * @param policyTypeId the ID of policy type\r
+     * @param policyTypeVersion the version of policy type\r
+     *\r
+     * @return the ToscaPolicyTypeList object containing a list of policy types matching specified fields\r
+     */\r
+    public ToscaServiceTemplate fetchPolicyTypes(String policyTypeId, String policyTypeVersion) {\r
+        // placeholder\r
+        // something like return new PolicyModelProvider().getPolicyTypes(<blah>);\r
+        return new ToscaServiceTemplate();\r
+    }\r
+\r
+    /**\r
+     * Creates a new policy type.\r
+     *\r
+     * @param body the entity body of policy type\r
+     *\r
+     * @return a string message indicating the operation results\r
+     */\r
+    public String createPolicyType(ToscaServiceTemplate body) {\r
+        // placeholder\r
+        // something like return new PolicyModelProvider().createPolicyTypes(<blah>);\r
+        return POST_OK;\r
+    }\r
+\r
+    /**\r
+     * Delete the policy types matching specified policy type ID and version.\r
+     *\r
+     * @param policyTypeId the ID of policy type\r
+     * @param policyTypeVersion the version of policy type\r
+     *\r
+     * @return a string message indicating the operation results\r
+     */\r
+    public String deletePolicyTypes(String policyTypeId, String policyTypeVersion) {\r
+        // placeholder\r
+        // something like return new PolicyModelProvider().deletePolicyTypes(<blah>);\r
+        return DELETE_OK;\r
+    }\r
+}\r