systemctl常用命令

systemctl常用命令

systemctl 防火墙操作

1
2
3
4
5
6
7
8
9
#暂时关闭防火墙的命令:
systemctl stop firewalld
#暂时开启防火墙:
systemctl start firewalld

#永久关闭防火墙(禁用开机自启)下次启动,才生效:
systemctl disable firewalld
#永久开启防火墙(启用开机自启)下次启动,才生效:
systemctl enable firewalld

learn more >>

Activiti5.22.0兼容达梦数据库

Activiti5.22.0兼容达梦数据库

修改Activiti源码使Activiti兼容达梦数据库,
Activiti版本为5.22.0

1. 下载源码

代码地址: git@github.com:Activiti/Activiti.git
切换activiti-engine模块分支至5.22.0:e92ce378

2. 源码修改

1. 在org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl,增加dm成员变量:

public static final String DATABASE_TYPE_DM = "dm";

2. 在org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl,修改getDefaultDatabaseTypeMappings():

databaseTypeMappings.setProperty("DM DBMS", DATABASE_TYPE_DM);
ProcessEngineConfigurationImpl;

3. 在org.activiti.engine.impl.db.DbSqlSession,增加版本信息

ACTIVITI_VERSIONS.add(new ActivitiVersion("5.22.0.0"));
DbSqlSession;

4. 在org.activiti.engine.impl.db.DbSqlSessionFactory,添加达梦信息

达梦语句与oracle基本一致,信息复制oracle修改名称

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
// 达梦 dm
databaseSpecificLimitBeforeStatements.put("dm", "select * from ( select a.*, ROWNUM rnum from (");
databaseSpecificLimitAfterStatements.put("dm", " ) a where ROWNUM < #{lastRow}) where rnum >= #{firstRow}");
databaseSpecificLimitBetweenStatements.put("dm", "");
databaseOuterJoinLimitBetweenStatements.put("dm", "");
databaseSpecificOrderByStatements.put("dm", defaultOrderBy);
addDatabaseSpecificStatement("dm", "selectExclusiveJobsToExecute", "selectExclusiveJobsToExecute_integerBoolean");
addDatabaseSpecificStatement("dm", "selectUnlockedTimersByDuedate", "selectUnlockedTimersByDuedate_oracle");
addDatabaseSpecificStatement("dm", "insertEventLogEntry", "insertEventLogEntry_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertVariableInstance", "bulkInsertVariableInstance_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertTask", "bulkInsertTask_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertResource", "bulkInsertResource_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertProperty", "bulkInsertProperty_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertProcessDefinition", "bulkInsertProcessDefinition_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertModel", "bulkInsertModel_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertTimer", "bulkInsertTimer_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertMessage", "bulkInsertMessage_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertIdentityLink", "bulkInsertIdentityLink_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertHistoricVariableInstance", "bulkInsertHistoricVariableInstance_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertHistoricTaskInstance", "bulkInsertHistoricTaskInstance_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertHistoricProcessInstance", "bulkInsertHistoricProcessInstance_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertHistoricIdentityLink", "bulkInsertHistoricIdentityLink_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertHistoricDetailVariableInstanceUpdate", "bulkInsertHistoricDetailVariableInstanceUpdate_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertHistoricFormProperty", "bulkInsertHistoricFormProperty_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertHistoricActivityInstance", "bulkInsertHistoricActivityInstance_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertExecution", "bulkInsertExecution_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertMessageEventSubscription", "bulkInsertMessageEventSubscription_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertSignalEventSubscription", "bulkInsertSignalEventSubscription_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertCompensateEventSubscription", "bulkInsertCompensateEventSubscription_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertEventLogEntry", "bulkInsertEventLogEntry_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertDeployment", "bulkInsertDeployment_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertComment", "bulkInsertComment_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertByteArray", "bulkInsertByteArray_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertEventLogEntry", "bulkInsertEventLogEntry_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertDeployment", "bulkInsertDeployment_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertComment", "bulkInsertComment_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertAttachment", "bulkInsertAttachment_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertJob", "bulkInsertJob_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertTimerJob", "bulkInsertTimerJob_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertSuspendedJob", "bulkInsertSuspendedJob_oracle");
addDatabaseSpecificStatement("dm", "bulkInsertDeadLetterJob", "bulkInsertDeadLetterJob_oracle");

