[ 
https://issues.apache.org/jira/browse/MINIFI-30?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15329782#comment-15329782
 ] 

ASF GitHub Bot commented on MINIFI-30:
--------------------------------------

Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi/pull/17#discussion_r67004047
  
    --- Diff: 
minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/schema/common/BaseSchema.java
 ---
    @@ -51,18 +55,80 @@ public void addValidationIssue(String keyName, String 
wrapperName, String reason
             validationIssues.add("'" + keyName + "' in section '" + 
wrapperName + "' because " + reason);
         }
     
    -    public <T> T getRequiredKey(Map map, String keyName, String 
wrapperName) {
    -        if (map.get(keyName) != null) {
    -            return (T) map.get(keyName);
    +    public void addIssuesIfNotNull(BaseSchema baseSchema) {
    +        if (baseSchema != null) {
    +            validationIssues.addAll(baseSchema.getValidationIssues());
    +        }
    +    }
    +
    +    /******* Value Access/Interpretation helper methods *******/
    +    public <T> T getOptionalKeyAsType(Map valueMap, String key, Class 
targetClass, String wrapperName, T defaultValue) {
    +        return getKeyAsType(valueMap, key, targetClass, wrapperName, 
false, defaultValue);
    +    }
    +
    +    public <T> T getRequiredKeyAsType(Map valueMap, String key, Class 
targetClass, String wrapperName) {
    +        return getKeyAsType(valueMap, key, targetClass, wrapperName, true, 
null);
    +    }
    +
    +    <T> T getKeyAsType(Map valueMap, String key, Class targetClass, String 
wrapperName, boolean required, T defaultValue) {
    +        Object value = valueMap.get(key);
    +        if (value == null) {
    +            if (defaultValue != null) {
    +                return defaultValue;
    +            } else if(required) {
    +                addValidationIssue(key, wrapperName, "it was not found and 
it is required");
    +            }
             } else {
    -            addValidationIssue(keyName, wrapperName, "it was not found and 
it is required");
    -            return null;
    +            if (targetClass.isInstance(value)) {
    +                return (T) value;
    +            } else {
    +                addValidationIssue(key, wrapperName, "it is found but 
could not be parsed as a " + targetClass.getSimpleName());
    +            }
             }
    +        return null;
         }
     
    -    public void addIssuesIfNotNull(BaseSchema baseSchema) {
    -        if (baseSchema != null) {
    -            validationIssues.addAll(baseSchema.getValidationIssues());
    +
    +    public <T> T getMapAsType(Map valueMap, String key, Class targetClass, 
String wrapperName, boolean required) {
    +        Object obj = valueMap.get(key);
    +        return interpretValueAsType(obj, key, targetClass, wrapperName, 
required);
    +    }
    +
    +    public void instantiateList(List list, String simpleListType, Class 
targetClass, String wrapperName){
    --- End diff --
    
    I agree


> Improve Configuration to Allow Intermediate Processors
> ------------------------------------------------------
>
>                 Key: MINIFI-30
>                 URL: https://issues.apache.org/jira/browse/MINIFI-30
>             Project: Apache NiFi MiNiFi
>          Issue Type: Improvement
>            Reporter: Joseph Percivall
>            Assignee: Joseph Percivall
>
> Currently the config.yml spec and ConfigTransformer only allow for an input 
> processor and S2S out. Going forward there needs to be a way to have 
> intermediate processors to act on and route data, as well as a way to push 
> data out using a processor (like PutMQTT) instead of S2S



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to