Browse Source

JFinal 1.5 release :)

JamesZhan 12 years ago
parent
commit
9e4d8b4a67
100 changed files with 301 additions and 181 deletions
  1. 1 1
      README.rst
  2. 1 1
      src/com/jfinal/aop/ActionInvocationWrapper.java
  3. 1 1
      src/com/jfinal/aop/Before.java
  4. 1 1
      src/com/jfinal/aop/ClearInterceptor.java
  5. 1 1
      src/com/jfinal/aop/ClearLayer.java
  6. 1 1
      src/com/jfinal/aop/Interceptor.java
  7. 1 1
      src/com/jfinal/aop/InterceptorStack.java
  8. 1 1
      src/com/jfinal/aop/PrototypeInterceptor.java
  9. 6 2
      src/com/jfinal/config/Constants.java
  10. 1 1
      src/com/jfinal/config/Handlers.java
  11. 1 1
      src/com/jfinal/config/Interceptors.java
  12. 1 1
      src/com/jfinal/config/JFinalConfig.java
  13. 1 1
      src/com/jfinal/config/Plugins.java
  14. 1 1
      src/com/jfinal/config/Routes.java
  15. 1 1
      src/com/jfinal/core/Action.java
  16. 1 1
      src/com/jfinal/core/ActionException.java
  17. 1 1
      src/com/jfinal/core/ActionHandler.java
  18. 1 1
      src/com/jfinal/core/ActionInvocation.java
  19. 1 1
      src/com/jfinal/core/ActionKey.java
  20. 1 1
      src/com/jfinal/core/ActionMapping.java
  21. 1 1
      src/com/jfinal/core/ActionRender.java
  22. 1 1
      src/com/jfinal/core/ActionReporter.java
  23. 1 1
      src/com/jfinal/core/Config.java
  24. 2 2
      src/com/jfinal/core/Const.java
  25. 82 16
      src/com/jfinal/core/Controller.java
  26. 1 1
      src/com/jfinal/core/InterceptorBuilder.java
  27. 1 1
      src/com/jfinal/core/JFinal.java
  28. 1 1
      src/com/jfinal/core/JFinalFilter.java
  29. 4 17
      src/com/jfinal/core/ModelInjector.java
  30. 10 5
      src/com/jfinal/core/TypeConverter.java
  31. 1 1
      src/com/jfinal/ext/handler/ContextPathHandler.java
  32. 1 1
      src/com/jfinal/ext/handler/FakeStaticHandler.java
  33. 1 1
      src/com/jfinal/ext/handler/RoutesHandler.java
  34. 1 1
      src/com/jfinal/ext/handler/ServerNameRedirect301Handler.java
  35. 1 1
      src/com/jfinal/ext/handler/UrlSkipHandler.java
  36. 16 0
      src/com/jfinal/ext/interceptor/GET.java
  37. 1 1
      src/com/jfinal/ext/interceptor/LogInterceptor.java
  38. 1 1
      src/com/jfinal/ext/interceptor/NoUrlPara.java
  39. 16 0
      src/com/jfinal/ext/interceptor/POST.java
  40. 16 0
      src/com/jfinal/ext/interceptor/Restful.java
  41. 1 1
      src/com/jfinal/ext/interceptor/SessionInViewInterceptor.java
  42. 1 1
      src/com/jfinal/ext/kit/DateKit.java
  43. 1 1
      src/com/jfinal/ext/kit/SessionIdKit.java
  44. 0 5
      src/com/jfinal/ext/plugin/redis/RedisKit.java
  45. 0 14
      src/com/jfinal/ext/plugin/redis/RedisPlugin.java
  46. 0 11
      src/com/jfinal/ext/plugin/shiro/ShiroInterceptor.java
  47. 0 14
      src/com/jfinal/ext/plugin/shiro/ShiroPlugin.java
  48. 1 1
      src/com/jfinal/ext/render/CaptchaRender.java
  49. 16 0
      src/com/jfinal/ext/render/StaticHtmlRender.java
  50. 1 1
      src/com/jfinal/handler/Handler.java
  51. 1 1
      src/com/jfinal/handler/HandlerFactory.java
  52. 1 1
      src/com/jfinal/i18n/I18N.java
  53. 1 1
      src/com/jfinal/kit/FileKit.java
  54. 1 1
      src/com/jfinal/kit/HandlerKit.java
  55. 27 3
      src/com/jfinal/kit/JsonKit.java
  56. 1 1
      src/com/jfinal/kit/PathKit.java
  57. 1 1
      src/com/jfinal/kit/StringKit.java
  58. 1 1
      src/com/jfinal/log/ILoggerFactory.java
  59. 1 1
      src/com/jfinal/log/JdkLogger.java
  60. 1 1
      src/com/jfinal/log/JdkLoggerFactory.java
  61. 1 1
      src/com/jfinal/log/Log4jLogger.java
  62. 1 1
      src/com/jfinal/log/Log4jLoggerFactory.java
  63. 1 1
      src/com/jfinal/log/Logger.java
  64. 1 1
      src/com/jfinal/log/NullLoggerFactory.java
  65. 1 1
      src/com/jfinal/plugin/IPlugin.java
  66. 1 1
      src/com/jfinal/plugin/activerecord/ActiveRecordException.java
  67. 1 1
      src/com/jfinal/plugin/activerecord/ActiveRecordPlugin.java
  68. 1 1
      src/com/jfinal/plugin/activerecord/CPI.java
  69. 1 1
      src/com/jfinal/plugin/activerecord/CaseInsensitiveContainerFactory.java
  70. 7 7
      src/com/jfinal/plugin/activerecord/Db.java
  71. 1 1
      src/com/jfinal/plugin/activerecord/DbKit.java
  72. 1 1
      src/com/jfinal/plugin/activerecord/IAtom.java
  73. 2 2
      src/com/jfinal/plugin/activerecord/ICallback.java
  74. 1 1
      src/com/jfinal/plugin/activerecord/IContainerFactory.java
  75. 1 1
      src/com/jfinal/plugin/activerecord/IDataSourceProvider.java
  76. 8 1
      src/com/jfinal/plugin/activerecord/Model.java
  77. 1 1
      src/com/jfinal/plugin/activerecord/ModelBuilder.java
  78. 1 1
      src/com/jfinal/plugin/activerecord/OneConnectionPerThread.java
  79. 1 1
      src/com/jfinal/plugin/activerecord/Page.java
  80. 8 1
      src/com/jfinal/plugin/activerecord/Record.java
  81. 1 1
      src/com/jfinal/plugin/activerecord/RecordBuilder.java
  82. 1 1
      src/com/jfinal/plugin/activerecord/SqlReporter.java
  83. 1 1
      src/com/jfinal/plugin/activerecord/TableInfo.java
  84. 1 1
      src/com/jfinal/plugin/activerecord/TableInfoBuilder.java
  85. 1 1
      src/com/jfinal/plugin/activerecord/TableInfoMapping.java
  86. 1 1
      src/com/jfinal/plugin/activerecord/cache/EhCache.java
  87. 1 1
      src/com/jfinal/plugin/activerecord/cache/ICache.java
  88. 1 1
      src/com/jfinal/plugin/activerecord/dialect/AnsiSqlDialect.java
  89. 1 1
      src/com/jfinal/plugin/activerecord/dialect/Dialect.java
  90. 1 1
      src/com/jfinal/plugin/activerecord/dialect/MysqlDialect.java
  91. 1 1
      src/com/jfinal/plugin/activerecord/dialect/OracleDialect.java
  92. 1 1
      src/com/jfinal/plugin/activerecord/dialect/PostgreSqlDialect.java
  93. 1 1
      src/com/jfinal/plugin/activerecord/dialect/Sqlite3Dialect.java
  94. 1 1
      src/com/jfinal/plugin/activerecord/tx/Transaction.java
  95. 1 1
      src/com/jfinal/plugin/activerecord/tx/Tx.java
  96. 1 1
      src/com/jfinal/plugin/activerecord/tx/TxByActionKeys.java
  97. 1 1
      src/com/jfinal/plugin/activerecord/tx/TxByRegex.java
  98. 1 1
      src/com/jfinal/plugin/activerecord/tx/TxReadCommitted.java
  99. 1 1
      src/com/jfinal/plugin/activerecord/tx/TxReadUncommitted.java
  100. 0 0
      src/com/jfinal/plugin/activerecord/tx/TxRepeatableRead.java