DbSqlSessionFactory;

5. 修改org.activiti.engine.impl.db.DbSqlSessionFactory 类的 initBulkInsertEnabledMap(String databaseType)方法

1
2
3
if ("oracle".equals(databaseType) || "dm".equals(databaseType)) {
bulkInsertableMap.put(EventLogEntryEntity.class, Boolean.FALSE);
}

DbSqlSessionFactory;

6. 修改org.activiti.engine.impl.AbstractQuery 类的 addOrder(String column, String sortOrder, NullHandlingOnOrder nullHandlingOnOrder)方法

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
if (nullHandlingOnOrder.equals(NullHandlingOnOrder.NULLS_FIRST)) {

if (ProcessEngineConfigurationImpl.DATABASE_TYPE_H2.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_HSQL.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_POSTGRES.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_ORACLE.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_DM.equals(databaseType)) {//达梦
orderBy = orderBy + defaultOrderByClause + " NULLS FIRST";
} else if (ProcessEngineConfigurationImpl.DATABASE_TYPE_MYSQL.equals(databaseType)) {
orderBy = orderBy + "isnull(" + column +") desc," + defaultOrderByClause;
} else if (ProcessEngineConfigurationImpl.DATABASE_TYPE_DB2.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_MSSQL.equals(databaseType)) {
orderBy = orderBy + "case when " + column + " is null then 0 else 1 end," + defaultOrderByClause;
} else {
orderBy = orderBy + defaultOrderByClause;
}


} else if (nullHandlingOnOrder.equals(NullHandlingOnOrder.NULLS_LAST)) {

if (ProcessEngineConfigurationImpl.DATABASE_TYPE_H2.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_HSQL.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_POSTGRES.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_ORACLE.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_DM.equals(databaseType)) {//达梦
orderBy = orderBy + column + " "+sortOrder + " NULLS LAST";
} else if (ProcessEngineConfigurationImpl.DATABASE_TYPE_MYSQL.equals(databaseType)) {
orderBy = orderBy + "isnull(" + column +") asc," + defaultOrderByClause;
} else if (ProcessEngineConfigurationImpl.DATABASE_TYPE_DB2.equals(databaseType)
|| ProcessEngineConfigurationImpl.DATABASE_TYPE_MSSQL.equals(databaseType)) {
orderBy = orderBy + "case when " + column + " is null then 1 else 0 end," + defaultOrderByClause;
} else {
orderBy = orderBy + defaultOrderByClause;
}

}

AbstractQuery;

7. 新增达梦sql文件

1. 复制文件

达梦sql与oracle基本一致 复制oracle文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
复制resources.org.activiti.db.creat目录下
activiti.oracle.create.engine.sql,
activiti.oracle.create.history.sql,
activiti.oracle.create.identity.sql
到同目录下并更名为
activiti.dm.create.engine.sql
activiti.dm.create.history.sql
activiti.dm.create.identity.sql

复制resources.org.activiti.db.drop目录下
activiti.oracle.drop.engine.sql
activiti.oracle.drop.history.sql
activiti.oracle.drop.identity.sql
到同目录下并更名为
activiti.dm.drop.engine.sql
activiti.dm.drop.history.sql
activiti.dm.drop.identity.sql

2. 修改sql文件

达梦不存在NVARCHAR2 关键字,将复制sql文件中的NVARCHAR2 改为varchar;
sql

3 替换jar包

重新打包代码,并替换maven中jar包即可