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.PUT;
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.Context;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.log4j.Logger;
-import org.onap.dmaap.dbcapi.authentication.AuthenticationErrorException;
import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
-import org.onap.dmaap.dbcapi.logging.DmaapbcLogMessageEnum;
import org.onap.dmaap.dbcapi.model.ApiError;
import org.onap.dmaap.dbcapi.model.DR_Pub;
-import org.onap.dmaap.dbcapi.model.DR_Sub;
import org.onap.dmaap.dbcapi.model.Feed;
-import org.onap.dmaap.dbcapi.model.Topic;
import org.onap.dmaap.dbcapi.model.DmaapObject.DmaapObject_Status;
import org.onap.dmaap.dbcapi.service.ApiService;
import org.onap.dmaap.dbcapi.service.FeedService;
notes = "Returns array of `Feed` objects.",
response = Feed.class)
@ApiResponses( value = {
- @ApiResponse( code = 200, message = "Success", response = DR_Pub.class),
+ @ApiResponse( code = 200, message = "Success", response = Feed.class),
@ApiResponse( code = 400, message = "Error", response = ApiError.class )
})
public Response getFeeds(
notes = "Create a of `Feed` object.",
response = Feed.class)
@ApiResponses( value = {
- @ApiResponse( code = 200, message = "Success", response = DR_Pub.class),
+ @ApiResponse( code = 200, message = "Success", response = Feed.class),
@ApiResponse( code = 400, message = "Error", response = ApiError.class )
})
public Response addFeed(
- @WebParam(name = "feed") Feed feed
+ @WebParam(name = "feed") Feed feed,
+ @QueryParam("useExisting") String useExisting
) {
ApiService resp = new ApiService();
return resp.error();
}
+
FeedService feedService = new FeedService();
Feed nfeed = feedService.getFeedByName( feed.getFeedName(), feed.getFeedVersion(), resp.getErr() );
if ( nfeed == null ) {
return resp.error();
}
} else if ( nfeed.getStatus() == DmaapObject_Status.DELETED ) {
- nfeed = feedService.updateFeed(nfeed, resp.getErr());
+ feed.setFeedId( nfeed.getFeedId());
+ nfeed = feedService.updateFeed(feed, resp.getErr());
if ( nfeed != null ) {
return resp.success(nfeed);
} else {
return resp.error();
}
+ } else if ( (useExisting != null) && ("true".compareToIgnoreCase( useExisting ) == 0)) {
+ return resp.success(nfeed);
}
resp.setCode(Status.CONFLICT.getStatusCode());
notes = "Update a `Feed` object, specified by id.",
response = Feed.class)
@ApiResponses( value = {
- @ApiResponse( code = 200, message = "Success", response = DR_Pub.class),
+ @ApiResponse( code = 200, message = "Success", response = Feed.class),
@ApiResponse( code = 400, message = "Error", response = ApiError.class )
})
@Path("/{id}")
notes = "Delete a `Feed` object, specified by id.",
response = Feed.class)
@ApiResponses( value = {
- @ApiResponse( code = 204, message = "Success", response = DR_Pub.class),
+ @ApiResponse( code = 204, message = "Success", response = Feed.class),
@ApiResponse( code = 400, message = "Error", response = ApiError.class )
})
@Path("/{id}")