/** * Return {@code true} if the upstream app (the app that appears before the provided app) * contains partition related properties. * * @param stream stream for the app * @param currentApp app for which to determine if the upstream app has partition * properties * @param streamDeploymentProperties deployment properties for the stream * @return true if the upstream app has partition properties */ /* default */ boolean upstreamAppHasPartitionInfo(StreamDefinition stream, StreamAppDefinition currentApp, Map<String, String> streamDeploymentProperties) { Iterator<StreamAppDefinition> iterator = stream.getDeploymentOrderIterator(); while (iterator.hasNext()) { StreamAppDefinition app = iterator.next(); if (app.equals(currentApp) && iterator.hasNext()) { StreamAppDefinition prevApp = iterator.next(); Map<String, String> appDeploymentProperties = extractAppProperties(prevApp, streamDeploymentProperties); return appDeploymentProperties.containsKey(BindingPropertyKeys.OUTPUT_PARTITION_KEY_EXPRESSION) || appDeploymentProperties .containsKey(BindingPropertyKeys.OUTPUT_PARTITION_KEY_EXTRACTOR_CLASS); } } return false; }
/** * Return {@code true} if the upstream app (the app that appears before the provided app) * contains partition related properties. * * @param stream stream for the app * @param currentApp app for which to determine if the upstream app has partition * properties * @param streamDeploymentProperties deployment properties for the stream * @return true if the upstream app has partition properties */ /* default */ boolean upstreamAppHasPartitionInfo(StreamDefinition stream, StreamAppDefinition currentApp, Map<String, String> streamDeploymentProperties) { Iterator<StreamAppDefinition> iterator = stream.getDeploymentOrderIterator(); while (iterator.hasNext()) { StreamAppDefinition app = iterator.next(); if (app.equals(currentApp) && iterator.hasNext()) { StreamAppDefinition prevApp = iterator.next(); Map<String, String> appDeploymentProperties = extractAppProperties(prevApp, streamDeploymentProperties); return appDeploymentProperties.containsKey(BindingPropertyKeys.OUTPUT_PARTITION_KEY_EXPRESSION) || appDeploymentProperties .containsKey(BindingPropertyKeys.OUTPUT_PARTITION_KEY_EXTRACTOR_CLASS); } } return false; }