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

The following examples show how to use org.apache.nifi.web.api.dto.ConnectionDTO#setFlowFileExpiration() . 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: ConnectionSchemaTest.java    From nifi-minifi with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    ConnectableDTO source = new ConnectableDTO();
    source.setId(testSourceId);

    ConnectableDTO destination = new ConnectableDTO();
    destination.setId(testDestinationId);

    dto = new ConnectionDTO();
    dto.setId(testId);
    dto.setName(testName);
    dto.setSource(source);
    dto.setSelectedRelationships(Arrays.asList(testSelectedRelationship).stream().collect(Collectors.toSet()));
    dto.setDestination(destination);
    dto.setBackPressureObjectThreshold(testMaxWorkQueueSize);
    dto.setBackPressureDataSizeThreshold(testMaxWorkQueueDataSize);
    dto.setFlowFileExpiration(testFlowfileExpiration);
    dto.setPrioritizers(Arrays.asList(testQueuePrioritizerClass));

    map = new HashMap<>();
    map.put(CommonPropertyKeys.ID_KEY, testId);
    map.put(CommonPropertyKeys.NAME_KEY, testName);
    map.put(ConnectionSchema.SOURCE_ID_KEY, testSourceId);
    map.put(ConnectionSchema.SOURCE_RELATIONSHIP_NAMES_KEY, new ArrayList<>(Arrays.asList(testSelectedRelationship)));
    map.put(ConnectionSchema.DESTINATION_ID_KEY, testDestinationId);
    map.put(ConnectionSchema.MAX_WORK_QUEUE_SIZE_KEY, testMaxWorkQueueSize);
    map.put(ConnectionSchema.MAX_WORK_QUEUE_DATA_SIZE_KEY, testMaxWorkQueueDataSize);
    map.put(ConnectionSchema.FLOWFILE_EXPIRATION__KEY, testFlowfileExpiration);
    map.put(ConnectionSchema.QUEUE_PRIORITIZER_CLASS_KEY, testQueuePrioritizerClass);
}
 
Example 2
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 3
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;
}