Repository: incubator-nifi
Updated Branches:
  refs/heads/NIFI-292 0e176b5b9 -> 821ef4162


NIFI-292:
- Continuing to document/annotate REST resources.
- Continuing to template the REST documentation.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/821ef416
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/821ef416
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/821ef416

Branch: refs/heads/NIFI-292
Commit: 821ef4162064b6af24ca446870cd2df4dea4a21b
Parents: 0e176b5
Author: Matt Gilman <[email protected]>
Authored: Tue Apr 28 15:35:58 2015 -0400
Committer: Matt Gilman <[email protected]>
Committed: Tue Apr 28 15:35:58 2015 -0400

----------------------------------------------------------------------
 .../nifi/web/api/BulletinBoardResource.java     |  71 ++++-
 .../apache/nifi/web/api/HistoryResource.java    | 270 +++++++++++++++++--
 .../src/main/resources/templates/example.hbs    |   4 +-
 .../src/main/resources/templates/index.html.hbs |   7 +-
 .../src/main/resources/templates/type.hbs       |   2 +-
 5 files changed, 318 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/821ef416/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/BulletinBoardResource.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/BulletinBoardResource.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/BulletinBoardResource.java
index 6cc1c8a..14b2184 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/BulletinBoardResource.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/BulletinBoardResource.java
@@ -17,9 +17,15 @@
 package org.apache.nifi.web.api;
 
 import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+import com.wordnik.swagger.annotations.ApiParam;
