Skip to content

Commit

Permalink
NIFI-3335: Incorporated review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyb149 committed Jul 26, 2017
1 parent be79615 commit 16e1832
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Expand Up @@ -168,6 +168,9 @@ public abstract class AbstractDatabaseFetchProcessor extends AbstractSessionFact

private static SimpleDateFormat TIME_TYPE_FORMAT = new SimpleDateFormat("HH:mm:ss.SSS");

// A Map (name to value) of initial maximum-value properties, filled at schedule-time and used at trigger-time
protected Map<String,String> maxValueProperties;

static {
// Load the DatabaseAdapters
ArrayList<AllowableValue> dbAdapterValues = new ArrayList<>();
Expand Down
Expand Up @@ -153,6 +153,7 @@ protected Collection<ValidationResult> customValidate(ValidationContext validati
@Override
@OnScheduled
public void setup(final ProcessContext context) {
maxValueProperties = getDefaultMaxValueProperties(context.getProperties());
// Pre-fetch the column types if using a static table name and max-value columns
if (!isDynamicTableName && !isDynamicMaxValues) {
super.setup(context);
Expand Down Expand Up @@ -202,7 +203,6 @@ public void onTrigger(final ProcessContext context, final ProcessSessionFactory
final Map<String, String> statePropertyMap = new HashMap<>(stateMap.toMap());

// If an initial max value for column(s) has been specified using properties, and this column is not in the state manager, sync them to the state property map
final Map<String,String> maxValueProperties = getDefaultMaxValueProperties(context.getProperties());
for (final Map.Entry<String, String> maxProp : maxValueProperties.entrySet()) {
String maxPropKey = maxProp.getKey().toLowerCase();
String fullyQualifiedMaxPropKey = getStateKey(tableName, maxPropKey);
Expand Down
Expand Up @@ -176,6 +176,7 @@ protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {

@OnScheduled
public void setup(final ProcessContext context) {
maxValueProperties = getDefaultMaxValueProperties(context.getProperties());
super.setup(context);
}

Expand Down Expand Up @@ -205,8 +206,6 @@ public void onTrigger(final ProcessContext context, final ProcessSessionFactory
.defaultScale(context.getProperty(DEFAULT_SCALE).evaluateAttributeExpressions().asInteger())
.build();

final Map<String,String> maxValueProperties = getDefaultMaxValueProperties(context.getProperties());

final StateManager stateManager = context.getStateManager();
final StateMap stateMap;

Expand Down

0 comments on commit 16e1832

Please sign in to comment.