-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vulnerability upgrades backwards compatibility #656
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
widget.datepicker.is.numeric=true | ||
widget.value.translated=true | ||
widget.value.translated=true | ||
enable.backward.compatability=true | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1428,11 +1428,12 @@ private Facts getEntries(String[] address, JSONObject object) throws JSONExcepti | |
formObject.put(RuleConstant.IS_RULE_CHECK, true); | ||
formObject.put(RuleConstant.STEP, formObject.getString(RuleConstant.STEP)); | ||
|
||
if(Utils.enabledProperty(NativeFormsProperties.KEY.ENABLE_BACKWARD_COMPATIBILITY)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Go to |
||
Facts resultFacts = getValueFromAddressCore(formObject); | ||
|
||
Facts resultFacts = getValueFromAddressCore(formObject); | ||
|
||
for (Map.Entry<String,Object> factEntry: resultFacts.asMap().entrySet()) { | ||
result.put(factEntry.getKey(),factEntry.getValue()); | ||
for (Map.Entry<String, Object> factEntry : resultFacts.asMap().entrySet()) { | ||
result.put(factEntry.getKey(), factEntry.getValue()); | ||
} | ||
} | ||
|
||
} | ||
|
@@ -1939,6 +1940,7 @@ private List<String> getRules(String filename, String fieldKey, boolean readAllR | |
|
||
StringBuilder conditionString = new StringBuilder(); | ||
conditionString.append(map.get(RuleConstant.CONDITION).toString()); | ||
boolean backwardCompatibility = Utils.enabledProperty(NativeFormsProperties.KEY.ENABLE_BACKWARD_COMPATIBILITY); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename this variable to be more accurate eg |
||
|
||
List<String> fields = (List<String>) map.get(RuleConstant.ACTIONS); | ||
List<String> newFields = new ArrayList<>(); | ||
|
@@ -1948,12 +1950,14 @@ private List<String> getRules(String filename, String fieldKey, boolean readAllR | |
field.trim().startsWith(RuleConstant.CONSTRAINT)) { | ||
conditionString.append(" " + field); | ||
} | ||
|
||
if(backwardCompatibility) | ||
newFields.add("facts." + field); | ||
} | ||
|
||
fields.clear(); | ||
fields.addAll(newFields); | ||
if(backwardCompatibility) { | ||
fields.clear(); | ||
fields.addAll(newFields); | ||
} | ||
} | ||
|
||
actions.addAll(getConditionKeys(conditionString.toString())); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import com.vijay.jsonwizard.constants.JsonFormConstants; | ||
import com.vijay.jsonwizard.interfaces.FormFileSource; | ||
import com.vijay.jsonwizard.rules.YamlRuleDefinitionReaderExt; | ||
import com.vijay.jsonwizard.utils.NativeFormsProperties; | ||
import com.vijay.jsonwizard.utils.Utils; | ||
|
||
import org.jeasy.rules.api.Rules; | ||
|
@@ -26,7 +27,7 @@ public class AssetsFileSource implements FormFileSource { | |
private MVELRuleFactory mvelRuleFactory; | ||
|
||
private AssetsFileSource() { | ||
this.mvelRuleFactory = new MVELRuleFactory(new YamlRuleDefinitionReaderExt()); | ||
this.mvelRuleFactory = new MVELRuleFactory(new YamlRuleDefinitionReaderExt()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kindly make this optional by switching to |
||
} | ||
|
||
@Override | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
import com.vijay.jsonwizard.constants.JsonFormConstants; | ||
import com.vijay.jsonwizard.interfaces.FormFileSource; | ||
import com.vijay.jsonwizard.rules.YamlRuleDefinitionReaderExt; | ||
import com.vijay.jsonwizard.utils.NativeFormsProperties; | ||
import com.vijay.jsonwizard.utils.Utils; | ||
|
||
import org.jeasy.rules.api.Rules; | ||
|
@@ -31,7 +32,7 @@ public class DiskFileSource implements FormFileSource { | |
private MVELRuleFactory mvelRuleFactory; | ||
|
||
private DiskFileSource() { | ||
this.mvelRuleFactory = new MVELRuleFactory(new YamlRuleDefinitionReaderExt()); | ||
this.mvelRuleFactory = new MVELRuleFactory(new YamlRuleDefinitionReaderExt()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kindly make this optional by switching to |
||
} | ||
|
||
@Override | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ public final static class KEY { | |
//Widgets | ||
public static final String WIDGET_DATEPICKER_IS_NUMERIC = "widget.datepicker.is.numeric"; | ||
public static final String WIDGET_VALUE_TRANSLATED = "widget.value.translated"; | ||
public static final String ENABLE_BACKWARD_COMPATIBILITY = "enable.backward.compatability"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename this constant to |
||
|
||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this to
easy_rule.v3.compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes mentioned are updated according the suggestion @ekigamba