struts git commit: WW-4795 Implements @LongRangeFieldValidator annotation

2017-05-09 Thread lukaszlenart
Repository: struts
Updated Branches:
  refs/heads/master bbd4a9e8c -> 0314ddcb5


WW-4795 Implements @LongRangeFieldValidator annotation


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/0314ddcb
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/0314ddcb
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/0314ddcb

Branch: refs/heads/master
Commit: 0314ddcb5c8badb8c216735f318fe75ffe56d6b5
Parents: bbd4a9e
Author: Lukasz Lenart 
Authored: Tue May 9 10:33:35 2017 +0200
Committer: Lukasz Lenart 
Committed: Tue May 9 10:33:35 2017 +0200

--
 ...nnotationValidationConfigurationBuilder.java |  52 +
 .../annotations/LongRangeFieldValidator.java| 194 +++
 .../validator/annotations/Validations.java  |   4 +
 .../xwork2/validator/validators/default.xml |   1 +
 .../template/xhtml/form-close-validate.ftl  |   2 +-
 .../validator/AnnotationValidationAction.java   |   3 +
 ...ationValidationConfigurationBuilderTest.java |  15 +-
 core/src/test/resources/validators.xml  |   2 +
 8 files changed, 271 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/struts/blob/0314ddcb/core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java
--
diff --git 
a/core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java
 
b/core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java
index b2764ca..f0f3e12 100644
--- 
a/core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java
+++ 
b/core/src/main/java/com/opensymphony/xwork2/validator/AnnotationValidationConfigurationBuilder.java
@@ -146,6 +146,14 @@ public class AnnotationValidationConfigurationBuilder {
 result.add(temp);
 }
 }
+// Process LongRangeFieldValidator
+else if (a instanceof LongRangeFieldValidator) {
+LongRangeFieldValidator v = (LongRangeFieldValidator) a;
+ValidatorConfig temp = 
processLongRangeFieldValidatorAnnotation(v, fieldName, methodName);
+if (temp != null) {
+result.add(temp);
+}
+}
 // Process ShortRangeFieldValidator
 else if (a instanceof ShortRangeFieldValidator) {
 ShortRangeFieldValidator v = (ShortRangeFieldValidator) a;
@@ -298,6 +306,15 @@ public class AnnotationValidationConfigurationBuilder {
 }
 }
 }
