Aexlor -- rapid construction of java OA business application framework

1. Aexlor overview

Axelor Open Suite is a French Open Source OA project framework: Axelor Open Suite focuses on business processes, reduces the complexity of development and helps us build applications quickly. It is an MVC framework, which requires us to write a small amount of java code, because its models, views and actions are defined in xml files. The framework will automatically help us generate the code of each part, which greatly improves the development efficiency. Only a small amount of business code needs us to develop. The function already exists in the form of "app", which supports installation and uninstallation. The documentation of the framework is particularly rich and detailed. It is a good learning project.

Axelor Open Suite includes the following default modules: customer relationship management, sales management, financial and cost management, human resource management, project management, inventory and supply chain management, production management, multi company, multi currency and multi language.


Axelor is a framework, your code is hosted in Axelor, and the initiative of calling is in the hands of Axelor. Code and resources need to comply with axelor's agreement before they can be discovered and used by axelor; The function items of axelor can be replaced by IOC container. For details, please refer to axelor's official documents:

Axelor official website: https://www.axelor.com
Axelor documentation: https://docs.axelor.com
Axelor code base: https://github.com/axelor

2. Aexlor construction

2.1 Axelor project structure

2.2 environmental preparation:

  • Java 8, Aexlor only supports Java 8
  • Gradle build tool: organize projects through gradle build scripts
  • IDE or VS editor
  • SQL database system. PostgreSQL is used in this chapter. Other Mysql and Oracle are OK
  • Database client PgAdmin

2.3 create project skeleton

1. Database creation user and empty library

2. Add application Properties configuration to set the database configuration

# Application Information
application.name = Axelor Demo
application.description = Axelor Demo
application.version = 0.1.0

# Default Locale (language)
# Set default application locale (en, fr, fr_FR, en_US)
application.locale = zh_CN
# HERE
# PostgreSQL
db.default.driver = org.postgresql.Driver
db.default.ddl = update
db.default.url = jdbc:postgresql://localhost:5432/axelor-demo-db
db.default.user = postgres
db.default.password = postgres

# Date Format
# ~~~~~
date.format = yyyy/MM/dd

# Timezone
# ~~~~~
date.timezone = Asia/Shanghai

# Session timeout (in minutes)
# ~~~~~
session.timeout = 60

# Storage path for upload files (attachments)
# ~~~~~
# use {user.home} key to save files under user home directory, or
# use absolute path where server user have write permission.
file.upload.dir = {user.home}/.axelor/attachments

# Maximum upload size (in MB)
# ~~~~~
file.upload.size = 5

# The external report design directory
# ~~~~~
# this directory is searched for the rptdesign files
# (fallbacks to designs provided by modules)
reports.design.dir = {user.home}/.axelor/reports

# Storage path for report outputs
reports.output.dir = {user.home}/.axelor/reports-gen

# Data export (csv) encoding
# ~~~~
# Use Windows-1252, ISO-8859-1 or ISO-8859-15 if targeting ms excel
# (excel does not recognize utf8 encoded csv)
data.export.encoding = UTF-8

# Storage path for export action
# ~~~~~
data.export.dir = {user.home}/.axelor/data-export

# Specify whether to import demo data
# ~~~~~
data.import.demo-data = true

# Storage path for templates
# ~~~~~
template.search.dir = {user.home}/.axelor/templates

# LDAP Configuration
# ~~~~~
#ldap.server.url = ldap://localhost:10389

# can be "simple" or "CRAM-MD5"
ldap.auth.type = simple

ldap.system.user = uid=admin,ou=system
ldap.system.password = secret

# group search base
ldap.group.base = ou=groups,dc=example,dc=com

# if set, create groups on ldap server under ldap.group.base
#ldap.group.object.class = groupOfUniqueNames

# a template to search groups by user login id
ldap.group.filter = (uniqueMember=uid={0})

# user search base
ldap.user.base = ou=users,dc=example,dc=com

# a template to search user by user login id
ldap.user.filter = (uid={0})

# Specify whether to enable quartz scheduler
quartz.enable = false

# total number of threads in quartz thread pool
# the number of jobs that can run simultaneously
quartz.threadCount = 3

# View configuration
# ~~~~~

# Set to true to enable single view mode
view.single.tab = false

# Set menu style (left, top, both)
view.menubar.location = both

# HERE
view.toolbar.titles = true

# Global logging
logging.level.root = ERROR

# Axelor logging

# Log everything.
logging.level.com.axelor = INFO

3. Add JPA persistence XML file

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence version="2.1"
             xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
        <properties>
            <!--
            <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/axelor-app" />
            -->
            <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:mem:test" />

            <property name="javax.persistence.jdbc.user" value="sa" />
            <property name="javax.persistence.jdbc.password" value="" />

            <!-- value="create" to build a new database on each run;
                 value="update" to modify an existing database;
                 value="create-drop" means the same as "create" but also drops tables when Hibernate closes;
                 value="validate" makes no changes to the database -->
            <property name="hibernate.hbm2ddl.auto" value="update" />

            <!-- connection pooling -->
            <property name="hibernate.connection.provider_class"
                      value="org.hibernate.hikaricp.internal.HikariCPConnectionProvider" />

            <property name="hibernate.hikari.minimumIdle" value="10" />
            <property name="hibernate.hikari.maximumPoolSize" value="200" />
            <property name="hibernate.hikari.idleTimeout" value="30000" />

        </properties>
    </persistence-unit>
</persistence>

4. Create a new java project based on gradle and set build Gradle and settings Gradle file

build.gradle file:

buildscript {
    ext.repos = {

        // The local Maven warehouse shall be inspected first
        mavenLocal()
        // Public warehouses give priority to Alibaba cloud
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/jcenter'}
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        // Use Axelor's official Repo below to supplement the missing jars
        maven { url 'https://repository.axelor.com/nexus/public/' }
        // The original Maven warehouse is placed at the end and can not be used because Alibaba cloud's warehouse is image synchronized
        /*
        mavenCentral()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/'}
        */
    }
    repositories repos
    dependencies {
        classpath 'com.axelor:axelor-gradle:5.3.0-SNAPSHOT'
    }
}

allprojects {
    repositories repos
}

apply plugin: 'com.axelor.app'

axelor {
    title = 'axelor-emo'
}

allprojects {
    apply plugin: 'idea'
    group 'rachel'
    version '1.0-SNAPSHOT'

    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}

dependencies {
    compile project(":modules:sales")
}

wrapper {
    gradleVersion = "5.6.4"
}

settings.gradle file:

rootProject.name = 'rachel-sales-demo'
include "modules:sales"

5. Add the root directory Gradle Properties file to set the Gradle compilation run parameters

org.gradle.daemon=false

6. Start the operation, open the browser according to the output url, and you can see the Axelor interface

Login account: admin/admin

Keywords: Java Gradle

Added by ryanthegecko on Sun, 16 Jan 2022 07:02:38 +0200