Code Review
/
dmaap
/
dbcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix object references to show fields
[dmaap/dbcapi.git]
/
src
/
main
/
java
/
org
/
onap
/
dmaap
/
dbcapi
/
resources
/
FeedResource.java
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
361491a
..
a7b4f73
100644
(file)
--- a/
src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java
+++ b/
src/main/java/org/onap/dmaap/dbcapi/resources/FeedResource.java
@@
-31,47
+31,20
@@
import javax.jws.WebParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
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.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.
core.Context
;
+import javax.ws.rs.
QueryParam
;
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.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.aaf.authentication.AuthenticationErrorException;
import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
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.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.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;
import org.onap.dmaap.dbcapi.model.DmaapObject.DmaapObject_Status;
import org.onap.dmaap.dbcapi.service.ApiService;
import org.onap.dmaap.dbcapi.service.FeedService;
@@
-89,15
+62,19
@@
public class FeedResource extends BaseLoggingClass {
notes = "Returns array of `Feed` objects.",
response = Feed.class)
@ApiResponses( value = {
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 )
})
@ApiResponse( code = 400, message = "Error", response = ApiError.class )
})
- public Response getFeeds() {
+ public Response getFeeds(
+ @QueryParam("feedName") String feedName,
+ @QueryParam("version") String version,
+ @QueryParam("match") String match
+ ) {
ApiService resp = new ApiService();
FeedService feedService = new FeedService();
ApiService resp = new ApiService();
FeedService feedService = new FeedService();
- List<Feed> nfeeds = feedService.getAllFeeds();
+ List<Feed> nfeeds = feedService.getAllFeeds(
feedName, version, match
);
GenericEntity<List<Feed>> list = new GenericEntity<List<Feed>>(nfeeds) {
};
return resp.success(list);
GenericEntity<List<Feed>> list = new GenericEntity<List<Feed>>(nfeeds) {
};
return resp.success(list);
@@
-110,11
+87,12
@@
public class FeedResource extends BaseLoggingClass {
notes = "Create a of `Feed` object.",
response = Feed.class)
@ApiResponses( value = {
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(
@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();
) {
ApiService resp = new ApiService();
@@
-129,6
+107,7
@@
public class FeedResource extends BaseLoggingClass {
return resp.error();
}
return resp.error();
}
+
FeedService feedService = new FeedService();
Feed nfeed = feedService.getFeedByName( feed.getFeedName(), feed.getFeedVersion(), resp.getErr() );
if ( nfeed == null ) {
FeedService feedService = new FeedService();
Feed nfeed = feedService.getFeedByName( feed.getFeedName(), feed.getFeedVersion(), resp.getErr() );
if ( nfeed == null ) {
@@
-141,7
+120,8
@@
public class FeedResource extends BaseLoggingClass {
return resp.error();
}
} else if ( nfeed.getStatus() == DmaapObject_Status.DELETED ) {
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 {
if ( nfeed != null ) {
return resp.success(nfeed);
} else {
@@
-149,6
+129,8
@@
public class FeedResource extends BaseLoggingClass {
return resp.error();
}
return resp.error();
}
+ } else if ( (useExisting != null) && ("true".compareToIgnoreCase( useExisting ) == 0)) {
+ return resp.success(nfeed);
}
resp.setCode(Status.CONFLICT.getStatusCode());
}
resp.setCode(Status.CONFLICT.getStatusCode());
@@
-160,7
+142,7
@@
public class FeedResource extends BaseLoggingClass {
notes = "Update a `Feed` object, specified by id.",
response = Feed.class)
@ApiResponses( value = {
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}")
@ApiResponse( code = 400, message = "Error", response = ApiError.class )
})
@Path("/{id}")
@@
-205,7
+187,7
@@
public class FeedResource extends BaseLoggingClass {
notes = "Delete a `Feed` object, specified by id.",
response = Feed.class)
@ApiResponses( value = {
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}")
@ApiResponse( code = 400, message = "Error", response = ApiError.class )
})
@Path("/{id}")