diff --git a/pigx-common/pigx-common-bom/pom.xml b/pigx-common/pigx-common-bom/pom.xml
index 585fdbaae..3a1e7ad59 100644
--- a/pigx-common/pigx-common-bom/pom.xml
+++ b/pigx-common/pigx-common-bom/pom.xml
@@ -26,7 +26,7 @@
8.0.3221.3.0.08.4.1.jre8
- 8.1.2.79
+ 8.1.2.1926.2.03.0.32.1.0
@@ -252,6 +252,11 @@
DmJdbcDriver18${dm.version}
+
+ com.dameng
+ DmDialect-for-hibernate5.3
+ ${dm.version}
+ com.highgoHgdbJdbc
diff --git a/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/pom.xml b/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/pom.xml
index 2fcf12ba5..599dcdf4b 100644
--- a/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/pom.xml
+++ b/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/pom.xml
@@ -118,6 +118,10 @@
org.springframework.bootspring-boot-starter-test
+
+ com.dameng
+ DmJdbcDriver18
+
diff --git a/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/src/main/java/org/flowable/common/engine/impl/AbstractEngineConfiguration.java b/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/src/main/java/org/flowable/common/engine/impl/AbstractEngineConfiguration.java
new file mode 100644
index 000000000..7ba7b77ba
--- /dev/null
+++ b/pigx-flow/pigx-flow-engine/pigx-flow-engine-biz/src/main/java/org/flowable/common/engine/impl/AbstractEngineConfiguration.java
@@ -0,0 +1,2219 @@
+/* Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.flowable.common.engine.impl;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ServiceLoader;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.builder.xml.XMLConfigBuilder;
+import org.apache.ibatis.builder.xml.XMLMapperBuilder;
+import org.apache.ibatis.datasource.pooled.PooledDataSource;
+import org.apache.ibatis.mapping.Environment;
+import org.apache.ibatis.plugin.Interceptor;
+import org.apache.ibatis.session.Configuration;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.defaults.DefaultSqlSessionFactory;
+import org.apache.ibatis.transaction.TransactionFactory;
+import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
+import org.apache.ibatis.transaction.managed.ManagedTransactionFactory;
+import org.apache.ibatis.type.ArrayTypeHandler;
+import org.apache.ibatis.type.BigDecimalTypeHandler;
+import org.apache.ibatis.type.BlobInputStreamTypeHandler;
+import org.apache.ibatis.type.BlobTypeHandler;
+import org.apache.ibatis.type.BooleanTypeHandler;
+import org.apache.ibatis.type.ByteTypeHandler;
+import org.apache.ibatis.type.ClobTypeHandler;
+import org.apache.ibatis.type.DateOnlyTypeHandler;
+import org.apache.ibatis.type.DateTypeHandler;
+import org.apache.ibatis.type.DoubleTypeHandler;
+import org.apache.ibatis.type.FloatTypeHandler;
+import org.apache.ibatis.type.IntegerTypeHandler;
+import org.apache.ibatis.type.JdbcType;
+import org.apache.ibatis.type.LongTypeHandler;
+import org.apache.ibatis.type.NClobTypeHandler;
+import org.apache.ibatis.type.NStringTypeHandler;
+import org.apache.ibatis.type.ShortTypeHandler;
+import org.apache.ibatis.type.SqlxmlTypeHandler;
+import org.apache.ibatis.type.StringTypeHandler;
+import org.apache.ibatis.type.TimeOnlyTypeHandler;
+import org.apache.ibatis.type.TypeHandlerRegistry;
+import org.flowable.common.engine.api.FlowableException;
+import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
+import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
+import org.flowable.common.engine.api.delegate.event.FlowableEventListener;
+import org.flowable.common.engine.api.engine.EngineLifecycleListener;
+import org.flowable.common.engine.impl.agenda.AgendaOperationRunner;
+import org.flowable.common.engine.impl.cfg.CommandExecutorImpl;
+import org.flowable.common.engine.impl.cfg.IdGenerator;
+import org.flowable.common.engine.impl.cfg.TransactionContextFactory;
+import org.flowable.common.engine.impl.cfg.standalone.StandaloneMybatisTransactionContextFactory;
+import org.flowable.common.engine.impl.db.CommonDbSchemaManager;
+import org.flowable.common.engine.impl.db.DbSqlSessionFactory;
+import org.flowable.common.engine.impl.db.LogSqlExecutionTimePlugin;
+import org.flowable.common.engine.impl.db.MybatisTypeAliasConfigurator;
+import org.flowable.common.engine.impl.db.MybatisTypeHandlerConfigurator;
+import org.flowable.common.engine.impl.db.SchemaManager;
+import org.flowable.common.engine.impl.event.EventDispatchAction;
+import org.flowable.common.engine.impl.event.FlowableEventDispatcherImpl;
+import org.flowable.common.engine.impl.interceptor.Command;
+import org.flowable.common.engine.impl.interceptor.CommandConfig;
+import org.flowable.common.engine.impl.interceptor.CommandContextFactory;
+import org.flowable.common.engine.impl.interceptor.CommandContextInterceptor;
+import org.flowable.common.engine.impl.interceptor.CommandExecutor;
+import org.flowable.common.engine.impl.interceptor.CommandInterceptor;
+import org.flowable.common.engine.impl.interceptor.CrDbRetryInterceptor;
+import org.flowable.common.engine.impl.interceptor.DefaultCommandInvoker;
+import org.flowable.common.engine.impl.interceptor.LogInterceptor;
+import org.flowable.common.engine.impl.interceptor.SessionFactory;
+import org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor;
+import org.flowable.common.engine.impl.lock.LockManager;
+import org.flowable.common.engine.impl.lock.LockManagerImpl;
+import org.flowable.common.engine.impl.logging.LoggingListener;
+import org.flowable.common.engine.impl.logging.LoggingSession;
+import org.flowable.common.engine.impl.logging.LoggingSessionFactory;
+import org.flowable.common.engine.impl.persistence.GenericManagerFactory;
+import org.flowable.common.engine.impl.persistence.StrongUuidGenerator;
+import org.flowable.common.engine.impl.persistence.cache.EntityCache;
+import org.flowable.common.engine.impl.persistence.cache.EntityCacheImpl;
+import org.flowable.common.engine.impl.persistence.entity.ByteArrayEntityManager;
+import org.flowable.common.engine.impl.persistence.entity.ByteArrayEntityManagerImpl;
+import org.flowable.common.engine.impl.persistence.entity.Entity;
+import org.flowable.common.engine.impl.persistence.entity.PropertyEntityManager;
+import org.flowable.common.engine.impl.persistence.entity.PropertyEntityManagerImpl;
+import org.flowable.common.engine.impl.persistence.entity.TableDataManager;
+import org.flowable.common.engine.impl.persistence.entity.TableDataManagerImpl;
+import org.flowable.common.engine.impl.persistence.entity.data.ByteArrayDataManager;
+import org.flowable.common.engine.impl.persistence.entity.data.PropertyDataManager;
+import org.flowable.common.engine.impl.persistence.entity.data.impl.MybatisByteArrayDataManager;
+import org.flowable.common.engine.impl.persistence.entity.data.impl.MybatisPropertyDataManager;
+import org.flowable.common.engine.impl.runtime.Clock;
+import org.flowable.common.engine.impl.service.CommonEngineServiceImpl;
+import org.flowable.common.engine.impl.util.DefaultClockImpl;
+import org.flowable.common.engine.impl.util.IoUtil;
+import org.flowable.common.engine.impl.util.ReflectUtil;
+import org.flowable.eventregistry.api.EventRegistryEventConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+/**
+ * 覆盖原有配置支持国产化数据库
+ */
+public abstract class AbstractEngineConfiguration {
+
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
+
+ /** The tenant id indicating 'no tenant' */
+ public static final String NO_TENANT_ID = "";
+
+ /**
+ * Checks the version of the DB schema against the library when the form engine is
+ * being created and throws an exception if the versions don't match.
+ */
+ public static final String DB_SCHEMA_UPDATE_FALSE = "false";
+
+ public static final String DB_SCHEMA_UPDATE_CREATE = "create";
+
+ public static final String DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop";
+
+ /**
+ * Creates the schema when the form engine is being created and drops the schema when
+ * the form engine is being closed.
+ */
+ public static final String DB_SCHEMA_UPDATE_DROP_CREATE = "drop-create";
+
+ /**
+ * Upon building of the process engine, a check is performed and an update of the
+ * schema is performed if it is necessary.
+ */
+ public static final String DB_SCHEMA_UPDATE_TRUE = "true";
+
+ protected boolean forceCloseMybatisConnectionPool = true;
+
+ protected String databaseType;
+
+ protected String jdbcDriver = "org.h2.Driver";
+
+ protected String jdbcUrl = "jdbc:h2:tcp://localhost/~/flowable";
+
+ protected String jdbcUsername = "sa";
+
+ protected String jdbcPassword = "";
+
+ protected String dataSourceJndiName;
+
+ protected int jdbcMaxActiveConnections = 16;
+
+ protected int jdbcMaxIdleConnections = 8;
+
+ protected int jdbcMaxCheckoutTime;
+
+ protected int jdbcMaxWaitTime;
+
+ protected boolean jdbcPingEnabled;
+
+ protected String jdbcPingQuery;
+
+ protected int jdbcPingConnectionNotUsedFor;
+
+ protected int jdbcDefaultTransactionIsolationLevel;
+
+ protected DataSource dataSource;
+
+ protected SchemaManager commonSchemaManager;
+
+ protected SchemaManager schemaManager;
+
+ protected Command schemaManagementCmd;
+
+ protected String databaseSchemaUpdate = DB_SCHEMA_UPDATE_FALSE;
+
+ /**
+ * Whether to use a lock when performing the database schema create or update
+ * operations.
+ */
+ protected boolean useLockForDatabaseSchemaUpdate = false;
+
+ protected String xmlEncoding = "UTF-8";
+
+ // COMMAND EXECUTORS ///////////////////////////////////////////////
+
+ protected CommandExecutor commandExecutor;
+
+ protected Collection extends CommandInterceptor> defaultCommandInterceptors;
+
+ protected CommandConfig defaultCommandConfig;
+
+ protected CommandConfig schemaCommandConfig;
+
+ protected CommandContextFactory commandContextFactory;
+
+ protected CommandInterceptor commandInvoker;
+
+ protected AgendaOperationRunner agendaOperationRunner = (commandContext, runnable) -> runnable.run();
+
+ protected List customPreCommandInterceptors;
+
+ protected List customPostCommandInterceptors;
+
+ protected List commandInterceptors;
+
+ protected Map engineConfigurations = new HashMap<>();
+
+ protected Map serviceConfigurations = new HashMap<>();
+
+ protected ClassLoader classLoader;
+
+ /**
+ * Either use Class.forName or ClassLoader.loadClass for class loading. See
+ * http://forums.activiti.org/content/reflectutilloadclass-and-custom- classloader
+ */
+ protected boolean useClassForNameClassLoading = true;
+
+ protected List engineLifecycleListeners;
+
+ // Event Registry //////////////////////////////////////////////////
+ protected Map eventRegistryEventConsumers = new HashMap<>();
+
+ // MYBATIS SQL SESSION FACTORY /////////////////////////////////////
+
+ protected boolean isDbHistoryUsed = true;
+
+ protected DbSqlSessionFactory dbSqlSessionFactory;
+
+ protected SqlSessionFactory sqlSessionFactory;
+
+ protected TransactionFactory transactionFactory;
+
+ protected TransactionContextFactory transactionContextFactory;
+
+ /**
+ * If set to true, enables bulk insert (grouping sql inserts together). Default true.
+ * For some databases (eg DB2+z/OS) needs to be set to false.
+ */
+ protected boolean isBulkInsertEnabled = true;
+
+ /**
+ * Some databases have a limit of how many parameters one sql insert can have (eg SQL
+ * Server, 2000 params (!= insert statements) ). Tweak this parameter in case of
+ * exceptions indicating too much is being put into one bulk insert, or make it higher
+ * if your database can cope with it and there are inserts with a huge amount of data.
+ *
+ * By default: 100 (55 for mssql server as it has a hard limit of 2000 parameters in a
+ * statement)
+ */
+ protected int maxNrOfStatementsInBulkInsert = 100;
+
+ public int DEFAULT_MAX_NR_OF_STATEMENTS_BULK_INSERT_SQL_SERVER = 55; // currently
+ // Execution
+ // has most
+ // params
+ // (35). 2000
+ // / 35 = 57.
+
+ protected String mybatisMappingFile;
+
+ protected Set> customMybatisMappers;
+
+ protected Set customMybatisXMLMappers;
+
+ protected List customMybatisInterceptors;
+
+ protected Set dependentEngineMyBatisXmlMappers;
+
+ protected List dependentEngineMybatisTypeAliasConfigs;
+
+ protected List dependentEngineMybatisTypeHandlerConfigs;
+
+ // SESSION FACTORIES ///////////////////////////////////////////////
+ protected List customSessionFactories;
+
+ protected Map, SessionFactory> sessionFactories;
+
+ protected boolean enableEventDispatcher = true;
+
+ protected FlowableEventDispatcher eventDispatcher;
+
+ protected List eventListeners;
+
+ protected Map> typedEventListeners;
+
+ protected List additionalEventDispatchActions;
+
+ protected LoggingListener loggingListener;
+
+ protected boolean transactionsExternallyManaged;
+
+ /**
+ * Flag that can be set to configure or not a relational database is used. This is
+ * useful for custom implementations that do not use relational databases at all.
+ *
+ * If true (default), the
+ * {@link AbstractEngineConfiguration#getDatabaseSchemaUpdate()} value will be used to
+ * determine what needs to happen wrt the database schema.
+ *
+ * If false, no validation or schema creation will be done. That means that the
+ * database schema must have been created 'manually' before but the engine does not
+ * validate whether the schema is correct. The
+ * {@link AbstractEngineConfiguration#getDatabaseSchemaUpdate()} value will not be
+ * used.
+ */
+ protected boolean usingRelationalDatabase = true;
+
+ /**
+ * Flag that can be set to configure whether or not a schema is used. This is useful
+ * for custom implementations that do not use relational databases at all. Setting
+ * {@link #usingRelationalDatabase} to true will automatically imply using a schema.
+ */
+ protected boolean usingSchemaMgmt = true;
+
+ /**
+ * Allows configuring a database table prefix which is used for all runtime operations
+ * of the process engine. For example, if you specify a prefix named 'PRE1.', Flowable
+ * will query for executions in a table named 'PRE1.ACT_RU_EXECUTION_'.
+ *
+ *
+ * NOTE: the prefix is not respected by automatic database schema management.
+ * If you use {@link AbstractEngineConfiguration#DB_SCHEMA_UPDATE_CREATE_DROP} or
+ * {@link AbstractEngineConfiguration#DB_SCHEMA_UPDATE_TRUE}, Flowable will create the
+ * database tables using the default names, regardless of the prefix configured
+ * here.
+ */
+ protected String databaseTablePrefix = "";
+
+ /**
+ * Escape character for doing wildcard searches.
+ *
+ * This will be added at then end of queries that include for example a LIKE clause.
+ * For example: SELECT * FROM table WHERE column LIKE '%\%%' ESCAPE '\';
+ */
+ protected String databaseWildcardEscapeCharacter;
+
+ /**
+ * database catalog to use
+ */
+ protected String databaseCatalog = "";
+
+ /**
+ * In some situations you want to set the schema to use for table checks / generation
+ * if the database metadata doesn't return that correctly, see
+ * https://jira.codehaus.org/browse/ACT-1220,
+ * https://jira.codehaus.org/browse/ACT-1062
+ */
+ protected String databaseSchema;
+
+ /**
+ * Set to true in case the defined databaseTablePrefix is a schema-name, instead of an
+ * actual table name prefix. This is relevant for checking if Flowable-tables exist,
+ * the databaseTablePrefix will not be used here - since the schema is taken into
+ * account already, adding a prefix for the table-check will result in wrong
+ * table-names.
+ */
+ protected boolean tablePrefixIsSchema;
+
+ /**
+ * Set to true if the latest version of a definition should be retrieved, ignoring a
+ * possible parent deployment id value
+ */
+ protected boolean alwaysLookupLatestDefinitionVersion;
+
+ /**
+ * Set to true if by default lookups should fallback to the default tenant (an empty
+ * string by default or a defined tenant value)
+ */
+ protected boolean fallbackToDefaultTenant;
+
+ /**
+ * Default tenant provider that is executed when looking up definitions, in case the
+ * global or local fallback to default tenant value is true
+ */
+ protected DefaultTenantProvider defaultTenantProvider = (tenantId, scope, scopeKey) -> NO_TENANT_ID;
+
+ /**
+ * Enables the MyBatis plugin that logs the execution time of sql statements.
+ */
+ protected boolean enableLogSqlExecutionTime;
+
+ protected Properties databaseTypeMappings = getDefaultDatabaseTypeMappings();
+
+ /**
+ * Duration between the checks when acquiring a lock.
+ */
+ protected Duration lockPollRate = Duration.ofSeconds(10);
+
+ /**
+ * Duration to wait for the DB Schema lock before giving up.
+ */
+ protected Duration schemaLockWaitTime = Duration.ofMinutes(5);
+
+ // DATA MANAGERS //////////////////////////////////////////////////////////////////
+
+ protected PropertyDataManager propertyDataManager;
+
+ protected ByteArrayDataManager byteArrayDataManager;
+
+ protected TableDataManager tableDataManager;
+
+ // ENTITY MANAGERS ////////////////////////////////////////////////////////////////
+
+ protected PropertyEntityManager propertyEntityManager;
+
+ protected ByteArrayEntityManager byteArrayEntityManager;
+
+ protected List customPreDeployers;
+
+ protected List customPostDeployers;
+
+ protected List deployers;
+
+ // CONFIGURATORS ////////////////////////////////////////////////////////////
+
+ protected boolean enableConfiguratorServiceLoader = true; // Enabled by default. In
+ // certain environments
+ // this should be set to
+ // false (eg osgi)
+
+ protected List configurators; // The injected configurators
+
+ protected List allConfigurators; // Including auto-discovered
+ // configurators
+
+ protected EngineConfigurator idmEngineConfigurator;
+
+ protected EngineConfigurator eventRegistryConfigurator;
+
+ public static final String PRODUCT_NAME_POSTGRES = "PostgreSQL";
+
+ public static final String PRODUCT_NAME_CRDB = "CockroachDB";
+
+ public static final String DATABASE_TYPE_H2 = "h2";
+
+ public static final String DATABASE_TYPE_HSQL = "hsql";
+
+ public static final String DATABASE_TYPE_MYSQL = "mysql";
+
+ public static final String DATABASE_TYPE_ORACLE = "oracle";
+
+ public static final String DATABASE_TYPE_POSTGRES = "postgres";
+
+ public static final String DATABASE_TYPE_MSSQL = "mssql";
+
+ public static final String DATABASE_TYPE_DB2 = "db2";
+
+ public static final String DATABASE_TYPE_COCKROACHDB = "cockroachdb";
+
+ public static Properties getDefaultDatabaseTypeMappings() {
+ Properties databaseTypeMappings = new Properties();
+ databaseTypeMappings.setProperty("H2", DATABASE_TYPE_H2);
+ databaseTypeMappings.setProperty("HSQL Database Engine", DATABASE_TYPE_HSQL);
+ databaseTypeMappings.setProperty("MySQL", DATABASE_TYPE_MYSQL);
+ databaseTypeMappings.setProperty("MariaDB", DATABASE_TYPE_MYSQL);
+ databaseTypeMappings.setProperty("Oracle", DATABASE_TYPE_ORACLE);
+ databaseTypeMappings.setProperty(PRODUCT_NAME_POSTGRES, DATABASE_TYPE_POSTGRES);
+ databaseTypeMappings.setProperty("Microsoft SQL Server", DATABASE_TYPE_MSSQL);
+ databaseTypeMappings.setProperty(DATABASE_TYPE_DB2, DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/NT", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/NT64", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2 UDP", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/LINUX", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/LINUX390", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/LINUXX8664", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/LINUXZ64", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/LINUXPPC64", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/LINUXPPC64LE", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/400 SQL", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/6000", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2 UDB iSeries", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/AIX64", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/HPUX", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/HP64", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/SUN", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/SUN64", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/PTX", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2/2", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DB2 UDB AS400", DATABASE_TYPE_DB2);
+ databaseTypeMappings.setProperty("DM DBMS",DATABASE_TYPE_MYSQL);//扩展支持达梦数据
+ databaseTypeMappings.setProperty(PRODUCT_NAME_CRDB, DATABASE_TYPE_COCKROACHDB);
+ return databaseTypeMappings;
+ }
+
+ protected Map