Java Code Examples for org.apache.nifi.components.PropertyValue#asInteger()

The following examples show how to use org.apache.nifi.components.PropertyValue#asInteger() . 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: SFTPTransfer.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Override
public List<FileInfo> getListing() throws IOException {
    final String path = ctx.getProperty(FileTransfer.REMOTE_PATH).evaluateAttributeExpressions().getValue();
    final int depth = 0;

    final int maxResults;
    final PropertyValue batchSizeValue = ctx.getProperty(FileTransfer.REMOTE_POLL_BATCH_SIZE);
    if (batchSizeValue == null) {
        maxResults = Integer.MAX_VALUE;
    } else {
        final Integer configuredValue = batchSizeValue.asInteger();
        maxResults = configuredValue == null ? Integer.MAX_VALUE : configuredValue;
    }

    final List<FileInfo> listing = new ArrayList<>(1000);
    getListing(path, depth, maxResults, listing);
    return listing;
}
 
Example 2
Source File: SFTPTransfer.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Override
public List<FileInfo> getListing() throws IOException {
    final String path = ctx.getProperty(FileTransfer.REMOTE_PATH).evaluateAttributeExpressions().getValue();
    final int depth = 0;

    final int maxResults;
    final PropertyValue batchSizeValue = ctx.getProperty(FileTransfer.REMOTE_POLL_BATCH_SIZE);
    if (batchSizeValue == null) {
        maxResults = Integer.MAX_VALUE;
    } else {
        final Integer configuredValue = batchSizeValue.asInteger();
        maxResults = configuredValue == null ? Integer.MAX_VALUE : configuredValue;
    }

    final List<FileInfo> listing = new ArrayList<>(1000);
    getListing(path, depth, maxResults, listing);
    return listing;
}
 
Example 3
Source File: TestStandardPropertyValue.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
@Test(expected = NumberFormatException.class)
public void testGetValueAsIntegerAfterSubstitutingWithNonInteger() {
    final PropertyValue value = new StandardPropertyValue("1${value}", lookup);
    final Map<String, String> attributes = new HashMap<>();
    attributes.put("value", "Yes");
    final PropertyValue substituted = value.evaluateAttributeExpressions(createFlowFile(attributes));
    substituted.asInteger();
}
 
Example 4
Source File: TestStandardPropertyValue.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Test(expected = NumberFormatException.class)
public void testGetValueAsIntegerAfterSubstitutingWithNonInteger() {
    final PropertyValue value = new StandardPropertyValue("1${value}", lookup, ParameterLookup.EMPTY);
    final Map<String, String> attributes = new HashMap<>();
    attributes.put("value", "Yes");
    final PropertyValue substituted = value.evaluateAttributeExpressions(createFlowFile(attributes));
    substituted.asInteger();
}