├── .gitignore
├── LICENSE
├── README.md
├── axelor-demo-01
├── .gitignore
├── .idea
│ ├── .gitignore
│ ├── codeStyles
│ │ └── codeStyleConfig.xml
│ ├── gradle.xml
│ ├── jarRepositories.xml
│ ├── misc.xml
│ └── vcs.xml
├── README.md
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
│ └── main
│ └── resources
│ ├── META-INF
│ └── persistence.xml
│ └── application.properties
├── axelor-demo-02
├── .gitignore
├── .idea
│ ├── .gitignore
│ ├── codeStyles
│ │ └── codeStyleConfig.xml
│ ├── gradle.xml
│ ├── jarRepositories.xml
│ ├── misc.xml
│ └── vcs.xml
├── README.md
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── modules
│ └── librarian
│ │ ├── build.gradle
│ │ └── src
│ │ ├── license
│ │ └── header.txt
│ │ └── main
│ │ └── resources
│ │ ├── domains
│ │ └── Entities.xml
│ │ └── views
│ │ ├── BookView.xml
│ │ └── Menu.xml
├── settings.gradle
└── src
│ └── main
│ └── resources
│ ├── META-INF
│ └── persistence.xml
│ └── application.properties
├── axelor-demo-03
├── .gitignore
├── README.md
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── modules
│ └── librarian
│ │ ├── build.gradle
│ │ └── src
│ │ └── main
│ │ ├── java
│ │ └── mingshu
│ │ │ └── librarian
│ │ │ ├── LibrarianModule.java
│ │ │ ├── db
│ │ │ └── repo
│ │ │ │ ├── BookRepository.java
│ │ │ │ └── ReaderRepository.java
│ │ │ ├── service
│ │ │ ├── BorrowingService.java
│ │ │ ├── BorrowingServiceImpl.java
│ │ │ ├── ReaderService.java
│ │ │ └── ReaderServiceImpl.java
│ │ │ └── web
│ │ │ ├── BorrowingController.java
│ │ │ └── ReaderController.java
│ │ └── resources
│ │ ├── domains
│ │ ├── Entities.xml
│ │ └── User.xml
│ │ └── views
│ │ ├── BookView.xml
│ │ ├── BorrowingView.xml
│ │ ├── Menu.xml
│ │ ├── ReaderView.xml
│ │ └── User.xml
├── settings.gradle
└── src
│ ├── license
│ └── header.txt
│ └── main
│ └── resources
│ ├── META-INF
│ └── persistence.xml
│ └── application.properties
├── axelor-demo-04
├── .gitignore
├── README.md
├── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── modules
│ └── librarian
│ │ ├── build.gradle
│ │ └── src
│ │ └── main
│ │ ├── java
│ │ └── mingshu
│ │ │ └── librarian
│ │ │ ├── LibrarianModule.java
│ │ │ ├── db
│ │ │ └── repo
│ │ │ │ ├── BookRepository.java
│ │ │ │ └── ReaderRepository.java
│ │ │ ├── service
│ │ │ ├── BorrowingService.java
│ │ │ ├── BorrowingServiceImpl.java
│ │ │ ├── ReaderService.java
│ │ │ └── ReaderServiceImpl.java
│ │ │ └── web
│ │ │ ├── BorrowingController.java
│ │ │ └── ReaderController.java
│ │ └── resources
│ │ ├── domains
│ │ ├── Entities.xml
│ │ └── User.xml
│ │ └── views
│ │ ├── BookView.xml
│ │ ├── BorrowingView.xml
│ │ ├── Menu.xml
│ │ ├── ReaderView.xml
│ │ └── User.xml
├── settings.gradle
└── src
│ ├── license
│ └── header.txt
│ └── main
│ └── resources
│ ├── META-INF
│ └── persistence.xml
│ └── application.properties
└── python-samples
└── axelor-web-service-demo.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Gradle GUI config
2 | gradle-app.setting
3 |
4 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
5 | !gradle-wrapper.jar
6 |
7 | # Cache of project
8 | .gradletasknamecache
9 |
10 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
11 | # gradle/wrapper/gradle-wrapper.properties
12 | #
13 |
14 | bin
15 | build
16 | .gradle
17 | .project
18 | .classpath
19 | .settings
20 | node_modules
21 | application.min.*
22 | *.sw[nop]
23 | *~
24 | .#*
25 | [#]*#
26 | .metadata/
27 | .idea/
28 | out/
29 | *.iml
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020-2021 云南伴星科技有限公司
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # axelor-cookbook-samples
2 |
3 | Axelor 教程代码范例仓库,本仓库保存“命叔杂技”视频专栏《Axelor 开发系列教程》的实例代码。
4 |
5 | 本项目的 `build.gradle` 中引用了作者提供的 Axelor 开发平台汉化版:
6 |
7 | https://github.com/axelor-l10n-cn
8 |
9 | 请确保网络可以访问 GitHub 的内容,自己的项目可参考如何使用汉化版。
10 |
11 | 任何问题可进 QQ 群 1048161339 讨论。
12 |
13 | # 视频教程在线观看:
14 |
15 | * Youtube: https://www.youtube.com/watch?v=wegQWkt3vDg&list=PLlQK_EEIm_sWj-BvmcOcj8klPX2M96aF9
16 | * Bilibili: https://space.bilibili.com/26188820/channel/detail?cid=103191
17 | * 西瓜视频: https://www.ixigua.com/pseries/6791677568144638477
18 |
19 | # 编译环境需求
20 |
21 | * Java JDK8(必须 Java8)
22 | * Gradle 5.6+(必须,但必须 <= 6.3,6.4 无法运行)
23 | * Intellij IDEA(可选)
24 |
25 | # 命令行编译运行
26 |
27 | 进入各个例子的目录,执行:
28 |
29 | ## Windows
30 |
31 | ```cmd
32 | .\gradlew.bat run
33 | ```
34 |
35 | ## Linux & MacOSX
36 |
37 | ```bash
38 | ./gradlew run
39 | ```
40 |
41 | 启动完成以后命令行日志会提示服务器 URL,用浏览器打开即可,默认用户名、密码:`admin`和`admin`。
42 |
43 | # FAQ
44 |
45 | * **Q:编译时出现错误,`generateCode` 任务生成的代码报“注释未结束”的错误。** A:升级机器上的 Gradle 到 6.0 或更高版本可解决。
46 |
47 |
--------------------------------------------------------------------------------
/axelor-demo-01/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .gradle
3 |
--------------------------------------------------------------------------------
/axelor-demo-01/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /workspace.xml
--------------------------------------------------------------------------------
/axelor-demo-01/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/axelor-demo-01/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/axelor-demo-01/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/axelor-demo-01/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/axelor-demo-01/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/axelor-demo-01/README.md:
--------------------------------------------------------------------------------
1 | # Axelor 开发教程视频 EP02 配套示例代码
2 |
3 | 各大视频网站搜索“命叔炸机”即可免费观看独家 Axelor 开发教程。
4 |
--------------------------------------------------------------------------------
/axelor-demo-01/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.repos = {
3 |
4 | // 最优先检查本地 Maven 仓库
5 | mavenLocal()
6 |
7 | // 这行放在上面,优先使用命叔叔 Github 仓库提供的汉化过的 Axelor 框架
8 | maven {
9 | url uri("https://raw.githubusercontent.com/axelor-l10n-cn/axelor-open-platform-l10n-cn-mvn/master/mvn-repo")
10 | }
11 |
12 | // 公共仓库优先使用阿里云的
13 | maven { url 'https://maven.aliyun.com/repository/central' }
14 | maven { url 'https://maven.aliyun.com/repository/jcenter'}
15 | maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
16 |
17 |
18 | // 使用 Axelor 官方的 Repo 放在下面,以便补充缺少的 JAR
19 | maven { url 'https://repository.axelor.com/nexus/public/' }
20 |
21 | // 原始的 Maven 仓库放在最后,可以不用,因为阿里云的仓库是镜像同步的
22 | /*
23 | mavenCentral()
24 | jcenter()
25 | maven { url 'https://plugins.gradle.org/m2/'}
26 | */
27 | }
28 | repositories repos
29 | dependencies {
30 | classpath 'com.axelor:axelor-gradle:5.3.0-SNAPSHOT'
31 | }
32 | }
33 |
34 | allprojects {
35 | repositories repos
36 | }
37 |
38 | apply plugin: 'com.axelor.app'
39 |
40 | axelor {
41 | title = 'Demo 01'
42 | }
43 |
44 | allprojects {
45 | apply plugin: 'idea'
46 | group 'mingshu'
47 | version '1.0-SNAPSHOT'
48 |
49 | sourceCompatibility = 1.8
50 | targetCompatibility = 1.8
51 | }
52 |
53 | dependencies {
54 | //compile project(":modules:sales")
55 | }
56 |
57 | wrapper {
58 | gradleVersion = "5.6.4"
59 | }
60 |
61 |
--------------------------------------------------------------------------------
/axelor-demo-01/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.daemon=false
--------------------------------------------------------------------------------
/axelor-demo-01/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldrev/axelor-cookbook-samples/3a04160fa2d4c7e90fb8e9957c702966c19b9145/axelor-demo-01/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/axelor-demo-01/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/axelor-demo-01/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/axelor-demo-01/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/axelor-demo-01/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'axelor-demo-01'
2 |
3 | //include "modules:sales"
4 |
--------------------------------------------------------------------------------
/axelor-demo-01/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | org.hibernate.jpa.HibernatePersistenceProvider
7 | ENABLE_SELECTIVE
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/axelor-demo-01/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # Application Information
2 | # ~~~~~
3 | application.name = Axelor Demo 01
4 | application.description = Axelor Demo by Uncle Ming Channel
5 | application.version = 0.1.0
6 |
7 | # Author/Company
8 | # ~~~~~
9 | application.author = Uncle Ming Channel
10 | application.copyright = Copyright (c) {year} Uncle Ming Channel. All Rights Reserved.
11 |
12 | # Header Logo
13 | # ~~~~~
14 | # Should be 40px in height with transparent background
15 | application.logo =
16 |
17 | # Home Website
18 | # ~~~~~
19 | # Link to be used with header logo
20 | application.home = https://www.youtube.com/channel/UC8nM1uN2Ii9bC0nDAoOQa3g
21 |
22 | # Link to the online help
23 | # ~~~~~
24 | application.help = https://www.youtube.com/channel/UC8nM1uN2Ii9bC0nDAoOQa3g
25 |
26 | # Application deployment mode
27 | # ~~~~~
28 | # Set to 'dev' for development mode else 'prod'
29 | application.mode = dev
30 |
31 | # CSS Theme
32 | # ~~~~~
33 | # Set default CSS theme, for example `blue`
34 | application.theme =
35 |
36 | # Default Locale (language)
37 | # ~~~~~
38 | # Set default application locale (en, fr, fr_FR, en_US)
39 | application.locale = zh_CN
40 |
41 | # Encryption
42 | # ~~~~~
43 | # Set encryption password
44 | #encryption.password = MySuperSecretKey
45 |
46 | # Set encryption algorithm (CBC or GCM)
47 | #encryption.algorithm = CBC
48 |
49 | # Database settings
50 | # ~~~~~
51 | # See hibernate documentation for connection parameters
52 |
53 | # HERE
54 | # PostgreSQL
55 | db.default.driver = org.postgresql.Driver
56 | db.default.ddl = update
57 | db.default.url = jdbc:postgresql://localhost:5432/axelor-demo-01-db
58 | db.default.user = mingming
59 | db.default.password = mingming
60 |
61 | # MySQL
62 | #db.default.driver = com.mysql.jdbc.Driver
63 | #db.default.ddl = update
64 | #db.default.url = jdbc:mysql://localhost:3306/axelor_demo_dev
65 | #db.default.user = axelor
66 | #db.default.password =
67 |
68 | # Oracle
69 | #db.default.driver = oracle.jdbc.OracleDriver
70 | #db.default.ddl = update
71 | #db.default.url = jdbc:oracle:thin:@localhost:1521:oracle
72 | #db.default.user = axelor
73 | #db.default.password =
74 |
75 | # Date Format
76 | # ~~~~~
77 | date.format = yyyy/MM/dd
78 |
79 | # Timezone
80 | # ~~~~~
81 | date.timezone = Asia/Shanghai
82 |
83 | # Session timeout (in minutes)
84 | # ~~~~~
85 | session.timeout = 60
86 |
87 | # Storage path for upload files (attachments)
88 | # ~~~~~
89 | # use {user.home} key to save files under user home directory, or
90 | # use absolute path where server user have write permission.
91 | file.upload.dir = {user.home}/.axelor/attachments
92 |
93 | # Upload filename pattern, default is auto where file is save with same name
94 | # in the given upload dir, if file is already there, a count number is
95 | # appended to file name.
96 | #
97 | # This can be overridden by providing custom name pattern, for example:
98 | #
99 | # file.upload.filename.pattern = {year}-{month}/{day}/{name}
100 | # file.upload.filename.pattern = {AA}/{name}
101 | #
102 | # Following placeholders can be used:
103 | #
104 | # {year} - current year
105 | # {month} - current month
106 | # {day} - current day
107 | # {name} - file name
108 | # {A} - first letter from file name
109 | # {AA} - first 2 letter from file name
110 | # {AAA} - first 3 letter from file name
111 | #
112 | #file.upload.filename.pattern = {year}-{month}/{day}/{name}
113 |
114 | # Maximum upload size (in MB)
115 | # ~~~~~
116 | file.upload.size = 5
117 |
118 | # Whitelist pattern can be used to allow file upload with matching names.
119 | #
120 | # For example: \\.(xml|html|jpg|png|pdf|xsl)$
121 | #
122 | # Regular expression
123 | # ~~~~~
124 | #file.upload.whitelist.pattern =
125 |
126 | # Blacklist pattern can be used to block file upload with matching names.
127 | #
128 | # Regular expression
129 | # ~~~~~
130 | #file.upload.blacklist.pattern =
131 |
132 | # Whitelist content type can be used to allow file upload with matching content.
133 | #
134 | # List of mime-types (plain/text,image/*,video/webm)
135 | # ~~~~~
136 | #file.upload.whitelist.types =
137 |
138 | # Blacklist content type can be used to block file upload with matching content.
139 | #
140 | # List of mime-types (plain/text,image/*,video/webm)
141 | # ~~~~~
142 | #file.upload.blacklist.types =
143 |
144 | # The external report design directory
145 | # ~~~~~
146 | # this directory is searched for the rptdesign files
147 | # (fallbacks to designs provided by modules)
148 | reports.design.dir = {user.home}/.axelor/reports
149 |
150 | # Storage path for report outputs
151 | reports.output.dir = {user.home}/.axelor/reports-gen
152 |
153 | # Data export (csv) encoding
154 | # ~~~~
155 | # Use Windows-1252, ISO-8859-1 or ISO-8859-15 if targeting ms excel
156 | # (excel does not recognize utf8 encoded csv)
157 | data.export.encoding = UTF-8
158 |
159 | # Storage path for export action
160 | # ~~~~~
161 | data.export.dir = {user.home}/.axelor/data-export
162 |
163 | # Specify whether to import demo data
164 | # ~~~~~
165 | data.import.demo-data = true
166 |
167 | # Storage path for templates
168 | # ~~~~~
169 | template.search.dir = {user.home}/.axelor/templates
170 |
171 | # LDAP Configuration
172 | # ~~~~~
173 | #ldap.server.url = ldap://localhost:10389
174 |
175 | # can be "simple" or "CRAM-MD5"
176 | ldap.auth.type = simple
177 |
178 | ldap.system.user = uid=admin,ou=system
179 | ldap.system.password = secret
180 |
181 | # group search base
182 | ldap.group.base = ou=groups,dc=example,dc=com
183 |
184 | # if set, create groups on ldap server under ldap.group.base
185 | #ldap.group.object.class = groupOfUniqueNames
186 |
187 | # a template to search groups by user login id
188 | ldap.group.filter = (uniqueMember=uid={0})
189 |
190 | # user search base
191 | ldap.user.base = ou=users,dc=example,dc=com
192 |
193 | # a template to search user by user login id
194 | ldap.user.filter = (uid={0})
195 |
196 | # CAS configuration
197 | # ~~~~~
198 | #auth.cas.server.url.prefix = https://localhost:8443/cas
199 |
200 | # use public accessible url
201 | #auth.cas.service = http://localhost:8080/axelor-demo/cas
202 |
203 | # login url, if not given prepared from server & service url
204 | #auth.cas.login.url = https://localhost:8443/cas/login?service=http://localhost:8080/axelor-demo/cas
205 |
206 | # logout url, if not given prepared from server & service url
207 | #auth.cas.logout.url = https://localhost:8443/cas/logout?service=http://localhost:8080/axelor-demo/
208 |
209 | # CAS validation protocol (CAS, SAML)
210 | #auth.cas.protocol = SAML
211 |
212 | # the attribute to map to user display name
213 | #auth.cas.attrs.user.name = name
214 |
215 | # the attribute to map to user email
216 | #auth.cas.attrs.user.email = mail
217 |
218 | # Quartz Scheduler
219 | # ~~~~~
220 | # quartz job scheduler
221 |
222 | # Specify whether to enable quartz scheduler
223 | quartz.enable = false
224 |
225 | # total number of threads in quartz thread pool
226 | # the number of jobs that can run simultaneously
227 | quartz.threadCount = 3
228 |
229 | # SMPT configuration
230 | # ~~~~~
231 | # SMTP server configuration
232 | #mail.smtp.host = smtp.gmail.com
233 | #mail.smtp.port = 587
234 | #mail.smtp.channel = starttls
235 | #mail.smtp.user = user@gmail.com
236 | #mail.smtp.pass = secret
237 |
238 | # timeout settings
239 | #mail.smtp.timeout = 60000
240 | #mail.smtp.connectionTimeout = 60000
241 |
242 | # IMAP configuration
243 | # ~~~~~
244 | # IMAP server configuration
245 | # (quartz scheduler should be enabled for fetching stream replies)
246 | #mail.imap.host = imap.gmail.com
247 | #mail.imap.port = 993
248 | #mail.imap.channel = ssl
249 | #mail.imap.user = user@gmail.com
250 | #mail.imap.pass = secret
251 |
252 | # timeout settings
253 | #mail.imap.timeout = 60000
254 | #mail.imap.connectionTimeout = 60000
255 |
256 | # CORS configuration
257 | # ~~~~~
258 | # CORS settings to allow cross origin requests
259 |
260 | # regular expression to test allowed origin or * to allow all (not recommended)
261 | #cors.allow.origin = *
262 | #cors.allow.credentials = true
263 | #cors.allow.methods = GET,PUT,POST,DELETE,HEAD,OPTIONS
264 | #cors.allow.headers = Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers
265 |
266 | # View configuration
267 | # ~~~~~
268 |
269 | # Set to true to enable single view mode
270 | view.single.tab = false
271 |
272 | # Set menu style (left, top, both)
273 | view.menubar.location = both
274 |
275 | # HERE
276 | view.toolbar.titles = true
277 |
278 | # Advance Filter Sharing
279 | # ~~~~~
280 | # Set to false to hide advance search filter share option, or set to list of
281 | # role names to enable share for those roles only.
282 | #view.adv-search.share = share-filter,can-share-filter
283 |
284 | # Logging
285 | # ~~~~~
286 | # Custom logback configuration can be provided with `logging.config` property pointing
287 | # to a custom `logback.xml`. In this case, all the logging configuration provided here
288 | # will be ignored.
289 | #
290 | # Following settings can be used to configure logging system automatically.
291 | #
292 | #logging.path = {user.home}/.axelor/logs
293 | #logging.pattern.file = %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%t] %-40.40logger{39} : %m%n
294 | #logging.pattern.console = %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n
295 |
296 | # Global logging
297 | logging.level.root = ERROR
298 |
299 | # Axelor logging
300 |
301 | # Log everything.
302 | logging.level.com.axelor = INFO
303 |
304 | # Hibernate logging
305 |
306 | # Log everything. Good for troubleshooting
307 | #logging.level.org.hibernate = INFO
308 |
309 | # Log all SQL DML statements as they are executed
310 | #logging.level.org.hibernate.SQL = DEBUG
311 | #logging.level.org.hibernate.engine.jdbc = DEBUG
312 |
313 | # Log all SQL DDL statements as they are executed
314 | #logging.level.org.hibernate.tool.hbm2ddl = INFO
315 |
316 | # Log all JDBC parameters
317 | #logging.level.org.hibernate.type = ALL
318 |
319 | # Log transactions
320 | #logging.level.org.hibernate.transaction = DEBUG
321 |
322 | # Log L2-Cache
323 | #logging.level.org.hibernate.cache = DEBUG
324 |
325 | # Log JDBC resource acquisition
326 | #logging.level.org.hibernate.jdbc = TRACE
327 | #logging.level.org.hibernate.service.jdbc = TRACE
328 |
329 | # Log connection pooling
330 | #logging.level.com.zaxxer.hikari = INFO
331 |
--------------------------------------------------------------------------------
/axelor-demo-02/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .gradle
3 |
--------------------------------------------------------------------------------
/axelor-demo-02/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /workspace.xml
--------------------------------------------------------------------------------
/axelor-demo-02/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/axelor-demo-02/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/axelor-demo-02/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/axelor-demo-02/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/axelor-demo-02/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/axelor-demo-02/README.md:
--------------------------------------------------------------------------------
1 | # Axelor 开发教程视频 EP03 配套示例代码
2 |
3 | 各大视频网站搜索“命叔炸机”即可免费观看独家 Axelor 开发教程。
4 |
--------------------------------------------------------------------------------
/axelor-demo-02/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.repos = {
3 |
4 | // 最优先检查本地 Maven 仓库
5 | mavenLocal()
6 |
7 | // 这行放在上面,优先使用命叔叔 Github 仓库提供的汉化过的 Axelor 框架
8 | maven {
9 | url uri("https://raw.githubusercontent.com/axelor-l10n-cn/axelor-open-platform-l10n-cn-mvn/master/mvn-repo")
10 | }
11 |
12 |
13 | // 公共仓库优先使用阿里云的
14 | maven { url 'https://maven.aliyun.com/repository/central' }
15 | maven { url 'https://maven.aliyun.com/repository/jcenter'}
16 | maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
17 |
18 |
19 | // 使用 Axelor 官方的 Repo 放在下面,以便补充缺少的 JAR
20 | maven { url 'https://repository.axelor.com/nexus/public/' }
21 |
22 | // 原始的 Maven 仓库放在最后,可以不用,因为阿里云的仓库是镜像同步的
23 | /*
24 | mavenCentral()
25 | jcenter()
26 | maven { url 'https://plugins.gradle.org/m2/'}
27 | */
28 | }
29 | repositories repos
30 | dependencies {
31 | classpath 'com.axelor:axelor-gradle:5.3.0-SNAPSHOT'
32 | }
33 | }
34 |
35 | allprojects {
36 | repositories repos
37 | }
38 |
39 | apply plugin: 'com.axelor.app'
40 |
41 | axelor {
42 | title = 'Demo 02'
43 | }
44 |
45 | allprojects {
46 | apply plugin: 'idea'
47 | group 'mingshu'
48 | version '1.0-SNAPSHOT'
49 |
50 | sourceCompatibility = 1.8
51 | targetCompatibility = 1.8
52 | }
53 |
54 | dependencies {
55 | compile project(":modules:librarian")
56 | }
57 |
58 | wrapper {
59 | gradleVersion = "5.6.4"
60 | }
61 |
--------------------------------------------------------------------------------
/axelor-demo-02/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.daemon=false
--------------------------------------------------------------------------------
/axelor-demo-02/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldrev/axelor-cookbook-samples/3a04160fa2d4c7e90fb8e9957c702966c19b9145/axelor-demo-02/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/axelor-demo-02/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/axelor-demo-02/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/axelor-demo-02/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/axelor-demo-02/modules/librarian/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.axelor.app-module'
2 |
3 | axelor {
4 | title "Library Management System"
5 | version "0.1.0"
6 | description ""
7 | removable = true
8 | }
9 |
10 | dependencies {
11 |
12 | }
--------------------------------------------------------------------------------
/axelor-demo-02/modules/librarian/src/license/header.txt:
--------------------------------------------------------------------------------
1 | // 版权所有 2020-2021 © 云南半星科技有限公司。保留所有权力
2 |
--------------------------------------------------------------------------------
/axelor-demo-02/modules/librarian/src/main/resources/domains/Entities.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/axelor-demo-02/modules/librarian/src/main/resources/views/BookView.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
21 |
22 |
--------------------------------------------------------------------------------
/axelor-demo-02/modules/librarian/src/main/resources/views/Menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/axelor-demo-02/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'axelor-demo-02'
2 |
3 | include "modules:librarian"
4 |
--------------------------------------------------------------------------------
/axelor-demo-02/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | org.hibernate.jpa.HibernatePersistenceProvider
7 | ENABLE_SELECTIVE
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/axelor-demo-02/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # Application Information
2 | # ~~~~~
3 | application.name = Library Management System (Demo02)
4 | application.description = Axelor Demo by Uncle Ming Channel
5 | application.version = 0.1.0
6 |
7 | # Author/Company
8 | # ~~~~~
9 | application.author = Uncle Ming Channel
10 | application.copyright = Copyright (c) {year} Uncle Ming Channel. All Rights Reserved.
11 |
12 | # Header Logo
13 | # ~~~~~
14 | # Should be 40px in height with transparent background
15 | application.logo =
16 |
17 | # Home Website
18 | # ~~~~~
19 | # Link to be used with header logo
20 | application.home = https://www.youtube.com/channel/UC8nM1uN2Ii9bC0nDAoOQa3g
21 |
22 | # Link to the online help
23 | # ~~~~~
24 | application.help = https://www.youtube.com/channel/UC8nM1uN2Ii9bC0nDAoOQa3g
25 |
26 | # Application deployment mode
27 | # ~~~~~
28 | # Set to 'dev' for development mode else 'prod'
29 | application.mode = dev
30 |
31 | # CSS Theme
32 | # ~~~~~
33 | # Set default CSS theme, for example `blue`
34 | application.theme =
35 |
36 | # Default Locale (language)
37 | # ~~~~~
38 | # Set default application locale (en, fr, fr_FR, en_US)
39 | application.locale = zh_CN
40 |
41 | # Encryption
42 | # ~~~~~
43 | # Set encryption password
44 | #encryption.password = MySuperSecretKey
45 |
46 | # Set encryption algorithm (CBC or GCM)
47 | #encryption.algorithm = CBC
48 |
49 | # Database settings
50 | # ~~~~~
51 | # See hibernate documentation for connection parameters
52 |
53 | # HERE
54 | # PostgreSQL
55 | db.default.driver = org.postgresql.Driver
56 | db.default.ddl = update
57 | db.default.url = jdbc:postgresql://localhost:5432/axelor-demo-02-db
58 | db.default.user = mingming
59 | db.default.password = mingming
60 |
61 | # MySQL
62 | #db.default.driver = com.mysql.jdbc.Driver
63 | #db.default.ddl = update
64 | #db.default.url = jdbc:mysql://localhost:3306/axelor_demo_dev
65 | #db.default.user = axelor
66 | #db.default.password =
67 |
68 | # Oracle
69 | #db.default.driver = oracle.jdbc.OracleDriver
70 | #db.default.ddl = update
71 | #db.default.url = jdbc:oracle:thin:@localhost:1521:oracle
72 | #db.default.user = axelor
73 | #db.default.password =
74 |
75 | # Date Format
76 | # ~~~~~
77 | date.format = yyyy/MM/dd
78 |
79 | # Timezone
80 | # ~~~~~
81 | date.timezone = Asia/Shanghai
82 |
83 | # Session timeout (in minutes)
84 | # ~~~~~
85 | session.timeout = 60
86 |
87 | # Storage path for upload files (attachments)
88 | # ~~~~~
89 | # use {user.home} key to save files under user home directory, or
90 | # use absolute path where server user have write permission.
91 | file.upload.dir = {user.home}/.axelor/attachments
92 |
93 | # Upload filename pattern, default is auto where file is save with same name
94 | # in the given upload dir, if file is already there, a count number is
95 | # appended to file name.
96 | #
97 | # This can be overridden by providing custom name pattern, for example:
98 | #
99 | # file.upload.filename.pattern = {year}-{month}/{day}/{name}
100 | # file.upload.filename.pattern = {AA}/{name}
101 | #
102 | # Following placeholders can be used:
103 | #
104 | # {year} - current year
105 | # {month} - current month
106 | # {day} - current day
107 | # {name} - file name
108 | # {A} - first letter from file name
109 | # {AA} - first 2 letter from file name
110 | # {AAA} - first 3 letter from file name
111 | #
112 | #file.upload.filename.pattern = {year}-{month}/{day}/{name}
113 |
114 | # Maximum upload size (in MB)
115 | # ~~~~~
116 | file.upload.size = 5
117 |
118 | # Whitelist pattern can be used to allow file upload with matching names.
119 | #
120 | # For example: \\.(xml|html|jpg|png|pdf|xsl)$
121 | #
122 | # Regular expression
123 | # ~~~~~
124 | #file.upload.whitelist.pattern =
125 |
126 | # Blacklist pattern can be used to block file upload with matching names.
127 | #
128 | # Regular expression
129 | # ~~~~~
130 | #file.upload.blacklist.pattern =
131 |
132 | # Whitelist content type can be used to allow file upload with matching content.
133 | #
134 | # List of mime-types (plain/text,image/*,video/webm)
135 | # ~~~~~
136 | #file.upload.whitelist.types =
137 |
138 | # Blacklist content type can be used to block file upload with matching content.
139 | #
140 | # List of mime-types (plain/text,image/*,video/webm)
141 | # ~~~~~
142 | #file.upload.blacklist.types =
143 |
144 | # The external report design directory
145 | # ~~~~~
146 | # this directory is searched for the rptdesign files
147 | # (fallbacks to designs provided by modules)
148 | reports.design.dir = {user.home}/.axelor/reports
149 |
150 | # Storage path for report outputs
151 | reports.output.dir = {user.home}/.axelor/reports-gen
152 |
153 | # Data export (csv) encoding
154 | # ~~~~
155 | # Use Windows-1252, ISO-8859-1 or ISO-8859-15 if targeting ms excel
156 | # (excel does not recognize utf8 encoded csv)
157 | data.export.encoding = UTF-8
158 |
159 | # Storage path for export action
160 | # ~~~~~
161 | data.export.dir = {user.home}/.axelor/data-export
162 |
163 | # Specify whether to import demo data
164 | # ~~~~~
165 | data.import.demo-data = true
166 |
167 | # Storage path for templates
168 | # ~~~~~
169 | template.search.dir = {user.home}/.axelor/templates
170 |
171 | # LDAP Configuration
172 | # ~~~~~
173 | #ldap.server.url = ldap://localhost:10389
174 |
175 | # can be "simple" or "CRAM-MD5"
176 | ldap.auth.type = simple
177 |
178 | ldap.system.user = uid=admin,ou=system
179 | ldap.system.password = secret
180 |
181 | # group search base
182 | ldap.group.base = ou=groups,dc=example,dc=com
183 |
184 | # if set, create groups on ldap server under ldap.group.base
185 | #ldap.group.object.class = groupOfUniqueNames
186 |
187 | # a template to search groups by user login id
188 | ldap.group.filter = (uniqueMember=uid={0})
189 |
190 | # user search base
191 | ldap.user.base = ou=users,dc=example,dc=com
192 |
193 | # a template to search user by user login id
194 | ldap.user.filter = (uid={0})
195 |
196 | # CAS configuration
197 | # ~~~~~
198 | #auth.cas.server.url.prefix = https://localhost:8443/cas
199 |
200 | # use public accessible url
201 | #auth.cas.service = http://localhost:8080/axelor-demo/cas
202 |
203 | # login url, if not given prepared from server & service url
204 | #auth.cas.login.url = https://localhost:8443/cas/login?service=http://localhost:8080/axelor-demo/cas
205 |
206 | # logout url, if not given prepared from server & service url
207 | #auth.cas.logout.url = https://localhost:8443/cas/logout?service=http://localhost:8080/axelor-demo/
208 |
209 | # CAS validation protocol (CAS, SAML)
210 | #auth.cas.protocol = SAML
211 |
212 | # the attribute to map to user display name
213 | #auth.cas.attrs.user.name = name
214 |
215 | # the attribute to map to user email
216 | #auth.cas.attrs.user.email = mail
217 |
218 | # Quartz Scheduler
219 | # ~~~~~
220 | # quartz job scheduler
221 |
222 | # Specify whether to enable quartz scheduler
223 | quartz.enable = false
224 |
225 | # total number of threads in quartz thread pool
226 | # the number of jobs that can run simultaneously
227 | quartz.threadCount = 3
228 |
229 | # SMPT configuration
230 | # ~~~~~
231 | # SMTP server configuration
232 | #mail.smtp.host = smtp.gmail.com
233 | #mail.smtp.port = 587
234 | #mail.smtp.channel = starttls
235 | #mail.smtp.user = user@gmail.com
236 | #mail.smtp.pass = secret
237 |
238 | # timeout settings
239 | #mail.smtp.timeout = 60000
240 | #mail.smtp.connectionTimeout = 60000
241 |
242 | # IMAP configuration
243 | # ~~~~~
244 | # IMAP server configuration
245 | # (quartz scheduler should be enabled for fetching stream replies)
246 | #mail.imap.host = imap.gmail.com
247 | #mail.imap.port = 993
248 | #mail.imap.channel = ssl
249 | #mail.imap.user = user@gmail.com
250 | #mail.imap.pass = secret
251 |
252 | # timeout settings
253 | #mail.imap.timeout = 60000
254 | #mail.imap.connectionTimeout = 60000
255 |
256 | # CORS configuration
257 | # ~~~~~
258 | # CORS settings to allow cross origin requests
259 |
260 | # regular expression to test allowed origin or * to allow all (not recommended)
261 | #cors.allow.origin = *
262 | #cors.allow.credentials = true
263 | #cors.allow.methods = GET,PUT,POST,DELETE,HEAD,OPTIONS
264 | #cors.allow.headers = Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers
265 |
266 | # View configuration
267 | # ~~~~~
268 |
269 | # Set to true to enable single view mode
270 | view.single.tab = false
271 |
272 | # Set menu style (left, top, both)
273 | view.menubar.location = both
274 |
275 | # HERE
276 | view.toolbar.titles = true
277 |
278 | # Advance Filter Sharing
279 | # ~~~~~
280 | # Set to false to hide advance search filter share option, or set to list of
281 | # role names to enable share for those roles only.
282 | #view.adv-search.share = share-filter,can-share-filter
283 |
284 | # Logging
285 | # ~~~~~
286 | # Custom logback configuration can be provided with `logging.config` property pointing
287 | # to a custom `logback.xml`. In this case, all the logging configuration provided here
288 | # will be ignored.
289 | #
290 | # Following settings can be used to configure logging system automatically.
291 | #
292 | #logging.path = {user.home}/.axelor/logs
293 | #logging.pattern.file = %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%t] %-40.40logger{39} : %m%n
294 | #logging.pattern.console = %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n
295 |
296 | # Global logging
297 | logging.level.root = ERROR
298 |
299 | # Axelor logging
300 |
301 | # Log everything.
302 | logging.level.com.axelor = INFO
303 |
304 | # Hibernate logging
305 |
306 | # Log everything. Good for troubleshooting
307 | #logging.level.org.hibernate = INFO
308 |
309 | # Log all SQL DML statements as they are executed
310 | #logging.level.org.hibernate.SQL = DEBUG
311 | #logging.level.org.hibernate.engine.jdbc = DEBUG
312 |
313 | # Log all SQL DDL statements as they are executed
314 | #logging.level.org.hibernate.tool.hbm2ddl = INFO
315 |
316 | # Log all JDBC parameters
317 | #logging.level.org.hibernate.type = ALL
318 |
319 | # Log transactions
320 | #logging.level.org.hibernate.transaction = DEBUG
321 |
322 | # Log L2-Cache
323 | #logging.level.org.hibernate.cache = DEBUG
324 |
325 | # Log JDBC resource acquisition
326 | #logging.level.org.hibernate.jdbc = TRACE
327 | #logging.level.org.hibernate.service.jdbc = TRACE
328 |
329 | # Log connection pooling
330 | #logging.level.com.zaxxer.hikari = INFO
331 |
--------------------------------------------------------------------------------
/axelor-demo-03/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .gradle
3 |
--------------------------------------------------------------------------------
/axelor-demo-03/README.md:
--------------------------------------------------------------------------------
1 | # Axelor 开发教程视频 EP04 配套示例代码
2 |
3 | 各大视频网站搜索“命叔炸机”即可免费观看独家 Axelor 开发教程。
4 |
--------------------------------------------------------------------------------
/axelor-demo-03/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.repos = {
3 |
4 | // 最优先检查本地 Maven 仓库
5 | mavenLocal()
6 |
7 | // 这行放在上面,优先使用命叔叔 Github 仓库提供的汉化过的 Axelor 框架
8 | maven {
9 | url uri("https://raw.githubusercontent.com/axelor-l10n-cn/axelor-open-platform-l10n-cn-mvn/master/mvn-repo")
10 | }
11 |
12 |
13 | // 公共仓库优先使用阿里云的
14 | maven { url 'https://maven.aliyun.com/repository/central' }
15 | maven { url 'https://maven.aliyun.com/repository/jcenter'}
16 | maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
17 |
18 |
19 | // 使用 Axelor 官方的 Repo 放在下面,以便补充缺少的 JAR
20 | maven { url 'https://repository.axelor.com/nexus/public/' }
21 |
22 | // 原始的 Maven 仓库放在最后,可以不用,因为阿里云的仓库是镜像同步的
23 | /*
24 | mavenCentral()
25 | jcenter()
26 | maven { url 'https://plugins.gradle.org/m2/'}
27 | */
28 | }
29 | repositories repos
30 | dependencies {
31 | classpath 'com.axelor:axelor-gradle:5.3.0-SNAPSHOT'
32 | }
33 | }
34 |
35 | allprojects {
36 | repositories repos
37 | }
38 |
39 | apply plugin: 'com.axelor.app'
40 |
41 | axelor {
42 | title = 'Demo 03'
43 | }
44 |
45 | allprojects {
46 | apply plugin: 'idea'
47 | group 'mingshu'
48 | version '1.0-SNAPSHOT'
49 |
50 | sourceCompatibility = 1.8
51 | targetCompatibility = 1.8
52 | }
53 |
54 | dependencies {
55 | compile project(":modules:librarian")
56 | }
57 |
58 | wrapper {
59 | gradleVersion = "5.6.4"
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/axelor-demo-03/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.daemon=false
--------------------------------------------------------------------------------
/axelor-demo-03/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldrev/axelor-cookbook-samples/3a04160fa2d4c7e90fb8e9957c702966c19b9145/axelor-demo-03/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/axelor-demo-03/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/axelor-demo-03/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/axelor-demo-03/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.axelor.app-module'
2 |
3 | axelor {
4 | title "Library Management System"
5 | version "0.1.0"
6 | description ""
7 | removable = false
8 | }
9 |
10 | dependencies {
11 |
12 | }
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/java/mingshu/librarian/LibrarianModule.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian;
2 |
3 | import com.axelor.app.AxelorModule;
4 | import mingshu.librarian.service.*;
5 |
6 | public class LibrarianModule extends AxelorModule {
7 |
8 | @Override
9 | protected void configure() {
10 | bind(ReaderService.class).to(ReaderServiceImpl.class);
11 | bind(BorrowingService.class).to(BorrowingServiceImpl.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/java/mingshu/librarian/db/repo/BookRepository.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.db.repo;
2 |
3 | public class BookRepository extends AbstractBookRepository {
4 | }
5 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/java/mingshu/librarian/db/repo/ReaderRepository.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.db.repo;
2 |
3 | import com.axelor.auth.db.User;
4 | import com.axelor.auth.db.repo.UserRepository;
5 | import com.axelor.inject.Beans;
6 | import mingshu.librarian.db.Reader;
7 |
8 | import javax.inject.Inject;
9 |
10 | public class ReaderRepository extends AbstractReaderRepository {
11 |
12 | @Inject
13 | private UserRepository _users;
14 |
15 | /**
16 | * 覆盖父类方法,删除读者信息时删除配套的用户
17 | * @param reader
18 | */
19 | @Override
20 | public void remove(Reader reader) {
21 |
22 | if (reader.getUser() != null) {
23 | User user = _users.find(reader.getUser().getId());
24 | if (user != null) {
25 | user.setReader(null);
26 | _users.save(user);
27 | _users.remove(user);
28 | }
29 | }
30 |
31 | super.remove(reader);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/java/mingshu/librarian/service/BorrowingService.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.service;
2 |
3 | import com.axelor.meta.CallMethod;
4 | import mingshu.librarian.db.Borrowing;
5 |
6 | public interface BorrowingService {
7 |
8 | @CallMethod
9 | String getCode();
10 |
11 | Borrowing confirm(Long id);
12 |
13 | Borrowing back(Long id);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/java/mingshu/librarian/service/BorrowingServiceImpl.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.service;
2 |
3 | import com.google.inject.Inject;
4 | import com.google.inject.persist.Transactional;
5 | import mingshu.librarian.db.Borrowing;
6 | import mingshu.librarian.db.BorrowingStatus;
7 | import mingshu.librarian.db.repo.BorrowingRepository;
8 |
9 | import java.time.LocalDate;
10 | import java.time.LocalDateTime;
11 | import java.time.format.DateTimeFormatter;
12 |
13 | public class BorrowingServiceImpl implements BorrowingService {
14 |
15 | @Inject private BorrowingRepository _borrowings;
16 |
17 | public String getCode() {
18 | return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddhhmmss"));
19 | }
20 |
21 | @Override
22 | @Transactional
23 | public Borrowing confirm(Long id) {
24 | Borrowing borrowing = _borrowings.find(id);
25 | borrowing.setReturnTime(borrowing.getBorrowTime().plusDays(borrowing.getDays()));
26 | borrowing.setStatus(BorrowingStatus.WAIT);
27 | _borrowings.save(borrowing);
28 | return borrowing;
29 | }
30 |
31 | @Override
32 | @Transactional
33 | public Borrowing back(Long id) {
34 | Borrowing borrowing = _borrowings.find(id);
35 | borrowing.setBackTime(LocalDateTime.now());
36 | borrowing.setStatus(BorrowingStatus.DONE);
37 | _borrowings.save(borrowing);
38 | return borrowing;
39 | }
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/java/mingshu/librarian/service/ReaderService.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.service;
2 |
3 | import com.axelor.auth.db.*;
4 | import mingshu.librarian.db.*;
5 |
6 | public interface ReaderService {
7 |
8 | User assignNewUser(Reader reader);
9 | }
10 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/java/mingshu/librarian/service/ReaderServiceImpl.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.service;
2 |
3 | import com.axelor.auth.db.*;
4 | import com.axelor.auth.db.repo.*;
5 | import com.google.inject.persist.Transactional;
6 | import mingshu.librarian.db.*;
7 | import mingshu.librarian.db.repo.ReaderRepository;
8 |
9 | import javax.inject.Inject;
10 |
11 | public class ReaderServiceImpl implements ReaderService {
12 |
13 | @Inject
14 | private UserRepository _users;
15 |
16 | @Inject
17 | private ReaderRepository _readers;
18 |
19 | @Transactional
20 | public User assignNewUser(Reader reader) {
21 | User newUser = new User();
22 | newUser.setCode(reader.getMobile()); // 设置读者用户登录用户名为其手机号
23 | newUser.setName("读者 " + reader.getName()); // 设置用户信息的名称为读者的姓名
24 | newUser.setForcePasswordChange(true); // 要求读者用户登录时修改密码
25 | newUser.setPassword("123456"); // 读者用户密码默认为 `123456`
26 | newUser.setReader(reader);
27 | newUser = _users.save(newUser);
28 | reader.setUser(newUser);
29 | _readers.save(reader);
30 | return newUser;
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/java/mingshu/librarian/web/BorrowingController.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.web;
2 |
3 | import javax.inject.Inject;
4 | import com.axelor.rpc.ActionRequest;
5 | import com.axelor.rpc.ActionResponse;
6 |
7 | import mingshu.librarian.db.*;
8 | import mingshu.librarian.service.BorrowingService;
9 |
10 |
11 | public class BorrowingController {
12 |
13 | @Inject
14 | private BorrowingService _borrowingService;
15 |
16 | public void onConfirm(ActionRequest request, ActionResponse response){
17 | Borrowing borrowing = request.getContext().asType(Borrowing.class);
18 |
19 | response.setReadonly("borrowTime", true);
20 | _borrowingService.confirm(borrowing.getId());
21 | response.setNotify("命叔说:借阅已生效");
22 | response.setReload(true);
23 | }
24 |
25 | public void onBack(ActionRequest request, ActionResponse response){
26 | Borrowing borrowing = request.getContext().asType(Borrowing.class);
27 | _borrowingService.back(borrowing.getId());
28 | response.setNotify("命叔说:已成功还书");
29 | response.setReload(true);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/java/mingshu/librarian/web/ReaderController.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.web;
2 |
3 | // 导入系统库
4 | import com.axelor.auth.db.User;
5 | import com.axelor.db.JpaSupport;
6 | import com.axelor.rpc.ActionRequest;
7 | import com.axelor.rpc.ActionResponse;
8 | import com.google.common.collect.Lists;
9 | import java.math.BigDecimal;
10 | import java.math.RoundingMode;
11 | import java.time.LocalDate;
12 | import java.util.HashMap;
13 | import java.util.List;
14 | import java.util.Map;
15 | import javax.inject.Inject;
16 | import javax.persistence.EntityManager;
17 | import javax.persistence.Query;
18 |
19 | // 导入模块库
20 | import mingshu.librarian.db.*;
21 | import mingshu.librarian.db.repo.ReaderRepository;
22 | import mingshu.librarian.service.*;
23 |
24 | public class ReaderController extends JpaSupport {
25 |
26 | @Inject private ReaderRepository _readers;
27 | @Inject private ReaderService _readerService;
28 |
29 | /**
30 | * 按下“设置用户”后端执行的操作
31 | */
32 | public void onAssignUser(ActionRequest request, ActionResponse response) {
33 |
34 | // 用 request 里 JSON 解析出来的 Map 字段名=>值 来填充对象 reader 里的对应属性
35 | Reader reader = request.getContext().asType(Reader.class);
36 |
37 | // 用 id 字段去数据库里查询 reader,返回 Hibernate 跟踪的实体类对象,
38 | // 后续操作一般是使用 Hibernate 跟踪的对象
39 | reader = _readers.find(reader.getId());
40 |
41 | if (reader.getUser() == null) {
42 | User newUser =_readerService.assignNewUser(reader);
43 | }
44 |
45 | response.setFlash("命叔说:读者配套的登录用户设置好了"); // 前端弹出消息
46 | response.setReload(true); // 要求前端重新加载数据
47 | }
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/resources/domains/Entities.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
35 |
36 |
37 |
38 |
39 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/resources/domains/User.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/resources/views/BookView.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
25 |
26 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/resources/views/BorrowingView.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/resources/views/Menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/resources/views/ReaderView.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/axelor-demo-03/modules/librarian/src/main/resources/views/User.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
16 |
17 |
--------------------------------------------------------------------------------
/axelor-demo-03/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'axelor-demo-03'
2 |
3 | include "modules:librarian"
4 |
--------------------------------------------------------------------------------
/axelor-demo-03/src/license/header.txt:
--------------------------------------------------------------------------------
1 | // 版权所有 2020-2021 © 云南半星科技有限公司。保留所有权力
2 |
--------------------------------------------------------------------------------
/axelor-demo-03/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | org.hibernate.jpa.HibernatePersistenceProvider
7 | ENABLE_SELECTIVE
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/axelor-demo-03/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # Application Information
2 | # ~~~~~
3 | application.name = Library Management System (Demo03)
4 | application.description = Axelor Demo by Uncle Ming Channel
5 | application.version = 0.1.0
6 |
7 | # Author/Company
8 | # ~~~~~
9 | application.author = Uncle Ming Channel
10 | application.copyright = Copyright (c) {year} Uncle Ming Channel. All Rights Reserved.
11 |
12 | # Header Logo
13 | # ~~~~~
14 | # Should be 40px in height with transparent background
15 | application.logo =
16 |
17 | # Home Website
18 | # ~~~~~
19 | # Link to be used with header logo
20 | application.home = https://www.youtube.com/channel/UC8nM1uN2Ii9bC0nDAoOQa3g
21 |
22 | # Link to the online help
23 | # ~~~~~
24 | application.help = https://www.youtube.com/channel/UC8nM1uN2Ii9bC0nDAoOQa3g
25 |
26 | # Application deployment mode
27 | # ~~~~~
28 | # Set to 'dev' for development mode else 'prod'
29 | application.mode = dev
30 |
31 | # CSS Theme
32 | # ~~~~~
33 | # Set default CSS theme, for example `blue`
34 | application.theme =
35 |
36 | # Default Locale (language)
37 | # ~~~~~
38 | # Set default application locale (en, fr, fr_FR, en_US)
39 | application.locale = zh_CN
40 |
41 | # Encryption
42 | # ~~~~~
43 | # Set encryption password
44 | #encryption.password = MySuperSecretKey
45 |
46 | # Set encryption algorithm (CBC or GCM)
47 | #encryption.algorithm = CBC
48 |
49 | # Database settings
50 | # ~~~~~
51 | # See hibernate documentation for connection parameters
52 |
53 | # HERE
54 | # PostgreSQL
55 | db.default.driver = org.postgresql.Driver
56 | db.default.ddl = update
57 | db.default.url = jdbc:postgresql://localhost:5432/axelor-demo-03-db
58 | db.default.user = mingming
59 | db.default.password = mingming
60 |
61 | # MySQL
62 | #db.default.driver = com.mysql.jdbc.Driver
63 | #db.default.ddl = update
64 | #db.default.url = jdbc:mysql://localhost:3306/axelor_demo_dev
65 | #db.default.user = axelor
66 | #db.default.password =
67 |
68 | # Oracle
69 | #db.default.driver = oracle.jdbc.OracleDriver
70 | #db.default.ddl = update
71 | #db.default.url = jdbc:oracle:thin:@localhost:1521:oracle
72 | #db.default.user = axelor
73 | #db.default.password =
74 |
75 | # Date Format
76 | # ~~~~~
77 | date.format = yyyy/MM/dd
78 |
79 | # Timezone
80 | # ~~~~~
81 | date.timezone = Asia/Shanghai
82 |
83 | # Session timeout (in minutes)
84 | # ~~~~~
85 | session.timeout = 60
86 |
87 | # Storage path for upload files (attachments)
88 | # ~~~~~
89 | # use {user.home} key to save files under user home directory, or
90 | # use absolute path where server user have write permission.
91 | file.upload.dir = {user.home}/.axelor/attachments
92 |
93 | # Upload filename pattern, default is auto where file is save with same name
94 | # in the given upload dir, if file is already there, a count number is
95 | # appended to file name.
96 | #
97 | # This can be overridden by providing custom name pattern, for example:
98 | #
99 | # file.upload.filename.pattern = {year}-{month}/{day}/{name}
100 | # file.upload.filename.pattern = {AA}/{name}
101 | #
102 | # Following placeholders can be used:
103 | #
104 | # {year} - current year
105 | # {month} - current month
106 | # {day} - current day
107 | # {name} - file name
108 | # {A} - first letter from file name
109 | # {AA} - first 2 letter from file name
110 | # {AAA} - first 3 letter from file name
111 | #
112 | #file.upload.filename.pattern = {year}-{month}/{day}/{name}
113 |
114 | # Maximum upload size (in MB)
115 | # ~~~~~
116 | file.upload.size = 5
117 |
118 | # Whitelist pattern can be used to allow file upload with matching names.
119 | #
120 | # For example: \\.(xml|html|jpg|png|pdf|xsl)$
121 | #
122 | # Regular expression
123 | # ~~~~~
124 | #file.upload.whitelist.pattern =
125 |
126 | # Blacklist pattern can be used to block file upload with matching names.
127 | #
128 | # Regular expression
129 | # ~~~~~
130 | #file.upload.blacklist.pattern =
131 |
132 | # Whitelist content type can be used to allow file upload with matching content.
133 | #
134 | # List of mime-types (plain/text,image/*,video/webm)
135 | # ~~~~~
136 | #file.upload.whitelist.types =
137 |
138 | # Blacklist content type can be used to block file upload with matching content.
139 | #
140 | # List of mime-types (plain/text,image/*,video/webm)
141 | # ~~~~~
142 | #file.upload.blacklist.types =
143 |
144 | # The external report design directory
145 | # ~~~~~
146 | # this directory is searched for the rptdesign files
147 | # (fallbacks to designs provided by modules)
148 | reports.design.dir = {user.home}/.axelor/reports
149 |
150 | # Storage path for report outputs
151 | reports.output.dir = {user.home}/.axelor/reports-gen
152 |
153 | # Data export (csv) encoding
154 | # ~~~~
155 | # Use Windows-1252, ISO-8859-1 or ISO-8859-15 if targeting ms excel
156 | # (excel does not recognize utf8 encoded csv)
157 | data.export.encoding = UTF-8
158 |
159 | # Storage path for export action
160 | # ~~~~~
161 | data.export.dir = {user.home}/.axelor/data-export
162 |
163 | # Specify whether to import demo data
164 | # ~~~~~
165 | data.import.demo-data = true
166 |
167 | # Storage path for templates
168 | # ~~~~~
169 | template.search.dir = {user.home}/.axelor/templates
170 |
171 | # LDAP Configuration
172 | # ~~~~~
173 | #ldap.server.url = ldap://localhost:10389
174 |
175 | # can be "simple" or "CRAM-MD5"
176 | ldap.auth.type = simple
177 |
178 | ldap.system.user = uid=admin,ou=system
179 | ldap.system.password = secret
180 |
181 | # group search base
182 | ldap.group.base = ou=groups,dc=example,dc=com
183 |
184 | # if set, create groups on ldap server under ldap.group.base
185 | #ldap.group.object.class = groupOfUniqueNames
186 |
187 | # a template to search groups by user login id
188 | ldap.group.filter = (uniqueMember=uid={0})
189 |
190 | # user search base
191 | ldap.user.base = ou=users,dc=example,dc=com
192 |
193 | # a template to search user by user login id
194 | ldap.user.filter = (uid={0})
195 |
196 | # CAS configuration
197 | # ~~~~~
198 | #auth.cas.server.url.prefix = https://localhost:8443/cas
199 |
200 | # use public accessible url
201 | #auth.cas.service = http://localhost:8080/axelor-demo/cas
202 |
203 | # login url, if not given prepared from server & service url
204 | #auth.cas.login.url = https://localhost:8443/cas/login?service=http://localhost:8080/axelor-demo/cas
205 |
206 | # logout url, if not given prepared from server & service url
207 | #auth.cas.logout.url = https://localhost:8443/cas/logout?service=http://localhost:8080/axelor-demo/
208 |
209 | # CAS validation protocol (CAS, SAML)
210 | #auth.cas.protocol = SAML
211 |
212 | # the attribute to map to user display name
213 | #auth.cas.attrs.user.name = name
214 |
215 | # the attribute to map to user email
216 | #auth.cas.attrs.user.email = mail
217 |
218 | # Quartz Scheduler
219 | # ~~~~~
220 | # quartz job scheduler
221 |
222 | # Specify whether to enable quartz scheduler
223 | quartz.enable = false
224 |
225 | # total number of threads in quartz thread pool
226 | # the number of jobs that can run simultaneously
227 | quartz.threadCount = 3
228 |
229 | # SMPT configuration
230 | # ~~~~~
231 | # SMTP server configuration
232 | #mail.smtp.host = smtp.gmail.com
233 | #mail.smtp.port = 587
234 | #mail.smtp.channel = starttls
235 | #mail.smtp.user = user@gmail.com
236 | #mail.smtp.pass = secret
237 |
238 | # timeout settings
239 | #mail.smtp.timeout = 60000
240 | #mail.smtp.connectionTimeout = 60000
241 |
242 | # IMAP configuration
243 | # ~~~~~
244 | # IMAP server configuration
245 | # (quartz scheduler should be enabled for fetching stream replies)
246 | #mail.imap.host = imap.gmail.com
247 | #mail.imap.port = 993
248 | #mail.imap.channel = ssl
249 | #mail.imap.user = user@gmail.com
250 | #mail.imap.pass = secret
251 |
252 | # timeout settings
253 | #mail.imap.timeout = 60000
254 | #mail.imap.connectionTimeout = 60000
255 |
256 | # CORS configuration
257 | # ~~~~~
258 | # CORS settings to allow cross origin requests
259 |
260 | # regular expression to test allowed origin or * to allow all (not recommended)
261 | #cors.allow.origin = *
262 | #cors.allow.credentials = true
263 | #cors.allow.methods = GET,PUT,POST,DELETE,HEAD,OPTIONS
264 | #cors.allow.headers = Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers
265 |
266 | # View configuration
267 | # ~~~~~
268 |
269 | # Set to true to enable single view mode
270 | view.single.tab = false
271 |
272 | # Set menu style (left, top, both)
273 | view.menubar.location = both
274 |
275 | # HERE
276 | view.toolbar.titles = true
277 |
278 | # Advance Filter Sharing
279 | # ~~~~~
280 | # Set to false to hide advance search filter share option, or set to list of
281 | # role names to enable share for those roles only.
282 | #view.adv-search.share = share-filter,can-share-filter
283 |
284 | # Logging
285 | # ~~~~~
286 | # Custom logback configuration can be provided with `logging.config` property pointing
287 | # to a custom `logback.xml`. In this case, all the logging configuration provided here
288 | # will be ignored.
289 | #
290 | # Following settings can be used to configure logging system automatically.
291 | #
292 | #logging.path = {user.home}/.axelor/logs
293 | #logging.pattern.file = %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%t] %-40.40logger{39} : %m%n
294 | #logging.pattern.console = %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n
295 |
296 | # Global logging
297 | logging.level.root = ERROR
298 |
299 | # Axelor logging
300 |
301 | # Log everything.
302 | logging.level.com.axelor = INFO
303 |
304 | # Hibernate logging
305 |
306 | # Log everything. Good for troubleshooting
307 | #logging.level.org.hibernate = INFO
308 |
309 | # Log all SQL DML statements as they are executed
310 | #logging.level.org.hibernate.SQL = DEBUG
311 | #logging.level.org.hibernate.engine.jdbc = DEBUG
312 |
313 | # Log all SQL DDL statements as they are executed
314 | #logging.level.org.hibernate.tool.hbm2ddl = INFO
315 |
316 | # Log all JDBC parameters
317 | #logging.level.org.hibernate.type = ALL
318 |
319 | # Log transactions
320 | #logging.level.org.hibernate.transaction = DEBUG
321 |
322 | # Log L2-Cache
323 | #logging.level.org.hibernate.cache = DEBUG
324 |
325 | # Log JDBC resource acquisition
326 | #logging.level.org.hibernate.jdbc = TRACE
327 | #logging.level.org.hibernate.service.jdbc = TRACE
328 |
329 | # Log connection pooling
330 | #logging.level.com.zaxxer.hikari = INFO
331 |
--------------------------------------------------------------------------------
/axelor-demo-04/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .gradle
3 |
--------------------------------------------------------------------------------
/axelor-demo-04/README.md:
--------------------------------------------------------------------------------
1 | # Axelor 开发教程视频 EP05 配套示例代码
2 |
3 | 各大视频网站搜索“命叔杂技”即可免费观看独家 Axelor 开发教程。
4 |
--------------------------------------------------------------------------------
/axelor-demo-04/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.repos = {
3 |
4 | // 最优先检查本地 Maven 仓库
5 | mavenLocal()
6 |
7 | // 这行放在上面,优先使用命叔叔 Github 仓库提供的汉化过的 Axelor 框架
8 | maven {
9 | url uri("https://raw.githubusercontent.com/axelor-l10n-cn/axelor-open-platform-l10n-cn-mvn/master/mvn-repo")
10 | }
11 |
12 |
13 | // 公共仓库优先使用阿里云的
14 | maven { url 'https://maven.aliyun.com/repository/central' }
15 | maven { url 'https://maven.aliyun.com/repository/jcenter'}
16 | maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
17 |
18 |
19 | // 使用 Axelor 官方的 Repo 放在下面,以便补充缺少的 JAR
20 | maven { url 'https://repository.axelor.com/nexus/public/' }
21 |
22 | // 原始的 Maven 仓库放在最后,可以不用,因为阿里云的仓库是镜像同步的
23 | /*
24 | mavenCentral()
25 | jcenter()
26 | maven { url 'https://plugins.gradle.org/m2/'}
27 | */
28 | }
29 | repositories repos
30 | dependencies {
31 | classpath 'com.axelor:axelor-gradle:5.4.0-SNAPSHOT'
32 | }
33 | }
34 |
35 | allprojects {
36 | repositories repos
37 | }
38 |
39 | apply plugin: 'com.axelor.app'
40 |
41 | axelor {
42 | title = 'Demo 04'
43 | }
44 |
45 | allprojects {
46 | apply plugin: 'idea'
47 | group 'mingshu'
48 | version '1.0-SNAPSHOT'
49 |
50 | sourceCompatibility = 1.8
51 | targetCompatibility = 1.8
52 | }
53 |
54 | dependencies {
55 | compile project(":modules:librarian")
56 | }
57 |
58 | wrapper {
59 | gradleVersion = "5.6.4"
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/axelor-demo-04/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oldrev/axelor-cookbook-samples/3a04160fa2d4c7e90fb8e9957c702966c19b9145/axelor-demo-04/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/axelor-demo-04/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/axelor-demo-04/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/axelor-demo-04/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.axelor.app-module'
2 |
3 | axelor {
4 | title "Library Management System"
5 | version "0.1.0"
6 | description ""
7 | removable = false
8 | }
9 |
10 | dependencies {
11 |
12 | }
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/java/mingshu/librarian/LibrarianModule.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian;
2 |
3 | import com.axelor.app.AxelorModule;
4 | import mingshu.librarian.service.*;
5 |
6 | public class LibrarianModule extends AxelorModule {
7 |
8 | @Override
9 | protected void configure() {
10 | bind(ReaderService.class).to(ReaderServiceImpl.class);
11 | bind(BorrowingService.class).to(BorrowingServiceImpl.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/java/mingshu/librarian/db/repo/BookRepository.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.db.repo;
2 |
3 | public class BookRepository extends AbstractBookRepository {
4 | }
5 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/java/mingshu/librarian/db/repo/ReaderRepository.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.db.repo;
2 |
3 | import com.axelor.auth.db.User;
4 | import com.axelor.auth.db.repo.UserRepository;
5 | import com.axelor.inject.Beans;
6 | import mingshu.librarian.db.Reader;
7 |
8 | import javax.inject.Inject;
9 |
10 | public class ReaderRepository extends AbstractReaderRepository {
11 |
12 | @Inject
13 | private UserRepository _users;
14 |
15 | /**
16 | * 覆盖父类方法,删除读者信息时删除配套的用户
17 | * @param reader
18 | */
19 | @Override
20 | public void remove(Reader reader) {
21 |
22 | if (reader.getUser() != null) {
23 | User user = _users.find(reader.getUser().getId());
24 | if (user != null) {
25 | user.setReader(null);
26 | _users.save(user);
27 | _users.remove(user);
28 | }
29 | }
30 |
31 | super.remove(reader);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/java/mingshu/librarian/service/BorrowingService.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.service;
2 |
3 | import com.axelor.meta.CallMethod;
4 | import mingshu.librarian.db.Borrowing;
5 |
6 | public interface BorrowingService {
7 |
8 | @CallMethod
9 | String getCode();
10 |
11 | Borrowing confirm(Long id);
12 |
13 | Borrowing back(Long id);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/java/mingshu/librarian/service/BorrowingServiceImpl.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.service;
2 |
3 | import com.google.inject.Inject;
4 | import com.google.inject.persist.Transactional;
5 | import mingshu.librarian.db.Borrowing;
6 | import mingshu.librarian.db.BorrowingStatus;
7 | import mingshu.librarian.db.repo.BorrowingRepository;
8 |
9 | import java.time.LocalDate;
10 | import java.time.LocalDateTime;
11 | import java.time.format.DateTimeFormatter;
12 |
13 | public class BorrowingServiceImpl implements BorrowingService {
14 |
15 | @Inject private BorrowingRepository _borrowings;
16 |
17 | public String getCode() {
18 | return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddhhmmss"));
19 | }
20 |
21 | @Override
22 | @Transactional
23 | public Borrowing confirm(Long id) {
24 | Borrowing borrowing = _borrowings.find(id);
25 | borrowing.setReturnTime(borrowing.getBorrowTime().plusDays(borrowing.getDays()));
26 | borrowing.setStatus(BorrowingStatus.WAIT);
27 | _borrowings.save(borrowing);
28 | return borrowing;
29 | }
30 |
31 | @Override
32 | @Transactional
33 | public Borrowing back(Long id) {
34 | Borrowing borrowing = _borrowings.find(id);
35 | borrowing.setBackTime(LocalDateTime.now());
36 | borrowing.setStatus(BorrowingStatus.DONE);
37 | _borrowings.save(borrowing);
38 | return borrowing;
39 | }
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/java/mingshu/librarian/service/ReaderService.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.service;
2 |
3 | import com.axelor.auth.db.*;
4 | import mingshu.librarian.db.*;
5 |
6 | public interface ReaderService {
7 |
8 | User assignNewUser(Reader reader);
9 | }
10 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/java/mingshu/librarian/service/ReaderServiceImpl.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.service;
2 |
3 | import com.axelor.auth.db.*;
4 | import com.axelor.auth.db.repo.*;
5 | import com.google.inject.persist.Transactional;
6 | import mingshu.librarian.db.*;
7 | import mingshu.librarian.db.repo.ReaderRepository;
8 |
9 | import javax.inject.Inject;
10 |
11 | public class ReaderServiceImpl implements ReaderService {
12 |
13 | @Inject
14 | private UserRepository _users;
15 |
16 | @Inject
17 | private ReaderRepository _readers;
18 |
19 | @Transactional
20 | public User assignNewUser(Reader reader) {
21 | User newUser = new User();
22 | newUser.setCode(reader.getMobile()); // 设置读者用户登录用户名为其手机号
23 | newUser.setName("读者 " + reader.getName()); // 设置用户信息的名称为读者的姓名
24 | newUser.setForcePasswordChange(true); // 要求读者用户登录时修改密码
25 | newUser.setPassword("123456"); // 读者用户密码默认为 `123456`
26 | newUser.setReader(reader);
27 | newUser = _users.save(newUser);
28 | reader.setUser(newUser);
29 | _readers.save(reader);
30 | return newUser;
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/java/mingshu/librarian/web/BorrowingController.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.web;
2 |
3 | import javax.inject.Inject;
4 | import com.axelor.rpc.ActionRequest;
5 | import com.axelor.rpc.ActionResponse;
6 |
7 | import mingshu.librarian.db.*;
8 | import mingshu.librarian.service.BorrowingService;
9 |
10 |
11 | public class BorrowingController {
12 |
13 | @Inject
14 | private BorrowingService _borrowingService;
15 |
16 | public void onConfirm(ActionRequest request, ActionResponse response){
17 | Borrowing borrowing = request.getContext().asType(Borrowing.class);
18 |
19 | response.setReadonly("borrowTime", true);
20 | _borrowingService.confirm(borrowing.getId());
21 | response.setNotify("命叔说:借阅已生效");
22 | response.setReload(true);
23 | }
24 |
25 | public void onBack(ActionRequest request, ActionResponse response){
26 | Borrowing borrowing = request.getContext().asType(Borrowing.class);
27 | _borrowingService.back(borrowing.getId());
28 | response.setNotify("命叔说:已成功还书");
29 | response.setReload(true);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/java/mingshu/librarian/web/ReaderController.java:
--------------------------------------------------------------------------------
1 | package mingshu.librarian.web;
2 |
3 | // 导入系统库
4 | import com.axelor.auth.db.User;
5 | import com.axelor.db.JpaSupport;
6 | import com.axelor.rpc.ActionRequest;
7 | import com.axelor.rpc.ActionResponse;
8 | import com.google.common.collect.Lists;
9 | import java.math.BigDecimal;
10 | import java.math.RoundingMode;
11 | import java.time.LocalDate;
12 | import java.util.HashMap;
13 | import java.util.List;
14 | import java.util.Map;
15 | import javax.inject.Inject;
16 | import javax.persistence.EntityManager;
17 | import javax.persistence.Query;
18 |
19 | // 导入模块库
20 | import mingshu.librarian.db.*;
21 | import mingshu.librarian.db.repo.ReaderRepository;
22 | import mingshu.librarian.service.*;
23 |
24 | public class ReaderController extends JpaSupport {
25 |
26 | @Inject private ReaderRepository _readers;
27 | @Inject private ReaderService _readerService;
28 |
29 | /**
30 | * 按下“设置用户”后端执行的操作
31 | */
32 | public void onAssignUser(ActionRequest request, ActionResponse response) {
33 |
34 | // 用 request 里 JSON 解析出来的 Map 字段名=>值 来填充对象 reader 里的对应属性
35 | Reader reader = request.getContext().asType(Reader.class);
36 |
37 | // 用 id 字段去数据库里查询 reader,返回 Hibernate 跟踪的实体类对象,
38 | // 后续操作一般是使用 Hibernate 跟踪的对象
39 | reader = _readers.find(reader.getId());
40 |
41 | if (reader.getUser() == null) {
42 | User newUser =_readerService.assignNewUser(reader);
43 | }
44 |
45 | response.setFlash("命叔说:读者配套的登录用户设置好了"); // 前端弹出消息
46 | response.setReload(true); // 要求前端重新加载数据
47 | }
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/resources/domains/Entities.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
35 |
36 |
37 |
38 |
39 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/resources/domains/User.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/resources/views/BookView.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
25 |
26 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/resources/views/BorrowingView.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/resources/views/Menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/resources/views/ReaderView.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/axelor-demo-04/modules/librarian/src/main/resources/views/User.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
16 |
17 |
--------------------------------------------------------------------------------
/axelor-demo-04/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'axelor-demo-04'
2 |
3 | include "modules:librarian"
4 |
--------------------------------------------------------------------------------
/axelor-demo-04/src/license/header.txt:
--------------------------------------------------------------------------------
1 | // 版权所有 2020-2021 © 云南半星科技有限公司。保留所有权力
2 |
--------------------------------------------------------------------------------
/axelor-demo-04/src/main/resources/META-INF/persistence.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | org.hibernate.jpa.HibernatePersistenceProvider
7 | ENABLE_SELECTIVE
8 |
9 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
23 |
24 |
25 |
26 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/axelor-demo-04/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # Application Information
2 | # ~~~~~
3 | application.name = Library Management System (Demo04)
4 | application.description = Axelor Demo by Uncle Ming Channel
5 | application.version = 0.2.0
6 |
7 | # Author/Company
8 | # ~~~~~
9 | application.author = 云南伴星科技有限公司
10 | application.copyright = 版权所有 © {year} 云南伴星科技有限公司。保留所有权利。
11 |
12 | # Header Logo
13 | # ~~~~~
14 | # Should be 40px in height with transparent background
15 | application.logo =
16 |
17 | # Home Website
18 | # ~~~~~
19 | # Link to be used with header logo
20 | application.home = https://www.youtube.com/channel/UC8nM1uN2Ii9bC0nDAoOQa3g
21 |
22 | # Link to the online help
23 | # ~~~~~
24 | application.help = https://www.youtube.com/channel/UC8nM1uN2Ii9bC0nDAoOQa3g
25 |
26 | # Application deployment mode
27 | # ~~~~~
28 | # Set to 'dev' for development mode else 'prod'
29 | application.mode = dev
30 |
31 | # CSS Theme
32 | # ~~~~~
33 | # Set default CSS theme, for example `blue`
34 | application.theme =
35 |
36 | # Default Locale (language)
37 | # ~~~~~
38 | # Set default application locale (en, fr, fr_FR, en_US)
39 | application.locale = zh_CN
40 |
41 | # Encryption
42 | # ~~~~~
43 | # Set encryption password
44 | #encryption.password = MySuperSecretKey
45 |
46 | # Set encryption algorithm (CBC or GCM)
47 | #encryption.algorithm = CBC
48 |
49 | # Database settings
50 | # ~~~~~
51 | # See hibernate documentation for connection parameters
52 |
53 | # HERE
54 | # PostgreSQL
55 | db.default.driver = org.postgresql.Driver
56 | db.default.ddl = update
57 | db.default.url = jdbc:postgresql://localhost:5432/axelor-demo-04-db
58 | db.default.user = mingming
59 | db.default.password = mingming
60 |
61 | # MySQL
62 | #db.default.driver = com.mysql.jdbc.Driver
63 | #db.default.ddl = update
64 | #db.default.url = jdbc:mysql://localhost:3306/axelor_demo_dev
65 | #db.default.user = axelor
66 | #db.default.password =
67 |
68 | # Oracle
69 | #db.default.driver = oracle.jdbc.OracleDriver
70 | #db.default.ddl = update
71 | #db.default.url = jdbc:oracle:thin:@localhost:1521:oracle
72 | #db.default.user = axelor
73 | #db.default.password =
74 |
75 | # Date Format
76 | # ~~~~~
77 | date.format = yyyy/MM/dd
78 |
79 | # Timezone
80 | # ~~~~~
81 | date.timezone = Asia/Shanghai
82 |
83 | # Session timeout (in minutes)
84 | # ~~~~~
85 | session.timeout = 60
86 |
87 | # Storage path for upload files (attachments)
88 | # ~~~~~
89 | # use {user.home} key to save files under user home directory, or
90 | # use absolute path where server user have write permission.
91 | file.upload.dir = {user.home}/.axelor/attachments
92 |
93 | # Upload filename pattern, default is auto where file is save with same name
94 | # in the given upload dir, if file is already there, a count number is
95 | # appended to file name.
96 | #
97 | # This can be overridden by providing custom name pattern, for example:
98 | #
99 | # file.upload.filename.pattern = {year}-{month}/{day}/{name}
100 | # file.upload.filename.pattern = {AA}/{name}
101 | #
102 | # Following placeholders can be used:
103 | #
104 | # {year} - current year
105 | # {month} - current month
106 | # {day} - current day
107 | # {name} - file name
108 | # {A} - first letter from file name
109 | # {AA} - first 2 letter from file name
110 | # {AAA} - first 3 letter from file name
111 | #
112 | #file.upload.filename.pattern = {year}-{month}/{day}/{name}
113 |
114 | # Maximum upload size (in MB)
115 | # ~~~~~
116 | file.upload.size = 5
117 |
118 | # Whitelist pattern can be used to allow file upload with matching names.
119 | #
120 | # For example: \\.(xml|html|jpg|png|pdf|xsl)$
121 | #
122 | # Regular expression
123 | # ~~~~~
124 | #file.upload.whitelist.pattern =
125 |
126 | # Blacklist pattern can be used to block file upload with matching names.
127 | #
128 | # Regular expression
129 | # ~~~~~
130 | #file.upload.blacklist.pattern =
131 |
132 | # Whitelist content type can be used to allow file upload with matching content.
133 | #
134 | # List of mime-types (plain/text,image/*,video/webm)
135 | # ~~~~~
136 | #file.upload.whitelist.types =
137 |
138 | # Blacklist content type can be used to block file upload with matching content.
139 | #
140 | # List of mime-types (plain/text,image/*,video/webm)
141 | # ~~~~~
142 | #file.upload.blacklist.types =
143 |
144 | # The external report design directory
145 | # ~~~~~
146 | # this directory is searched for the rptdesign files
147 | # (fallbacks to designs provided by modules)
148 | reports.design.dir = {user.home}/.axelor/reports
149 |
150 | # Storage path for report outputs
151 | reports.output.dir = {user.home}/.axelor/reports-gen
152 |
153 | # Data export (csv) encoding
154 | # ~~~~
155 | # Use Windows-1252, ISO-8859-1 or ISO-8859-15 if targeting ms excel
156 | # (excel does not recognize utf8 encoded csv)
157 | data.export.encoding = UTF-8
158 |
159 | # Storage path for export action
160 | # ~~~~~
161 | data.export.dir = {user.home}/.axelor/data-export
162 |
163 | # Specify whether to import demo data
164 | # ~~~~~
165 | data.import.demo-data = true
166 |
167 | # Storage path for templates
168 | # ~~~~~
169 | template.search.dir = {user.home}/.axelor/templates
170 |
171 | # LDAP Configuration
172 | # ~~~~~
173 | #ldap.server.url = ldap://localhost:10389
174 |
175 | # can be "simple" or "CRAM-MD5"
176 | ldap.auth.type = simple
177 |
178 | ldap.system.user = uid=admin,ou=system
179 | ldap.system.password = secret
180 |
181 | # group search base
182 | ldap.group.base = ou=groups,dc=example,dc=com
183 |
184 | # if set, create groups on ldap server under ldap.group.base
185 | #ldap.group.object.class = groupOfUniqueNames
186 |
187 | # a template to search groups by user login id
188 | ldap.group.filter = (uniqueMember=uid={0})
189 |
190 | # user search base
191 | ldap.user.base = ou=users,dc=example,dc=com
192 |
193 | # a template to search user by user login id
194 | ldap.user.filter = (uid={0})
195 |
196 | # CAS configuration
197 | # ~~~~~
198 | #auth.cas.server.url.prefix = https://localhost:8443/cas
199 |
200 | # use public accessible url
201 | #auth.cas.service = http://localhost:8080/axelor-demo/cas
202 |
203 | # login url, if not given prepared from server & service url
204 | #auth.cas.login.url = https://localhost:8443/cas/login?service=http://localhost:8080/axelor-demo/cas
205 |
206 | # logout url, if not given prepared from server & service url
207 | #auth.cas.logout.url = https://localhost:8443/cas/logout?service=http://localhost:8080/axelor-demo/
208 |
209 | # CAS validation protocol (CAS, SAML)
210 | #auth.cas.protocol = SAML
211 |
212 | # the attribute to map to user display name
213 | #auth.cas.attrs.user.name = name
214 |
215 | # the attribute to map to user email
216 | #auth.cas.attrs.user.email = mail
217 |
218 | # Quartz Scheduler
219 | # ~~~~~
220 | # quartz job scheduler
221 |
222 | # Specify whether to enable quartz scheduler
223 | quartz.enable = false
224 |
225 | # total number of threads in quartz thread pool
226 | # the number of jobs that can run simultaneously
227 | quartz.threadCount = 3
228 |
229 | # SMPT configuration
230 | # ~~~~~
231 | # SMTP server configuration
232 | #mail.smtp.host = smtp.gmail.com
233 | #mail.smtp.port = 587
234 | #mail.smtp.channel = starttls
235 | #mail.smtp.user = user@gmail.com
236 | #mail.smtp.pass = secret
237 |
238 | # timeout settings
239 | #mail.smtp.timeout = 60000
240 | #mail.smtp.connectionTimeout = 60000
241 |
242 | # IMAP configuration
243 | # ~~~~~
244 | # IMAP server configuration
245 | # (quartz scheduler should be enabled for fetching stream replies)
246 | #mail.imap.host = imap.gmail.com
247 | #mail.imap.port = 993
248 | #mail.imap.channel = ssl
249 | #mail.imap.user = user@gmail.com
250 | #mail.imap.pass = secret
251 |
252 | # timeout settings
253 | #mail.imap.timeout = 60000
254 | #mail.imap.connectionTimeout = 60000
255 |
256 | # CORS configuration
257 | # ~~~~~
258 | # CORS settings to allow cross origin requests
259 |
260 | # regular expression to test allowed origin or * to allow all (not recommended)
261 | #cors.allow.origin = *
262 | #cors.allow.credentials = true
263 | #cors.allow.methods = GET,PUT,POST,DELETE,HEAD,OPTIONS
264 | #cors.allow.headers = Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers
265 |
266 | # View configuration
267 | # ~~~~~
268 |
269 | # Set to true to enable single view mode
270 | view.single.tab = false
271 |
272 | # Set menu style (left, top, both)
273 | view.menubar.location = both
274 |
275 | # HERE
276 | view.toolbar.titles = true
277 |
278 | # Advance Filter Sharing
279 | # ~~~~~
280 | # Set to false to hide advance search filter share option, or set to list of
281 | # role names to enable share for those roles only.
282 | #view.adv-search.share = share-filter,can-share-filter
283 |
284 | # Logging
285 | # ~~~~~
286 | # Custom logback configuration can be provided with `logging.config` property pointing
287 | # to a custom `logback.xml`. In this case, all the logging configuration provided here
288 | # will be ignored.
289 | #
290 | # Following settings can be used to configure logging system automatically.
291 | #
292 | #logging.path = {user.home}/.axelor/logs
293 | #logging.pattern.file = %d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%t] %-40.40logger{39} : %m%n
294 | #logging.pattern.console = %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n
295 |
296 | # Global logging
297 | logging.level.root = ERROR
298 |
299 | # Axelor logging
300 |
301 | # Log everything.
302 | logging.level.com.axelor = INFO
303 |
304 | # Hibernate logging
305 |
306 | # Log everything. Good for troubleshooting
307 | #logging.level.org.hibernate = INFO
308 |
309 | # Log all SQL DML statements as they are executed
310 | #logging.level.org.hibernate.SQL = DEBUG
311 | #logging.level.org.hibernate.engine.jdbc = DEBUG
312 |
313 | # Log all SQL DDL statements as they are executed
314 | #logging.level.org.hibernate.tool.hbm2ddl = INFO
315 |
316 | # Log all JDBC parameters
317 | #logging.level.org.hibernate.type = ALL
318 |
319 | # Log transactions
320 | #logging.level.org.hibernate.transaction = DEBUG
321 |
322 | # Log L2-Cache
323 | #logging.level.org.hibernate.cache = DEBUG
324 |
325 | # Log JDBC resource acquisition
326 | #logging.level.org.hibernate.jdbc = TRACE
327 | #logging.level.org.hibernate.service.jdbc = TRACE
328 |
329 | # Log connection pooling
330 | #logging.level.com.zaxxer.hikari = INFO
331 |
--------------------------------------------------------------------------------
/python-samples/axelor-web-service-demo.py:
--------------------------------------------------------------------------------
1 | #encoding: utf-8
2 | # 演示访问 Axelor Web Service 的 Python 脚本
3 | # 作者:命师
4 |
5 | import requests
6 |
7 | URL = 'http://127.0.0.1:3000/axelor-demo-03'
8 | USERNAME = 'admin'
9 | PASSWORD = 'admin'
10 |
11 | session = requests.Session()
12 |
13 | # 提交用户名和密码执行登录
14 | login_form = {'username': USERNAME, 'password': PASSWORD}
15 | url = URL + '/callback'
16 | response = session.post(url, data=login_form)
17 |
18 | # 调用 Web Service 查询并显示系统中所有的用户
19 | url = URL + '/ws/rest/com.axelor.auth.db.User'
20 | response = session.get(url)
21 | obj = response.json()
22 | print('Users in Axelor:\n')
23 | for record in obj['data']:
24 | print('ID={0}\tName={1}\t\t\t\t'.format(record['id'], record['name']))
25 |
--------------------------------------------------------------------------------