X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Fresources%2FFeedResource.java;h=6df135d31ed9acc37562abff1d314241cfc7289b;hb=81352e8c9570dc8e442ca61edfb991d34b62eb08;hp=86a79f28ffd5e27d7df198c80cc8704b12bb16d9;hpb=911f5f3577e569d34cc32719806c84c119268951;p=dmaap%2Fdbcapi.git diff --git a/src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java b/src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java index 86a79f2..6df135d 100644 --- a/src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java +++ b/src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java @@ -232,4 +232,36 @@ public class FeedResource extends BaseLoggingClass { } return responseBuilder.success(nfeed); } + + @PUT + @ApiOperation( value = "sync feeds to existing DR", + notes = "When Bus Controller is deployed after DR, then it is possible" + + "that DR has previous provisioning data that needs to be imported" + + "into Bus Controller.", + response = Feed.class ) + @ApiResponses( value = { + @ApiResponse( code = 200, message = "Success", response = Feed.class), + @ApiResponse( code = 400, message = "Error", response = ApiError.class ) + }) + @Path( "/sync") + public Response syncFeeds ( + @QueryParam("hard") String hardParam + ) { + ApiService resp = new ApiService(); + + FeedService feedService = new FeedService(); + boolean hard = false; + if ( hardParam != null && hardParam.equalsIgnoreCase("true")) { + hard = true; + } + feedService.sync( hard, resp.getErr() ); + if ( resp.getErr().is2xx()) { + List nfeeds = feedService.getAllFeeds(); + GenericEntity> list = new GenericEntity>(nfeeds) { + }; + return responseBuilder.success(list); + } + return responseBuilder.error(resp.getErr()); + } + }