+ 1 - 1
README.rst

@@ -91,4 +91,4 @@ Blog()这行代码也不是必须)**
 
 Javadoc: http://www.ostools.net/apidocs/apidoc?api=jfinal 
 
-**JFinal 极速开发QQ群欢迎您的加入: 222478625(一号群)、196337924(二号群)、283446146(三号群)**
+**JFinal 极速开发QQ群欢迎您的加入: 283446146、222478625、326297041、196337924**

+ 1 - 1
src/com/jfinal/aop/ActionInvocationWrapper.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/aop/Before.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/aop/ClearInterceptor.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/aop/ClearLayer.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/aop/Interceptor.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/aop/InterceptorStack.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/aop/PrototypeInterceptor.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 6 - 2
src/com/jfinal/config/Constants.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,9 @@
 package com.jfinal.config;
 
 import java.io.File;
+import java.util.HashMap;
 import java.util.Locale;
+import java.util.Map;
 import com.jfinal.core.Const;
 import com.jfinal.kit.PathKit;
 import com.jfinal.kit.StringKit;
@@ -184,10 +186,12 @@ final public class Constants {
 		errorViewMapping.put(403, error403View);
 	}
 	
-	private java.util.Map<Integer, String> errorViewMapping = new java.util.HashMap<Integer, String>();
+	private Map<Integer, String> errorViewMapping = new HashMap<Integer, String>();
+	
 	public void setErrorView(int errorCode, String errorView) {
 		errorViewMapping.put(errorCode, errorView);
 	}
