use of com.thinkbiganalytics.nifi.rest.client.layout.AlignNiFiComponents in project kylo by Teradata.
the class NifiIntegrationRestController method autoAlign.
@GET
@Path("/auto-align/{processGroupId}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Organizes the components of the specified process group.")
@ApiResponses(@ApiResponse(code = 200, message = "The result of the operation.", response = RestResponseStatus.class))
public Response autoAlign(@PathParam("processGroupId") String processGroupId) {
accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ADMIN_FEEDS);
RestResponseStatus status;
if ("all".equals(processGroupId)) {
AlignNiFiComponents alignNiFiComponents = new AlignNiFiComponents();
alignNiFiComponents.setNiFiRestClient(legacyNifiRestClient.getNiFiRestClient());
alignNiFiComponents.autoLayout();
String message = "";
if (alignNiFiComponents.isAligned()) {
message = "Aligned All of NiFi. " + alignNiFiComponents.getAlignedProcessGroups() + " process groups were aligned ";
} else {
message = "Alignment failed while attempting to align all of NiFi. " + alignNiFiComponents.getAlignedProcessGroups() + " were successfully aligned. Please look at the logs for more information";
}
status = new RestResponseStatus.ResponseStatusBuilder().message(message).buildSuccess();
} else {
AlignProcessGroupComponents alignProcessGroupComponents = new AlignProcessGroupComponents(legacyNifiRestClient.getNiFiRestClient(), processGroupId);
ProcessGroupDTO alignedGroup = alignProcessGroupComponents.autoLayout();
String message = "";
if (alignProcessGroupComponents.isAligned()) {
message = "Aligned " + alignedGroup.getContents().getProcessGroups().size() + " process groups under " + alignedGroup.getName();
} else {
message = "Alignment failed for process group " + processGroupId + ". Please look at the logs for more information";
}
status = new RestResponseStatus.ResponseStatusBuilder().message(message).buildSuccess();
}
return Response.ok(status).build();
}
Aggregations