Skip to content

Commit

Permalink
update getComponentProperties to handle Tag[] value expectation.
Browse files Browse the repository at this point in the history
  • Loading branch information
wildone committed Jun 5, 2021
1 parent 2ccb376 commit 8126e07
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1232,9 +1232,24 @@ public static ComponentProperties getComponentProperties(Map<String, Object> pag

Object fieldValue = null;

//read component value or return default value, result could be a expression
// that need to be processed using @ComponentProperties.evaluateExpressionFields()
fieldValue = getComponentProperty(properties, currentPolicy, fieldName, fieldDefaultValue, true);
//handle Tag[] value expectation.
if (fieldDefaultValue.getClass() == Tag[].class) {
Resource currentResource = (Resource)pageContext.get("resource");
//get value from policy
fieldValue = currentPolicy.get(fieldName, Tag[].class);
//try resourcee
if (fieldValue == null) {
fieldValue = tagManager.getTags(currentResource);
}
//use default
if (fieldValue == null) {
fieldValue = fieldDefaultValue;
}
} else {
//read component value or return default value, result could be a expression
// that need to be processed using @ComponentProperties.evaluateExpressionFields()
fieldValue = getComponentProperty(properties, currentPolicy, fieldName, fieldDefaultValue, true);
}

boolean fieldValueHasExpressions = isStringRegex(fieldDefaultValue.toString());

Expand Down

0 comments on commit 8126e07

Please sign in to comment.