+	
 	public String getErrorView(int errorCode) {
 		return errorViewMapping.get(errorCode);
 	}

+ 1 - 1
src/com/jfinal/config/Handlers.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/config/Interceptors.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/config/JFinalConfig.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/config/Plugins.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/config/Routes.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/Action.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/ActionException.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/ActionHandler.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/ActionInvocation.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/ActionKey.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/ActionMapping.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/ActionRender.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/ActionReporter.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/Config.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 2 - 2
src/com/jfinal/core/Const.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ public interface Const {
 	
 	int DEFAULT_FREEMARKER_TEMPLATE_UPDATE_DELAY = 3600;	// For not devMode only
 	
-	String DEFAULT_TOKEN_NAME = "JFinalDefaultTokenName";
+	String DEFAULT_TOKEN_NAME = "jfinal_token";
 	
 	int DEFAULT_SECONDS_OF_TOKEN_TIME_OUT = 900;			// 900 seconds ---> 15 minutes
 	

+ 82 - 16
src/com/jfinal/core/Controller.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package com.jfinal.core;
 
 import java.io.File;
 import java.text.ParseException;
+import java.util.Date;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Locale;
@@ -255,32 +256,89 @@ public abstract class Controller {
 		return toLong(request.getParameter(name), defaultValue);
 	}
 	
+	private Boolean toBoolean(String value, Boolean defaultValue) {
+		if (value == null || "".equals(value.trim()))
+			return defaultValue;
+		value = value.trim().toLowerCase();
+		if ("1".equals(value) || "true".equals(value))
+			return Boolean.TRUE;
+		else if ("0".equals(value) || "false".equals(value))
+			return Boolean.FALSE;
+		throw new RuntimeException("Can not parse the parameter \"" + value + "\" to boolean value.");
+	}
+	
 	/**
 	 * Returns the value of a request parameter and convert to Boolean.
 	 * @param name a String specifying the name of the parameter
-	 * @return false if the value of the parameter is "false" or "0", true if it is "true" or "1", null if parameter is not exists
+	 * @return true if the value of the parameter is "true" or "1", false if it is "false" or "0", null if parameter is not exists
 	 */
 	public Boolean getParaToBoolean(String name) {
-		String result = request.getParameter(name);
-		if (result != null) {
-			result = result.trim().toLowerCase();
-			if (result.equals("1") || result.equals("true"))
-				return Boolean.TRUE;
-			else if (result.equals("0") || result.equals("false"))
-				return Boolean.FALSE;
-			// return Boolean.FALSE;	// if use this, delete 2 lines code under
-		}
-		return null;
+		return toBoolean(request.getParameter(name), null);
 	}
 	
 	/**
 	 * Returns the value of a request parameter and convert to Boolean with a default value if it is null.
 	 * @param name a String specifying the name of the parameter
-	 * @return false if the value of the parameter is "false" or "0", true if it is "true" or "1", default value if it is null
+	 * @return true if the value of the parameter is "true" or "1", false if it is "false" or "0", default value if it is null
 	 */
 	public Boolean getParaToBoolean(String name, Boolean defaultValue) {
-		Boolean result = getParaToBoolean(name);
-		return result != null ? result : defaultValue;
+		return toBoolean(request.getParameter(name), defaultValue);
+	}
+	
+	/**
+	 * Get all para from url and convert to Boolean
+	 */
+	public Boolean getParaToBoolean() {
+		return toBoolean(getPara(), null);
+	}
+	
+	/**
+	 * Get para from url and conver to Boolean. The first index is 0
+	 */
+	public Boolean getParaToBoolean(int index) {
+		return toBoolean(getPara(index), null);
+	}
+	
+	/**
+	 * Get para from url and conver to Boolean with default value if it is null.
+	 */
+	public Boolean getParaToBoolean(int index, Boolean defaultValue) {
+		return toBoolean(getPara(index), defaultValue);
+	}
+	
+	private Date toDate(String value, Date defaultValue) {
+		if (value == null || "".equals(value.trim()))
+			return defaultValue;
+		try {
+			return new java.text.SimpleDateFormat("yyyy-MM-dd").parse(value);
+		} catch (ParseException e) {
+			throw new RuntimeException(e);
+		}
+	}
+	
+	/**
+	 * Returns the value of a request parameter and convert to Date.
+	 * @param name a String specifying the name of the parameter
+	 * @return a Date representing the single value of the parameter
+	 */
+	public Date getParaToDate(String name) {
+		return toDate(request.getParameter(name), null);
+	}
+	
+	/**
+	 * Returns the value of a request parameter and convert to Date with a default value if it is null.
+	 * @param name a String specifying the name of the parameter
+	 * @return a Date representing the single value of the parameter
+	 */
+	public Date getParaToDate(String name, Date defaultValue) {
+		return toDate(request.getParameter(name), defaultValue);
+	}
+	
+	/**
+	 * Get all para from url and convert to Date
+	 */
+	public Date getParaToDate() {
+		return toDate(getPara(), null);
 	}
 	
 	/**
@@ -755,13 +813,21 @@ public abstract class Controller {
 	}
 	
 	/**
-	 * Create a token with default token name ---> "token" and with default seconds of time out.
+	 * Create a token with default token name and with default seconds of time out.
 	 */
 	public void createToken() {
 		createToken(Const.DEFAULT_TOKEN_NAME, Const.DEFAULT_SECONDS_OF_TOKEN_TIME_OUT);
 	}
 	
 	/**
+	 * Create a token with default seconds of time out.
+	 * @param tokenName the token name used in view
+	 */
+	public void createToken(String tokenName) {
+		createToken(tokenName, Const.DEFAULT_SECONDS_OF_TOKEN_TIME_OUT);
+	}
+	
+	/**
 	 * Check token to prevent resubmit.
 	 * @param tokenName the token name used in view's form
 	 * @return true if token is correct

+ 1 - 1
src/com/jfinal/core/InterceptorBuilder.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/JFinal.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/core/JFinalFilter.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 4 - 17
src/com/jfinal/core/ModelInjector.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ final class ModelInjector {
 		try {
 			model = modelClass.newInstance();
 		} catch (Exception e) {
-			throw new ModelInjectException(e);
+			throw new RuntimeException(e);
 		}
 		
 		if (model instanceof Model)
@@ -71,7 +71,7 @@ final class ModelInjector {
 					method.invoke(model, TypeConverter.convert(types[0], value));
 				} catch (Exception e) {
 					if (skipConvertError == false)
-					throw new ModelInjectException(e);
+					throw new RuntimeException(e);
 				}
 			}
 		}
@@ -98,23 +98,10 @@ final class ModelInjector {
 					model.set(paraName, value);
 				} catch (Exception ex) {
 					if (skipConvertError == false)
-						throw new ModelInjectException("Can not convert parameter: " + modelNameAndDot + paraName, ex);
+						throw new RuntimeException("Can not convert parameter: " + modelNameAndDot + paraName, ex);
 				}
 			}
 		}
 	}
 }
 
-class ModelInjectException extends RuntimeException {
-	
-	private static final long serialVersionUID = 867623224283092808L;
-	
-	public ModelInjectException(Throwable cause) {
-		super(cause);
-	}
-	
-	public ModelInjectException(String message, Throwable cause) {
-		super(message, cause);
-	}
-}
-

+ 10 - 5
src/com/jfinal/core/TypeConverter.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -37,8 +37,9 @@ final class TypeConverter {
 	 * 3: 需要考 model中的 string属性,在传过来 "" 时是该转成 null还是不该转换,
 	 *    我想, 因为用户没有输入那么肯定是 null, 而不该是 ""
 	 * 
-	 * 注意: 当clazz参数不为String.class, 且参数s为空串blank的情况,
+	 * 注意: 1:当clazz参数不为String.class, 且参数s为空串blank的情况,
 	 *       此情况下转换结果为 null, 而不应该抛出异常
+	 *      2:调用者需要对被转换数据做 null 判断,参见 ModelInjector 的两处调用
 	 */
 	public static final Object convert(Class<?> clazz, String s) throws ParseException {
 		// mysql type: varchar, char, enum, set, text, tinytext, mediumtext, longtext
@@ -62,7 +63,7 @@ final class TypeConverter {
 		}
 		// 经测试java.util.Data类型不会返回, java.sql.Date, java.sql.Time,java.sql.Timestamp 全部直接继承自 java.util.Data, 所以 getDate可以返回这三类数据
 		else if (clazz == java.util.Date.class) {
-        	if (s.length() >= timeStampLen) {
+        	if (s.length() >= timeStampLen) {	// if (x < timeStampLen) 改用 datePattern 转换,更智能
         		// Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
         		// result = new java.util.Date(java.sql.Timestamp.valueOf(s).getTime());	// error under jdk 64bit(maybe)
         		result = new SimpleDateFormat(timeStampPattern).parse(s);
@@ -74,7 +75,7 @@ final class TypeConverter {
         }
 		// mysql type: date, year
         else if (clazz == java.sql.Date.class) {
-        	if (s.length() >= timeStampLen) {
+        	if (s.length() >= timeStampLen) {	// if (x < timeStampLen) 改用 datePattern 转换,更智能
         		// result = new java.sql.Date(java.sql.Timestamp.valueOf(s).getTime());	// error under jdk 64bit(maybe)
         		result = new java.sql.Date(new SimpleDateFormat(timeStampPattern).parse(s).getTime());
         	}
@@ -101,12 +102,16 @@ final class TypeConverter {
 		}
 		// mysql type: bit, tinyint(1)
         else if (clazz == Boolean.class) {
-        	result = Boolean.parseBoolean(s);
+        	result = Boolean.parseBoolean(s) || "1".equals(s);
 		}
 		// mysql type: decimal, numeric
         else if (clazz == java.math.BigDecimal.class) {
         	result = new java.math.BigDecimal(s);
 		}
+		// mysql type: unsigned bigint
+		else if (clazz == java.math.BigInteger.class) {
+			result = new java.math.BigInteger(s);
+		}
 		// mysql type: binary, varbinary, tinyblob, blob, mediumblob, longblob. I have not finished the test.
         else if (clazz == byte[].class) {
 			result = s.getBytes();

+ 1 - 1
src/com/jfinal/ext/handler/ContextPathHandler.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/ext/handler/FakeStaticHandler.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/ext/handler/RoutesHandler.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/ext/handler/ServerNameRedirect301Handler.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/ext/handler/UrlSkipHandler.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 16 - 0
src/com/jfinal/ext/interceptor/GET.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package com.jfinal.ext.interceptor;
 
 import com.jfinal.aop.Interceptor;

+ 1 - 1
src/com/jfinal/ext/interceptor/LogInterceptor.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/ext/interceptor/NoUrlPara.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 16 - 0
src/com/jfinal/ext/interceptor/POST.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package com.jfinal.ext.interceptor;
 
 import com.jfinal.aop.Interceptor;

+ 16 - 0
src/com/jfinal/ext/interceptor/Restful.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package com.jfinal.ext.interceptor;
 
 import java.util.HashSet;

+ 1 - 1
src/com/jfinal/ext/interceptor/SessionInViewInterceptor.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/ext/kit/DateKit.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/ext/kit/SessionIdKit.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 0 - 5
src/com/jfinal/ext/plugin/redis/RedisKit.java

@@ -1,5 +0,0 @@
-package com.jfinal.ext.plugin.redis;
-
-public class RedisKit {
-	
-}

+ 0 - 14
src/com/jfinal/ext/plugin/redis/RedisPlugin.java

@@ -1,14 +0,0 @@
-package com.jfinal.ext.plugin.redis;
-
-import com.jfinal.plugin.IPlugin;
-
-public class RedisPlugin implements IPlugin {
-	
-	public boolean start() {
-		throw new RuntimeException("Not finish!!!");
-	}
-	
-	public boolean stop() {
-		throw new RuntimeException("Not finish!!!");
-	}
-}

+ 0 - 11
src/com/jfinal/ext/plugin/shiro/ShiroInterceptor.java

@@ -1,11 +0,0 @@
-package com.jfinal.ext.plugin.shiro;
-
-import com.jfinal.aop.Interceptor;
-import com.jfinal.core.ActionInvocation;
-
-public class ShiroInterceptor implements Interceptor {
-	
-	public void intercept(ActionInvocation ai) {
-		throw new RuntimeException("Not finish!!!");
-	}
-}

+ 0 - 14
src/com/jfinal/ext/plugin/shiro/ShiroPlugin.java

@@ -1,14 +0,0 @@
-package com.jfinal.ext.plugin.shiro;
-
-import com.jfinal.plugin.IPlugin;
-
-public class ShiroPlugin implements IPlugin {
-	
-	public boolean start() {
-		throw new RuntimeException("Not finish!!!");
-	}
-	
-	public boolean stop() {
-		throw new RuntimeException("Not finish!!!");
-	}
-}

+ 1 - 1
src/com/jfinal/ext/render/CaptchaRender.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 16 - 0
src/com/jfinal/ext/render/StaticHtmlRender.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package com.jfinal.ext.render;
 
 import com.jfinal.render.Render;

+ 1 - 1
src/com/jfinal/handler/Handler.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/handler/HandlerFactory.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/i18n/I18N.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/kit/FileKit.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/kit/HandlerKit.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 27 - 3
src/com/jfinal/kit/JsonKit.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
 package com.jfinal.kit;
 
 import java.lang.reflect.Method;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -40,6 +41,8 @@ import com.jfinal.plugin.activerecord.Record;
 public class JsonKit {
 	
 	private static int convertDepth = 8;
+	private static String timestampPattern = "yyyy-MM-dd HH:mm:ss";
+	private static String datePattern = "yyyy-MM-dd";
 	
 	public static void setConvertDepth(int convertDepth) {
 		if (convertDepth < 2)
@@ -47,6 +50,18 @@ public class JsonKit {
 		JsonKit.convertDepth = convertDepth;
 	}
 	
+	public static void setTimestampPattern(String timestampPattern) {
+		if (timestampPattern == null || "".equals(timestampPattern.trim()))
+			throw new IllegalArgumentException("timestampPattern can not be blank.");
+		JsonKit.timestampPattern = timestampPattern;
+	}
+	
+	public static void setDatePattern(String datePattern) {
+		if (datePattern == null || "".equals(datePattern.trim()))
+			throw new IllegalArgumentException("datePattern can not be blank.");
+		JsonKit.datePattern = datePattern;
+	}
+	
 	public static String mapToJson(Map map, int depth) {
 		if(map == null)
 			return "null";
@@ -194,6 +209,14 @@ public class JsonKit {
 		if(value instanceof Boolean)
 			return value.toString();
 		
+		if (value instanceof java.util.Date) {
+			if (value instanceof java.sql.Timestamp)
+				return "\"" + new SimpleDateFormat(timestampPattern).format(value) + "\"";
+			if (value instanceof java.sql.Time)
+				return "\"" + value.toString() + "\"";
+			return "\"" + new SimpleDateFormat(datePattern).format(value) + "\"";
+		}
+		
 		if(value instanceof Map) {
 			return mapToJson((Map)value, depth);
 		}
@@ -212,8 +235,9 @@ public class JsonKit {
 	}
 	
 	private static String otherToJson(Object value, int depth) {
-		if (value instanceof java.util.Date || value instanceof Character)
-			return null;
+		if (value instanceof Character) {
+			return "\"" + escape(value.toString()) + "\"";
+		}
 		
 		if (value instanceof Model) {
 			Map map = com.jfinal.plugin.activerecord.CPI.getAttrs((Model)value);

+ 1 - 1
src/com/jfinal/kit/PathKit.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/kit/StringKit.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/log/ILoggerFactory.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/log/JdkLogger.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/log/JdkLoggerFactory.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/log/Log4jLogger.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/log/Log4jLoggerFactory.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/log/Logger.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/log/NullLoggerFactory.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/IPlugin.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/ActiveRecordException.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/ActiveRecordPlugin.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/CPI.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/CaseInsensitiveContainerFactory.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 7 - 7
src/com/jfinal/plugin/activerecord/Db.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -735,8 +735,8 @@ public class Db {
 	/**
 	 * @see #execute(DataSource, ICallback)
 	 */
-	public static void execute(ICallback callback) {
-		execute(DbKit.getDataSource(), callback);
+	public static Object execute(ICallback callback) {
+		return execute(DbKit.getDataSource(), callback);
 	}
 	
 	/**
@@ -744,11 +744,11 @@ public class Db {
 	 * @param dataSource the DataSource for this query
 	 * @param callback the ICallback interface
 	 */
-	public static void execute(DataSource dataSource, ICallback callback) {
+	public static Object execute(DataSource dataSource, ICallback callback) {
 		Connection conn = null;
 		try {
 			conn = dataSource.getConnection();
-			callback.run(conn);
+			return callback.run(conn);
 		} catch (Exception e) {
 			throw new ActiveRecordException(e);
 		} finally {
@@ -762,7 +762,7 @@ public class Db {
 	 * @param atom the atom operation
 	 * @return true if transaction executing succeed otherwise false
 	 */
-	public  static boolean tx(int transactionLevel, IAtom atom) {
+	public static boolean tx(int transactionLevel, IAtom atom) {
 		Connection conn = DbKit.getThreadLocalConnection();
 		if (conn != null) {	// Nested transaction support
 			try {
@@ -794,7 +794,7 @@ public class Db {
 		} catch (Exception e) {
 			if (conn != null)
 				try {conn.rollback();} catch (Exception e1) {e1.printStackTrace();}
-			return false;	// throw new ActiveRecordException(e);
+			throw e instanceof RuntimeException ? (RuntimeException)e : new ActiveRecordException(e);
 		} finally {
 			try {
 				if (conn != null) {

+ 1 - 1
src/com/jfinal/plugin/activerecord/DbKit.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/IAtom.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 2 - 2
src/com/jfinal/plugin/activerecord/ICallback.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,5 +28,5 @@ public interface ICallback {
 	 * Place codes here that need call back by active record plugin.
 	 * @param conn the JDBC Connection, you need't close this connection after used it, active record plugin will close it automatically
 	 */
-	void run(Connection conn) throws SQLException;
+	Object run(Connection conn) throws SQLException;
 }

+ 1 - 1
src/com/jfinal/plugin/activerecord/IContainerFactory.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/IDataSourceProvider.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 8 - 1
src/com/jfinal/plugin/activerecord/Model.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -123,6 +123,13 @@ public abstract class Model<M extends Model> implements Serializable {
 		return (Long)attrs.get(attr);
 	}
 	
+	/**
+	 * Get attribute of mysql type: unsigned bigint
+	 */
+	public java.math.BigInteger getBigInteger(String attr) {
+		return (java.math.BigInteger)attrs.get(attr);
+	}
+	
 	// java.util.Data never returned
 	// public java.util.Date getDate(String attr) {
 		// return attrs.get(attr);

+ 1 - 1
src/com/jfinal/plugin/activerecord/ModelBuilder.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/OneConnectionPerThread.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/Page.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 8 - 1
src/com/jfinal/plugin/activerecord/Record.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -178,6 +178,13 @@ public class Record implements Serializable {
 	}
 	
 	/**
+	 * Get column of mysql type: unsigned bigint
+	 */
+	public java.math.BigInteger getBigInteger(String column) {
+		return (java.math.BigInteger)columns.get(column);
+	}
+	
+	/**
 	 * Get column of mysql type: date, year
 	 */
 	public java.sql.Date getDate(String column) {

+ 1 - 1
src/com/jfinal/plugin/activerecord/RecordBuilder.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/SqlReporter.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/TableInfo.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/TableInfoBuilder.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/TableInfoMapping.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/cache/EhCache.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/cache/ICache.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/dialect/AnsiSqlDialect.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/dialect/Dialect.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/dialect/MysqlDialect.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/dialect/OracleDialect.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/dialect/PostgreSqlDialect.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/dialect/Sqlite3Dialect.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/tx/Transaction.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/tx/Tx.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/tx/TxByActionKeys.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/tx/TxByRegex.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/tx/TxReadCommitted.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 1 - 1
src/com/jfinal/plugin/activerecord/tx/TxReadUncommitted.java

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2011-2012, James Zhan 詹波 (jfinal@126.com).
+ * Copyright (c) 2011-2013, James Zhan 詹波 (jfinal@126.com).
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

+ 0 - 0
src/com/jfinal/plugin/activerecord/tx/TxRepeatableRead.java


Some files were not shown because too many files changed in this diff