-
-
Save leapar/4e0726a56a1cbab661b3695cf9e23585 to your computer and use it in GitHub Desktop.
全文搜索
cuba 用的lumen 因为它支持各种数据格式,内档数据库等等查询.
Apache Lucene framework,全文搜索上传的附件,以及各表字段
docker部署
参考https://github.com/whpv/Dockerfile-javaweb
FROM tomcat:8.5.15-jre8-alpine
MAINTAINER leapar <[email protected]>
ADD conf/tomcat/tomcat-users.xml /usr/local/tomcat/conf/tomcat-users.xml
ADD conf/tomcat/context.xml /usr/local/tomcat/webapps/manager/META-INF/context.xml
ADD conf/tomcat/war/app.war /usr/local/tomcat/webapps/app.war
ADD conf/tomcat/war/app-core.war /usr/local/tomcat/webapps/app-core.war
tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin"/>
<role rolename="admin-gui"/>
<user username="admin" password="admin" roles="manager,manager-gui,manager-script,manager-jmx,manager-status,admin,admin-gui"/>
</tomcat-users>
context.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<Context antiResourceLocking="false" privileged="true" >
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
</Context>
build.gradle
task buildWar(type: CubaWarBuilding) {
appHome = './app_home'
singleWar = false
includeContextXml = true
includeJdbcDriver = true
//webXmlPath = 'modules/web/web/WEB-INF/web.xml'
appProperties = [
'cuba.automaticDatabaseUpdate': true,
'cuba.webPort': 8080,
'cuba.connectionUrlList': 'http://localhost:8080/app-core'
]
}
/opt/gradle/bin/gradle buildWar
启动mysql 要求5.7以上,否则createDatabase会报错
docker run -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_ROOT_HOST=% -p 3306:3306 -d mysql/mysql-server:5.7
文件系统
路径
deploy\tomcat\work\app-core\filestorage
表
DROP TABLE IF EXISTS `oa`.`sys_file`;
CREATE TABLE `oa`.`sys_file` (
`ID` varchar(32) NOT NULL DEFAULT '',
`CREATE_TS` datetime(3) DEFAULT NULL,
`CREATED_BY` varchar(50) DEFAULT NULL,
`VERSION` int(11) DEFAULT NULL,
`UPDATE_TS` datetime(3) DEFAULT NULL,
`UPDATED_BY` varchar(50) DEFAULT NULL,
`DELETE_TS` datetime(3) DEFAULT NULL,
`DELETED_BY` varchar(50) DEFAULT NULL,
`NAME` varchar(500) NOT NULL,
`EXT` varchar(20) DEFAULT NULL,
`FILE_SIZE` bigint(20) DEFAULT NULL,
`CREATE_DATE` datetime(3) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SELECT * FROM sys_file s;
'ec0c1b65ea3dcc1280477d4c295e1500', '2017-07-02 20:15:06.473', 'admin', 1, '2017-07-02 20:15:06.473', '', '', '', '1448783921442.jpg', 'jpg', 3146291, '2017-07-02 20:15:05.017'
其中ID是UUID,格式如下:ec0c1b65ea3dcc1280477d4c295e1500 对应的文件名:ec0c1b65-ea3d-cc12-8047-7d4c295e1500.jpg
不能自己随便填写id例如123,最后会找不到的。CREATE_DATE是对应文件存储目录:2017/07/02
如果我有个表关联manytoone的file字段,表中file_id存储ec0c1b65ea3dcc1280477d4c295e1500。如果是manytomany,会生成一个新表关联。
用户密码加密方式
默认是cuba_Sha1EncryptionModule
如果要修改为md5,请在如下两个文件追加
cuba.passwordEncryptionModule = cuba_Md5EncryptionModule
oa/modules/web/src/com/purvar/ito/oa/web-app.properties
oa/modules/core/src/com/purvar/ito/oa/app.properties
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
#NamePattern
分两种一种是%s %d这种,还有一种是#getFunction 用#开头表示调用函数。
这个地方有问题:如果是onetomany这种关联关系字段,如果fetchType=lazy,不能使用到instantName中,这时候还拿不到值。
另外:当我扩展一个User对象,增加字段Compay_id这种,如果我把company写入instantName中,实体日志中会报异常。
图表
<chart:serialChart id="serialChart"
autoMarginOffset="20"
categoryField="date"
datasource="countryGrowthDs"
height="100%"
marginLeft="40"
marginRight="40"
marginTop="10"
mouseWheelZoomEnabled="true"
dataDateFormat="YYYY-MM-DD"
creditsPosition="TOP_RIGHT"
theme="LIGHT"
width="100%">
<chart:valueAxes>
<chart:axis id="v1"
axisAlpha="0"
ignoreAxisWidth="true"
position="LEFT"/>
</chart:valueAxes>
<chart:balloon borderThickness="1"
shadowAlpha="0"/>
<chart:graphs>
<chart:graph id="g1"
balloonText="<span style='font-size:18px;'>[[value]]</span>"
bullet="ROUND"
bulletBorderAlpha="1"
bulletColor="WHITE"
bulletSize="10"
hideBulletsCount="50"
lineThickness="2"
title="Red line"
useLineColorForBulletBorder="true"
valueField="value">
<chart:balloon adjustBorderColor="false"
color="WHITE"
drop="true"/>
</chart:graph>
</chart:graphs>
<chart:categoryAxis dashLength="1"
minorGridEnabled="true"
minPeriod="DAYS"
parseDates="true">
<chart:dateFormats
>
<chart:dateFormat
period="DAYS"
format="MM-DD"
>
</chart:dateFormat>
<chart:dateFormat
period="MONTHS"
format="YYYY-MM-DD"
>
</chart:dateFormat>
</chart:dateFormats>
</chart:categoryAxis>
<chart:chartScrollbar autoGridCount="true"
backgroundAlpha="0"
color="#AAAAAA"
graph="g1"
graphFillAlpha="0"
graphLineAlpha="0.5"
oppositeAxis="true"
scrollbarHeight="40"
selectedBackgroundAlpha="0.1"
selectedBackgroundColor="#888888"
selectedGraphFillAlpha="0"
selectedGraphLineAlpha="1"/>
<chart:chartCursor cursorAlpha="1"
cursorColor="#258cbb"
cursorPosition="MOUSE"
limitToGraph="g1"
pan="true"
valueLineAlpha="0.2"
valueLineBalloonEnabled="true"
categoryBalloonDateFormat="YYYY-MM-DD"
valueLineEnabled="true"
valueZoomable="true"/>
<chart:valueScrollbar
oppositeAxis="true"
scrollbarHeight="10"/>
<chart:export/>
</chart:serialChart>
- oppositeAxis为true表示在轴线文字另一边,如果是false,那么跟轴线文字一起,需要用offset设置下位置。
- minPeriod最小的时间显示等级分年、月、日、时、分、秒,然后通过chart:dateFormats设置格式化字符串。
- creditsPosition版权信息的位置
- bulletSize时序图上面点的大小
cuba vaadin google map
谷歌地图是经过gwt封装,然后vaadin再封装,最后cuba再封装
-
语言问题
在web-app.properties里面定义charts.map.language = CHINESE_SIMPLIFIED -
长城防火墙问题
@Inject
private MapViewer googleMap;
@Override
public void init(Map<String, Object> params) {
super.init(params);
WebGoogleMapViewer mapViewer = (WebGoogleMapViewer)googleMap;
GoogleMap map = (GoogleMap) mapViewer.getComponent();
GoogleMapState state = (GoogleMapState) genericInvokMethod(map,"getState",0);
state.apiUrl = "www.google.cn";
这个要处理的话,要把state.apiUrl 写成自己服务器IP,然后全部配置代理出去,可以参考https://baya.github.io/2015/05/19/%E6%90%AD%E5%BB%BAgoogle%E8%B5%84%E6%BA%90%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1.html
restful api
- env
https://dzone.com/articles/improvements-in-cubas-rest-api-v2
- token
http://localhost:8080/app/rest/v2/oauth/token
- get entities
/entities/oa$Record?limit=10
- upload file
/files
- download file
/files/72ef0df5-431d-42d7-7094-65f592350f7f
BI
metabase 轻量 https://www.road-to-cuba-and-beyond.com/integrate-cuba-with-metabase-bi-solution/
chartio 轻量
jasperport 重
pentaho 重 cuba官方是这 https://doc.cuba-platform.com/bi-6.5/index.html