+import com.wordnik.swagger.annotations.ApiResponse;
+import com.wordnik.swagger.annotations.ApiResponses;
+import com.wordnik.swagger.annotations.Authorization;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
+import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
@@ -52,8 +58,11 @@ public class BulletinBoardResource extends 
ApplicationResource {
     /**
      * Retrieves all the of templates in this NiFi.
      *
-     * @param clientId Optional client id. If the client id is not specified, 
a new one will be generated. This value (whether specified or generated) is 
included in the response.
-     * @param after Supporting querying for bulletins after a particular 
bulletin id.
+     * @param clientId Optional client id. If the client id is not specified, a
+     * new one will be generated. This value (whether specified or generated) 
is
+     * included in the response.
+     * @param after Supporting querying for bulletins after a particular
+     * bulletin id.
      * @param limit The max number of bulletins to return.
      * @param sourceName Source name filter. Supports a regular expression.
      * @param message Message filter. Supports a regular expression.
@@ -64,12 +73,62 @@ public class BulletinBoardResource extends 
ApplicationResource {
     @GET
     @Consumes(MediaType.WILDCARD)
     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    @Path("") // necessary due to bug in swagger
     @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
     @TypeHint(BulletinBoardEntity.class)
-    public Response getBulletinBoard(@QueryParam(CLIENT_ID) 
@DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
-            @QueryParam("after") LongParameter after, 
@QueryParam("sourceName") BulletinBoardPatternParameter sourceName,
-            @QueryParam("message") BulletinBoardPatternParameter message, 
@QueryParam("sourceId") BulletinBoardPatternParameter sourceId,
-            @QueryParam("groupId") BulletinBoardPatternParameter groupId, 
@QueryParam("limit") IntegerParameter limit) {
+    @ApiOperation(
+            value = "Gets current bulletins",
+            response = BulletinBoardEntity.class,
+            authorizations = {
+                @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+                @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"),
+                @Authorization(value = "Administrator", type = "ROLE_ADMIN")
+            }
+    )
+    @ApiResponses(
+            value = {
+                @ApiResponse(code = 400, message = "NiFi was unable to 
complete the request because it was invalid. The request should not be retried 
without modification."),
+                @ApiResponse(code = 401, message = "Client could not be 
authenticated."),
+                @ApiResponse(code = 403, message = "Client is not authorized 
to make this request."),
+                @ApiResponse(code = 409, message = "The request was valid but 
NiFi was not in the appropriate state to process it. Retrying the same request 
later may be successful.")
+            }
+    )
+    public Response getBulletinBoard(
+            @ApiParam(
+                    value = "If the client id is not specified, new one will 
be generated. This value (whether specified or generated) is included in the 
response.",
+                    required = false
+            )
+            @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) 
ClientIdParameter clientId,
+            @ApiParam(
+                    value = "Includes bulletins with an id after this value.",
+                    required = false
+            )
+            @QueryParam("after") LongParameter after,
+            @ApiParam(
+                    value = "Includes bulletins originating from this sources 
whose name match this regular expression.",
+                    required = false
+            )
+            @QueryParam("sourceName") BulletinBoardPatternParameter sourceName,
+            @ApiParam(
+                    value = "Includes bulletins whose message that match this 
regular expression.",
+                    required = false
+            )
+            @QueryParam("message") BulletinBoardPatternParameter message,
+            @ApiParam(
+                    value = "Includes bulletins originating from this sources 
whose id match this regular expression.",
+                    required = false
+            )
+            @QueryParam("sourceId") BulletinBoardPatternParameter sourceId,
+            @ApiParam(
+                    value = "Includes bulletins originating from this sources 
whose group id match this regular expression.",
+                    required = false
+            )
+            @QueryParam("groupId") BulletinBoardPatternParameter groupId,
+            @ApiParam(
+                    value = "The number of bulletins to limit the response 
to.",
+                    required = false
+            )
+            @QueryParam("limit") IntegerParameter limit) {
 
         // build the bulletin query
         final BulletinQueryDTO query = new BulletinQueryDTO();

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/821ef416/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java
index c334b37..5be739e 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/HistoryResource.java
@@ -17,6 +17,12 @@
 package org.apache.nifi.web.api;
 
 import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+import com.wordnik.swagger.annotations.ApiParam;
+import com.wordnik.swagger.annotations.ApiResponse;
+import com.wordnik.swagger.annotations.ApiResponses;
+import com.wordnik.swagger.annotations.Authorization;
+import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
@@ -53,28 +59,100 @@ public class HistoryResource extends ApplicationResource {
     /**
      * Queries the history of this Controller.
      *
-     * @param clientId Optional client id. If the client id is not specified, 
a new one will be generated. This value (whether specified or generated) is 
included in the response.
-     * @param offset The offset into the data. This parameter is required and 
is used in conjunction with count.
-     * @param count The number of rows that should be returned. This parameter 
is required and is used in conjunction with page.
-     * @param sortColumn The column to sort on. This parameter is optional. If 
not specified the results will be returned with the most recent first.
+     * @param clientId Optional client id. If the client id is not specified, a
+     * new one will be generated. This value (whether specified or generated) 
is
+     * included in the response.
+     * @param offset The offset into the data. This parameter is required and 
is
+     * used in conjunction with count.
+     * @param count The number of rows that should be returned. This parameter
+     * is required and is used in conjunction with page.
+     * @param sortColumn The column to sort on. This parameter is optional. If
+     * not specified the results will be returned with the most recent first.
      * @param sortOrder The sort order.
-     * @param startDate The start date/time for the query. The start date/time 
must be formatted as 'MM/dd/yyyy HH:mm:ss'. This parameter is optional and must 
be specified in the timezone of the
-     * server. The server's timezone can be determined by inspecting the 
result of a status or history request.
-     * @param endDate The end date/time for the query. The end date/time must 
be formatted as 'MM/dd/yyyy HH:mm:ss'. This parameter is optional and must be 
specified in the timezone of the server. The
-     * server's timezone can be determined by inspecting the result of a 
status or history request.
-     * @param userName The user name of the user who's actions are being 
queried. This parameter is optional.
-     * @param sourceId The id of the source being queried (usually a processor 
id). This parameter is optional.
+     * @param startDate The start date/time for the query. The start date/time
+     * must be formatted as 'MM/dd/yyyy HH:mm:ss'. This parameter is optional
+     * and must be specified in the timezone of the server. The server's
+     * timezone can be determined by inspecting the result of a status or
+     * history request.
+     * @param endDate The end date/time for the query. The end date/time must 
be
+     * formatted as 'MM/dd/yyyy HH:mm:ss'. This parameter is optional and must
+     * be specified in the timezone of the server. The server's timezone can be
+     * determined by inspecting the result of a status or history request.
+     * @param userName The user name of the user who's actions are being
+     * queried. This parameter is optional.
+     * @param sourceId The id of the source being queried (usually a processor
+     * id). This parameter is optional.
      * @return A historyEntity.
      */
     @GET
+    @Consumes(MediaType.WILDCARD)
     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    @Path("") // necessary due to bug in swagger
     @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
     @TypeHint(HistoryEntity.class)
-    public Response queryHistory(@QueryParam(CLIENT_ID) 
@DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
-            @QueryParam("offset") IntegerParameter offset, 
@QueryParam("count") IntegerParameter count,
-            @QueryParam("sortColumn") String sortColumn, 
@QueryParam("sortOrder") String sortOrder,
-            @QueryParam("startDate") DateTimeParameter startDate, 
@QueryParam("endDate") DateTimeParameter endDate,
-            @QueryParam("userName") String userName, @QueryParam("sourceId") 
String sourceId) {
+    @ApiOperation(
+            value = "Gets configuration history",
+            response = HistoryEntity.class,
+            authorizations = {
+                @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+                @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"),
+                @Authorization(value = "Administrator", type = "ROLE_ADMIN")
+            }
+    )
+    @ApiResponses(
+            value = {
+                @ApiResponse(code = 400, message = "NiFi was unable to 
complete the request because it was invalid. The request should not be retried 
without modification."),
+                @ApiResponse(code = 401, message = "Client could not be 
authenticated."),
+                @ApiResponse(code = 403, message = "Client is not authorized 
to make this request."),
+                @ApiResponse(code = 409, message = "The request was valid but 
NiFi was not in the appropriate state to process it. Retrying the same request 
later may be successful.")
+            }
+    )
+    public Response queryHistory(
+            @ApiParam(
+                    value = "If the client id is not specified, new one will 
be generated. This value (whether specified or generated) is included in the 
response.",
+                    required = false
+            )
+            @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) 
ClientIdParameter clientId,
+            @ApiParam(
+                    value = "The offset into the result set.",
+                    required = true
+            )
+            @QueryParam("offset") IntegerParameter offset,
+            @ApiParam(
+                    value = "The number of actions to return.",
+                    required = true
+            )
+            @QueryParam("count") IntegerParameter count,
+            @ApiParam(
+                    value = "The field to sort on.",
+                    required = false
+            )
+            @QueryParam("sortColumn") String sortColumn,
+            @ApiParam(
+                    value = "The direction to sort.",
+                    required = false
+            )
+            @QueryParam("sortOrder") String sortOrder,
+            @ApiParam(
+                    value = "Include actions after this date.",
+                    required = false
+            )
+            @QueryParam("startDate") DateTimeParameter startDate,
+            @ApiParam(
+                    value = "Include actions before this date.",
+                    required = false
+            )
+            @QueryParam("endDate") DateTimeParameter endDate,
+            @ApiParam(
+                    value = "Include actions performed by this user.",
+                    required = false
+            )
+            @QueryParam("userName") String userName,
+            @ApiParam(
+                    value = "Include actions on this component.",
+                    required = false
+            )
+            @QueryParam("sourceId") String sourceId) {
 
         // ensure the page is specified
         if (offset == null) {
@@ -150,16 +228,46 @@ public class HistoryResource extends ApplicationResource {
     /**
      * Gets the action for the corresponding id.
      *
-     * @param clientId Optional client id. If the client id is not specified, 
a new one will be generated. This value (whether specified or generated) is 
included in the response.
+     * @param clientId Optional client id. If the client id is not specified, a
+     * new one will be generated. This value (whether specified or generated) 
is
+     * included in the response.
      * @param id The id of the action to get.
      * @return An actionEntity.
      */
     @GET
+    @Consumes(MediaType.WILDCARD)
     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
     @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
     @Path("{id}")
     @TypeHint(ActionEntity.class)
-    public Response getAction(@QueryParam(CLIENT_ID) 
@DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId,
+    @ApiOperation(
+            value = "Gets an action",
+            response = ActionEntity.class,
+            authorizations = {
+                @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+                @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"),
+                @Authorization(value = "Administrator", type = "ROLE_ADMIN")
+            }
+    )
+    @ApiResponses(
+            value = {
+                @ApiResponse(code = 400, message = "NiFi was unable to 
complete the request because it was invalid. The request should not be retried 
without modification."),
+                @ApiResponse(code = 401, message = "Client could not be 
authenticated."),
+                @ApiResponse(code = 403, message = "Client is not authorized 
to make this request."),
+                @ApiResponse(code = 404, message = "The specified resource 
could not be found."),
+                @ApiResponse(code = 409, message = "The request was valid but 
NiFi was not in the appropriate state to process it. Retrying the same request 
later may be successful.")
+            }
+    )
+    public Response getAction(
+            @ApiParam(
+                    value = "If the client id is not specified, new one will 
be generated. This value (whether specified or generated) is included in the 
response.",
+                    required = false
+            )
+            @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) 
ClientIdParameter clientId,
+            @ApiParam(
+                    value = "The action id.",
+                    required = true
+            )
             @PathParam("id") IntegerParameter id) {
 
         // ensure the id was specified
@@ -186,16 +294,43 @@ public class HistoryResource extends ApplicationResource {
     /**
      * Deletes flow history from the specified end date.
      *
-     * @param clientId Optional client id. If the client id is not specified, 
a new one will be generated. This value (whether specified or generated) is 
included in the response.
+     * @param clientId Optional client id. If the client id is not specified, a
+     * new one will be generated. This value (whether specified or generated) 
is
+     * included in the response.
      * @param endDate The end date for the purge action.
      * @return A historyEntity
      */
     @DELETE
+    @Consumes(MediaType.WILDCARD)
     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+    @Path("") // necessary due to bug in swagger
     @PreAuthorize("hasRole('ROLE_ADMIN')")
     @TypeHint(HistoryEntity.class)
+    @ApiOperation(
+            value = "Purges history",
+            response = HistoryEntity.class,
+            authorizations = {
+                @Authorization(value = "Administrator", type = "ROLE_ADMIN")
+            }
+    )
+    @ApiResponses(
+            value = {
+                @ApiResponse(code = 400, message = "NiFi was unable to 
complete the request because it was invalid. The request should not be retried 
without modification."),
+                @ApiResponse(code = 401, message = "Client could not be 
authenticated."),
+                @ApiResponse(code = 403, message = "Client is not authorized 
to make this request."),
+                @ApiResponse(code = 409, message = "The request was valid but 
NiFi was not in the appropriate state to process it. Retrying the same request 
later may be successful.")
+            }
+    )
     public Response deleteHistory(
+            @ApiParam(
+                    value = "If the client id is not specified, new one will 
be generated. This value (whether specified or generated) is included in the 
response.",
+                    required = false
+            )
             @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) 
ClientIdParameter clientId,
+            @ApiParam(
+                    value = "Purge actions before this date/time.",
+                    required = true
+            )
             @QueryParam("endDate") DateTimeParameter endDate) {
 
         // ensure the end date is specified
@@ -221,17 +356,46 @@ public class HistoryResource extends ApplicationResource {
     /**
      * Gets the actions for the specified processor.
      *
-     * @param clientId Optional client id. If the client id is not specified, 
a new one will be generated. This value (whether specified or generated) is 
included in the response.
+     * @param clientId Optional client id. If the client id is not specified, a
+     * new one will be generated. This value (whether specified or generated) 
is
+     * included in the response.
      * @param processorId The id of the processor.
      * @return An processorHistoryEntity.
      */
     @GET
+    @Consumes(MediaType.WILDCARD)
     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
-    @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
     @Path("/processors/{processorId}")
+    @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
     @TypeHint(ComponentHistoryEntity.class)
+    @ApiOperation(
+            value = "Gets configuration history for a processor",
+            response = ComponentHistoryEntity.class,
+            authorizations = {
+                @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+                @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"),
+                @Authorization(value = "Administrator", type = "ROLE_ADMIN")
+            }
+    )
+    @ApiResponses(
+            value = {
+                @ApiResponse(code = 400, message = "NiFi was unable to 
complete the request because it was invalid. The request should not be retried 
without modification."),
+                @ApiResponse(code = 401, message = "Client could not be 
authenticated."),
+                @ApiResponse(code = 403, message = "Client is not authorized 
to make this request."),
+                @ApiResponse(code = 404, message = "The specified resource 
could not be found."),
+                @ApiResponse(code = 409, message = "The request was valid but 
NiFi was not in the appropriate state to process it. Retrying the same request 
later may be successful.")
+            }
+    )
     public Response getProcessorHistory(
+            @ApiParam(
+                    value = "If the client id is not specified, new one will 
be generated. This value (whether specified or generated) is included in the 
response.",
+                    required = false
+            )
             @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) 
ClientIdParameter clientId,
+            @ApiParam(
+                    value = "The processor id.",
+                    required = true
+            )
             @PathParam("processorId") final String processorId) {
 
         // create the revision
@@ -250,17 +414,46 @@ public class HistoryResource extends ApplicationResource {
     /**
      * Gets the actions for the specified controller service.
      *
-     * @param clientId Optional client id. If the client id is not specified, 
a new one will be generated. This value (whether specified or generated) is 
included in the response.
+     * @param clientId Optional client id. If the client id is not specified, a
+     * new one will be generated. This value (whether specified or generated) 
is
+     * included in the response.
      * @param controllerServiceId The id of the controller service.
      * @return An componentHistoryEntity.
      */
     @GET
+    @Consumes(MediaType.WILDCARD)
     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
-    @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
     @Path("/controller-services/{controllerServiceId}")
+    @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
     @TypeHint(ComponentHistoryEntity.class)
+    @ApiOperation(
+            value = "Gets configuration history for a controller service",
+            response = ComponentHistoryEntity.class,
+            authorizations = {
+                @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+                @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"),
+                @Authorization(value = "Administrator", type = "ROLE_ADMIN")
+            }
+    )
+    @ApiResponses(
+            value = {
+                @ApiResponse(code = 400, message = "NiFi was unable to 
complete the request because it was invalid. The request should not be retried 
without modification."),
+                @ApiResponse(code = 401, message = "Client could not be 
authenticated."),
+                @ApiResponse(code = 403, message = "Client is not authorized 
to make this request."),
+                @ApiResponse(code = 404, message = "The specified resource 
could not be found."),
+                @ApiResponse(code = 409, message = "The request was valid but 
NiFi was not in the appropriate state to process it. Retrying the same request 
later may be successful.")
+            }
+    )
     public Response getControllerServiceHistory(
+            @ApiParam(
+                    value = "If the client id is not specified, new one will 
be generated. This value (whether specified or generated) is included in the 
response.",
+                    required = false
+            )
             @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) 
ClientIdParameter clientId,
+            @ApiParam(
+                    value = "The controller service id.",
+                    required = true
+            )
             @PathParam("controllerServiceId") final String 
controllerServiceId) {
 
         // create the revision
@@ -279,17 +472,46 @@ public class HistoryResource extends ApplicationResource {
     /**
      * Gets the actions for the specified reporting task.
      *
-     * @param clientId Optional client id. If the client id is not specified, 
a new one will be generated. This value (whether specified or generated) is 
included in the response.
+     * @param clientId Optional client id. If the client id is not specified, a
+     * new one will be generated. This value (whether specified or generated) 
is
+     * included in the response.
      * @param reportingTaskId The id of the reporting task.
      * @return An componentHistoryEntity.
      */
     @GET
+    @Consumes(MediaType.WILDCARD)
     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
-    @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
     @Path("/reporting-tasks/{reportingTaskId}")
+    @PreAuthorize("hasAnyRole('ROLE_MONITOR', 'ROLE_DFM', 'ROLE_ADMIN')")
     @TypeHint(ComponentHistoryEntity.class)
+    @ApiOperation(
+            value = "Gets configuration history for a reporting task",
+            response = ComponentHistoryEntity.class,
+            authorizations = {
+                @Authorization(value = "Read Only", type = "ROLE_MONITOR"),
+                @Authorization(value = "Data Flow Manager", type = "ROLE_DFM"),
+                @Authorization(value = "Administrator", type = "ROLE_ADMIN")
+            }
+    )
+    @ApiResponses(
+            value = {
+                @ApiResponse(code = 400, message = "NiFi was unable to 
complete the request because it was invalid. The request should not be retried 
without modification."),
+                @ApiResponse(code = 401, message = "Client could not be 
authenticated."),
+                @ApiResponse(code = 403, message = "Client is not authorized 
to make this request."),
+                @ApiResponse(code = 404, message = "The specified resource 
could not be found."),
+                @ApiResponse(code = 409, message = "The request was valid but 
NiFi was not in the appropriate state to process it. Retrying the same request 
later may be successful.")
+            }
+    )
     public Response getReportingTaskHistory(
+            @ApiParam(
+                    value = "If the client id is not specified, new one will 
be generated. This value (whether specified or generated) is included in the 
response.",
+                    required = false
+            )
             @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) 
ClientIdParameter clientId,
+            @ApiParam(
+                    value = "The reporting task id.",
+                    required = true
+            )
             @PathParam("reportingTaskId") final String reportingTaskId) {
 
         // create the revision

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/821ef416/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs
index 835c4b5..a84281e 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/example.hbs
@@ -12,5 +12,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 --}}
-{{#each properties}}    {{#ifeq type "string"}}"{{@key}}": 
"value"{{/ifeq}}{{#ifeq type "boolean"}}"{{@key}}": true{{/ifeq}}{{#ifeq type 
"integer"}}"{{@key}}": 0{{/ifeq}}{{#if $ref}}"{{@key}}": <span class="nested 
collapsed"><span class="nested-id hidden">{{basename $ref}}</span><span 
class="nested-example">&#123;&#8230;&#125;</span></span>{{/if}}{{#ifeq type 
"array"}}"{{@key}}": [{{#if items.$ref}}<span class="nested collapsed"><span 
class="nested-id hidden">{{basename items.$ref}}</span><span 
class="nested-example">&#123;&#8230;&#125;</span></span>{{else}}{{items.type}}{{/if}}]{{/ifeq}}{{#ifeq
 type "object"}}"{{@key}}": &#123;{{#if additionalProperties.$ref}}<span 
class="nested collapsed"><span class="nested-id hidden">{{basename 
additionalProperties.$ref}}</span><span 
class="nested-example">&#123;&#8230;&#125;</span></span>{{else}}{{#ifeq 
additionalProperties.type 
"integer"}}0{{else}}"value"{{/ifeq}}{{/if}}&#125;{{/ifeq}}<span 
class="comma">,</span>
+{{#each properties}}    {{#ifeq type "string"}}"{{@key}}": 
"value"{{/ifeq}}{{#ifeq type "boolean"}}"{{@key}}": true{{/ifeq}}{{#ifeq type 
"integer"}}"{{@key}}": 0{{/ifeq}}{{#ifeq type "number"}}"{{@key}}": 
0.0{{/ifeq}}{{#if $ref}}"{{@key}}": <span class="nested collapsed"><span 
class="nested-id hidden">{{basename $ref}}</span><span 
class="nested-example"><span 
class="open-object">&#123;&#8230;&#125;</span></span></span>{{/if}}{{#ifeq type 
"array"}}"{{@key}}": [{{#if items.$ref}}<span class="nested collapsed"><span 
class="nested-id hidden">{{basename items.$ref}}</span><span 
class="nested-example"><span 
class="open-object">&#123;&#8230;&#125;</span></span></span>{{else}}"value"{{/if}}]{{/ifeq}}{{#ifeq
 type "object"}}"{{@key}}": <span class="open-object">&#123;
+        "name": {{#if additionalProperties.$ref}}<span class="nested 
collapsed"><span class="nested-id hidden">{{basename 
additionalProperties.$ref}}</span><span class="nested-example"><span 
class="open-object">&#123;&#8230;&#125;</span></span></span>{{else}}{{#ifeq 
additionalProperties.type "integer"}}0{{else}}"value"{{/ifeq}}{{/if}}
+    &#125;</span>{{/ifeq}}<span class="comma">,</span>
 {{/each}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/821ef416/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs
index ec4cec4..71d748d 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/index.html.hbs
@@ -314,9 +314,8 @@
                     e.stopPropagation();
                 });
                 
-                // due to lack of support for @last when iterating objects 
-                // in handlebars we need to remove the last comma from each 
-                // example
+                // due to lack of support for @last when iterating objects in 
+                // handlebars we need to remove the last comma from each 
example
                 $('code.example').find('span.comma:last').remove();
                 
                 // populate nested examples
@@ -328,7 +327,7 @@
                     // get the id of the nested example
                     var typeId = nestedId.text();
                     var example = $('#' + typeId + ' code.example').html();
-                    var depth = nestedId.parents('span.nested').length;
+                    var depth = nestedId.parents('span.open-object').length;
                     
                     // tab over as appropriate
                     example = example.replace(/(\r\n|\r|\n)/g, function(match) 
{

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/821ef416/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs
index 08f7a02..3930816 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/templates/type.hbs
@@ -47,5 +47,5 @@
         {{/each}}
     </table>
     <h4>Example</h4>
-    <code class="example">&#123;{{> example}}&#125;</code>
+    <code class="example"><span class="open-object">&#123;{{> 
example}}&#125;</span></code>
 </div>
\ No newline at end of file

Reply via email to