org.apache.nifi.web.api.dto.FunnelDTO Java Examples
The following examples show how to use
org.apache.nifi.web.api.dto.FunnelDTO.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ITFunnelAccessControl.java From nifi with Apache License 2.0 | 6 votes |
private FunnelEntity createFunnel() throws Exception { String url = helper.getBaseUrl() + "/process-groups/root/funnels"; // create the funnel FunnelDTO funnel = new FunnelDTO(); // create the revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(READ_WRITE_CLIENT_ID); revision.setVersion(0L); // create the entity body FunnelEntity entity = new FunnelEntity(); entity.setRevision(revision); entity.setComponent(funnel); // perform the request Response response = helper.getReadWriteUser().testPost(url, entity); // ensure the request is successful assertEquals(201, response.getStatus()); // get the entity body return response.readEntity(FunnelEntity.class); }
Example #2
Source File: StandardFunnelDAO.java From nifi with Apache License 2.0 | 6 votes |
@Override public Funnel createFunnel(String groupId, FunnelDTO funnelDTO) { if (funnelDTO.getParentGroupId() != null && !flowController.getFlowManager().areGroupsSame(groupId, funnelDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Funnel is being added."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // create the funnel Funnel funnel = flowController.getFlowManager().createFunnel(funnelDTO.getId()); if (funnelDTO.getPosition() != null) { funnel.setPosition(new Position(funnelDTO.getPosition().getX(), funnelDTO.getPosition().getY())); } // add the funnel group.addFunnel(funnel); group.startFunnel(funnel); return funnel; }
Example #3
Source File: StandardFunnelDAO.java From nifi with Apache License 2.0 | 6 votes |
@Override public Funnel updateFunnel(FunnelDTO funnelDTO) { // get the funnel being updated Funnel funnel = locateFunnel(funnelDTO.getId()); // update the label state if (isNotNull(funnelDTO.getPosition())) { if (funnelDTO.getPosition() != null) { funnel.setPosition(new Position(funnelDTO.getPosition().getX(), funnelDTO.getPosition().getY())); } } funnel.getProcessGroup().onComponentModified(); return funnel; }
Example #4
Source File: ITFunnelAccessControl.java From localization_nifi with Apache License 2.0 | 6 votes |
private FunnelEntity createFunnel() throws Exception { String url = helper.getBaseUrl() + "/process-groups/root/funnels"; // create the funnel FunnelDTO funnel = new FunnelDTO(); // create the revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(READ_WRITE_CLIENT_ID); revision.setVersion(0L); // create the entity body FunnelEntity entity = new FunnelEntity(); entity.setRevision(revision); entity.setComponent(funnel); // perform the request ClientResponse response = helper.getReadWriteUser().testPost(url, entity); // ensure the request is successful assertEquals(201, response.getStatus()); // get the entity body return response.getEntity(FunnelEntity.class); }
Example #5
Source File: StandardFunnelDAO.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public Funnel createFunnel(String groupId, FunnelDTO funnelDTO) { if (funnelDTO.getParentGroupId() != null && !flowController.areGroupsSame(groupId, funnelDTO.getParentGroupId())) { throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Funnel is being added."); } // get the desired group ProcessGroup group = locateProcessGroup(flowController, groupId); // create the funnel Funnel funnel = flowController.createFunnel(funnelDTO.getId()); if (funnelDTO.getPosition() != null) { funnel.setPosition(new Position(funnelDTO.getPosition().getX(), funnelDTO.getPosition().getY())); } // add the funnel group.addFunnel(funnel); group.startFunnel(funnel); return funnel; }
Example #6
Source File: FlowFromDOMFactory.java From nifi with Apache License 2.0 | 5 votes |
public static FunnelDTO getFunnel(final Element element) { final FunnelDTO dto = new FunnelDTO(); dto.setId(getString(element, "id")); dto.setVersionedComponentId(getString(element, "versionedComponentId")); dto.setPosition(getPosition(DomUtils.getChild(element, "position"))); return dto; }
Example #7
Source File: StandardFunnelDAO.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public Funnel updateFunnel(FunnelDTO funnelDTO) { // get the funnel being updated Funnel funnel = locateFunnel(funnelDTO.getId()); // update the label state if (isNotNull(funnelDTO.getPosition())) { if (funnelDTO.getPosition() != null) { funnel.setPosition(new Position(funnelDTO.getPosition().getX(), funnelDTO.getPosition().getY())); } } return funnel; }
Example #8
Source File: ITFunnelAccessControl.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * Ensures the WRITE user can put a funnel. * * @throws Exception ex */ @Test public void testWriteUserPutFunnel() throws Exception { final FunnelEntity entity = getRandomFunnel(helper.getWriteUser()); assertFalse(entity.getPermissions().getCanRead()); assertTrue(entity.getPermissions().getCanWrite()); assertNull(entity.getComponent()); final double y = 15.0; // attempt to update the position final FunnelDTO requestDto = new FunnelDTO(); requestDto.setId(entity.getId()); requestDto.setPosition(new PositionDTO(0.0, y)); final long version = entity.getRevision().getVersion(); final RevisionDTO requestRevision = new RevisionDTO(); requestRevision.setVersion(version); requestRevision.setClientId(AccessControlHelper.WRITE_CLIENT_ID); final FunnelEntity requestEntity = new FunnelEntity(); requestEntity.setId(entity.getId()); requestEntity.setRevision(requestRevision); requestEntity.setComponent(requestDto); // perform the request final ClientResponse response = updateFunnel(helper.getWriteUser(), requestEntity); // ensure successful response assertEquals(200, response.getStatus()); // get the response final FunnelEntity responseEntity = response.getEntity(FunnelEntity.class); // verify assertEquals(WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); assertEquals(version + 1, responseEntity.getRevision().getVersion().longValue()); }
Example #9
Source File: ITFunnelAccessControl.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * Ensures the NONE user cannot put a funnel. * * @throws Exception ex */ @Test public void testNoneUserPutFunnel() throws Exception { final FunnelEntity entity = getRandomFunnel(helper.getNoneUser()); assertFalse(entity.getPermissions().getCanRead()); assertFalse(entity.getPermissions().getCanWrite()); assertNull(entity.getComponent()); // attempt to update the position final FunnelDTO requestDto = new FunnelDTO(); requestDto.setId(entity.getId()); requestDto.setPosition(new PositionDTO(0.0, 15.0)); final long version = entity.getRevision().getVersion(); final RevisionDTO requestRevision = new RevisionDTO(); requestRevision.setVersion(version); requestRevision.setClientId(AccessControlHelper.NONE_CLIENT_ID); final FunnelEntity requestEntity = new FunnelEntity(); requestEntity.setId(entity.getId()); requestEntity.setRevision(requestRevision); requestEntity.setComponent(requestDto); // perform the request final ClientResponse response = updateFunnel(helper.getNoneUser(), requestEntity); // ensure forbidden response assertEquals(403, response.getStatus()); }
Example #10
Source File: StandardFlowSynchronizer.java From nifi with Apache License 2.0 | 5 votes |
private void addFunnels(final Element processGroupElement, final ProcessGroup processGroup, final FlowController controller) { final List<Element> funnelNodeList = getChildrenByTagName(processGroupElement, "funnel"); for (final Element funnelElement : funnelNodeList) { final FunnelDTO funnelDTO = FlowFromDOMFactory.getFunnel(funnelElement); final Funnel funnel = controller.getFlowManager().createFunnel(funnelDTO.getId()); funnel.setVersionedComponentId(funnelDTO.getVersionedComponentId()); funnel.setPosition(toPosition(funnelDTO.getPosition())); // Since this is called during startup, we want to add the funnel without enabling it // and then tell the controller to enable it. This way, if the controller is not fully // initialized, the starting of the funnel is delayed until the controller is ready. processGroup.addFunnel(funnel, false); controller.startConnectable(funnel); } }
Example #11
Source File: ITFunnelAccessControl.java From nifi with Apache License 2.0 | 5 votes |
/** * Ensures the NONE user cannot put a funnel. * * @throws Exception ex */ @Test public void testNoneUserPutFunnel() throws Exception { final FunnelEntity entity = getRandomFunnel(helper.getNoneUser()); assertFalse(entity.getPermissions().getCanRead()); assertFalse(entity.getPermissions().getCanWrite()); assertNull(entity.getComponent()); // attempt to update the position final FunnelDTO requestDto = new FunnelDTO(); requestDto.setId(entity.getId()); requestDto.setPosition(new PositionDTO(0.0, 15.0)); final long version = entity.getRevision().getVersion(); final RevisionDTO requestRevision = new RevisionDTO(); requestRevision.setVersion(version); requestRevision.setClientId(AccessControlHelper.NONE_CLIENT_ID); final FunnelEntity requestEntity = new FunnelEntity(); requestEntity.setId(entity.getId()); requestEntity.setRevision(requestRevision); requestEntity.setComponent(requestDto); // perform the request final Response response = updateFunnel(helper.getNoneUser(), requestEntity); // ensure forbidden response assertEquals(403, response.getStatus()); }
Example #12
Source File: FlowFromDOMFactory.java From localization_nifi with Apache License 2.0 | 5 votes |
public static FunnelDTO getFunnel(final Element element) { final FunnelDTO dto = new FunnelDTO(); dto.setId(getString(element, "id")); dto.setPosition(getPosition(DomUtils.getChild(element, "position"))); return dto; }
Example #13
Source File: ITFunnelAccessControl.java From nifi with Apache License 2.0 | 5 votes |
/** * Ensures the WRITE user can put a funnel. * * @throws Exception ex */ @Test public void testWriteUserPutFunnel() throws Exception { final FunnelEntity entity = getRandomFunnel(helper.getWriteUser()); assertFalse(entity.getPermissions().getCanRead()); assertTrue(entity.getPermissions().getCanWrite()); assertNull(entity.getComponent()); final double y = 15.0; // attempt to update the position final FunnelDTO requestDto = new FunnelDTO(); requestDto.setId(entity.getId()); requestDto.setPosition(new PositionDTO(0.0, y)); final long version = entity.getRevision().getVersion(); final RevisionDTO requestRevision = new RevisionDTO(); requestRevision.setVersion(version); requestRevision.setClientId(AccessControlHelper.WRITE_CLIENT_ID); final FunnelEntity requestEntity = new FunnelEntity(); requestEntity.setId(entity.getId()); requestEntity.setRevision(requestRevision); requestEntity.setComponent(requestDto); // perform the request final Response response = updateFunnel(helper.getWriteUser(), requestEntity); // ensure successful response assertEquals(200, response.getStatus()); // get the response final FunnelEntity responseEntity = response.readEntity(FunnelEntity.class); // verify assertEquals(WRITE_CLIENT_ID, responseEntity.getRevision().getClientId()); assertEquals(version + 1, responseEntity.getRevision().getVersion().longValue()); }
Example #14
Source File: StandardNiFiServiceFacade.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public FunnelEntity updateFunnel(final Revision revision, final FunnelDTO funnelDTO) { final Funnel funnelNode = funnelDAO.getFunnel(funnelDTO.getId()); final RevisionUpdate<FunnelDTO> snapshot = updateComponent(revision, funnelNode, () -> funnelDAO.updateFunnel(funnelDTO), funnel -> dtoFactory.createFunnelDto(funnel)); final PermissionsDTO permissions = dtoFactory.createPermissionsDto(funnelNode); return entityFactory.createFunnelEntity(snapshot.getComponent(), dtoFactory.createRevisionDTO(snapshot.getLastModification()), permissions); }
Example #15
Source File: StandardNiFiServiceFacade.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public FunnelEntity deleteFunnel(final Revision revision, final String funnelId) { final Funnel funnel = funnelDAO.getFunnel(funnelId); final PermissionsDTO permissions = dtoFactory.createPermissionsDto(funnel); final FunnelDTO snapshot = deleteComponent( revision, funnel.getResource(), () -> funnelDAO.deleteFunnel(funnelId), true, dtoFactory.createFunnelDto(funnel)); return entityFactory.createFunnelEntity(snapshot, null, permissions); }
Example #16
Source File: FlowFromDOMFactory.java From nifi with Apache License 2.0 | 4 votes |
public static ProcessGroupDTO getProcessGroup(final String parentId, final Element element, final StringEncryptor encryptor, final FlowEncodingVersion encodingVersion) { final ProcessGroupDTO dto = new ProcessGroupDTO(); final String groupId = getString(element, "id"); dto.setId(groupId); dto.setVersionedComponentId(getString(element, "versionedComponentId")); dto.setParentGroupId(parentId); dto.setName(getString(element, "name")); dto.setPosition(getPosition(DomUtils.getChild(element, "position"))); dto.setComments(getString(element, "comment")); dto.setFlowfileConcurrency(getString(element, "flowfileConcurrency")); dto.setFlowfileOutboundPolicy(getString(element, "flowfileOutboundPolicy")); final Map<String, String> variables = new HashMap<>(); final NodeList variableList = DomUtils.getChildNodesByTagName(element, "variable"); for (int i = 0; i < variableList.getLength(); i++) { final Element variableElement = (Element) variableList.item(i); final String name = variableElement.getAttribute("name"); final String value = variableElement.getAttribute("value"); variables.put(name, value); } dto.setVariables(variables); final Element versionControlInfoElement = DomUtils.getChild(element, "versionControlInformation"); dto.setVersionControlInformation(getVersionControlInformation(versionControlInfoElement)); final String parameterContextId = getString(element, "parameterContextId"); final ParameterContextReferenceEntity parameterContextReference = new ParameterContextReferenceEntity(); parameterContextReference.setId(parameterContextId); dto.setParameterContext(parameterContextReference); final Set<ProcessorDTO> processors = new HashSet<>(); final Set<ConnectionDTO> connections = new HashSet<>(); final Set<FunnelDTO> funnels = new HashSet<>(); final Set<PortDTO> inputPorts = new HashSet<>(); final Set<PortDTO> outputPorts = new HashSet<>(); final Set<LabelDTO> labels = new HashSet<>(); final Set<ProcessGroupDTO> processGroups = new HashSet<>(); final Set<RemoteProcessGroupDTO> remoteProcessGroups = new HashSet<>(); NodeList nodeList = DomUtils.getChildNodesByTagName(element, "processor"); for (int i = 0; i < nodeList.getLength(); i++) { processors.add(getProcessor((Element) nodeList.item(i), encryptor, encodingVersion)); } nodeList = DomUtils.getChildNodesByTagName(element, "funnel"); for (int i = 0; i < nodeList.getLength(); i++) { funnels.add(getFunnel((Element) nodeList.item(i))); } nodeList = DomUtils.getChildNodesByTagName(element, "inputPort"); for (int i = 0; i < nodeList.getLength(); i++) { inputPorts.add(getPort((Element) nodeList.item(i))); } nodeList = DomUtils.getChildNodesByTagName(element, "outputPort"); for (int i = 0; i < nodeList.getLength(); i++) { outputPorts.add(getPort((Element) nodeList.item(i))); } nodeList = DomUtils.getChildNodesByTagName(element, "label"); for (int i = 0; i < nodeList.getLength(); i++) { labels.add(getLabel((Element) nodeList.item(i))); } nodeList = DomUtils.getChildNodesByTagName(element, "processGroup"); for (int i = 0; i < nodeList.getLength(); i++) { processGroups.add(getProcessGroup(groupId, (Element) nodeList.item(i), encryptor, encodingVersion)); } nodeList = DomUtils.getChildNodesByTagName(element, "remoteProcessGroup"); for (int i = 0; i < nodeList.getLength(); i++) { remoteProcessGroups.add(getRemoteProcessGroup((Element) nodeList.item(i), encryptor)); } nodeList = DomUtils.getChildNodesByTagName(element, "connection"); for (int i = 0; i < nodeList.getLength(); i++) { connections.add(getConnection((Element) nodeList.item(i))); } final FlowSnippetDTO groupContents = new FlowSnippetDTO(); groupContents.setConnections(connections); groupContents.setFunnels(funnels); groupContents.setInputPorts(inputPorts); groupContents.setLabels(labels); groupContents.setOutputPorts(outputPorts); groupContents.setProcessGroups(processGroups); groupContents.setProcessors(processors); groupContents.setRemoteProcessGroups(remoteProcessGroups); dto.setContents(groupContents); return dto; }
Example #17
Source File: FunnelEntity.java From nifi with Apache License 2.0 | 4 votes |
public void setComponent(FunnelDTO component) { this.component = component; }
Example #18
Source File: FunnelResource.java From nifi with Apache License 2.0 | 4 votes |
/** * Creates a new Funnel. * * @param httpServletRequest request * @param id The id of the funnel to update. * @param requestFunnelEntity A funnelEntity. * @return A funnelEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") @ApiOperation( value = "Updates a funnel", response = FunnelEntity.class, authorizations = { @Authorization(value = "Write - /funnels/{uuid}") } ) @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 updateFunnel( @Context final HttpServletRequest httpServletRequest, @ApiParam( value = "The funnel id.", required = true ) @PathParam("id") final String id, @ApiParam( value = "The funnel configuration details.", required = true ) final FunnelEntity requestFunnelEntity) { if (requestFunnelEntity == null || requestFunnelEntity.getComponent() == null) { throw new IllegalArgumentException("Funnel details must be specified."); } if (requestFunnelEntity.getRevision() == null) { throw new IllegalArgumentException("Revision must be specified."); } // ensure the ids are the same final FunnelDTO requestFunnelDTO = requestFunnelEntity.getComponent(); if (!id.equals(requestFunnelDTO.getId())) { throw new IllegalArgumentException(String.format("The funnel id (%s) in the request body does not equal the " + "funnel id of the requested resource (%s).", requestFunnelDTO.getId(), id)); } final PositionDTO proposedPosition = requestFunnelDTO.getPosition(); if (proposedPosition != null) { if (proposedPosition.getX() == null || proposedPosition.getY() == null) { throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); } } if (isReplicateRequest()) { return replicate(HttpMethod.PUT, requestFunnelEntity); } else if (isDisconnectedFromCluster()) { verifyDisconnectedNodeModification(requestFunnelEntity.isDisconnectedNodeAcknowledged()); } // Extract the revision final Revision requestRevision = getRevision(requestFunnelEntity, id); return withWriteLock( serviceFacade, requestFunnelEntity, requestRevision, lookup -> { Authorizable authorizable = lookup.getFunnel(id); authorizable.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); }, null, (revision, funnelEntity) -> { // update the funnel final FunnelEntity entity = serviceFacade.updateFunnel(revision, funnelEntity.getComponent()); populateRemainingFunnelEntityContent(entity); return generateOkResponse(entity).build(); } ); }
Example #19
Source File: FunnelSchemaFunction.java From nifi-minifi with Apache License 2.0 | 4 votes |
@Override public FunnelSchema apply(FunnelDTO funnelDTO) { Map<String, Object> map = new HashMap<>(); map.put(ID_KEY, funnelDTO.getId()); return new FunnelSchema(map); }
Example #20
Source File: FunnelEntity.java From localization_nifi with Apache License 2.0 | 4 votes |
public void setComponent(FunnelDTO component) { this.component = component; }
Example #21
Source File: FlowFromDOMFactory.java From localization_nifi with Apache License 2.0 | 4 votes |
public static ProcessGroupDTO getProcessGroup(final String parentId, final Element element, final StringEncryptor encryptor, final FlowEncodingVersion encodingVersion) { final ProcessGroupDTO dto = new ProcessGroupDTO(); final String groupId = getString(element, "id"); dto.setId(groupId); dto.setParentGroupId(parentId); dto.setName(getString(element, "name")); dto.setPosition(getPosition(DomUtils.getChild(element, "position"))); dto.setComments(getString(element, "comment")); final Set<ProcessorDTO> processors = new HashSet<>(); final Set<ConnectionDTO> connections = new HashSet<>(); final Set<FunnelDTO> funnels = new HashSet<>(); final Set<PortDTO> inputPorts = new HashSet<>(); final Set<PortDTO> outputPorts = new HashSet<>(); final Set<LabelDTO> labels = new HashSet<>(); final Set<ProcessGroupDTO> processGroups = new HashSet<>(); final Set<RemoteProcessGroupDTO> remoteProcessGroups = new HashSet<>(); NodeList nodeList = DomUtils.getChildNodesByTagName(element, "processor"); for (int i = 0; i < nodeList.getLength(); i++) { processors.add(getProcessor((Element) nodeList.item(i), encryptor)); } nodeList = DomUtils.getChildNodesByTagName(element, "funnel"); for (int i = 0; i < nodeList.getLength(); i++) { funnels.add(getFunnel((Element) nodeList.item(i))); } nodeList = DomUtils.getChildNodesByTagName(element, "inputPort"); for (int i = 0; i < nodeList.getLength(); i++) { inputPorts.add(getPort((Element) nodeList.item(i))); } nodeList = DomUtils.getChildNodesByTagName(element, "outputPort"); for (int i = 0; i < nodeList.getLength(); i++) { outputPorts.add(getPort((Element) nodeList.item(i))); } nodeList = DomUtils.getChildNodesByTagName(element, "label"); for (int i = 0; i < nodeList.getLength(); i++) { labels.add(getLabel((Element) nodeList.item(i))); } nodeList = DomUtils.getChildNodesByTagName(element, "processGroup"); for (int i = 0; i < nodeList.getLength(); i++) { processGroups.add(getProcessGroup(groupId, (Element) nodeList.item(i), encryptor, encodingVersion)); } nodeList = DomUtils.getChildNodesByTagName(element, "remoteProcessGroup"); for (int i = 0; i < nodeList.getLength(); i++) { remoteProcessGroups.add(getRemoteProcessGroup((Element) nodeList.item(i), encryptor)); } nodeList = DomUtils.getChildNodesByTagName(element, "connection"); for (int i = 0; i < nodeList.getLength(); i++) { connections.add(getConnection((Element) nodeList.item(i))); } final FlowSnippetDTO groupContents = new FlowSnippetDTO(); groupContents.setConnections(connections); groupContents.setFunnels(funnels); groupContents.setInputPorts(inputPorts); groupContents.setLabels(labels); groupContents.setOutputPorts(outputPorts); groupContents.setProcessGroups(processGroups); groupContents.setProcessors(processors); groupContents.setRemoteProcessGroups(remoteProcessGroups); dto.setContents(groupContents); return dto; }
Example #22
Source File: FunnelResource.java From localization_nifi with Apache License 2.0 | 4 votes |
/** * Creates a new Funnel. * * @param httpServletRequest request * @param id The id of the funnel to update. * @param requestFunnelEntity A funnelEntity. * @return A funnelEntity. */ @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") @ApiOperation( value = "Updates a funnel", response = FunnelEntity.class, authorizations = { @Authorization(value = "Write - /funnels/{uuid}", type = "") } ) @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 updateFunnel( @Context final HttpServletRequest httpServletRequest, @ApiParam( value = "The funnel id.", required = true ) @PathParam("id") final String id, @ApiParam( value = "The funnel configuration details.", required = true ) final FunnelEntity requestFunnelEntity) { if (requestFunnelEntity == null || requestFunnelEntity.getComponent() == null) { throw new IllegalArgumentException("Funnel details must be specified."); } if (requestFunnelEntity.getRevision() == null) { throw new IllegalArgumentException("Revision must be specified."); } // ensure the ids are the same final FunnelDTO requestFunnelDTO = requestFunnelEntity.getComponent(); if (!id.equals(requestFunnelDTO.getId())) { throw new IllegalArgumentException(String.format("The funnel id (%s) in the request body does not equal the " + "funnel id of the requested resource (%s).", requestFunnelDTO.getId(), id)); } final PositionDTO proposedPosition = requestFunnelDTO.getPosition(); if (proposedPosition != null) { if (proposedPosition.getX() == null || proposedPosition.getY() == null) { throw new IllegalArgumentException("The x and y coordinate of the proposed position must be specified."); } } if (isReplicateRequest()) { return replicate(HttpMethod.PUT, requestFunnelEntity); } // Extract the revision final Revision requestRevision = getRevision(requestFunnelEntity, id); return withWriteLock( serviceFacade, requestFunnelEntity, requestRevision, lookup -> { Authorizable authorizable = lookup.getFunnel(id); authorizable.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); }, null, (revision, funnelEntity) -> { // update the funnel final FunnelEntity entity = serviceFacade.updateFunnel(revision, funnelEntity.getComponent()); populateRemainingFunnelEntityContent(entity); return clusterContext(generateOkResponse(entity)).build(); } ); }
Example #23
Source File: FunnelDAO.java From nifi with Apache License 2.0 | 2 votes |
/** * Creates a funnel in the specified group. * * @param groupId group id * @param funnelDTO The funnel DTO * @return The funnel */ Funnel createFunnel(String groupId, FunnelDTO funnelDTO);
Example #24
Source File: FunnelDAO.java From nifi with Apache License 2.0 | 2 votes |
/** * Updates the specified funnel. * * @param funnelDTO The funnel DTO * @return The funnel */ Funnel updateFunnel(FunnelDTO funnelDTO);
Example #25
Source File: NiFiServiceFacade.java From nifi with Apache License 2.0 | 2 votes |
/** * Creates a funnel. * * @param revision revision * @param groupId group * @param funnelDTO funnel * @return The funnel DTO */ FunnelEntity createFunnel(Revision revision, String groupId, FunnelDTO funnelDTO);
Example #26
Source File: NiFiServiceFacade.java From nifi with Apache License 2.0 | 2 votes |
/** * Updates the specified funnel. * * @param revision Revision to compare with current base revision * @param funnelDTO The funnel DTO * @return The funnel DTO */ FunnelEntity updateFunnel(Revision revision, FunnelDTO funnelDTO);
Example #27
Source File: FunnelEntity.java From localization_nifi with Apache License 2.0 | 2 votes |
/** * The FunnelDTO that is being serialized. * * @return The FunnelDTO object */ public FunnelDTO getComponent() { return component; }
Example #28
Source File: NiFiServiceFacade.java From localization_nifi with Apache License 2.0 | 2 votes |
/** * Updates the specified funnel. * * @param revision Revision to compare with current base revision * @param funnelDTO The funnel DTO * @return The funnel DTO */ FunnelEntity updateFunnel(Revision revision, FunnelDTO funnelDTO);
Example #29
Source File: NiFiServiceFacade.java From localization_nifi with Apache License 2.0 | 2 votes |
/** * Creates a funnel. * * @param revision revision * @param groupId group * @param funnelDTO funnel * @return The funnel DTO */ FunnelEntity createFunnel(Revision revision, String groupId, FunnelDTO funnelDTO);
Example #30
Source File: FunnelDAO.java From localization_nifi with Apache License 2.0 | 2 votes |
/** * Updates the specified funnel. * * @param funnelDTO The funnel DTO * @return The funnel */ Funnel updateFunnel(FunnelDTO funnelDTO);