+LongRangeFieldValidator[] lrfv = validations.longRangeFields();
+if (irfv != null) {
+for (LongRangeFieldValidator v : lrfv) {
+ValidatorConfig temp = 
processLongRangeFieldValidatorAnnotation(v, fieldName, methodName);
+if (temp != null) {
+result.add(temp);
+}
+}
+}
 RegexFieldValidator[] rfv = validations.regexFields();
 if (rfv != null) {
 for (RegexFieldValidator v : rfv) {
@@ -672,6 +689,41 @@ public class AnnotationValidationConfigurationBuilder {
 .build();
 }
 
+private ValidatorConfig 
processLongRangeFieldValidatorAnnotation(LongRangeFieldValidator v, String 
fieldName, String methodName) {
+String validatorType = "long";
+
+Map params = new HashMap<>();
+
+if (fieldName != null) {
+params.put("fieldName", fieldName);
+} else if (StringUtils.isNotEmpty(v.fieldName())) {
+params.put("fieldName", v.fieldName());
+}
+
+if (v.min() != null && v.min().length() > 0) {
+params.put("min", v.min());
+}
+if (v.max() != null && v.max().length() > 0) {
+params.put("max", v.max());
+}
+if (StringUtils.isNotEmpty(v.maxExpression())) {
+params.put("maxExpression", v.maxExpression());
+}
+if (StringUtils.isNotEmpty(v.minExpression())) {
+params.put("minExpression", v.minExpression());
+}
+
+validatorFactory.lookupRegisteredValidatorType(validatorType);
+return new ValidatorConfig.Builder(validatorType)
+.addParams(params)
+.addParam("methodName", methodName)
+.shortCircuit(v.shortCircuit())
+.defaultMessage(v.message())
+.messageKey(v.key())
+.messageParams(v.messageParams())
+.build();
+}
+
 private ValidatorConfig 
processShortRangeFieldValidatorAnnotation(ShortRangeFieldValidator v, St

svn commit: r1011991 - in /websites/production/struts/content/docs: freemarker-result.html interceptors.html noop-interceptor.html s2-028.html spring-plugin.html

2017-05-09 Thread lukaszlenart
Author: lukaszlenart
Date: Wed May 10 06:35:13 2017
New Revision: 1011991

Log:
Updates production

Added:
websites/production/struts/content/docs/noop-interceptor.html
Modified:
websites/production/struts/content/docs/freemarker-result.html
websites/production/struts/content/docs/interceptors.html
websites/production/struts/content/docs/s2-028.html
websites/production/struts/content/docs/spring-plugin.html

Modified: websites/production/struts/content/docs/freemarker-result.html
==
--- websites/production/struts/content/docs/freemarker-result.html (original)
+++ websites/production/struts/content/docs/freemarker-result.html Wed May 10 
06:35:13 2017
@@ -139,38 +139,9 @@ under the License.
 
 
 
-
-
-Renders a view using the Freemarker template engine.
-
-The FreemarkarManager class configures the template loaders so that the
-template location can be either
-
-
-relative to the web root folder. eg 
/WEB-INF/views/home.ftl
-a classpath resuorce. eg 
/com/company/web/views/home.ftl
-
-
-Also see Freemarker 
Support.
-
-Parameters
-
-
-location (default) - the location of the 
template to process.parse - true by default. If 
set to false, the location param will
-not be parsed for Ognl expressions.contentType 
- defaults to "text/html" unless 
specified.writeIfCompleted - false by default, 
write to stream only if there isn't any error 
-processing the template. Setting template_exception_handler=rethrow in 
freemarker.properties
-will have the same effect.
-
-
-Examples
-
-
-
-
+Renders a view using the Freemarker 
template engine. The FreemarkarManager class configures the 
template loaders so that the template location can be eitherrelative to the web root folder, 
e.g.: /WEB-INF/views/home.ftla classpath resource, 
e.g.: 
/com/company/web/views/home.ftl Also see 
Freemarker Support.Parameterslocation (default) - the location of the template 
to process.parse - true by default. If set to 
false, the location param will not be parsed for 
expressions.contentType - defaults to 
text/html unless 
specified.writeIfCompleted - false by default, write to stream only if there isn't any error processing 
the template. Setting template_exception_handler=rethrow in 
freemarker.properties will have the same effect.Examples
+foo.ftl
+  
 
 
 

Modified: websites/production/struts/content/docs/interceptors.html
==
--- websites/production/struts/content/docs/interceptors.html (original)
+++ websites/production/struts/content/docs/interceptors.html Wed May 10 
06:35:13 2017
@@ -140,11 +140,11 @@ under the License.
 
 
 The default Interceptor stack is 
designed to serve the needs of most applications. Most applications will 
not need to add Interceptors or change the Interceptor 
stack.Many Actions share common concerns. Some Actions need 
input validated. Other Actions may need a file upload to be pre-processed. 
Another Action might need protection from a double submit. Many Actions need 
drop-down lists and other controls pre-populated before the page 
displays.The framework makes it easy to share solutions to these 
concerns using an "Interceptor" strategy. When you request a resource that maps 
to an "action", the framework invokes the Action object. But, before the Action 
is executed, the invocatio
 n can be intercepted by another object. After the Action executes, the 
invocation could be intercepted again. Unsurprisingly, we call these objects 
"Interceptors."/**/
+/*]]>*/
 Understanding 
InterceptorsConfiguring 
InterceptorsStacking Interceptors
 The Default 
Configuration
 Framework 
Interceptors
@@ -425,6 +425,12 @@ div.rbtoc1492969959447 li {margin-left:
 
 
 
+
+
+
+
+