use of org.apache.nifi.web.api.entity.AboutEntity in project nifi by apache.
the class FlowResource method getAboutInfo.
/**
* Retrieves details about this NiFi to put in the About dialog.
*
* @return An aboutEntity.
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("about")
@ApiOperation(value = "Retrieves details about this NiFi to put in the About dialog", response = AboutEntity.class, authorizations = { @Authorization(value = "Read - /flow") })
@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 getAboutInfo() {
authorizeFlow();
// create the about dto
final AboutDTO aboutDTO = new AboutDTO();
aboutDTO.setTitle("NiFi");
aboutDTO.setUri(generateResourceUri());
aboutDTO.setTimezone(new Date());
// get the content viewer url
final NiFiProperties properties = getProperties();
aboutDTO.setContentViewerUrl(properties.getProperty(NiFiProperties.CONTENT_VIEWER_URL));
final Bundle frameworkBundle = NarClassLoaders.getInstance().getFrameworkBundle();
if (frameworkBundle != null) {
final BundleDetails frameworkDetails = frameworkBundle.getBundleDetails();
// set the version
aboutDTO.setVersion(frameworkDetails.getCoordinate().getVersion());
// Get build info
aboutDTO.setBuildTag(frameworkDetails.getBuildTag());
aboutDTO.setBuildRevision(frameworkDetails.getBuildRevision());
aboutDTO.setBuildBranch(frameworkDetails.getBuildBranch());
aboutDTO.setBuildTimestamp(frameworkDetails.getBuildTimestampDate());
}
// create the response entity
final AboutEntity entity = new AboutEntity();
entity.setAbout(aboutDTO);
// generate the response
return generateOkResponse(entity).build();
}
Aggregations