Java Code Examples for org.apache.nifi.web.api.dto.ConnectionDTO#setBends()

The following examples show how to use org.apache.nifi.web.api.dto.ConnectionDTO#setBends() . 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: FlowFromDOMFactory.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
public static ConnectionDTO getConnection(final Element element) {
    final ConnectionDTO dto = new ConnectionDTO();
    dto.setId(getString(element, "id"));
    dto.setName(getString(element, "name"));
    dto.setLabelIndex(getOptionalInt(element, "labelIndex"));
    dto.setzIndex(getOptionalLong(element, "zIndex"));

    final List<PositionDTO> bends = new ArrayList<>();
    final Element bendPointsElement = DomUtils.getChild(element, "bendPoints");
    if (bendPointsElement != null) {
        for (final Element bendPointElement : getChildrenByTagName(bendPointsElement, "bendPoint")) {
            final PositionDTO bend = getPosition(bendPointElement);
            bends.add(bend);
        }
    }
    dto.setBends(bends);

    final ConnectableDTO sourceConnectable = new ConnectableDTO();
    dto.setSource(sourceConnectable);
    sourceConnectable.setId(getString(element, "sourceId"));
    sourceConnectable.setGroupId(getString(element, "sourceGroupId"));
    sourceConnectable.setType(getString(element, "sourceType"));

    final ConnectableDTO destConnectable = new ConnectableDTO();
    dto.setDestination(destConnectable);
    destConnectable.setId(getString(element, "destinationId"));
    destConnectable.setGroupId(getString(element, "destinationGroupId"));
    destConnectable.setType(getString(element, "destinationType"));

    final Set<String> relationships = new HashSet<>();
    final List<Element> relationshipNodeList = getChildrenByTagName(element, "relationship");
    for (final Element relationshipElem : relationshipNodeList) {
        relationships.add(relationshipElem.getTextContent());
    }
    dto.setSelectedRelationships(relationships);

    dto.setBackPressureObjectThreshold(getLong(element, "maxWorkQueueSize"));

    final String maxDataSize = getString(element, "maxWorkQueueDataSize");
    if (maxDataSize != null && !maxDataSize.trim().isEmpty()) {
        dto.setBackPressureDataSizeThreshold(maxDataSize);
    }

    String expiration = getString(element, "flowFileExpiration");
    if (expiration == null) {
        expiration = "0 sec";
    }
    dto.setFlowFileExpiration(expiration);

    final List<String> prioritizerClasses = new ArrayList<>();
    final List<Element> prioritizerNodeList = getChildrenByTagName(element, "queuePrioritizerClass");
    for (final Element prioritizerElement : prioritizerNodeList) {
        prioritizerClasses.add(prioritizerElement.getTextContent().trim());
    }
    dto.setPrioritizers(prioritizerClasses);

    return dto;
}
 
Example 2
Source File: FlowFromDOMFactory.java    From nifi with Apache License 2.0 4 votes vote down vote up
public static ConnectionDTO getConnection(final Element element) {
    final ConnectionDTO dto = new ConnectionDTO();
    dto.setId(getString(element, "id"));
    dto.setName(getString(element, "name"));
    dto.setLabelIndex(getOptionalInt(element, "labelIndex"));
    dto.setzIndex(getOptionalLong(element, "zIndex"));
    dto.setVersionedComponentId(getString(element, "versionedComponentId"));

    final List<PositionDTO> bends = new ArrayList<>();
    final Element bendPointsElement = DomUtils.getChild(element, "bendPoints");
    if (bendPointsElement != null) {
        for (final Element bendPointElement : getChildrenByTagName(bendPointsElement, "bendPoint")) {
            final PositionDTO bend = getPosition(bendPointElement);
            bends.add(bend);
        }
    }
    dto.setBends(bends);

    final ConnectableDTO sourceConnectable = new ConnectableDTO();
    dto.setSource(sourceConnectable);
    sourceConnectable.setId(getString(element, "sourceId"));
    sourceConnectable.setGroupId(getString(element, "sourceGroupId"));
    sourceConnectable.setType(getString(element, "sourceType"));

    final ConnectableDTO destConnectable = new ConnectableDTO();
    dto.setDestination(destConnectable);
    destConnectable.setId(getString(element, "destinationId"));
    destConnectable.setGroupId(getString(element, "destinationGroupId"));
    destConnectable.setType(getString(element, "destinationType"));

    final Set<String> relationships = new HashSet<>();
    final List<Element> relationshipNodeList = getChildrenByTagName(element, "relationship");
    for (final Element relationshipElem : relationshipNodeList) {
        relationships.add(relationshipElem.getTextContent());
    }
    dto.setSelectedRelationships(relationships);

    dto.setBackPressureObjectThreshold(getLong(element, "maxWorkQueueSize"));

    final String maxDataSize = getString(element, "maxWorkQueueDataSize");
    if (maxDataSize != null && !maxDataSize.trim().isEmpty()) {
        dto.setBackPressureDataSizeThreshold(maxDataSize);
    }

    String expiration = getString(element, "flowFileExpiration");
    if (expiration == null) {
        expiration = "0 sec";
    }
    dto.setFlowFileExpiration(expiration);

    final List<String> prioritizerClasses = new ArrayList<>();
    final List<Element> prioritizerNodeList = getChildrenByTagName(element, "queuePrioritizerClass");
    for (final Element prioritizerElement : prioritizerNodeList) {
        prioritizerClasses.add(prioritizerElement.getTextContent().trim());
    }
    dto.setPrioritizers(prioritizerClasses);

    dto.setLoadBalanceStrategy(getString(element, "loadBalanceStrategy"));
    dto.setLoadBalancePartitionAttribute(getString(element, "partitioningAttribute"));
    dto.setLoadBalanceCompression(getString(element, "loadBalanceCompression"));

    return dto;
}