Compare commits
9 commits
master
...
develop-ki
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8c4413874 | ||
| c70afb8e53 | |||
| 6dfd6e4148 | |||
| e4b31838f4 | |||
| 87390f9dd1 | |||
|
|
e460b26abb | ||
|
|
353e7d783e | ||
|
|
cd1c7dbf9e | ||
|
|
89c8e6aeea |
396 changed files with 4695 additions and 25267 deletions
23
.github/workflows/main.yml
vendored
23
.github/workflows/main.yml
vendored
|
|
@ -3,19 +3,14 @@
|
|||
|
||||
name: Maven Package
|
||||
|
||||
run-name: Release run ${{ github.run_number }} view
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
|
||||
schedule:
|
||||
- cron: "0 3 * * *"
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: self-hosted
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
|
@ -26,16 +21,8 @@ jobs:
|
|||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
|
||||
- name: Cache the Maven packages to speed up build
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
- name: Set up Maven
|
||||
uses: stCarolas/setup-maven@v4.5
|
||||
with:
|
||||
maven-version: 3.8.1
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
||||
- name: Publish to GitHub Packages Apache Maven
|
||||
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
|
||||
|
|
|
|||
401
docker-compose-legacy.yaml
Normal file
401
docker-compose-legacy.yaml
Normal file
|
|
@ -0,0 +1,401 @@
|
|||
version: "3"
|
||||
|
||||
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.27.1.0/24
|
||||
|
||||
|
||||
services:
|
||||
|
||||
kie-wb:
|
||||
image: kie-wb
|
||||
container_name: "businessCentral"
|
||||
volumes:
|
||||
- gitdata:/home/niodir
|
||||
- lucenedata:/home/lucene
|
||||
hostname: kie-wb.pymma
|
||||
environment:
|
||||
PYMMA_OPTS: " -DconnectionString=mongodb://mongodb:27017 -Dname=businessProxyDB "
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.5
|
||||
ports:
|
||||
- 8080:8080
|
||||
- 8001:8001
|
||||
restart: always
|
||||
|
||||
|
||||
|
||||
admin-console:
|
||||
image: runtime-admin-console
|
||||
container_name: "admin-console"
|
||||
environment:
|
||||
PYMMA_OPTS: " -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
hostname: admin.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.6
|
||||
ports:
|
||||
- 8200:8200
|
||||
links:
|
||||
- kie-wb:kie-wb
|
||||
- businessProxyDB:mongodb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
restart: always
|
||||
|
||||
|
||||
swimmingpool-wb:
|
||||
image: swimmingpool-web-ui
|
||||
container_name: "swimmingpool-web-ui"
|
||||
environment:
|
||||
PYMMA_OPTS: " "
|
||||
hostname: swimmingpool-wb.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.15
|
||||
ports:
|
||||
- 12099:12099
|
||||
links:
|
||||
- runtime-reverse-proxy:reverse-proxy
|
||||
depends_on:
|
||||
- runtime-reverse-proxy
|
||||
restart: always
|
||||
|
||||
|
||||
#-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y
|
||||
|
||||
|
||||
runtime-proxy-1:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-1"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server1 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.22
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
runtime-proxy-2:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-2"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server2 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.32
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
runtime-proxy-3:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-3"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server3 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.42
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
runtime-proxy-4:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-4"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server4 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.52
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
runtime-proxy-5:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-5"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server5 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.62
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
|
||||
runtime-indexer:
|
||||
image: runtime-indexer
|
||||
container_name: "runtime-indexer"
|
||||
hostname: indexer.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.23
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
restart: always
|
||||
|
||||
runtime-reverse-proxy:
|
||||
image: runtime-reverse-proxy
|
||||
container_name: "runtime-reverse-proxy"
|
||||
environment:
|
||||
PYMMA_OPTS: " -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
hostname: reverse-proxy.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.25
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
ports:
|
||||
- 9500:9500
|
||||
restart: always
|
||||
|
||||
|
||||
postgreskie:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1024M
|
||||
image: postgres:13.4-alpine
|
||||
environment:
|
||||
- POSTGRES_DB=chti-data
|
||||
- POSTGRES_USER=database_admin
|
||||
- POSTGRES_PASSWORD=
|
||||
- POSTGRES_HOST_AUTH_METHOD=trust
|
||||
- MAX_CONNECTIONS=500
|
||||
- MAX_WAL_SENDERS=100
|
||||
volumes:
|
||||
- pgsql-data:/var/lib/postgresql/data
|
||||
- ./backend/docker/pgsql_scripts:/docker-entrypoint-initdb.d
|
||||
ports:
|
||||
- 12432:5432
|
||||
|
||||
|
||||
zoo1:
|
||||
image: zookeeper:3.4.9
|
||||
hostname: zoo1
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.100
|
||||
ports:
|
||||
- "2181:2181"
|
||||
environment:
|
||||
ZOO_MY_ID: 1
|
||||
ZOO_PORT: 2181
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||
volumes:
|
||||
- zoo1_data:/data
|
||||
- zoo1_data_datalog:/datalog
|
||||
|
||||
zoo2:
|
||||
image: zookeeper:3.4.9
|
||||
hostname: zoo2
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.101
|
||||
ports:
|
||||
- "2182:2182"
|
||||
environment:
|
||||
ZOO_MY_ID: 2
|
||||
ZOO_PORT: 2182
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||
volumes:
|
||||
- zoo2_data:/data
|
||||
- zoo2_data_datalog:/datalog
|
||||
|
||||
zoo3:
|
||||
image: zookeeper:3.4.9
|
||||
hostname: zoo3
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.102
|
||||
ports:
|
||||
- "2183:2183"
|
||||
environment:
|
||||
ZOO_MY_ID: 3
|
||||
ZOO_PORT: 2183
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||
volumes:
|
||||
- zoo3_data:/data
|
||||
- zoo3_data_datalog:/datalog
|
||||
|
||||
|
||||
kafka1:
|
||||
image: confluentinc/cp-kafka:5.5.0
|
||||
hostname: kafka1.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.103
|
||||
ports:
|
||||
- "9092:9092"
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||
KAFKA_BROKER_ID: 1
|
||||
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||
KAFKA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_REPLICA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_MESSAGE_MAX_BYTES: 5048576
|
||||
KAFKA_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
CONNECT_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
volumes:
|
||||
- kafka1_data:/var/lib/kafka/data
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
|
||||
kafka2:
|
||||
image: confluentinc/cp-kafka:5.5.0
|
||||
hostname: kafka2.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.104
|
||||
ports:
|
||||
- "9093:9093"
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka2:19093,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9093
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||
KAFKA_BROKER_ID: 2
|
||||
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||
KAFKA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_REPLICA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_MESSAGE_MAX_BYTES: 5048576
|
||||
KAFKA_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
CONNECT_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
volumes:
|
||||
- kafka2_data:/var/lib/kafka/data
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
|
||||
kafka3:
|
||||
image: confluentinc/cp-kafka:5.5.0
|
||||
hostname: kafka3.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.105
|
||||
ports:
|
||||
- "9094:9094"
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka3:19094,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9094
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||
KAFKA_BROKER_ID: 3
|
||||
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||
KAFKA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_REPLICA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_MESSAGE_MAX_BYTES: 5048576
|
||||
KAFKA_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
CONNECT_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
volumes:
|
||||
- kafka3_data:/var/lib/kafka/data
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
|
||||
volumes:
|
||||
pgsql-data:
|
||||
|
||||
gitdata:
|
||||
lucenedata:
|
||||
kieserverdir:
|
||||
zoo1_data:
|
||||
zoo2_data:
|
||||
zoo3_data:
|
||||
zoo1_data_datalog:
|
||||
zoo2_data_datalog:
|
||||
zoo3_data_datalog:
|
||||
kafka1_data:
|
||||
kafka2_data:
|
||||
kafka3_data:
|
||||
|
|
@ -1,414 +1,42 @@
|
|||
version: "3"
|
||||
|
||||
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.27.1.0/24
|
||||
|
||||
|
||||
services:
|
||||
|
||||
kie-wb:
|
||||
image: kie-wb
|
||||
container_name: "businessCentral"
|
||||
volumes:
|
||||
- gitdata:/home/niodir
|
||||
- lucenedata:/home/lucene
|
||||
hostname: kie-wb.pymma
|
||||
|
||||
|
||||
postgres-kie:
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1024M
|
||||
image: postgres:13.4-alpine
|
||||
environment:
|
||||
PYMMA_OPTS: " -DconnectionString=mongodb://mongodb:27017 -Dname=businessProxyDB "
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.5
|
||||
- POSTGRES_DB=chti-data
|
||||
- POSTGRES_USER=database_admin
|
||||
- POSTGRES_PASSWORD=
|
||||
- POSTGRES_HOST_AUTH_METHOD=trust
|
||||
- MAX_CONNECTIONS=500
|
||||
- MAX_WAL_SENDERS=100
|
||||
volumes:
|
||||
- pgsql-data:/var/lib/postgresql/data
|
||||
- ./docker/database/:/docker-entrypoint-initdb.d
|
||||
ports:
|
||||
- 8080:8080
|
||||
- 8001:8001
|
||||
- 12432:5432
|
||||
|
||||
|
||||
|
||||
|
||||
activemq-server:
|
||||
image: webcenter/activemq:5.14.3
|
||||
volumes:
|
||||
- activemqdata:/data
|
||||
ports:
|
||||
- 10162:8161
|
||||
- 1617:61616
|
||||
restart: always
|
||||
|
||||
|
||||
|
||||
admin-console:
|
||||
image: runtime-admin-console
|
||||
container_name: "admin-console"
|
||||
environment:
|
||||
PYMMA_OPTS: " -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
hostname: admin.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.6
|
||||
ports:
|
||||
- 8200:8200
|
||||
links:
|
||||
- kie-wb:kie-wb
|
||||
- businessProxyDB:mongodb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
restart: always
|
||||
|
||||
|
||||
swimmingpool-wb:
|
||||
image: swimmingpool-web-ui
|
||||
container_name: "swimmingpool-web-ui"
|
||||
environment:
|
||||
PYMMA_OPTS: " "
|
||||
hostname: swimmingpool-wb.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.15
|
||||
ports:
|
||||
- 12099:12099
|
||||
links:
|
||||
- runtime-reverse-proxy:reverse-proxy
|
||||
depends_on:
|
||||
- runtime-reverse-proxy
|
||||
restart: always
|
||||
|
||||
|
||||
#-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y
|
||||
|
||||
|
||||
runtime-proxy-1:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-1"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server1 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.22
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
runtime-proxy-2:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-2"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server2 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.32
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
runtime-proxy-3:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-3"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server3 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.42
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
runtime-proxy-4:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-4"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server4 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.52
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
runtime-proxy-5:
|
||||
image: runtime-proxy
|
||||
container_name: "runtime-proxy-5"
|
||||
volumes:
|
||||
- kieserverdir:/niodir-kieserver
|
||||
environment:
|
||||
PYMMA_OPTS: "-Dorg.kie.server.id=server5 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.62
|
||||
ports:
|
||||
- 8090
|
||||
- 9080
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kie-wb:kie-wb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
- kie-wb
|
||||
restart: always
|
||||
|
||||
|
||||
runtime-indexer:
|
||||
image: runtime-indexer
|
||||
container_name: "runtime-indexer"
|
||||
hostname: indexer.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.23
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
restart: always
|
||||
|
||||
runtime-reverse-proxy:
|
||||
image: runtime-reverse-proxy
|
||||
container_name: "runtime-reverse-proxy"
|
||||
environment:
|
||||
PYMMA_OPTS: " -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
||||
hostname: reverse-proxy.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.25
|
||||
links:
|
||||
- businessProxyDB:mongodb
|
||||
- kafka1:kafka1
|
||||
- kafka2:kafka2
|
||||
- kafka3:kafka3
|
||||
depends_on:
|
||||
- businessProxyDB
|
||||
ports:
|
||||
- 9500:9500
|
||||
restart: always
|
||||
|
||||
businessProxyDB:
|
||||
image: mongo
|
||||
container_name: "businessProxyDB"
|
||||
volumes:
|
||||
- mongodb:/data/db
|
||||
- mongodb_config:/data/configdb
|
||||
hostname: mongo.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.3
|
||||
ports:
|
||||
- 28017:27017
|
||||
command: mongod
|
||||
restart: always
|
||||
|
||||
kafka_manager:
|
||||
image: hlebalbau/kafka-manager:stable
|
||||
ports:
|
||||
- "9000:9000"
|
||||
hostname: kafka_manager.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.89
|
||||
links:
|
||||
- zoo1:zoo1
|
||||
- zoo2:zoo2
|
||||
- zoo3:zoo3
|
||||
environment:
|
||||
ZK_HOSTS: "zoo1:2181, zoo2:2182, zoo3:2183"
|
||||
KAFKA_MANAGER_AUTH_ENABLED: "true"
|
||||
KAFKA_MANAGER_USERNAME: admin
|
||||
KAFKA_MANAGER_PASSWORD: adminpymma
|
||||
command: -Dpidfile.path=/dev/null
|
||||
|
||||
zoo1:
|
||||
image: zookeeper:3.4.9
|
||||
hostname: zoo1
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.100
|
||||
ports:
|
||||
- "2181:2181"
|
||||
environment:
|
||||
ZOO_MY_ID: 1
|
||||
ZOO_PORT: 2181
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||
volumes:
|
||||
- zoo1_data:/data
|
||||
- zoo1_data_datalog:/datalog
|
||||
|
||||
zoo2:
|
||||
image: zookeeper:3.4.9
|
||||
hostname: zoo2
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.101
|
||||
ports:
|
||||
- "2182:2182"
|
||||
environment:
|
||||
ZOO_MY_ID: 2
|
||||
ZOO_PORT: 2182
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||
volumes:
|
||||
- zoo2_data:/data
|
||||
- zoo2_data_datalog:/datalog
|
||||
|
||||
zoo3:
|
||||
image: zookeeper:3.4.9
|
||||
hostname: zoo3
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.102
|
||||
ports:
|
||||
- "2183:2183"
|
||||
environment:
|
||||
ZOO_MY_ID: 3
|
||||
ZOO_PORT: 2183
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||
volumes:
|
||||
- zoo3_data:/data
|
||||
- zoo3_data_datalog:/datalog
|
||||
|
||||
|
||||
kafka1:
|
||||
image: confluentinc/cp-kafka:5.5.0
|
||||
hostname: kafka1.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.103
|
||||
ports:
|
||||
- "9092:9092"
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||
KAFKA_BROKER_ID: 1
|
||||
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||
KAFKA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_REPLICA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_MESSAGE_MAX_BYTES: 5048576
|
||||
KAFKA_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
CONNECT_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
volumes:
|
||||
- kafka1_data:/var/lib/kafka/data
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
|
||||
kafka2:
|
||||
image: confluentinc/cp-kafka:5.5.0
|
||||
hostname: kafka2.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.104
|
||||
ports:
|
||||
- "9093:9093"
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka2:19093,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9093
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||
KAFKA_BROKER_ID: 2
|
||||
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||
KAFKA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_REPLICA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_MESSAGE_MAX_BYTES: 5048576
|
||||
KAFKA_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
CONNECT_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
volumes:
|
||||
- kafka2_data:/var/lib/kafka/data
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
|
||||
kafka3:
|
||||
image: confluentinc/cp-kafka:5.5.0
|
||||
hostname: kafka3.pymma
|
||||
networks:
|
||||
drools-network-dev:
|
||||
ipv4_address: 172.27.1.105
|
||||
ports:
|
||||
- "9094:9094"
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka3:19094,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9094
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||
KAFKA_BROKER_ID: 3
|
||||
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||
KAFKA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_REPLICA_FETCH_MAX_BYTES: 5048576
|
||||
KAFKA_MESSAGE_MAX_BYTES: 5048576
|
||||
KAFKA_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
CONNECT_PRODUCER_MAX_REQUEST_SIZE: 5048576
|
||||
volumes:
|
||||
- kafka3_data:/var/lib/kafka/data
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
|
||||
volumes:
|
||||
mongodb:
|
||||
mongodb_config:
|
||||
gitdata:
|
||||
lucenedata:
|
||||
kieserverdir:
|
||||
zoo1_data:
|
||||
zoo2_data:
|
||||
zoo3_data:
|
||||
zoo1_data_datalog:
|
||||
zoo2_data_datalog:
|
||||
zoo3_data_datalog:
|
||||
kafka1_data:
|
||||
kafka2_data:
|
||||
kafka3_data:
|
||||
pgsql-data:
|
||||
activemqdata:
|
||||
|
|
|
|||
3
docker/database/01_init.sql
Normal file
3
docker/database/01_init.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
CREATE USER kiedev WITH PASSWORD 'kiedev';
|
||||
create database kiedev ;
|
||||
GRANT ALL PRIVILEGES ON DATABASE kiedev to kiedev;
|
||||
|
|
@ -1,547 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>drools-framework-admin-console-parent</artifactId>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>drools-framework-admin-console</artifactId>
|
||||
|
||||
<properties>
|
||||
<vaadin.version>12.0.7</vaadin.version>
|
||||
<spring-boot.version>${spring.boot.version}</spring-boot.version>
|
||||
<spring-version>${spring.version}</spring-version>
|
||||
<webapp.directory>src/main/webapp</webapp.directory>
|
||||
</properties>
|
||||
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>vaadin-addons</id>
|
||||
<url>http://maven.vaadin.com/vaadin-addons</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.vaadin</groupId>
|
||||
<artifactId>vaadin-bom</artifactId>
|
||||
<version>${vaadin.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<!--exclusions>
|
||||
<exclusion>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</exclusion>
|
||||
</exclusions-->
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>4.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
<version>${kafka.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kie.server</groupId>
|
||||
<artifactId>kie-server-api</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.uberfire</groupId>
|
||||
<artifactId>uberfire-rest-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<artifactId>drools-framework-kie-wb-rest-pojo</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-workbench-models-guided-template</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.uberfire</groupId>
|
||||
<artifactId>uberfire-commons</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-workbench-models-guided-dtable</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.uberfire</groupId>
|
||||
<artifactId>uberfire-commons</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.offbytwo.jenkins</groupId>
|
||||
<artifactId>jenkins-client</artifactId>
|
||||
<version>0.3.8</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vaadin</groupId>
|
||||
<artifactId>vaadin-upload-flow</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vaadin</groupId>
|
||||
<artifactId>vaadin-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.vaadin.olli</groupId>
|
||||
<artifactId>file-download-wrapper</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.uberfire</groupId>
|
||||
<artifactId>uberfire-rest-client</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kie.server</groupId>
|
||||
<artifactId>kie-server-controller-api</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.10.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.10.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-jaxb-annotations</artifactId>
|
||||
<version>2.10.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-jaxb-annotations</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!--dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>4.3.6.Release</version>
|
||||
</dependency-->
|
||||
|
||||
<!--dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.9.4</version>
|
||||
</dependency-->
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<artifactId>drools-framework-business-proxy-persistence</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.vaadin.olli</groupId>
|
||||
<artifactId>clipboardhelper</artifactId>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>drools-framework-admin-console</finalName>
|
||||
|
||||
<plugins>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>${webapp.directory}/frontend-es5</directory>
|
||||
</fileset>
|
||||
<fileset>
|
||||
<directory>${webapp.directory}/frontend-es6</directory>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
||||
<configuration>
|
||||
<jvmArguments>-Dvaadin.productionMode</jvmArguments>
|
||||
<executable>true</executable>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven.plugin.version}</version>
|
||||
<configuration>
|
||||
<source>${pymma.java.version}</source>
|
||||
<target>${pymma.java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<profiles>
|
||||
<!--profile>
|
||||
<id>productionMode</id>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.vaadin</groupId>
|
||||
<artifactId>flow-server-production-mode</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.vaadin</groupId>
|
||||
<artifactId>vaadin-maven-plugin</artifactId>
|
||||
<version>${vaadin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>copy-production-files</goal>
|
||||
<goal>package-for-production</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<jvmArguments>-Dvaadin.productionMode</jvmArguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile-->
|
||||
|
||||
<profile>
|
||||
<id>docker-build</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>${fabri8.plugin.version}</version>
|
||||
|
||||
<configuration>
|
||||
<!--registry>192.168.1.184:12500</registry-->
|
||||
|
||||
|
||||
<!-- this is for Mac and Amazon Linux -->
|
||||
<dockerHost>unix:///var/run/docker.sock</dockerHost>
|
||||
|
||||
<verbose>true</verbose>
|
||||
<images>
|
||||
<image>
|
||||
<name>runtime-admin-console:${version.number}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||
|
||||
<!--copies Jar to the maven directory (uses Assembly system)-->
|
||||
<assembly>
|
||||
<descriptorRef>artifact</descriptorRef>
|
||||
</assembly>
|
||||
<tags>
|
||||
<tag>latest</tag>
|
||||
</tags>
|
||||
|
||||
</build>
|
||||
|
||||
<run>
|
||||
<extraHosts>
|
||||
<host>mongodb:192.168.43.94</host>
|
||||
<host>elasticsearchhost:192.168.43.94</host>
|
||||
<host>kie-wb:192.168.43.94</host>
|
||||
</extraHosts>
|
||||
<ports>
|
||||
<port>8200:8200</port>
|
||||
</ports>
|
||||
</run>
|
||||
</image>
|
||||
</images>
|
||||
</configuration>
|
||||
|
||||
<executions>
|
||||
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
|
||||
|
||||
</executions>
|
||||
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>docker-deploy</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>${fabri8.plugin.version}</version>
|
||||
|
||||
<configuration>
|
||||
<registry>${registry.host}</registry>
|
||||
<dockerHost>${docker.Host}</dockerHost>
|
||||
<verbose>true</verbose>
|
||||
<images>
|
||||
<image>
|
||||
<name>runtime-admin-console:${version.number}</name>
|
||||
<alias>runtime-admin-console</alias>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||
|
||||
<!--copies Jar to the maven directory (uses Assembly system)-->
|
||||
<assembly>
|
||||
<descriptorRef>artifact</descriptorRef>
|
||||
</assembly>
|
||||
<!--tags>
|
||||
<tag>latest</tag>
|
||||
</tags-->
|
||||
|
||||
</build>
|
||||
|
||||
<run>
|
||||
<extraHosts>
|
||||
<host>mongodb:192.168.1.100</host>
|
||||
</extraHosts>
|
||||
|
||||
</run>
|
||||
</image>
|
||||
</images>
|
||||
<authConfig>
|
||||
<username>nheron</username>
|
||||
<password>pymmalomme</password>
|
||||
</authConfig>
|
||||
<retries>5</retries>
|
||||
</configuration>
|
||||
|
||||
<executions>
|
||||
|
||||
|
||||
<execution>
|
||||
<id>mydeploy</id>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
<goal>push</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
|
||||
</executions>
|
||||
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>docker-hub</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>${fabri8.plugin.version}</version>
|
||||
|
||||
<configuration>
|
||||
<verbose>true</verbose>
|
||||
<images>
|
||||
<image>
|
||||
<name>pymmasoftware/runtime-admin-console:${project.version}</name>
|
||||
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||
|
||||
<!--copies Jar to the maven directory (uses Assembly system)-->
|
||||
<assembly>
|
||||
<descriptorRef>artifact</descriptorRef>
|
||||
</assembly>
|
||||
<tags>
|
||||
<tag>${version.number}</tag>
|
||||
<tag>latest</tag>
|
||||
<tag>${project.version}</tag>
|
||||
|
||||
</tags>
|
||||
</build>
|
||||
</image>
|
||||
</images>
|
||||
<authConfig>
|
||||
<username>pymmasoftwaredeploy</username>
|
||||
<password>${dockerhub.password}</password>
|
||||
</authConfig>
|
||||
<retries>5</retries>
|
||||
</configuration>
|
||||
|
||||
<executions>
|
||||
|
||||
|
||||
<execution>
|
||||
<id>mydeploy</id>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
<goal>push</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
|
||||
</executions>
|
||||
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
FROM azul/zulu-openjdk-debian:11
|
||||
|
||||
RUN apt-get update && apt-get install -y wget procps
|
||||
ADD application.properties /application.properties
|
||||
ADD maven/drools-framework-admin-console.jar app.jar
|
||||
|
||||
EXPOSE 8200
|
||||
|
||||
RUN bash -c 'touch /app.jar'
|
||||
ENV JAVA_OPTS "-Dspring.config.location=file:./ "
|
||||
|
||||
ENTRYPOINT exec java $JAVA_OPTS $PYMMA_OPTS -jar /app.jar
|
||||
#ENTRYPOINT ["java","-Dspring.config.location=file:./","-jar","/app.jar"]
|
||||
#ENTRYPOINT ["java","-jar","/app.jar"]
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
server.port=${port:8200}
|
||||
kie-wb.baseurl=${PYMMA_KIE_BASE_URL:http://kie-wb:8080/kie-wb/rest}
|
||||
kie-wb.mainwbintern=${PYMMA_KIE_MAINWBINTERN:http://kie-wb:8080/kie-wb}
|
||||
kie-wb.mainwbextern=${PYMMA_KIE_MAINWBEXTERN:http://kie-wb:8080/kie-wb}
|
||||
kie-wb.username=${PYMMA_KIE_USER:admin}
|
||||
kie-wb.password=${PYMMA_KIE_PASSWORD:admin}
|
||||
|
||||
adminConsole.tmpdir=/tmp
|
||||
|
||||
org.kie.server.controller=${PYMMA_KIE_CONTROLLER:http://kie-wb:8080/kie-wb/rest}
|
||||
org.kie.server.location=${PYMMA_KIE_LOCATION:http://admin-console:8200/api/server}
|
||||
org.kie.server.id=${PYMMA_KIE_SERVER_ID:pymmaConsole2}
|
||||
spring.data.mongodb.database=${PYMMA_MONGO_DATABASE:businessProxyDB}
|
||||
spring.data.mongodb.host=${PYMMA_MONGO_HOST:mongodb:27017}
|
||||
|
||||
|
||||
spring.servlet.multipart.enabled=false
|
||||
kafka.bootstrapAddress=${PYMMA_KAFKA_BOOTSTRAP:kafka1:19092,kafka2:19093,kafka3:19094}
|
||||
|
||||
pymma.kafka.activateSsl=${PYMMA_KAFKA_ACTIVATE_SSL:false}
|
||||
pymma.kafka.sslTruststoreLocation=${PYMMA_KAFKA_SSL_TRUSTSTORE_LOCATION:}
|
||||
pymma.kafka.sslTruststorePassword=${PYMMA_KAFKA_SSL_TRUSTSTORE_PASSWORD:}
|
||||
pymma.kafka.sslKeyPassword=${PYMMA_KAFKA_KEY_PASSWORD:}
|
||||
pymma.kafka.sslKeystorePassword=${PYMMA_KAFKA_SSL_KEYSTORE_PASSWORD:}
|
||||
pymma.kafka.sslKeystoreLocation=${PYMMA_KAFKA_SSL_KEYSTORE_LOCATION:}
|
||||
pymma.kafka.sslKeystoreType=${PYMMA_KAFKA_SSL_KEYSTORE_TYPE:}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
package org.chtijbug.drools.console;
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
|
||||
public interface AddLog {
|
||||
public void addRow(String textToAdd, UI ui);
|
||||
}
|
||||
|
|
@ -1,298 +0,0 @@
|
|||
package org.chtijbug.drools.console;
|
||||
|
||||
|
||||
import com.vaadin.flow.spring.SpringServlet;
|
||||
import org.apache.kafka.clients.CommonClientConfigs;
|
||||
import org.apache.kafka.clients.admin.AdminClientConfig;
|
||||
import org.apache.kafka.clients.admin.NewTopic;
|
||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||
import org.apache.kafka.common.config.SslConfigs;
|
||||
import org.apache.kafka.common.security.auth.SecurityProtocol;
|
||||
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||
import org.apache.kafka.common.serialization.StringSerializer;
|
||||
import org.chtijbug.drools.KieContainerResponse;
|
||||
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||
import org.chtijbug.drools.console.middle.DababaseContentUpdate;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.ApplicationContextProvider;
|
||||
import org.chtijbug.drools.console.service.wbconnector.KieBusinessCentralConnector;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.KieWorkbenchRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
import org.springframework.kafka.annotation.EnableKafka;
|
||||
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
||||
import org.springframework.kafka.core.*;
|
||||
import org.springframework.kafka.support.serializer.JsonDeserializer;
|
||||
import org.springframework.kafka.support.serializer.JsonSerializer;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import javax.servlet.MultipartConfigElement;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
@EnableMongoRepositories("org.chtijbug.drools.proxy.persistence.repository")
|
||||
@EnableKafka
|
||||
@PropertySource("classpath:application.properties")
|
||||
@EnableSwagger2
|
||||
@EnableScheduling
|
||||
public class DroolsSpringBootConsoleApplication extends SpringBootServletInitializer {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Value("${kie-wb.baseurl}")
|
||||
private String kiewbUrl;
|
||||
|
||||
@Value(value = "${kafka.bootstrapAddress}")
|
||||
private String bootstrapAddress;
|
||||
|
||||
@Value("${pymma.kafka.activateSsl:false}")
|
||||
private boolean activateSsl;
|
||||
|
||||
@Value("${pymma.kafka.sslTruststoreLocation:}")
|
||||
private String sslTruststoreLocation;
|
||||
|
||||
@Value("${pymma.kafka.sslTruststorePassword:}")
|
||||
private String sslTruststorePassword;
|
||||
|
||||
@Value("${pymma.kafka.sslKeyPassword:}")
|
||||
private String sslKeyPassword;
|
||||
|
||||
@Value("${pymma.kafka.sslKeystorePassword:}")
|
||||
private String sslKeystorePassword;
|
||||
|
||||
@Value("${pymma.kafka.sslKeystoreLocation:}")
|
||||
private String sslKeystoreLocation;
|
||||
|
||||
@Value("${pymma.kafka.sslKeystoreType:}")
|
||||
private String sslKeystoreType;
|
||||
|
||||
@Autowired
|
||||
private DababaseContentUpdate dababaseContentUpdate;
|
||||
@Autowired
|
||||
private KieBusinessCentralConnector kieBusinessCentralConnector;
|
||||
@Autowired
|
||||
private ProjectRepository projectRepository;
|
||||
|
||||
@Autowired
|
||||
private KieWorkbenchRepository kieWorkbenchRepository;
|
||||
|
||||
@Bean
|
||||
public WebMvcConfigurer corsConfigurer() {
|
||||
return new WebMvcConfigurer() {
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOrigins("*")
|
||||
.allowedMethods("GET", "POST", "OPTIONS", "DELETE", "PUT")
|
||||
.allowedHeaders("Access-Control-Allow-Origin", "*")
|
||||
.exposedHeaders("Access-Token", "Access-Control-Allow-Origin")
|
||||
.allowCredentials(false).maxAge(3600);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
public MultipartConfigElement multipartConfigElement() {
|
||||
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
DataSize dataSize =DataSize.ofMegabytes(100);
|
||||
factory.setMaxFileSize(dataSize);
|
||||
factory.setMaxRequestSize(dataSize);
|
||||
return factory.createMultipartConfig();
|
||||
|
||||
}
|
||||
@Bean(name = "applicationContext")
|
||||
public ApplicationContextProvider getAppplicationContext() {
|
||||
return new ApplicationContextProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public KieConfigurationData createKieConfigurationData(){
|
||||
KieConfigurationData kieConfigurationData = new KieConfigurationData();
|
||||
kieConfigurationData.setKiewbUrl(kiewbUrl);
|
||||
kieConfigurationData.setName("demo");
|
||||
return kieConfigurationData;
|
||||
}
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(DroolsSpringBootConsoleApplication.class);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public KafkaAdmin kafkaAdmin() {
|
||||
Map<String, Object> configs = new HashMap<>();
|
||||
configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||
if (activateSsl) {
|
||||
configs.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, SecurityProtocol.SSL.name);
|
||||
configs.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, this.sslTruststoreLocation);
|
||||
configs.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, this.sslTruststorePassword);
|
||||
configs.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, this.sslKeyPassword);
|
||||
configs.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, this.sslKeystorePassword);
|
||||
configs.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, this.sslKeystoreLocation);
|
||||
configs.put(SslConfigs.SSL_KEYSTORE_TYPE_CONFIG, this.sslKeystoreType);
|
||||
}
|
||||
return new KafkaAdmin(configs);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NewTopic loggingTopic() {
|
||||
return new NewTopic(KafkaTopicConstants.REVERSE_PROXY, 1, (short) 1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ProducerFactory<String, ReverseProxyUpdate> producerFactory() {
|
||||
Map<String, Object> configProps = new HashMap<>();
|
||||
configProps.put(
|
||||
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
|
||||
bootstrapAddress);
|
||||
configProps.put(
|
||||
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
|
||||
StringSerializer.class);
|
||||
configProps.put(
|
||||
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
|
||||
JsonSerializer.class);
|
||||
if (activateSsl) {
|
||||
configProps.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, SecurityProtocol.SSL.name);
|
||||
configProps.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, this.sslTruststoreLocation);
|
||||
configProps.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, this.sslTruststorePassword);
|
||||
configProps.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, this.sslKeyPassword);
|
||||
configProps.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, this.sslKeystorePassword);
|
||||
configProps.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, this.sslKeystoreLocation);
|
||||
configProps.put(SslConfigs.SSL_KEYSTORE_TYPE_CONFIG, this.sslKeystoreType);
|
||||
}
|
||||
return new DefaultKafkaProducerFactory<>(configProps);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplate() {
|
||||
return new KafkaTemplate<>(producerFactory());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public ConsumerFactory<String, KieContainerResponse> greetingConsumerFactory() {
|
||||
Map<String, Object> props = new HashMap<>();
|
||||
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||
props.put(ConsumerConfig.GROUP_ID_CONFIG,"Console");
|
||||
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KieContainerResponse.class));
|
||||
}
|
||||
@Bean
|
||||
public ConcurrentKafkaListenerContainerFactory<String, KieContainerResponse>
|
||||
ruleKafkaListenerKieContainerUpdateFactory() {
|
||||
|
||||
ConcurrentKafkaListenerContainerFactory<String, KieContainerResponse> factory =
|
||||
new ConcurrentKafkaListenerContainerFactory<>();
|
||||
factory.setConsumerFactory(greetingConsumerFactory());
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<SpringServlet> springServlet(ApplicationContext context) {
|
||||
return new ServletRegistrationBean<>(new SpringServlet(context), "/admin/*", "/frontend/*");
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DroolsSpringBootConsoleApplication.class, args);
|
||||
}
|
||||
|
||||
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void initPlatform(){
|
||||
dababaseContentUpdate.initDatabaseIfNecessary();
|
||||
/**
|
||||
for (KieWorkbench kieWorkbench: kieWorkbenchRepository.findAll()) {
|
||||
Map<String, KieContainerResource> kies = new HashMap<>();
|
||||
KieServerSetup kieServerSetup = kieBusinessCentralConnector.connectToBusinessCentral("nheron", "adminnheron00@", kieWorkbench.getName(),kieWorkbench.getExternalUrl());
|
||||
if (kieServerSetup != null && kieServerSetup.getContainers() != null) {
|
||||
for (KieContainerResource kieContainerResource : kieServerSetup.getContainers()) {
|
||||
kies.put(kieContainerResource.getContainerId(), kieContainerResource);
|
||||
}
|
||||
}
|
||||
List<ProjectPersist> projectRepositories = projectRepository.findByKieWorkbench(kieWorkbench);
|
||||
if (!projectRepositories.isEmpty()){
|
||||
for (ProjectPersist projectPersist : projectRepository.findAll()) {
|
||||
if (projectPersist.getServerNames().size() > 0) {
|
||||
if (!kies.containsKey(projectPersist.getArtifactID()+"_"+projectPersist.getProjectVersion())) {
|
||||
kieBusinessCentralConnector.createContainer("nheron", "adminnheron00@", projectPersist,kieWorkbench.getExternalUrl());
|
||||
} else {
|
||||
kieBusinessCentralConnector.updateContainer("nheron", "adminnheron00@", projectPersist, kies.get(projectPersist.getArtifactID()+"_"+projectPersist.getProjectVersion()),kieWorkbench.getExternalUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
for (ProjectPersist projectPersist : projectRepository.findAll()) {
|
||||
if (projectPersist.getServerNames().size() > 0) {
|
||||
if (!kies.containsKey(projectPersist.getContainerID())) {
|
||||
kieBusinessCentralConnector.createContainer("nheron", "adminnheron00@", projectPersist);
|
||||
} else {
|
||||
kieBusinessCentralConnector.updateContainer("nheron", "adminnheron00@", projectPersist, kies.get(projectPersist.getContainerID()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ServerInstanceKeyList serverInstanceKeyList = kieBusinessCentralConnector.getListInstances("nheron", "adminnheron00@");
|
||||
if (serverInstanceKeyList != null) {
|
||||
for (ServerInstanceKey serverInstanceKey : serverInstanceKeyList.getServerInstanceKeys()) {
|
||||
String serverInstanceId = serverInstanceKey.getServerInstanceId();
|
||||
ContainerList containerList = kieBusinessCentralConnector.getListContainers("nheron", "adminnheron00@", serverInstanceId);
|
||||
System.out.println("coucou");
|
||||
for (Container container : containerList.getContainers()) {
|
||||
|
||||
}
|
||||
}
|
||||
System.out.println("coucou");
|
||||
}
|
||||
System.out.println("coucou");
|
||||
|
||||
}
|
||||
**/
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket api() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("org.chtijbug.drools.console.restexpose"))
|
||||
//.paths(PathSelectors.regex("/api/wb./wb.*"))
|
||||
.paths(PathSelectors.regex("/api.*"))
|
||||
.build()
|
||||
.pathMapping("/swagger");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
package org.chtijbug.drools.console;
|
||||
|
||||
import org.chtijbug.drools.console.security.MongoUserDetailsService;
|
||||
import org.chtijbug.drools.console.security.MyNoOpPasswordEncoder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
import org.springframework.security.web.util.matcher.OrRequestMatcher;
|
||||
import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
@Autowired
|
||||
MongoUserDetailsService userDetailsService;
|
||||
private static final String[] AUTH_WHITELIST = {
|
||||
// -- swagger ui
|
||||
"/v2/api-docs",
|
||||
"/swagger-resources",
|
||||
"/swagger-resources/**",
|
||||
"/configuration/ui",
|
||||
"/configuration/security",
|
||||
"/swagger-ui.html",
|
||||
"/webjars/**"
|
||||
// other public endpoints of your API may be appended to this array
|
||||
};
|
||||
|
||||
private static final RequestMatcher PROTECTED_URLS = new OrRequestMatcher(
|
||||
new AntPathRequestMatcher("/api/**")
|
||||
);
|
||||
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.csrf().disable()
|
||||
|
||||
.authorizeRequests().antMatchers(AUTH_WHITELIST).permitAll()
|
||||
.requestMatchers(PROTECTED_URLS).authenticated()
|
||||
.and().httpBasic()
|
||||
.and().sessionManagement().disable();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new MyNoOpPasswordEncoder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(AuthenticationManagerBuilder builder) throws Exception {
|
||||
builder.userDetailsService(userDetailsService);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,254 +0,0 @@
|
|||
package org.chtijbug.drools.console.middle;
|
||||
|
||||
import org.chtijbug.drools.console.dto.VariableData;
|
||||
import org.chtijbug.drools.console.dto.VariableDefinition;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.proxy.persistence.model.*;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.*;
|
||||
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
|
||||
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
||||
import org.drools.workbench.models.guided.template.backend.RuleTemplateModelXMLPersistenceImpl;
|
||||
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
public class DababaseContentUpdate {
|
||||
|
||||
|
||||
|
||||
@Value("${kie-wb.mainwbintern}")
|
||||
private String mainwbUrlIntern;
|
||||
|
||||
@Value("${kie-wb.mainwbextern}")
|
||||
private String mainwbExtern;
|
||||
|
||||
@Value("${kie-wb.baseurl}")
|
||||
private String kiewbUrl;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRolesRepository userRolesRepository;
|
||||
|
||||
@Autowired
|
||||
private UserGroupsRepository userGroupsRepository;
|
||||
|
||||
@Autowired
|
||||
private KieWorkbenchRepository kieWorkbenchRepository;
|
||||
|
||||
@Autowired
|
||||
private GuidedRulestemplateDefinitionRepository guidedRulestemplateDefinitionRepository;
|
||||
|
||||
@Autowired
|
||||
private GuidedRulestemplateDataRepository guidedRulestemplateDataRepository;
|
||||
|
||||
@Autowired
|
||||
private CustomerRepository customerRepository;
|
||||
|
||||
@Autowired
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
@Autowired
|
||||
private ProjectPersistService projectPersistService;
|
||||
|
||||
public void initDatabaseIfNecessary() {
|
||||
/**
|
||||
* admin The administrator
|
||||
* analyst The analyst
|
||||
* developer The developer
|
||||
* manager The manager
|
||||
* user The end user
|
||||
* kiemgmt KIE management user
|
||||
*/
|
||||
User adminUser = userRepository.findByLogin("admin");
|
||||
if (adminUser == null) {
|
||||
this.initDatabase();
|
||||
this.synchronizeDatabaseWithWorkbenches();
|
||||
} else {
|
||||
this.synchronizeDatabaseWithWorkbenches();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initDatabase() {
|
||||
userRolesRepository.save(new UserRoles(UUID.randomUUID().toString(), "process-admin"));
|
||||
userRolesRepository.save(new UserRoles(UUID.randomUUID().toString(), "manager"));
|
||||
userRolesRepository.save(new UserRoles(UUID.randomUUID().toString(), "admin"));
|
||||
userRolesRepository.save(new UserRoles(UUID.randomUUID().toString(), "analyst"));
|
||||
userRolesRepository.save(new UserRoles(UUID.randomUUID().toString(), "rest-all"));
|
||||
userRolesRepository.save(new UserRoles(UUID.randomUUID().toString(), "developer"));
|
||||
userRolesRepository.save(new UserRoles(UUID.randomUUID().toString(), "rest-project"));
|
||||
userRolesRepository.save(new UserRoles(UUID.randomUUID().toString(), "user"));
|
||||
|
||||
|
||||
userGroupsRepository.save(new UserGroups(UUID.randomUUID().toString(), "kiemgmt"));
|
||||
userGroupsRepository.save(new UserGroups(UUID.randomUUID().toString(), "admingroup"));
|
||||
userGroupsRepository.save(new UserGroups(UUID.randomUUID().toString(), "demogroup"));
|
||||
|
||||
User adminUser = new User(UUID.randomUUID().toString(), "admin", "adminadmin99#");
|
||||
// adminUser.getUserGroups().add(userGroupsRepository.findByName("kiemgmt"));
|
||||
// adminUser.getUserGroups().add(userGroupsRepository.findByName("admingroup"));
|
||||
adminUser.getUserRoles().add(userRolesRepository.findByName("admin"));
|
||||
adminUser.getUserRoles().add(userRolesRepository.findByName("rest-all"));
|
||||
userRepository.save(adminUser);
|
||||
|
||||
User nheronUser = new User(UUID.randomUUID().toString(), "nheron", "adminnheron00@");
|
||||
// nheronUser.getUserGroups().add(userGroupsRepository.findByName("kiemgmt"));
|
||||
// nheronUser.getUserGroups().add(userGroupsRepository.findByName("admingroup"));
|
||||
nheronUser.getUserRoles().add(userRolesRepository.findByName("admin"));
|
||||
nheronUser.getUserRoles().add(userRolesRepository.findByName("rest-all"));
|
||||
userRepository.save(nheronUser);
|
||||
|
||||
User apiUser = new User(UUID.randomUUID().toString(), "api-user", "api-user");
|
||||
// nheronUser.getUserGroups().add(userGroupsRepository.findByName("kiemgmt"));
|
||||
// nheronUser.getUserGroups().add(userGroupsRepository.findByName("admingroup"));
|
||||
|
||||
apiUser.getUserRoles().add(userRolesRepository.findByName("rest-all"));
|
||||
userRepository.save(apiUser);
|
||||
|
||||
KieWorkbench mainWorkbench = new KieWorkbench();
|
||||
mainWorkbench.setID(UUID.randomUUID().toString());
|
||||
mainWorkbench.setName("demo");
|
||||
mainWorkbench.setExternalUrl(mainwbExtern);
|
||||
mainWorkbench.setInternalUrl(mainwbUrlIntern);
|
||||
mainWorkbench = kieWorkbenchRepository.save(mainWorkbench);
|
||||
|
||||
UserConnected userConnected = kieRepositoryService.getUserContent(mainWorkbench.getExternalUrl() + "/rest",
|
||||
nheronUser.getLogin(), nheronUser.getPassword(), mainWorkbench.getName());
|
||||
for (PlatformProjectData platformProjectData : userConnected.getProjectResponses()) {
|
||||
String projectName = platformProjectData.getName();
|
||||
String workspaceName = platformProjectData.getSpaceName();
|
||||
ProjectPersist projectPersist = projectPersistService.saveorUpdateProject(platformProjectData, mainWorkbench);
|
||||
UserGroups workspaceUserGroups = projectPersistService.createWorkSpaceGroupIfNeeded(workspaceName, mainWorkbench);
|
||||
String result=kieRepositoryService.createSpaceRight(mainWorkbench.getExternalUrl() + "/rest",
|
||||
nheronUser.getLogin(), nheronUser.getPassword(), mainWorkbench.getName(),workspaceUserGroups.getName(),workspaceName);
|
||||
projectPersistService.createProjectGroupIfNeeded(projectName, mainWorkbench, projectPersist, workspaceUserGroups);
|
||||
|
||||
//platformProjectData.getJavaClasses()
|
||||
|
||||
|
||||
}
|
||||
Customer demCustomer = new Customer();
|
||||
demCustomer.setKieWorkbench(mainWorkbench);
|
||||
demCustomer.setName("demoCustomer");
|
||||
demCustomer.setID(UUID.randomUUID().toString());
|
||||
customerRepository.save(demCustomer);
|
||||
User demoUser = new User(UUID.randomUUID().toString(), "demo", "demo");
|
||||
demoUser.getUserGroups().add(userGroupsRepository.findByName("demogroup"));
|
||||
demoUser.getUserRoles().add(userRolesRepository.findByName("user"));
|
||||
demoUser.getUserRoles().add(userRolesRepository.findByName("rest-all"));
|
||||
demoUser.getUserRoles().add(userRolesRepository.findByName("analyst"));
|
||||
demoUser.setWbName(mainWorkbench.getName());
|
||||
demoUser.setCustomer(demCustomer);
|
||||
userRepository.save(demoUser);
|
||||
}
|
||||
|
||||
public void updateOrCreateLineGuidedRuleTemplate(UserGroups spaceGroup,UserGroups projectGroup,String assetName, GuidedRulesTemplateData guidedRulesTemplateData){
|
||||
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 0/1 * * ?")
|
||||
public void synchronizeDatabaseWithWorkbenches() {
|
||||
guidedRulestemplateDefinitionRepository.deleteAll();
|
||||
guidedRulestemplateDataRepository.deleteAll();
|
||||
for (KieWorkbench kieWorkbench : kieWorkbenchRepository.findAll()) {
|
||||
User nheronUser = userRepository.findByLogin("nheron");
|
||||
UserConnected userConnected = kieRepositoryService.getUserContent(kieWorkbench.getExternalUrl() + "/rest",
|
||||
nheronUser.getLogin(), nheronUser.getPassword(), kieWorkbench.getName());
|
||||
for (PlatformProjectData platformProjectData : userConnected.getProjectResponses()) {
|
||||
|
||||
String projectName = platformProjectData.getName();
|
||||
String workspaceName = platformProjectData.getSpaceName();
|
||||
ProjectPersist projectPersist = projectPersistService.saveorUpdateProject(platformProjectData, kieWorkbench);
|
||||
UserGroups workSpaceGroupIfNeeded = projectPersistService.createWorkSpaceGroupIfNeeded(workspaceName, kieWorkbench);
|
||||
String result=kieRepositoryService.createSpaceRight(kieWorkbench.getExternalUrl() + "/rest",
|
||||
nheronUser.getLogin(), nheronUser.getPassword(), kieWorkbench.getName(),workSpaceGroupIfNeeded.getName(),workspaceName);
|
||||
|
||||
UserGroups projectGroupIfNeeded = projectPersistService.createProjectGroupIfNeeded(projectName, kieWorkbench, projectPersist, workSpaceGroupIfNeeded);
|
||||
|
||||
List<Asset> assets = kieRepositoryService.getListAssets(kieWorkbench.getExternalUrl() + "/rest", nheronUser.getLogin(), nheronUser.getPassword(), workspaceName, projectName);
|
||||
for (Asset asset : assets) {
|
||||
if (asset.getTitle().contains(".template")) {
|
||||
|
||||
GuidedRulesTemplateDefinition guidedRulesTemplateDefinition = guidedRulestemplateDefinitionRepository.findByTemplateNameAndProjectGroup(asset.getTitle(), projectGroupIfNeeded);
|
||||
if (guidedRulesTemplateDefinition == null) {
|
||||
guidedRulesTemplateDefinition = new GuidedRulesTemplateDefinition();
|
||||
guidedRulesTemplateDefinition.setTemplateName(asset.getTitle());
|
||||
|
||||
guidedRulesTemplateDefinition.setProjectGroup(workSpaceGroupIfNeeded);
|
||||
|
||||
}
|
||||
String assetSource = kieRepositoryService.getAssetSource(kieWorkbench.getExternalUrl() + "/rest", nheronUser.getLogin(), nheronUser.getPassword(), workspaceName, projectName, asset.getTitle());
|
||||
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetSource);
|
||||
guidedRulesTemplateDefinition.getVariables().clear();
|
||||
for (InterpolationVariable interpolationVariable : model.getInterpolationVariablesList()) {
|
||||
VariableDefinition variableDefinition = new VariableDefinition();
|
||||
variableDefinition.setVarName(interpolationVariable.getVarName());
|
||||
variableDefinition.setDataType(interpolationVariable.getDataType());
|
||||
variableDefinition.setFactField(interpolationVariable.getFactField());
|
||||
variableDefinition.setFactType(interpolationVariable.getFactType());
|
||||
variableDefinition.setOperator(interpolationVariable.getOperator());
|
||||
guidedRulesTemplateDefinition.getVariables().add(variableDefinition);
|
||||
}
|
||||
guidedRulesTemplateDefinition = guidedRulestemplateDefinitionRepository.save(guidedRulesTemplateDefinition);
|
||||
Map<String, VariableDefinition> variableDefinitionMap = new HashMap<>();
|
||||
for (VariableDefinition variableDefinition : guidedRulesTemplateDefinition.getVariables()) {
|
||||
variableDefinitionMap.put(variableDefinition.getVarName(), variableDefinition);
|
||||
}
|
||||
Map<String, List<String>> dataTable = model.getTable();
|
||||
int nbRows = model.getRowsCount();
|
||||
for (int i = 0; i < nbRows; i++) {
|
||||
GuidedRulesTemplateData guidedRulesTemplateData=guidedRulestemplateDataRepository.findByGuidedRulesTemplateDefinitionAndLineID(guidedRulesTemplateDefinition,String.valueOf(i));
|
||||
String colid = dataTable.get(TemplateModel.ID_COLUMN_NAME).get(i);
|
||||
if (guidedRulesTemplateData==null) {
|
||||
guidedRulesTemplateData = new GuidedRulesTemplateData();
|
||||
guidedRulesTemplateData.setGuidedRulesTemplateDefinition(guidedRulesTemplateDefinition);
|
||||
guidedRulesTemplateData.setLineID(colid);
|
||||
}
|
||||
|
||||
for (VariableDefinition variableDefinition : guidedRulesTemplateDefinition.getVariables()) {
|
||||
String data = dataTable.get(variableDefinition.getVarName()).get(i);
|
||||
VariableData variableData= new VariableData();
|
||||
variableData.setVarName(variableDefinition.getVarName());
|
||||
if ("String".equals(variableDefinition.getDataType())){
|
||||
variableData.setStringValue(data);
|
||||
}else if ("Long".equals(variableDefinition.getDataType())){
|
||||
if (data!=null && data.length()>0) {
|
||||
variableData.setLongValue(Long.parseLong(data));
|
||||
}
|
||||
}else if ("Double".equals(variableDefinition.getDataType())){
|
||||
if (data!=null && data.length()>0) {
|
||||
variableData.setDoubleValue(Double.parseDouble(data));
|
||||
}
|
||||
}else if ("BigDecimal".equals(variableDefinition.getDataType())){
|
||||
if (data!=null && data.length()>0) {
|
||||
variableData.setBigDecimalValue(BigDecimal.valueOf(Double.parseDouble(data)));
|
||||
}
|
||||
}
|
||||
guidedRulesTemplateData.getRows().add(variableData);
|
||||
}
|
||||
guidedRulestemplateDataRepository.save(guidedRulesTemplateData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
package org.chtijbug.drools.console.middle;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.JwtBuilder;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.security.Key;
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class JwtService {
|
||||
|
||||
@Value("${secretkey}")
|
||||
public String secretKey;
|
||||
|
||||
public String createJWT(ProjectPersist projectPersist, long ttlMillis) {
|
||||
|
||||
//The JWT signature algorithm we will be using to sign the token
|
||||
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
|
||||
|
||||
long nowMillis = System.currentTimeMillis();
|
||||
Date now = new Date(nowMillis);
|
||||
|
||||
//We will sign our JWT with our ApiKey secret
|
||||
byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(secretKey);
|
||||
Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());
|
||||
|
||||
//Let's set the JWT Claims
|
||||
JwtBuilder builder = Jwts.builder().setId(projectPersist.getUuid())
|
||||
.setIssuedAt(now)
|
||||
.setSubject("api")
|
||||
.setIssuer("pymma")
|
||||
.claim("groupID",projectPersist.getGroupID())
|
||||
.claim("artifactID",projectPersist.getArtifactID())
|
||||
.claim("branch",projectPersist.getBranch())
|
||||
.claim("mainClass",projectPersist.getMainClass())
|
||||
.claim("uuid",projectPersist.getUuid())
|
||||
.signWith(signatureAlgorithm, signingKey);
|
||||
|
||||
//if it has been specified, let's add the expiration
|
||||
if (ttlMillis >= 0) {
|
||||
long expMillis = nowMillis + ttlMillis;
|
||||
Date exp = new Date(expMillis);
|
||||
builder.setExpiration(exp);
|
||||
}
|
||||
|
||||
//Builds the JWT and serializes it to a compact, URL-safe string
|
||||
return builder.compact();
|
||||
}
|
||||
|
||||
|
||||
public Claims decodeJWT(String jwt) {
|
||||
return Jwts.parser()
|
||||
.setSigningKey(DatatypeConverter.parseBase64Binary(secretKey))
|
||||
.parseClaimsJws(jwt.replace("bearer","")).getBody();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,450 +0,0 @@
|
|||
package org.chtijbug.drools.console.restexpose;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.chtijbug.drools.console.dto.GuidedRuleTemplate;
|
||||
import org.chtijbug.drools.console.dto.GuidedRuleTemplateDataRow;
|
||||
import org.chtijbug.drools.console.dto.VariableData;
|
||||
import org.chtijbug.drools.console.dto.VariableDefinition;
|
||||
import org.chtijbug.drools.console.middle.DababaseContentUpdate;
|
||||
import org.chtijbug.drools.console.service.IndexerService;
|
||||
import org.chtijbug.drools.console.service.JobService;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.proxy.persistence.model.*;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.*;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
|
||||
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
||||
import org.drools.workbench.models.datamodel.rule.util.InterpolationVariableCollector;
|
||||
import org.drools.workbench.models.datamodel.rule.visitors.RuleModelVisitor;
|
||||
import org.drools.workbench.models.guided.template.backend.RuleTemplateModelXMLPersistenceImpl;
|
||||
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
||||
import org.guvnor.rest.client.SpaceRequest;
|
||||
import org.kie.server.api.model.KieServerInfo;
|
||||
import org.kie.soup.project.datamodel.oracle.DataType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RequestCallback;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Variant;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
import static org.drools.workbench.models.guided.template.shared.TemplateModel.ID_COLUMN_NAME;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/asset")
|
||||
@Api("/api/asset")
|
||||
public class AssetServiceExpose {
|
||||
|
||||
@Autowired
|
||||
private IndexerService indexerService;
|
||||
|
||||
private RestTemplate restTemplateKiewb = new RestTemplate();
|
||||
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@Autowired
|
||||
private KieWorkbenchRepository kieWorkbenchRepository;
|
||||
|
||||
@Autowired
|
||||
private UserGroupsRepository userGroupsRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private GuidedRulestemplateDefinitionRepository guidedRulestemplateDefinitionRepository;
|
||||
|
||||
@Autowired
|
||||
private GuidedRulestemplateDataRepository guidedRulestemplateDataRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRolesRepository userRolesRepository;
|
||||
|
||||
@Autowired
|
||||
private JobService jobService;
|
||||
|
||||
@Autowired
|
||||
private ProjectPersistService projectPersistService;
|
||||
|
||||
@Autowired
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
@GetMapping(value = "/{spaceName}/{projectName}/grt/{templateName}/data",
|
||||
consumes = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML},
|
||||
produces = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML})
|
||||
@ApiOperation(value = "Get Template dta", notes = "Sends back data of a guided rule template", response = GuidedRuleTemplate.class)
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 201, message = "Created", response = GuidedRuleTemplate.class)
|
||||
})
|
||||
public Response getTemplateData(@PathVariable("spaceName") String spaceName, @PathVariable("projectName") String projectName, @PathVariable("templateName") String templateName) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String currentPrincipalName = authentication.getName();
|
||||
|
||||
User connectedUser = userRepository.findByLogin(currentPrincipalName);
|
||||
UserGroups userGroupsSpace = userGroupsRepository.findBySpaceName(spaceName);
|
||||
if (userGroupsSpace == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Space not found").build();
|
||||
}
|
||||
|
||||
|
||||
UserGroups userGroupsProject = userGroupsRepository.findByWorkspaceUserGroupAndProjectName(userGroupsSpace, projectName);
|
||||
if (userGroupsProject == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Project not found").build();
|
||||
}
|
||||
if (!connectedUser.getUserRoles().contains(userRolesRepository.findByName("admin"))
|
||||
&& !connectedUser.getUserGroups().contains(userGroupsSpace)
|
||||
&& !connectedUser.getUserGroups().contains(userGroupsProject)) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("User not allowed to access workspace/project").build();
|
||||
}
|
||||
GuidedRulesTemplateDefinition guidedRulesTemplateDefinition = guidedRulestemplateDefinitionRepository.findByTemplateNameAndProjectGroup(templateName, userGroupsProject);
|
||||
if (guidedRulesTemplateDefinition == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Guided rule template not found").build();
|
||||
}
|
||||
GuidedRuleTemplate guidedRuleTemplate = new GuidedRuleTemplate();
|
||||
for (VariableDefinition elt : guidedRulesTemplateDefinition.getVariables()) {
|
||||
guidedRuleTemplate.getDefinitionList().put(elt.getVarName(), elt.getDataType());
|
||||
}
|
||||
|
||||
guidedRuleTemplate.setName(templateName);
|
||||
guidedRuleTemplate.setSpaceName(spaceName);
|
||||
guidedRuleTemplate.setProjectName(projectName);
|
||||
if (userGroupsSpace.getKieWorkbench() != null) {
|
||||
guidedRuleTemplate.setWorkbenchName(userGroupsSpace.getKieWorkbench().getName());
|
||||
}
|
||||
List<GuidedRulesTemplateData> guidedRulesTemplateDatas = guidedRulestemplateDataRepository.findByGuidedRulesTemplateDefinition(guidedRulesTemplateDefinition);
|
||||
|
||||
for (GuidedRulesTemplateData elt : guidedRulesTemplateDatas) {
|
||||
GuidedRuleTemplateDataRow guidedRuleTemplateDataRow = new GuidedRuleTemplateDataRow();
|
||||
guidedRuleTemplate.getRows().add(guidedRuleTemplateDataRow);
|
||||
guidedRuleTemplateDataRow.setLineID(elt.getLineID());
|
||||
for (VariableData elt2 : elt.getRows()) {
|
||||
if (elt2.getVarName()!= null) {
|
||||
if (elt2.getStringValue() != null) {
|
||||
guidedRuleTemplateDataRow.getDataList().put(elt2.getVarName(), elt2.getStringValue());
|
||||
} else if (elt2.getBigDecimalValue() != null) {
|
||||
guidedRuleTemplateDataRow.getDataList().put(elt2.getVarName(), elt2.getBigDecimalValue());
|
||||
} else if (elt2.getDoubleValue() != null) {
|
||||
guidedRuleTemplateDataRow.getDataList().put(elt2.getVarName(), elt2.getDoubleValue());
|
||||
} else if (elt2.getLongValue() != null) {
|
||||
guidedRuleTemplateDataRow.getDataList().put(elt2.getVarName(), elt2.getLongValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Variant variant = Variant.mediaTypes(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE).add().build().get(0);
|
||||
return Response.status(Response.Status.CREATED).entity(guidedRuleTemplate).variant(variant).build();
|
||||
}
|
||||
|
||||
@PutMapping(value = "/{spaceName}/{projectName}/grt/{templateName}/data/{lineID}",
|
||||
consumes = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML},
|
||||
produces = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML})
|
||||
@ApiOperation(value = "update Template dta row", notes = "updates row of a guided rule template", response = GuidedRuleTemplateDataRow.class)
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 200, message = "OK", response = GuidedRuleTemplateDataRow.class)
|
||||
})
|
||||
public Response updateTemplateData(@PathVariable("spaceName") String spaceName, @PathVariable("projectName") String projectName,
|
||||
@PathVariable("templateName") String templateName, @PathVariable("lineID") String lineID,
|
||||
@RequestBody GuidedRuleTemplateDataRow updatedRow) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String currentPrincipalName = authentication.getName();
|
||||
|
||||
User connectedUser = userRepository.findByLogin(currentPrincipalName);
|
||||
UserGroups userGroupsSpace = userGroupsRepository.findBySpaceName(spaceName);
|
||||
if (userGroupsSpace == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Space not found").build();
|
||||
}
|
||||
|
||||
|
||||
UserGroups userGroupsProject = userGroupsRepository.findByWorkspaceUserGroupAndProjectName(userGroupsSpace, projectName);
|
||||
if (userGroupsProject == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Project not found").build();
|
||||
}
|
||||
if (!connectedUser.getUserRoles().contains(userRolesRepository.findByName("admin"))
|
||||
&& !connectedUser.getUserGroups().contains(userGroupsSpace)
|
||||
&& !connectedUser.getUserGroups().contains(userGroupsProject)) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("User not allowed to access workspace/project").build();
|
||||
}
|
||||
GuidedRulesTemplateDefinition guidedRulesTemplateDefinition = guidedRulestemplateDefinitionRepository.findByTemplateNameAndProjectGroup(templateName, userGroupsProject);
|
||||
if (guidedRulesTemplateDefinition == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Guided rule template not found").build();
|
||||
}
|
||||
if (updatedRow == null) {
|
||||
return Response.status(Response.Status.NO_CONTENT).entity("No data ").build();
|
||||
}
|
||||
|
||||
GuidedRulesTemplateData guidedRulesTemplateData = guidedRulestemplateDataRepository.findByGuidedRulesTemplateDefinitionAndLineID(guidedRulesTemplateDefinition, lineID);
|
||||
if (guidedRulesTemplateData == null) {
|
||||
return Response.status(Response.Status.NO_CONTENT).entity("Line ID not existing ").build();
|
||||
}
|
||||
Map<String, VariableDefinition> defData = new HashMap<>();
|
||||
for (VariableDefinition dataDefinition : guidedRulesTemplateDefinition.getVariables()) {
|
||||
defData.put(dataDefinition.getVarName(), dataDefinition);
|
||||
}
|
||||
String assetSource = kieRepositoryService.getAssetSource(userGroupsSpace.getKieWorkbench().getExternalUrl() + "/rest", connectedUser.getLogin(), connectedUser.getPassword(), spaceName, projectName, templateName);
|
||||
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetSource);
|
||||
Object[] indexes = model.getTable().get(ID_COLUMN_NAME).toArray();
|
||||
int foundIndex=0;
|
||||
boolean found=false;
|
||||
for (Object o : indexes){
|
||||
if (o.equals(lineID)){
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
foundIndex++;
|
||||
}
|
||||
if (found) {
|
||||
Map<InterpolationVariable, Integer> variableIntegerMap = this.getInterpolationVariables(model);
|
||||
String[] rowContent = new String[variableIntegerMap.size() - 1];
|
||||
|
||||
for (Map.Entry<InterpolationVariable, Integer> entry : variableIntegerMap.entrySet()) {
|
||||
if (!entry.getKey().getVarName().equals(ID_COLUMN_NAME)) {
|
||||
|
||||
Object data = updatedRow.getDataList().get(entry.getKey().getVarName());
|
||||
if (data != null) {
|
||||
model.setValue(entry.getKey().getVarName(), foundIndex, data.toString());
|
||||
} else {
|
||||
model.setValue(entry.getKey().getVarName(), foundIndex, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String newAssetSource=RuleTemplateModelXMLPersistenceImpl.getInstance().marshal(model);
|
||||
kieRepositoryService.updateAssetSource(userGroupsSpace.getKieWorkbench().getExternalUrl() + "/rest", connectedUser.getLogin(), connectedUser.getPassword(), spaceName, projectName, templateName,newAssetSource);
|
||||
|
||||
Enumeration e = updatedRow.getDataList().keys();
|
||||
while (e.hasMoreElements()) {
|
||||
String variableName = (String) e.nextElement();
|
||||
Object variableData = updatedRow.getDataList().get(variableName);
|
||||
for (VariableData variableData1 : guidedRulesTemplateData.getRows()) {
|
||||
VariableDefinition dataDefinition = defData.get(variableData1.getVarName());
|
||||
if (dataDefinition.getVarName().equals(variableName)) {
|
||||
if ("String".equals(dataDefinition.getDataType())) {
|
||||
variableData1.setStringValue((String) variableData);
|
||||
} else if ("Long".equals(dataDefinition.getDataType())) {
|
||||
if (variableData != null) {
|
||||
Long ll = (Long) variableData;
|
||||
variableData1.setLongValue(ll);
|
||||
}
|
||||
} else if ("Double".equals(dataDefinition.getDataType())) {
|
||||
if (variableData != null) {
|
||||
Double dd = (Double) variableData;
|
||||
variableData1.setDoubleValue(dd);
|
||||
}
|
||||
} else if ("BigDecimal".equals(dataDefinition.getDataType())) {
|
||||
if (variableData != null) {
|
||||
BigDecimal bg = (BigDecimal) variableData;
|
||||
variableData1.setBigDecimalValue(bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
guidedRulestemplateDataRepository.save(guidedRulesTemplateData);
|
||||
Variant variant = Variant.mediaTypes(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE).add().build().get(0);
|
||||
return Response.status(Response.Status.OK).entity(updatedRow).variant(variant).build();
|
||||
}else{
|
||||
Variant variant = Variant.mediaTypes(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE).add().build().get(0);
|
||||
return Response.status(Response.Status.NOT_FOUND).entity(updatedRow).variant(variant).build();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/{spaceName}/{projectName}/grt/{templateName}/data",
|
||||
consumes = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML},
|
||||
produces = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML})
|
||||
@ApiOperation(value = "create Template dta row", notes = "creates row of a guided rule template", response = GuidedRuleTemplateDataRow.class)
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 200, message = "OK", response = GuidedRuleTemplateDataRow.class)
|
||||
})
|
||||
|
||||
|
||||
public Response createTemplateData(@PathVariable("spaceName") String spaceName, @PathVariable("projectName") String projectName,
|
||||
@PathVariable("templateName") String templateName,
|
||||
@RequestBody GuidedRuleTemplateDataRow updatedRow) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String currentPrincipalName = authentication.getName();
|
||||
|
||||
User connectedUser = userRepository.findByLogin(currentPrincipalName);
|
||||
UserGroups userGroupsSpace = userGroupsRepository.findBySpaceName(spaceName);
|
||||
if (userGroupsSpace == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Space not found").build();
|
||||
}
|
||||
UserGroups userGroupsProject = userGroupsRepository.findByWorkspaceUserGroupAndProjectName(userGroupsSpace, projectName);
|
||||
if (userGroupsProject == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Project not found").build();
|
||||
}
|
||||
if (!connectedUser.getUserRoles().contains(userRolesRepository.findByName("admin"))
|
||||
&& !connectedUser.getUserGroups().contains(userGroupsSpace)
|
||||
&& !connectedUser.getUserGroups().contains(userGroupsProject)) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("User not allowed to access workspace/project").build();
|
||||
}
|
||||
GuidedRulesTemplateDefinition guidedRulesTemplateDefinition = guidedRulestemplateDefinitionRepository.findByTemplateNameAndProjectGroup(templateName, userGroupsProject);
|
||||
if (guidedRulesTemplateDefinition == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Guided rule template not found").build();
|
||||
}
|
||||
if (updatedRow == null) {
|
||||
return Response.status(Response.Status.NO_CONTENT).entity("No data ").build();
|
||||
}
|
||||
|
||||
GuidedRulesTemplateData guidedRulesTemplateData = new GuidedRulesTemplateData();
|
||||
guidedRulesTemplateData.setGuidedRulesTemplateDefinition(guidedRulesTemplateDefinition);
|
||||
Map<String, VariableDefinition> defData = new HashMap<>();
|
||||
for (VariableDefinition dataDefinition : guidedRulesTemplateDefinition.getVariables()) {
|
||||
defData.put(dataDefinition.getVarName(), dataDefinition);
|
||||
}
|
||||
String assetSource = kieRepositoryService.getAssetSource(userGroupsSpace.getKieWorkbench().getExternalUrl() + "/rest", connectedUser.getLogin(), connectedUser.getPassword(), spaceName, projectName, templateName);
|
||||
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetSource);
|
||||
Map<InterpolationVariable, Integer> variableIntegerMap = this.getInterpolationVariables(model);
|
||||
String[] rowContent = new String[variableIntegerMap.size()-1];
|
||||
|
||||
for (Map.Entry<InterpolationVariable, Integer> entry : variableIntegerMap.entrySet()){
|
||||
if (!entry.getKey().getVarName().equals(ID_COLUMN_NAME)) {
|
||||
Object data = updatedRow.getDataList().get(entry.getKey().getVarName());
|
||||
if (data != null) {
|
||||
rowContent[entry.getValue()] = data.toString();
|
||||
} else {
|
||||
rowContent[entry.getValue()] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
String lineID = model.addRow(rowContent);
|
||||
guidedRulesTemplateData.setLineID(lineID);
|
||||
|
||||
String newAssetSource=RuleTemplateModelXMLPersistenceImpl.getInstance().marshal(model);
|
||||
kieRepositoryService.updateAssetSource(userGroupsSpace.getKieWorkbench().getExternalUrl() + "/rest", connectedUser.getLogin(), connectedUser.getPassword(), spaceName, projectName, templateName,newAssetSource);
|
||||
|
||||
Enumeration e = updatedRow.getDataList().keys();
|
||||
while (e.hasMoreElements()) {
|
||||
String variableName = (String) e.nextElement();
|
||||
Object variableData = updatedRow.getDataList().get(variableName);
|
||||
VariableData variableData1 = new VariableData();
|
||||
guidedRulesTemplateData.getRows().add(variableData1);
|
||||
variableData1.setVarName(variableName);
|
||||
VariableDefinition dataDefinition = defData.get(variableName);
|
||||
if (dataDefinition!= null
|
||||
&& dataDefinition.getVarName().equals(variableName)) {
|
||||
if ("String".equals(dataDefinition.getDataType())) {
|
||||
variableData1.setStringValue((String) variableData);
|
||||
} else if ("Long".equals(dataDefinition.getDataType())) {
|
||||
if (variableData != null) {
|
||||
Long ll = (Long) variableData;
|
||||
variableData1.setLongValue(ll);
|
||||
}
|
||||
} else if ("Double".equals(dataDefinition.getDataType())) {
|
||||
if (variableData != null) {
|
||||
Double dd = (Double) variableData;
|
||||
variableData1.setDoubleValue(dd);
|
||||
}
|
||||
} else if ("BigDecimal".equals(dataDefinition.getDataType())) {
|
||||
if (variableData != null) {
|
||||
BigDecimal bg = (BigDecimal) variableData;
|
||||
variableData1.setBigDecimalValue(bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
guidedRulestemplateDataRepository.save(guidedRulesTemplateData);
|
||||
Variant variant = Variant.mediaTypes(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE).add().build().get(0);
|
||||
updatedRow.setLineID(lineID);
|
||||
return Response.status(Response.Status.OK).entity(updatedRow).variant(variant).build();
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{spaceName}/{projectName}/grt/{templateName}/data/{lineID}",
|
||||
consumes = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML},
|
||||
produces = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML})
|
||||
@ApiOperation(value = "delete Template dta row", notes = "deletes row of a guided rule template", response = GuidedRuleTemplateDataRow.class)
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 200, message = "OK", response = Response.class)
|
||||
})
|
||||
public Response deleteemplateData(@PathVariable("spaceName") String spaceName, @PathVariable("projectName") String projectName,
|
||||
@PathVariable("templateName") String templateName, @PathVariable("lineID") String lineID) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String currentPrincipalName = authentication.getName();
|
||||
|
||||
User connectedUser = userRepository.findByLogin(currentPrincipalName);
|
||||
UserGroups userGroupsSpace = userGroupsRepository.findBySpaceName(spaceName);
|
||||
if (userGroupsSpace == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Space not found").build();
|
||||
}
|
||||
|
||||
|
||||
UserGroups userGroupsProject = userGroupsRepository.findByWorkspaceUserGroupAndProjectName(userGroupsSpace, projectName);
|
||||
if (userGroupsProject == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Project not found").build();
|
||||
}
|
||||
if (!connectedUser.getUserRoles().contains(userRolesRepository.findByName("admin"))
|
||||
&& !connectedUser.getUserGroups().contains(userGroupsSpace)
|
||||
&& !connectedUser.getUserGroups().contains(userGroupsProject)) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("User not allowed to access workspace/project").build();
|
||||
}
|
||||
GuidedRulesTemplateDefinition guidedRulesTemplateDefinition = guidedRulestemplateDefinitionRepository.findByTemplateNameAndProjectGroup(templateName, userGroupsProject);
|
||||
if (guidedRulesTemplateDefinition == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Guided rule template not found").build();
|
||||
}
|
||||
|
||||
|
||||
GuidedRulesTemplateData guidedRulesTemplateData = guidedRulestemplateDataRepository.findByGuidedRulesTemplateDefinitionAndLineID(guidedRulesTemplateDefinition, lineID);
|
||||
if (guidedRulesTemplateData == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Line ID not existing ").build();
|
||||
}
|
||||
String assetSource = kieRepositoryService.getAssetSource(userGroupsSpace.getKieWorkbench().getExternalUrl() + "/rest", connectedUser.getLogin(), connectedUser.getPassword(), spaceName, projectName, templateName);
|
||||
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetSource);
|
||||
model.removeRowById(lineID);
|
||||
String newAssetSource=RuleTemplateModelXMLPersistenceImpl.getInstance().marshal(model);
|
||||
kieRepositoryService.updateAssetSource(userGroupsSpace.getKieWorkbench().getExternalUrl() + "/rest", connectedUser.getLogin(), connectedUser.getPassword(), spaceName, projectName, templateName,newAssetSource);
|
||||
|
||||
guidedRulestemplateDataRepository.delete(guidedRulesTemplateData);
|
||||
Variant variant = Variant.mediaTypes(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE).add().build().get(0);
|
||||
return Response.status(Response.Status.OK).variant(variant).build();
|
||||
}
|
||||
private RequestCallback requestCallback(final Object content, String username, String password) {
|
||||
return clientHttpRequest -> {
|
||||
|
||||
if (content != null) {
|
||||
if (content instanceof KieServerInfo) {
|
||||
KieServerInfo kieServerSetup = (KieServerInfo) content;
|
||||
|
||||
mapper.writeValue(clientHttpRequest.getBody(), kieServerSetup);
|
||||
} else {
|
||||
mapper.writeValue(clientHttpRequest.getBody(), content);
|
||||
}
|
||||
}
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||
String auth = username + ":" + password;
|
||||
byte[] encodedAuth = Base64.encodeBase64(
|
||||
auth.getBytes(StandardCharsets.UTF_8));
|
||||
String authHeader = "Basic " + new String(encodedAuth);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.AUTHORIZATION, authHeader);
|
||||
};
|
||||
}
|
||||
private Map<InterpolationVariable, Integer> getInterpolationVariables(TemplateModel templateModel) {
|
||||
final Map<InterpolationVariable, Integer> variables = new HashMap<InterpolationVariable, Integer>();
|
||||
|
||||
new RuleModelVisitor(variables).visit(templateModel);
|
||||
|
||||
final Map<InterpolationVariable, Integer> result = new InterpolationVariableCollector(variables).getMap();
|
||||
|
||||
InterpolationVariable id = new InterpolationVariable(ID_COLUMN_NAME,
|
||||
DataType.TYPE_NUMERIC_LONG);
|
||||
result.put(id,
|
||||
result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package org.chtijbug.drools.console.restexpose;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.chtijbug.drools.console.service.IndexerService;
|
||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/logging")
|
||||
@Api("/api/logging")
|
||||
public class ElasticSearchExpose {
|
||||
|
||||
@Autowired
|
||||
private IndexerService indexerService;
|
||||
|
||||
@GetMapping(value = "/findLastByTransactionId")
|
||||
public BusinessTransactionPersistence findTransactionById(@RequestParam String transactionId, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
BusinessTransactionPersistence tmp=null;
|
||||
|
||||
List<BusinessTransactionPersistence> businessTransactionPersistences = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(transactionId,PageRequest.of(0,5000));
|
||||
|
||||
if(businessTransactionPersistences!=null) {
|
||||
for (BusinessTransactionPersistence b : businessTransactionPersistences) {
|
||||
|
||||
if (tmp == null) {
|
||||
tmp = b;
|
||||
}
|
||||
if (indexerService.toDate(tmp.getYear(), tmp.getMonth(), tmp.getDay(), tmp.getHour(), tmp.getMinute(), tmp.getMillis()).compareTo(
|
||||
indexerService.toDate(b.getYear(), b.getMonth(), b.getDay(), b.getHour(), b.getMinute(), b.getMillis()))>0) {
|
||||
tmp = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
@GetMapping(value = "/findActionByBusinessId")
|
||||
public List<BusinessTransactionAction> findActionById(@RequestParam String businessId, HttpServletRequest request, HttpServletResponse response) {
|
||||
return indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(businessId,Sort.by(new Sort.Order(Sort.Direction.ASC,"eventNumber")),PageRequest.of(0,5000));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
package org.chtijbug.drools.console.restexpose;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.chtijbug.drools.console.service.IndexerService;
|
||||
import org.chtijbug.drools.console.service.JobService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.proxy.persistence.model.KieWorkbench;
|
||||
import org.chtijbug.drools.proxy.persistence.model.User;
|
||||
import org.chtijbug.drools.proxy.persistence.model.UserGroups;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.KieWorkbenchRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.UserGroupsRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.UserRepository;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
|
||||
import org.guvnor.rest.client.CreateProjectJobRequest;
|
||||
import org.guvnor.rest.client.CreateProjectRequest;
|
||||
import org.guvnor.rest.client.Space;
|
||||
import org.guvnor.rest.client.SpaceRequest;
|
||||
import org.kie.server.api.model.KieServerInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RequestCallback;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Variant;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Scanner;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/wb")
|
||||
@Api("/api/wb")
|
||||
public class ProjectWorkspaceServiceExpose {
|
||||
|
||||
@Autowired
|
||||
private IndexerService indexerService;
|
||||
|
||||
private RestTemplate restTemplateKiewb = new RestTemplate();
|
||||
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@Autowired
|
||||
private KieWorkbenchRepository kieWorkbenchRepository;
|
||||
|
||||
@Autowired
|
||||
private UserGroupsRepository userGroupsRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private JobService jobService;
|
||||
|
||||
@Autowired
|
||||
private ProjectPersistService projectPersistService;
|
||||
|
||||
@PostMapping(value = "/spaces",
|
||||
consumes = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML},
|
||||
produces = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML})
|
||||
@ApiOperation(value = "Create Workspace", notes = "Creating a workspace in specified workbench name in body", response = SpaceRequest.class)
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 201, message = "Created", response = SpaceRequest.class)
|
||||
})
|
||||
public Response createWorkSpace(@RequestBody PlatformProjectData request) {
|
||||
String wbName = "demo";
|
||||
if (request.getWbName() != null
|
||||
&& !request.getWbName().isEmpty()) {
|
||||
wbName = request.getWbName();
|
||||
}
|
||||
KieWorkbench kieWorkbench = kieWorkbenchRepository.findByName(wbName);
|
||||
if (kieWorkbench == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Workbench not found").build();
|
||||
}
|
||||
String completeurl = kieWorkbench.getExternalUrl() + "/rest/spaces";
|
||||
Space space = new Space();
|
||||
space.setName(request.getSpaceName());
|
||||
space.setDescription(request.getDescription());
|
||||
space.setDefaultGroupId(request.getGroupId());
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String currentPrincipalName = authentication.getName();
|
||||
space.setOwner(authentication.getName());
|
||||
|
||||
User connectedUser = userRepository.findByLogin(currentPrincipalName);
|
||||
ResponseEntity<SpaceRequest> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.POST, requestCallback(space, connectedUser.getLogin(), connectedUser.getPassword()), clientHttpResponse -> {
|
||||
SpaceRequest extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = mapper.readValue(result, SpaceRequest.class);
|
||||
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
projectPersistService.createWorkSpaceGroupIfNeeded(request.getSpaceName(),kieWorkbench);
|
||||
jobService.executeWrite(kieWorkbench.getExternalUrl()+"/rest", connectedUser.getLogin(), connectedUser.getPassword(), null, response.getBody().getJobId(), null);
|
||||
Variant variant = Variant.mediaTypes(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE).add().build().get(0);
|
||||
return Response.status(Response.Status.CREATED).entity(response.getBody()).variant(variant).build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/spaces/{spaceName}/projects",
|
||||
consumes = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML},
|
||||
produces = {javax.ws.rs.core.MediaType.APPLICATION_JSON, javax.ws.rs.core.MediaType.APPLICATION_XML})
|
||||
public Response createProject(@PathVariable("spaceName") String spaceName,@RequestBody PlatformProjectData request) {
|
||||
String wbName = "demo";
|
||||
if (request.getWbName() != null
|
||||
&& !request.getWbName().isEmpty()) {
|
||||
wbName = request.getWbName();
|
||||
}
|
||||
KieWorkbench kieWorkbench = kieWorkbenchRepository.findByName(wbName);
|
||||
if (kieWorkbench == null) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Workbench not found").build();
|
||||
}
|
||||
String completeurl = kieWorkbench.getExternalUrl() + "/rest/spaces/"+spaceName+"/projects";
|
||||
CreateProjectRequest projectRequest = new CreateProjectRequest();
|
||||
|
||||
projectRequest.setName(request.getName());
|
||||
projectRequest.setGroupId(request.getGroupId());
|
||||
projectRequest.setVersion(request.getVersion());
|
||||
projectRequest.setDescription(request.getDescription());
|
||||
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
String currentPrincipalName = authentication.getName();
|
||||
|
||||
User connectedUser = userRepository.findByLogin(currentPrincipalName);
|
||||
ResponseEntity<CreateProjectJobRequest> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.POST, requestCallback(projectRequest, connectedUser.getLogin(), connectedUser.getPassword()), clientHttpResponse -> {
|
||||
CreateProjectJobRequest extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = mapper.readValue(result, CreateProjectJobRequest.class);
|
||||
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
jobService.executeWrite(kieWorkbench.getExternalUrl()+"/rest", connectedUser.getLogin(), connectedUser.getPassword(), null, response.getBody().getJobId(), null);
|
||||
|
||||
completeurl = kieWorkbench.getExternalUrl() + "/rest/chtijbug/"+spaceName+"/"+projectRequest.getName()+"/dependency";
|
||||
ResponseEntity<PlatformProjectData> response2 = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.PUT, requestCallback(request, connectedUser.getLogin(), connectedUser.getPassword()), clientHttpResponse -> {
|
||||
PlatformProjectData extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = mapper.readValue(result, PlatformProjectData.class);
|
||||
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
|
||||
|
||||
Variant variant = Variant.mediaTypes(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE).add().build().get(0);
|
||||
UserGroups workspaceUsergroup = userGroupsRepository.findByName("wrk_" + spaceName);
|
||||
projectPersistService.createProjectGroupIfNeeded(request.getName(),kieWorkbench,null,workspaceUsergroup);
|
||||
return Response.status(Response.Status.CREATED).entity(response2.getBody()).variant(variant).build();
|
||||
}
|
||||
private RequestCallback requestCallback(final Object content, String username, String password) {
|
||||
return clientHttpRequest -> {
|
||||
|
||||
if (content != null) {
|
||||
if (content instanceof KieServerInfo) {
|
||||
KieServerInfo kieServerSetup = (KieServerInfo) content;
|
||||
|
||||
mapper.writeValue(clientHttpRequest.getBody(), kieServerSetup);
|
||||
} else {
|
||||
mapper.writeValue(clientHttpRequest.getBody(), content);
|
||||
}
|
||||
}
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||
String auth = username + ":" + password;
|
||||
byte[] encodedAuth = Base64.encodeBase64(
|
||||
auth.getBytes(StandardCharsets.UTF_8));
|
||||
String authHeader = "Basic " + new String(encodedAuth);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.AUTHORIZATION, authHeader);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package org.chtijbug.drools.console.security;
|
||||
|
||||
import org.chtijbug.drools.proxy.persistence.model.User;
|
||||
import org.chtijbug.drools.proxy.persistence.model.UserRoles;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.UserRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Service
|
||||
public class MongoUserDetailsService implements UserDetailsService {
|
||||
@Autowired
|
||||
private UserRepository repository;
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
User user = repository.findByLogin(username);
|
||||
if(user == null) {
|
||||
throw new UsernameNotFoundException("User not found");
|
||||
}
|
||||
ArrayList<SimpleGrantedAuthority> authorities = new ArrayList<>();
|
||||
for (UserRoles userRole: user.getUserRoles()){
|
||||
authorities.add(new SimpleGrantedAuthority(userRole.getName()));
|
||||
}
|
||||
|
||||
return new org.springframework.security.core.userdetails.User(user.getLogin(), user.getPassword(), authorities);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package org.chtijbug.drools.console.security;
|
||||
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
public final class MyNoOpPasswordEncoder implements PasswordEncoder {
|
||||
|
||||
public String encode(CharSequence rawPassword) {
|
||||
return rawPassword.toString();
|
||||
}
|
||||
|
||||
public boolean matches(CharSequence rawPassword, String encodedPassword) {
|
||||
return rawPassword.toString().equals(encodedPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the singleton {@link org.springframework.security.crypto.password.NoOpPasswordEncoder}.
|
||||
*/
|
||||
public static PasswordEncoder getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private static final PasswordEncoder INSTANCE = new MyNoOpPasswordEncoder();
|
||||
|
||||
public MyNoOpPasswordEncoder() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.ColumnDefinition;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.DecisionTable;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.GuidedException;
|
||||
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
|
||||
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class DecisionTableExcelService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DecisionTableExcelService.class);
|
||||
|
||||
@Value("${adminConsole.tmpdir}")
|
||||
public String tmpDir;
|
||||
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
private KieConfigurationData config;
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
private String assetContent;
|
||||
|
||||
public DecisionTableExcelService() {
|
||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
}
|
||||
|
||||
public String getAssetContent() {
|
||||
assetContent = kieRepositoryService.getAssetSource(config.getKiewbUrl(),
|
||||
userConnectedService.getUserConnected().getUserName(),
|
||||
userConnectedService.getUserConnected().getUserPassword(),
|
||||
userConnectedService.getSpace(),
|
||||
userConnectedService.getProject(),
|
||||
userConnectedService.getAsset());
|
||||
return assetContent;
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> importExcel(InputStream inputStream) throws IOException {
|
||||
Workbook workbook = null;
|
||||
List<HashMap<String, Object>> result = null;
|
||||
try {
|
||||
workbook = WorkbookFactory.create(inputStream);
|
||||
result = new ArrayList<>();
|
||||
DataFormatter dataFormatter = new DataFormatter();
|
||||
for (Sheet sheet : workbook) {
|
||||
for (Row row : sheet) {
|
||||
|
||||
if (row.getRowNum() != 0) {
|
||||
|
||||
HashMap<String, Object> tmp = new HashMap<>();
|
||||
result.add(tmp);
|
||||
|
||||
for (Cell cell : row) {
|
||||
String cellValue = dataFormatter.formatCellValue(cell);
|
||||
|
||||
Integer numColumn = cell.getColumnIndex();
|
||||
Cell title = sheet.getRow(0).getCell(numColumn);
|
||||
tmp.put(dataFormatter.formatCellValue(title), cellValue);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("IOException","ImportExcell",e);
|
||||
throw e;
|
||||
} finally {
|
||||
if (workbook != null) {
|
||||
workbook.close();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ByteArrayInputStream exportExcel(String nameTemplate) {
|
||||
|
||||
//Récupération des objets JAVA
|
||||
|
||||
assetContent = kieRepositoryService.getAssetSource(config.getKiewbUrl(),
|
||||
userConnectedService.getUserConnected().getUserName(),
|
||||
userConnectedService.getUserConnected().getUserPassword(),
|
||||
userConnectedService.getSpace(),
|
||||
userConnectedService.getProject(),
|
||||
userConnectedService.getAsset());
|
||||
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal(assetContent);
|
||||
Workbook workbook = null;
|
||||
try {
|
||||
workbook = new XSSFWorkbook();
|
||||
DecisionTable decisionTable = new DecisionTable(model);
|
||||
workbook.getCreationHelper();
|
||||
Sheet sheet = workbook.createSheet(nameTemplate);
|
||||
|
||||
Font headerFont = workbook.createFont();
|
||||
headerFont.setFontHeightInPoints((short) 12);
|
||||
headerFont.setColor(IndexedColors.BLACK.getIndex());
|
||||
|
||||
CellStyle headerCellStyle = workbook.createCellStyle();
|
||||
headerCellStyle.setFont(headerFont);
|
||||
|
||||
Row headerRow = sheet.createRow(0);
|
||||
|
||||
if (decisionTable.getRows() != null && !decisionTable.getRows().isEmpty()) {
|
||||
|
||||
int j = 0;
|
||||
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
||||
if (!columnDefinition.isHideColumn()) {
|
||||
Cell cell = headerRow.createCell(j);
|
||||
cell.setCellValue(columnDefinition.getHeader());
|
||||
cell.setCellStyle(headerCellStyle);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
int rowIndex = 1;
|
||||
|
||||
for (int i = 0; i < decisionTable.getRows().size(); i++) {
|
||||
org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.Row row = decisionTable.getRows().get(i);
|
||||
int k = 0;
|
||||
int jj = 0;
|
||||
Row r = sheet.createRow(rowIndex);
|
||||
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
||||
if (!columnDefinition.isHideColumn()) {
|
||||
Cell cell = r.createCell(k);
|
||||
cell.setCellValue(row.getRowElements().get(jj).getValue());
|
||||
cell.setCellStyle(headerCellStyle);
|
||||
k++;
|
||||
}
|
||||
jj++;
|
||||
}
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
}
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream is = null;
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(tmpDir + "/" + nameTemplate + ".xlsx");
|
||||
workbook.write(fileOutputStream);
|
||||
workbook.write(bos);
|
||||
byte[] barray = bos.toByteArray();
|
||||
is = new ByteArrayInputStream(barray);
|
||||
workbook.close();
|
||||
return is;
|
||||
} catch (GuidedException | IOException e) {
|
||||
logger.error("new FileOutputStream", e);
|
||||
} finally {
|
||||
if (workbook != null) {
|
||||
try {
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.chtijbug.drools.console.service.model.gitlab.GroupElementResponse;
|
||||
import org.chtijbug.drools.console.service.model.gitlab.ProjectMoveResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RequestCallback;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class GitLabRepositoryService {
|
||||
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(GitLabRepositoryService.class);
|
||||
|
||||
|
||||
private RestTemplate restTemplateKiewb = new RestTemplate();
|
||||
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public List<GroupElementResponse> getListGitRepostitories(String url, String token, String groupName) {
|
||||
|
||||
String completeurl = url + "/groups/" + groupName + "/projects";
|
||||
logger.info("url gitlab : {}" , completeurl);
|
||||
ResponseEntity<List<GroupElementResponse>> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, token), clientHttpResponse -> {
|
||||
List<GroupElementResponse> extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
GroupElementResponse[] values = mapper.readValue(result, GroupElementResponse[].class);
|
||||
extractedResponse = Arrays.asList(values);
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
List<GroupElementResponse> reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public GroupElementResponse createProjectForUser(String url, String token, String projectName) {
|
||||
|
||||
String completeurl = url + "/projects?name=" + projectName;
|
||||
logger.info("url moteur reco : {}", completeurl);
|
||||
ResponseEntity<GroupElementResponse> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
||||
GroupElementResponse extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = mapper.readValue(result, GroupElementResponse.class);
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
GroupElementResponse reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public ProjectMoveResponse moveProjectTpGroup(String url, String token, String projectid, String groupName) {
|
||||
|
||||
String completeurl = url + "/groups/" + groupName + "/projects/" + projectid;
|
||||
logger.info("url moteur reco : {}" , completeurl);
|
||||
ResponseEntity<ProjectMoveResponse> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
||||
ProjectMoveResponse extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = mapper.readValue(result, ProjectMoveResponse.class);
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
ProjectMoveResponse reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
return reponseMoteur;
|
||||
}
|
||||
///groups/:id/projects/:project_id
|
||||
|
||||
private RequestCallback requestCallback(final Object content, String token) {
|
||||
return clientHttpRequest -> {
|
||||
if (content != null) {
|
||||
mapper.writeValue(clientHttpRequest.getBody(), content);
|
||||
}
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||
|
||||
String authHeader = token;
|
||||
clientHttpRequest.getHeaders().add(
|
||||
"Private-Token", authHeader);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class GitRepositoryService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(GitRepositoryService.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
GitRepositoryService service = new GitRepositoryService();
|
||||
service.executeCommand("cd /Users/nheron/kie-base-jbpm-6/niodir/.niogit/nico1.git && ./hooks/post-commit ");
|
||||
}
|
||||
|
||||
public void addHookToRepo(String projectName, String gitRepoBase,String gitBaseUrl) throws IOException {
|
||||
String fileBase = System.getProperty("org.uberfire.nio.git.dir");
|
||||
if (fileBase != null) {
|
||||
if (gitRepoBase==null || gitBaseUrl.length()==0){
|
||||
gitRepoBase=".niogit";
|
||||
}
|
||||
String gitdirectory = fileBase + "/"+gitRepoBase+"/" + projectName + ".git";
|
||||
String gitFileName = fileBase + "/"+gitRepoBase+"/" + projectName + ".git/hooks/post-commit";
|
||||
/**
|
||||
* #!/bin/sh
|
||||
* REPO=git@gitlab.pymma-software.com:nheron/jbpm-edop-base-example.git
|
||||
* git push --mirror $REPO;
|
||||
* echo "====push done ===="
|
||||
*/
|
||||
String gitRepo = gitBaseUrl + "/" + projectName + ".git";
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("#!/bin/sh").append("\n");
|
||||
stringBuilder.append("currentDir=$PWD").append("\n");
|
||||
stringBuilder.append("cd ").append(gitdirectory).append("\n");
|
||||
stringBuilder.append("REPO=").append(gitRepo).append("\n");
|
||||
stringBuilder.append("git push --mirror $REPO;").append("\n");
|
||||
stringBuilder.append("echo \"====push done ====\" ").append("\n");
|
||||
stringBuilder.append("cd $currentDir ").append("\n");
|
||||
File file = new File(gitFileName);
|
||||
FileUtils.writeStringToFile(file, stringBuilder.toString());
|
||||
boolean executable = file.setExecutable(true, true);
|
||||
logger.info("executable {}",executable);
|
||||
}
|
||||
}
|
||||
|
||||
public void executeHookPush(String projectName, String gitRepoBase,String gitBaseUrl) {
|
||||
String fileBase = System.getProperty("org.uberfire.nio.git.dir");
|
||||
if (fileBase != null) {
|
||||
if (gitRepoBase==null || gitBaseUrl.length()==0){
|
||||
gitRepoBase=".niogit";
|
||||
}
|
||||
String gitFileName = fileBase + "/"+gitRepoBase+"/" + projectName + ".git/hooks/post-commit";
|
||||
this.executeCommand(gitFileName);
|
||||
}
|
||||
}
|
||||
|
||||
private String executeCommand(String command) {
|
||||
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
Process process;
|
||||
try {
|
||||
logger.info(command);
|
||||
logger.info("============Command start======================");
|
||||
process = Runtime.getRuntime().exec(command);
|
||||
process.waitFor();
|
||||
logger.info("=============Command Stop=====================");
|
||||
new Thread(() -> {
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line = "";
|
||||
try {
|
||||
while ((line = reader.readLine()) != null)
|
||||
logger.info(line);
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
|
||||
// Consommation de la sortie d'erreur de l'application externe dans un Thread separe
|
||||
new Thread(() -> {
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
|
||||
String line = "";
|
||||
try {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
logger.info(line);
|
||||
// Traitement du flux d'erreur de l'application si besoin est
|
||||
}
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return output.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
||||
import org.drools.workbench.models.guided.template.backend.RuleTemplateModelXMLPersistenceImpl;
|
||||
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class GuidedRuleTemplateExcelService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GuidedRuleTemplateExcelService.class);
|
||||
|
||||
@Value("${adminConsole.tmpdir}")
|
||||
public String tmpDir;
|
||||
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
private KieConfigurationData config;
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
|
||||
public GuidedRuleTemplateExcelService() {
|
||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
|
||||
}
|
||||
|
||||
public String getAssetContent() {
|
||||
return kieRepositoryService.getAssetSource(config.getKiewbUrl(),
|
||||
userConnectedService.getUserConnected().getUserName(),
|
||||
userConnectedService.getUserConnected().getUserPassword(),
|
||||
userConnectedService.getSpace(),
|
||||
userConnectedService.getProject(),
|
||||
userConnectedService.getAsset());
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> importExcel(InputStream inputStream) throws IOException {
|
||||
List<HashMap<String, Object>> result = null;
|
||||
|
||||
try (Workbook workbook = WorkbookFactory.create(inputStream)) {
|
||||
DataFormatter dataFormatter = new DataFormatter();
|
||||
result = new ArrayList<>();
|
||||
for (Sheet sheet : workbook) {
|
||||
for (Row row : sheet) {
|
||||
if (row.getRowNum() != 0) {
|
||||
HashMap<String, Object> tmp = new HashMap<>();
|
||||
result.add(tmp);
|
||||
for (Cell cell : row) {
|
||||
String cellValue = dataFormatter.formatCellValue(cell);
|
||||
Integer numColumn = cell.getColumnIndex();
|
||||
Cell title = sheet.getRow(0).getCell(numColumn);
|
||||
tmp.put(dataFormatter.formatCellValue(title), cellValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ByteArrayInputStream exportExcel(String nameTemplate) {
|
||||
|
||||
//Récupération des objets JAVA
|
||||
|
||||
String assetContent = getAssetContent();
|
||||
|
||||
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetContent);
|
||||
InterpolationVariable[] variablesList = model.getInterpolationVariablesList();
|
||||
String[][] contenuTable = model.getTableAsArray();
|
||||
|
||||
|
||||
List<HashMap<String, Object>> rows = new ArrayList<>();
|
||||
for (int i = 0; i < model.getRowsCount(); i++) {
|
||||
HashMap<String, Object> newRow = new HashMap<>();
|
||||
rows.add(newRow);
|
||||
String[] ligne = contenuTable[i];
|
||||
int k = 0;
|
||||
for (InterpolationVariable j : variablesList) {
|
||||
newRow.put(j.getVarName(), ligne[k]);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
try (Workbook workbook = new XSSFWorkbook()) {
|
||||
Sheet sheet = workbook.createSheet(nameTemplate);
|
||||
|
||||
Font headerFont = workbook.createFont();
|
||||
headerFont.setFontHeightInPoints((short) 12);
|
||||
headerFont.setColor(IndexedColors.BLACK.getIndex());
|
||||
|
||||
CellStyle headerCellStyle = workbook.createCellStyle();
|
||||
headerCellStyle.setFont(headerFont);
|
||||
|
||||
Row headerRow = sheet.createRow(0);
|
||||
|
||||
if (rows != null && !rows.isEmpty()) {
|
||||
int columnIndex = 0;
|
||||
for (Map.Entry<String, Object> t : rows.get(0).entrySet()) {
|
||||
Cell cell = headerRow.createCell(columnIndex);
|
||||
cell.setCellValue(t.getKey());
|
||||
cell.setCellStyle(headerCellStyle);
|
||||
columnIndex++;
|
||||
}
|
||||
int rowIndex = 1;
|
||||
for (HashMap<String, Object> t : rows) {
|
||||
|
||||
int columnIndexTmp = 0;
|
||||
Row r = sheet.createRow(rowIndex);
|
||||
|
||||
for (Map.Entry<String, Object> tmp : t.entrySet()) {
|
||||
Cell cell = r.createCell(columnIndexTmp);
|
||||
cell.setCellValue(String.valueOf(tmp.getValue()));
|
||||
cell.setCellStyle(headerCellStyle);
|
||||
columnIndexTmp++;
|
||||
}
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(tmpDir + "/" + nameTemplate + ".xlsx");
|
||||
workbook.write(fileOutputStream);
|
||||
workbook.write(bos);
|
||||
byte[] barray = bos.toByteArray();
|
||||
return new ByteArrayInputStream(barray);
|
||||
} catch (IOException e) {
|
||||
logger.error("exportExcel", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
|
||||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionActionRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionPersistenceRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class IndexerService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BusinessTransactionPersistenceRepository businessTransactionPersistenceRepository;
|
||||
|
||||
@Autowired
|
||||
private BusinessTransactionActionRepository businessTransactionActionRepository;
|
||||
|
||||
public BusinessTransactionPersistenceRepository getBusinessTransactionPersistenceRepository() {
|
||||
return businessTransactionPersistenceRepository;
|
||||
}
|
||||
|
||||
public void setBusinessTransactionPersistenceRepository(BusinessTransactionPersistenceRepository businessTransactionPersistenceRepository) {
|
||||
this.businessTransactionPersistenceRepository = businessTransactionPersistenceRepository;
|
||||
}
|
||||
|
||||
public BusinessTransactionActionRepository getBusinessTransactionActionRepository() {
|
||||
return businessTransactionActionRepository;
|
||||
}
|
||||
|
||||
public void setBusinessTransactionActionRepository(BusinessTransactionActionRepository businessTransactionActionRepository) {
|
||||
this.businessTransactionActionRepository = businessTransactionActionRepository;
|
||||
}
|
||||
public Date toDate(Integer years, Integer month, Integer days, Integer hours, Integer minutes, Integer millis ){
|
||||
|
||||
return new GregorianCalendar(years,month-1,days,hours,minutes,millis).getTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import com.offbytwo.jenkins.JenkinsServer;
|
||||
import com.offbytwo.jenkins.model.Job;
|
||||
import com.offbytwo.jenkins.model.JobWithDetails;
|
||||
import com.offbytwo.jenkins.model.View;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.chtijbug.drools.console.service.model.gitlab.GitLabConfigurationData;
|
||||
import org.chtijbug.drools.console.service.model.jenkins.JenkinsConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class JenkinsService {
|
||||
JenkinsServer jenkins = null;
|
||||
|
||||
public void createJobForRepo(String jenkinsServerUrl, String username, String password, String viewName, String groupId, String artifactId, String pomXml, String nexusName, String nexusUrl, String jdkVersion) throws URISyntaxException, IOException, InterruptedException {
|
||||
GitLabConfigurationData configGitLab = AppContext.getApplicationContext().getBean(GitLabConfigurationData.class);
|
||||
JenkinsConfigurationData jenkinsConfigurationData = AppContext.getApplicationContext().getBean(JenkinsConfigurationData.class);
|
||||
|
||||
if (jenkins == null) {
|
||||
jenkins = new JenkinsServer(new URI(jenkinsServerUrl), username, password);
|
||||
|
||||
}
|
||||
|
||||
Map<String, View> views = jenkins.getViews();
|
||||
|
||||
if (views.containsKey(jenkinsConfigurationData.getGroupName())) {
|
||||
View view = views.get(viewName);
|
||||
InputStream stream = new ClassPathResource("/META-INF/DefaultJbpmArtefactJenkinsBuildProject.xml").getInputStream();
|
||||
String fileContent = IOUtils.toString(stream);
|
||||
fileContent = fileContent.replace(":gitRepoUrl", configGitLab.getBaseUrl() + "/" + artifactId + ".git");
|
||||
fileContent = fileContent.replace(":gitCredentials", jenkinsConfigurationData.getCredentials());
|
||||
fileContent = fileContent.replace(":groupId", groupId);
|
||||
fileContent = fileContent.replace(":artifactid", artifactId);
|
||||
fileContent = fileContent.replace(":pomxml", pomXml);
|
||||
fileContent = fileContent.replace(":nexusName", nexusName);
|
||||
fileContent = fileContent.replace(":nexusUrl", nexusUrl);
|
||||
fileContent = fileContent.replace(":jdkVersion", jdkVersion);
|
||||
|
||||
String newJobName = groupId.replace(".", "dot") + "dot" + artifactId;
|
||||
jenkins.createJob(newJobName, fileContent, false);
|
||||
boolean jobNotYetCreated = true;
|
||||
while (jobNotYetCreated) {
|
||||
JobWithDetails jobWithDetails = jenkins.getJob(newJobName);
|
||||
if (jobWithDetails != null) {
|
||||
jobNotYetCreated = false;
|
||||
} else {
|
||||
synchronized (this) {
|
||||
try {
|
||||
this.wait(1000);
|
||||
} catch (InterruptedException e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
InputStream streamView = new ClassPathResource("/META-INF/DefaultViewConfig.xml").getInputStream();
|
||||
String fileContentView = IOUtils.toString(streamView);
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (Job job : view.getJobs()) {
|
||||
stringBuilder.append("<string>").append(job.getName()).append("</string>").append("\n");
|
||||
}
|
||||
stringBuilder.append("<string>").append(newJobName).append("</string>").append("\n");
|
||||
fileContentView = fileContentView.replace(":listJobs", stringBuilder.toString());
|
||||
jenkins.updateView(view.getName(), fileContentView);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
import org.chtijbug.drools.console.AddLog;
|
||||
import org.chtijbug.drools.console.service.model.kie.JobStatus;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class JobService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JobService.class);
|
||||
|
||||
@Autowired
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
|
||||
public void executeWrite(String url, String username, String password, AddLog workOnGoingView, String jobID, UI ui) {
|
||||
|
||||
String isJobDone = "NO";
|
||||
while ("NO".equals(isJobDone)) {
|
||||
JobStatus jobStatus = kieRepositoryService.getStatusJobID(url,
|
||||
username,
|
||||
password, jobID);
|
||||
if ("DUPLICATE_RESOURCE".equals(jobStatus.getStatus())
|
||||
|| "SUCCESS".equals(jobStatus.getStatus())) {
|
||||
isJobDone = "YES";
|
||||
if (ui!= null) {
|
||||
workOnGoingView.addRow("JobID=" + jobID + " finished", ui);
|
||||
}
|
||||
} else if ("ACCEPTED".equals(jobStatus.getStatus())
|
||||
|| ("APPROVED".equals(jobStatus.getStatus()))) {
|
||||
try {
|
||||
synchronized (this) {
|
||||
if (ui!= null) {
|
||||
workOnGoingView.addRow("JobID=" + jobID + " not yet finished", ui);
|
||||
}
|
||||
this.wait(1000);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("executeWrite", e);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,309 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.vaadin.flow.component.UI;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.chtijbug.drools.console.AddLog;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.JobStatus;
|
||||
import org.chtijbug.drools.proxy.persistence.model.User;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.UserRepository;
|
||||
import org.chtijbug.guvnor.server.jaxrs.api.UserLoginInformation;
|
||||
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.WorkspaceAuthData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RequestCallback;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class KieRepositoryService {
|
||||
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(KieRepositoryService.class);
|
||||
|
||||
private static String chtijbugprefix="/chtijbug/";
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
private RestTemplate restTemplateKiewb = new RestTemplate();
|
||||
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
|
||||
public void updateAssetSource(String url, String username, String password, String spaceName, String projectName, String assetName, String assetSource) {
|
||||
|
||||
String completeurl = url + chtijbugprefix + spaceName + "/" + projectName + "/asset/" + assetName + "/source";
|
||||
logger.info("url updateAssetSource : {}", completeurl);
|
||||
|
||||
restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.PUT, requestCallback(assetSource, username, password), clientHttpResponse -> {
|
||||
String extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = result;
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
}
|
||||
|
||||
public String getAssetSource(String url, String username, String password, String spaceName, String projectName, String assetName) {
|
||||
String completeurl = url + chtijbugprefix + spaceName + "/" + projectName + "/assets/" + assetName + "/source";
|
||||
logger.info("url getAssetSource : {}", completeurl);
|
||||
ResponseEntity<String> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
String result=null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
result = s.hasNext() ? s.next() : "";
|
||||
}
|
||||
return new ResponseEntity<>(result, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
String reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public List<PlatformProjectData> getListSpaces2(String url, String username, String password) {
|
||||
String completeurl = url + chtijbugprefix+"detailedSpaces";
|
||||
logger.info("url getListSpaces2 :{} ", completeurl);
|
||||
ResponseEntity<List<PlatformProjectData>> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
List<PlatformProjectData> extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
PlatformProjectData[] values = mapper.readValue(result, PlatformProjectData[].class);
|
||||
extractedResponse = Arrays.asList(values);
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
List<PlatformProjectData> reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public UserConnected login(String url, String username, String password,String workbenchName) {
|
||||
|
||||
User user = userRepository.findByLogin(username);
|
||||
String completeurl = url + chtijbugprefix+"login";
|
||||
if (user != null && user.getPassword().equals(password)) {
|
||||
if (user.getCustomer()!= null &&
|
||||
user.getCustomer().getKieWorkbench()!= null
|
||||
&& user.getCustomer().getKieWorkbench().getInternalUrl()!= null){
|
||||
completeurl = user.getCustomer().getKieWorkbench().getInternalUrl()+"/rest/chtijbug/login";
|
||||
}
|
||||
|
||||
logger.info("url moteur reco : {}" , completeurl);
|
||||
ResponseEntity<UserLoginInformation> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
UserLoginInformation extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = mapper.readValue(result, UserLoginInformation.class);
|
||||
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
UserConnected userConnected = new UserConnected();
|
||||
|
||||
|
||||
userConnected.setUserName(username);
|
||||
userConnected.setUserPassword(password);
|
||||
userConnected.setUserPassword(password);
|
||||
if (response!= null) {
|
||||
UserLoginInformation responseBody = response.getBody();
|
||||
if (responseBody!= null) {
|
||||
userConnected.getProjectResponses().addAll(responseBody.getProjects());
|
||||
userConnected.getRoles().addAll(responseBody.getRoles());
|
||||
}
|
||||
}
|
||||
userConnected.setUserName(username);
|
||||
userConnected.setKieWorkbenchName(workbenchName);
|
||||
return userConnected;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public UserConnected getUserContent(String url, String username, String password,String workbenchName) {
|
||||
|
||||
User user = userRepository.findByLogin(username);
|
||||
String completeurl = url + chtijbugprefix+"content";
|
||||
if (user != null && user.getPassword().equals(password)) {
|
||||
if (user.getCustomer()!= null &&
|
||||
user.getCustomer().getKieWorkbench()!= null
|
||||
&& user.getCustomer().getKieWorkbench().getInternalUrl()!= null){
|
||||
completeurl = user.getCustomer().getKieWorkbench().getInternalUrl()+"/rest/chtijbug/content";
|
||||
}
|
||||
|
||||
logger.info("url moteur reco : {}" , completeurl);
|
||||
ResponseEntity<UserLoginInformation> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
UserLoginInformation extractedResponse =null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = mapper.readValue(result, UserLoginInformation.class);
|
||||
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
UserConnected userConnected = new UserConnected();
|
||||
|
||||
UserLoginInformation responseBody = response.getBody();
|
||||
userConnected.setUserName(username);
|
||||
userConnected.setUserPassword(password);
|
||||
userConnected.setUserPassword(password);
|
||||
userConnected.getProjectResponses().addAll(responseBody.getProjects());
|
||||
userConnected.getRoles().addAll(responseBody.getRoles());
|
||||
userConnected.setUserName(username);
|
||||
userConnected.setKieWorkbenchName(workbenchName);
|
||||
return userConnected;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public List<Asset> getListAssets(String url, String username, String password, String spaceName, String projectName) {
|
||||
String completeurl = url + chtijbugprefix + spaceName + "/" + projectName + "/assets";
|
||||
logger.info("url getListAssets : {}" , completeurl);
|
||||
ResponseEntity<List<Asset>> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
List<Asset> extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
Asset[] values = mapper.readValue(result, Asset[].class);
|
||||
extractedResponse = Arrays.asList(values);
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
List<Asset> reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public JobStatus buildProject(String url, String username, String password, String space, String project, String branchName,String command, AddLog workOnGoingView, UI ui) {
|
||||
String completeurl= url + "/spaces/" + space + "/projects/" + project + "/maven/" + command;
|
||||
if (branchName!= null && branchName.length()>0){
|
||||
completeurl= url + "/spaces/" + space + "/projects/" + project +"/branches/"+branchName+ "/maven/" + command;
|
||||
}
|
||||
logger.info("url buildProject Maven install : {}" , completeurl);
|
||||
ResponseEntity<JobStatus> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.POST, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
JobStatus extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
JobStatus values = mapper.readValue(result, JobStatus.class);
|
||||
extractedResponse = values;
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
JobStatus reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
workOnGoingView.addRow(reponseMoteur.toString(), ui);
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public JobStatus getStatusJobID(String url, String username, String password, String jobID) {
|
||||
|
||||
String completeurl = url + "/jobs/" + jobID;
|
||||
logger.info("url getStatusJobID : {}" , completeurl);
|
||||
ResponseEntity<JobStatus> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
JobStatus extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = mapper.readValue(result, JobStatus.class);
|
||||
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
JobStatus reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private RequestCallback requestCallback(final Object content, String username, String password) {
|
||||
return clientHttpRequest -> {
|
||||
if (content != null) {
|
||||
if (content instanceof String) {
|
||||
String stringContent = (String) content;
|
||||
stringContent = stringContent.replace("\"", "");
|
||||
mapper.writeValue(clientHttpRequest.getBody(), stringContent);
|
||||
} else {
|
||||
mapper.writeValue(clientHttpRequest.getBody(), content);
|
||||
}
|
||||
}
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||
String auth = username + ":" + password;
|
||||
byte[] encodedAuth = Base64.encodeBase64(
|
||||
auth.getBytes(StandardCharsets.UTF_8));
|
||||
String authHeader = "Basic " + new String(encodedAuth);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.AUTHORIZATION, authHeader);
|
||||
};
|
||||
}
|
||||
public String createSpaceRight(String url, String username, String password,String workbenchName,String groupName,String spaceName) {
|
||||
|
||||
User user = userRepository.findByLogin(username);
|
||||
String completeurl = url + chtijbugprefix+"auth";
|
||||
if (user != null && user.getPassword().equals(password)) {
|
||||
if (user.getCustomer()!= null &&
|
||||
user.getCustomer().getKieWorkbench()!= null
|
||||
&& user.getCustomer().getKieWorkbench().getInternalUrl()!= null){
|
||||
completeurl = user.getCustomer().getKieWorkbench().getInternalUrl()+"/rest/chtijbug/auth";
|
||||
}
|
||||
completeurl=completeurl+"/"+groupName+"/"+spaceName;
|
||||
logger.info("url moteur reco : {}" , completeurl);
|
||||
ResponseEntity<WorkspaceAuthData> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.POST, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
WorkspaceAuthData extractedResponse =null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
extractedResponse = mapper.readValue(result, WorkspaceAuthData.class);
|
||||
|
||||
}
|
||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
});
|
||||
|
||||
|
||||
WorkspaceAuthData responseBody = response.getBody();
|
||||
|
||||
return responseBody.getStatus();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,322 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||
import org.chtijbug.drools.console.AddLog;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.JobStatus;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.proxy.persistence.json.KieProject;
|
||||
import org.chtijbug.drools.proxy.persistence.model.*;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.*;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class ProjectPersistService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProjectPersistService.class);
|
||||
|
||||
private static String projectVariable = "4";
|
||||
|
||||
@Autowired
|
||||
private ProjectRepository projectRepository;
|
||||
|
||||
@Autowired
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
private KieConfigurationData config;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRolesRepository userRolesRepository;
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
@Autowired
|
||||
private JobService jobService;
|
||||
|
||||
@Autowired
|
||||
private ContainerRepository containerRepository;
|
||||
|
||||
@Autowired
|
||||
private ContainerRuntimeRepository containerRuntimeRepository;
|
||||
|
||||
@Autowired
|
||||
private RuntimeRepository runtimeRepository;
|
||||
|
||||
@Autowired
|
||||
private KieWorkbenchRepository workbenchRepository;
|
||||
|
||||
@Autowired
|
||||
private KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplateProxyUpdate;
|
||||
|
||||
@Autowired
|
||||
private UserGroupsRepository userGroupsRepository;
|
||||
|
||||
|
||||
public ProjectPersistService() {
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
|
||||
}
|
||||
|
||||
public ProjectPersist saveorUpdateProject(PlatformProjectData platformProjectData, KieWorkbench kieWorkbench) {
|
||||
ProjectPersist projectPersist = projectRepository.findByProjectNameAndBranch(new KieProject(platformProjectData.getSpaceName(), platformProjectData.getName()), platformProjectData.getBranch());
|
||||
|
||||
if (projectPersist == null) {
|
||||
projectPersist = platformProjectResponseToProjectPersist(platformProjectData);
|
||||
projectPersist.setKieWorkbench(kieWorkbench);
|
||||
projectPersist.setProjectVersion(platformProjectData.getVersion());
|
||||
projectPersist.setArtifactID(platformProjectData.getArtifactId());
|
||||
projectPersist.setGroupID(platformProjectData.getGroupId());
|
||||
projectPersist.setClassNameList(new ArrayList<>());
|
||||
for (String className : platformProjectData.getJavaClasses()) {
|
||||
projectPersist.getClassNameList().add(className);
|
||||
|
||||
}
|
||||
projectPersist = projectRepository.save(projectPersist);
|
||||
|
||||
} else {
|
||||
projectPersist.setKieWorkbench(kieWorkbench);
|
||||
projectPersist.setProjectVersion(platformProjectData.getVersion());
|
||||
projectPersist.setArtifactID(platformProjectData.getArtifactId());
|
||||
projectPersist.setGroupID(platformProjectData.getGroupId());
|
||||
projectPersist.setClassNameList(new ArrayList<>());
|
||||
for (String className : platformProjectData.getJavaClasses()) {
|
||||
projectPersist.getClassNameList().add(className);
|
||||
|
||||
}
|
||||
projectRepository.save(projectPersist);
|
||||
|
||||
}
|
||||
return projectPersist;
|
||||
}
|
||||
|
||||
public UserGroups createProjectGroupIfNeeded(String projectName, KieWorkbench kieWorkbench, ProjectPersist projectPersist, UserGroups workspaceUserGroup) {
|
||||
UserGroups userGroups = userGroupsRepository.findByName("prj_" + projectName);
|
||||
if (userGroups == null) {
|
||||
UserGroups projectGroup = new UserGroups(UUID.randomUUID().toString(), "prj_" + projectName);
|
||||
projectGroup.setKieWorkbench(kieWorkbench);
|
||||
projectGroup.setProjectName(projectName);
|
||||
projectGroup.setProjectPersist(projectPersist);
|
||||
projectGroup.setWorkspaceUserGroup(workspaceUserGroup);
|
||||
projectGroup = userGroupsRepository.save(projectGroup);
|
||||
User groupUser = new User(UUID.randomUUID().toString(), "prj_user_" + projectName, "adminadmin99#");
|
||||
groupUser.getUserGroups().add(projectGroup);
|
||||
groupUser.getUserRoles().add(userRolesRepository.findByName("analyst"));
|
||||
groupUser.getUserRoles().add(userRolesRepository.findByName("rest-all"));
|
||||
userRepository.save(groupUser);
|
||||
} else {
|
||||
userGroups.setWorkspaceUserGroup(workspaceUserGroup);
|
||||
userGroups=userGroupsRepository.save(userGroups);
|
||||
}
|
||||
return userGroups;
|
||||
}
|
||||
|
||||
public UserGroups createWorkSpaceGroupIfNeeded(String workSpaceName, KieWorkbench kieWorkbench) {
|
||||
UserGroups userGroupsWorkSpace = userGroupsRepository.findByName("wrk_" + workSpaceName);
|
||||
if (userGroupsWorkSpace == null) {
|
||||
userGroupsWorkSpace = new UserGroups(UUID.randomUUID().toString(), "wrk_" + workSpaceName);
|
||||
userGroupsWorkSpace.setKieWorkbench(kieWorkbench);
|
||||
userGroupsWorkSpace.setSpaceName(workSpaceName);
|
||||
userGroupsRepository.save(userGroupsWorkSpace);
|
||||
User groupUser = new User(UUID.randomUUID().toString(), "wrk_user_" + workSpaceName, "pymma#");
|
||||
groupUser.getUserGroups().add(userGroupsWorkSpace);
|
||||
groupUser.getUserRoles().add(userRolesRepository.findByName("analyst"));
|
||||
groupUser.getUserRoles().add(userRolesRepository.findByName("rest-all"));
|
||||
userRepository.save(groupUser);
|
||||
}
|
||||
|
||||
|
||||
return userGroupsWorkSpace;
|
||||
}
|
||||
|
||||
public Map<String, ProjectPersist> findProjectsConnectedUser() {
|
||||
//VaadinSession.getCurrent().get
|
||||
boolean isAdmin = false;
|
||||
|
||||
UserConnected userConnected = userConnectedService.getUserConnected();
|
||||
User user = userRepository.findByLogin(userConnected.getUserName());
|
||||
for (UserRoles userRoles : user.getUserRoles()) {
|
||||
if ("admin".equals(userRoles.getName())) {
|
||||
isAdmin = true;
|
||||
}
|
||||
}
|
||||
List<ProjectPersist> projectPersists = new ArrayList<>();
|
||||
if (isAdmin) {
|
||||
projectPersists = projectRepository.findAll();
|
||||
} else {
|
||||
List<UserGroups> userGroups = user.getUserGroups();
|
||||
|
||||
}
|
||||
Map<String, ProjectPersist> map = new HashMap<>();
|
||||
for (ProjectPersist projectPersist : projectPersists) {
|
||||
map.put(projectPersist.getProjectName().toString() + "-" + projectPersist.getBranch(), projectPersist);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public void removeAssociation(ProjectPersist projectPersist, List<RuntimePersist> runtimesRemove) {
|
||||
for (RuntimePersist runtimePersist : runtimesRemove) {
|
||||
List<ContainerRuntimePojoPersist> elts = containerRuntimeRepository.findByServerNameAndContainerId(runtimePersist.getServerName(), projectPersist.getContainerID());
|
||||
for (ContainerRuntimePojoPersist elt : elts) {
|
||||
elt.setStatus(ContainerRuntimePojoPersist.STATUS.TODELETE.name());
|
||||
containerRuntimeRepository.save(elt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean associate(ProjectPersist projectPersist, List<RuntimePersist> runtimePersists) {
|
||||
projectPersist.setStatus(ProjectPersist.Deployable);
|
||||
projectPersist.setContainerID(projectPersist.getDeploymentName() + "-" + projectPersist.getProjectName());
|
||||
projectPersist.getServerNames().clear();
|
||||
ReverseProxyUpdate reverseProxyUpdate = new ReverseProxyUpdate();
|
||||
reverseProxyUpdate.setContainerID(projectPersist.getContainerID());
|
||||
if (projectPersist.isUseJWTToConnect()) {
|
||||
reverseProxyUpdate.setTokenUUID(projectPersist.getUuid());
|
||||
}else{
|
||||
reverseProxyUpdate.setPath("/" + projectPersist.getContainerID());
|
||||
}
|
||||
for (RuntimePersist runtimePersist : runtimePersists) {
|
||||
List<String> names = new ArrayList<>();
|
||||
names.add(runtimePersist.getServerName());
|
||||
projectPersist.getServerNames().add(runtimePersist.getServerName());
|
||||
ContainerPojoPersist existingContainer = containerRepository.findByServerNameAndContainerId(runtimePersist.getServerName(), projectPersist.getContainerID());
|
||||
if (existingContainer == null) {
|
||||
ContainerPojoPersist newContainer = new ContainerPojoPersist();
|
||||
newContainer.setClassName(projectPersist.getMainClass());
|
||||
newContainer.setProcessID(projectPersist.getProcessID());
|
||||
newContainer.setContainerId(projectPersist.getContainerID());
|
||||
newContainer.setServerName(runtimePersist.getServerName());
|
||||
newContainer.setGroupId(projectPersist.getGroupID());
|
||||
newContainer.setArtifactId(projectPersist.getArtifactID());
|
||||
newContainer.setProjectUUID(projectPersist.getUuid());
|
||||
newContainer.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
newContainer.setVersion(projectPersist.getProjectVersion());
|
||||
containerRepository.save(newContainer);
|
||||
List<ContainerRuntimePojoPersist> elts = containerRuntimeRepository.findByServerNameAndContainerId(runtimePersist.getServerName(), projectPersist.getContainerID());
|
||||
if (!elts.isEmpty()) {
|
||||
for (ContainerRuntimePojoPersist elt : elts) {
|
||||
elt.setStatus(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name());
|
||||
containerRuntimeRepository.save(elt);
|
||||
}
|
||||
} else {
|
||||
|
||||
ContainerRuntimePojoPersist runtimePojoPersist = new ContainerRuntimePojoPersist();
|
||||
runtimePojoPersist.setServerName(runtimePersist.getServerName());
|
||||
runtimePojoPersist.setHostname(runtimePersist.getHostname());
|
||||
runtimePojoPersist.setContainerId(projectPersist.getContainerID());
|
||||
runtimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name());
|
||||
runtimePojoPersist.setProjectUUID(projectPersist.getUuid());
|
||||
runtimePojoPersist.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
containerRuntimeRepository.save(runtimePojoPersist);
|
||||
}
|
||||
|
||||
}else{
|
||||
existingContainer.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
existingContainer.setProjectUUID(projectPersist.getUuid());
|
||||
containerRepository.save(existingContainer);
|
||||
}
|
||||
|
||||
String hostName = runtimePersist.getServerUrl() + "/api/" + projectPersist.getContainerID();
|
||||
reverseProxyUpdate.getServerNames().add(hostName);
|
||||
}
|
||||
projectRepository.save(projectPersist);
|
||||
kafkaTemplateProxyUpdate.send(KafkaTopicConstants.REVERSE_PROXY, reverseProxyUpdate);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean deployer(ProjectPersist projectPersist, AddLog addLog, UI ui) {
|
||||
|
||||
|
||||
waitForJobToBeEnded(config.getKiewbUrl(), userConnectedService.getUserConnected().getUserName(),
|
||||
userConnectedService.getUserConnected().getUserPassword(), projectPersist, addLog, ui);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ProjectPersist platformProjectResponseToProjectPersist(PlatformProjectData platformProjectResponse) {
|
||||
ProjectPersist projectPersist = new ProjectPersist();
|
||||
projectPersist.setArtifactID(platformProjectResponse.getArtifactId());
|
||||
projectPersist.setGroupID(platformProjectResponse.getGroupId());
|
||||
projectPersist.setProjectName(new KieProject(platformProjectResponse.getSpaceName(), platformProjectResponse.getName()));
|
||||
projectPersist.setProjectVersion(platformProjectResponse.getVersion());
|
||||
projectPersist.setBranch(platformProjectResponse.getBranch());
|
||||
projectPersist.setStatus(ProjectPersist.ADEFINIR);
|
||||
projectPersist.setClassNameList(platformProjectResponse.getJavaClasses());
|
||||
return projectPersist;
|
||||
}
|
||||
|
||||
|
||||
public void waitForJobToBeEnded(String url, String username, String password, ProjectPersist projectPersist, AddLog workOnGoingView, UI ui) {
|
||||
|
||||
UserConnected userConnected = userConnectedService.getUserConnected();
|
||||
|
||||
Thread thread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
JobStatus result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), projectPersist.getBranch(), "compile", workOnGoingView, ui);
|
||||
|
||||
jobService.executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
||||
|
||||
result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), projectPersist.getBranch(), "install", workOnGoingView, ui);
|
||||
|
||||
jobService.executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
||||
|
||||
|
||||
for (String serverName : projectPersist.getServerNames()) {
|
||||
|
||||
|
||||
List<ContainerRuntimePojoPersist> existingContainers = containerRuntimeRepository.findByServerNameAndContainerId(serverName, projectPersist.getContainerID());
|
||||
if (!existingContainers.isEmpty()) {
|
||||
for (ContainerRuntimePojoPersist containerRuntimePojoPersist : existingContainers) {
|
||||
containerRuntimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name());
|
||||
containerRuntimeRepository.save(containerRuntimePojoPersist);
|
||||
}
|
||||
} else {
|
||||
List<RuntimePersist> servers = runtimeRepository.findByServerName(serverName);
|
||||
for (RuntimePersist server : servers) {
|
||||
ContainerRuntimePojoPersist runtimePojoPersist = new ContainerRuntimePojoPersist();
|
||||
runtimePojoPersist.setServerName(serverName);
|
||||
runtimePojoPersist.setHostname(server.getHostname());
|
||||
runtimePojoPersist.setContainerId(projectPersist.getContainerID());
|
||||
runtimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name());
|
||||
runtimePojoPersist.setProjectUUID(projectPersist.getUuid());
|
||||
containerRuntimeRepository.save(runtimePojoPersist);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ProjectRepository getProjectRepository() {
|
||||
return projectRepository;
|
||||
}
|
||||
|
||||
public void setProjectRepository(ProjectRepository projectRepository) {
|
||||
this.projectRepository = projectRepository;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import org.chtijbug.drools.console.service.model.ReturnPerso;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerRuntimePojoPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ContainerRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ContainerRuntimeRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.RuntimeRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.kie.server.api.model.KieServerInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class RuntimeService {
|
||||
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(RuntimeService.class);
|
||||
|
||||
@Autowired
|
||||
private RuntimeRepository runtimeRepository;
|
||||
|
||||
@Autowired
|
||||
private ContainerRepository containerRepository;
|
||||
|
||||
@Autowired
|
||||
private ContainerRuntimeRepository containerRuntimeRepository;
|
||||
|
||||
private RestTemplate restTemplateKiewb = new RestTemplate();
|
||||
|
||||
public ReturnPerso<KieServerInfo> verifyIfKieServerExist(String url) {
|
||||
String completeurl = url + "/api/server/details";
|
||||
logger.info("url pverifyIfKieServerExist :{} " , completeurl);
|
||||
|
||||
HttpHeaders httpHeaders=new HttpHeaders();
|
||||
|
||||
HttpEntity<Object> httpEntity=new HttpEntity<>(httpHeaders);
|
||||
|
||||
try {
|
||||
ResponseEntity<KieServerInfo> response = restTemplateKiewb.exchange(completeurl,
|
||||
HttpMethod.GET,
|
||||
httpEntity,
|
||||
new ParameterizedTypeReference<>() {
|
||||
});
|
||||
|
||||
if (response.getBody() != null ) {
|
||||
return new ReturnPerso<>(true,"the runtime has been successfully added",response.getBody());
|
||||
} else {
|
||||
return new ReturnPerso<>(false,"server error ",null);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return new ReturnPerso<>(false,"The hostname is incorrect",null);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveRuntime(RuntimePersist runtimePersist) {
|
||||
runtimeRepository.save(runtimePersist);
|
||||
}
|
||||
|
||||
public RuntimeRepository getRuntimeRepository() {
|
||||
return runtimeRepository;
|
||||
}
|
||||
|
||||
public void setRuntimeRepository(RuntimeRepository runtimeRepository) {
|
||||
this.runtimeRepository = runtimeRepository;
|
||||
}
|
||||
|
||||
public void updateRuntimes(ProjectPersist projectPersist) {
|
||||
if (projectPersist!= null && projectPersist.getUuid()!= null) {
|
||||
List<ContainerPojoPersist> containerPojoPersists = containerRepository.findByProjectUUID(projectPersist.getUuid());
|
||||
for (ContainerPojoPersist containerPojoPersist : containerPojoPersists){
|
||||
containerPojoPersist.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
containerRepository.save(containerPojoPersist);
|
||||
|
||||
List<ContainerRuntimePojoPersist> containerRuntimePojoPersists = containerRuntimeRepository.findByContainerId(containerPojoPersist.getContainerId());
|
||||
for (ContainerRuntimePojoPersist containerRuntimePojoPersist : containerRuntimePojoPersists){
|
||||
containerRuntimePojoPersist.setDisableRuleLogging(projectPersist.isDisableRuleLogging());
|
||||
containerRuntimePojoPersist.setProjectUUID(projectPersist.getUuid());
|
||||
containerRuntimeRepository.save(containerRuntimePojoPersist);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import com.vaadin.flow.server.VaadinSession;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@DependsOn("applicationContext")
|
||||
public class UserConnectedService {
|
||||
|
||||
public final static String USER = "1";
|
||||
public final static String ASSET = "2";
|
||||
public final static String SPACE = "3";
|
||||
public final static String PROJECT = "4";
|
||||
public final static String CURRENTPROJECT = "5";
|
||||
|
||||
|
||||
public UserConnected getUserConnected() {
|
||||
return (UserConnected) VaadinSession.getCurrent().getAttribute(USER);
|
||||
}
|
||||
|
||||
public void addUserToSession(UserConnected userConnected) {
|
||||
VaadinSession.getCurrent().setAttribute(USER, userConnected);
|
||||
}
|
||||
|
||||
public void disconnect(){
|
||||
VaadinSession.getCurrent().setAttribute(USER, null);
|
||||
}
|
||||
|
||||
public void addAssetToSession(String asset) {
|
||||
VaadinSession.getCurrent().setAttribute(ASSET, asset);
|
||||
}
|
||||
|
||||
public String getAsset() {
|
||||
return (String) VaadinSession.getCurrent().getAttribute(ASSET);
|
||||
}
|
||||
|
||||
public void addSpaceToSession(String spaceName) {
|
||||
VaadinSession.getCurrent().setAttribute(SPACE, spaceName);
|
||||
}
|
||||
|
||||
public String getSpace() {
|
||||
return (String) VaadinSession.getCurrent().getAttribute(SPACE);
|
||||
}
|
||||
|
||||
public void addProjectToSession(String projectName) {
|
||||
VaadinSession.getCurrent().setAttribute(CURRENTPROJECT, projectName);
|
||||
}
|
||||
|
||||
public String getProject() {
|
||||
return (String) VaadinSession.getCurrent().getAttribute(CURRENTPROJECT);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* 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.chtijbug.drools.console.service.kieserver;
|
||||
|
||||
import org.kie.server.api.commands.CommandScript;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
@RestController
|
||||
@RequestMapping("/api/server/config")
|
||||
public class KieServerResource {
|
||||
|
||||
public KieServerResource() {
|
||||
|
||||
}
|
||||
@PostMapping(consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response executeCommands(@RequestHeader HttpHeaders headers,
|
||||
@RequestBody CommandScript command ) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,196 +0,0 @@
|
|||
/*
|
||||
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
|
||||
*
|
||||
* 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.chtijbug.drools.console.service.kieserver;
|
||||
|
||||
import org.kie.server.api.model.KieContainerResourceFilter;
|
||||
import org.kie.server.api.model.KieContainerStatusFilter;
|
||||
import org.kie.server.api.model.KieServerInfo;
|
||||
import org.kie.server.api.model.ReleaseIdFilter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.kie.server.api.rest.RestURI.CONTAINER_ID;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/server")
|
||||
public class KieServerRestImpl {
|
||||
|
||||
@Value(value = "${org.kie.server.id}")
|
||||
private String kieserverID;
|
||||
|
||||
@Value("${org.kie.server.controller}")
|
||||
private String kiewbUrl;
|
||||
|
||||
@Value("${org.kie.server.location}")
|
||||
private String controlerLocation;
|
||||
|
||||
public KieServerRestImpl() {
|
||||
// for now, if no server impl is passed as parameter, create one
|
||||
|
||||
}
|
||||
//@RequestHeader HttpHeaders headers
|
||||
@GetMapping(path="/{kieServerName}",produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public KieServerInfo getInfo(
|
||||
@PathVariable("kieServerName") String kieServerName) {
|
||||
KieServerInfo kieServerInfo = new KieServerInfo();
|
||||
kieServerInfo.setServerId(kieserverID);
|
||||
kieServerInfo.setLocation(controlerLocation);
|
||||
kieServerInfo.setName(kieserverID);
|
||||
kieServerInfo.setCapabilities(new ArrayList<>());
|
||||
kieServerInfo.getCapabilities().add("BRM");
|
||||
return kieServerInfo;
|
||||
}
|
||||
|
||||
@GetMapping(path = "/{kieServerName}/containers",
|
||||
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response listContainers(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@RequestParam("groupId") String groupId,
|
||||
@RequestParam("artifactId") String artifactId,
|
||||
@RequestParam("version") String version,
|
||||
@RequestParam("status") String status) {
|
||||
ReleaseIdFilter releaseIdFilter = new ReleaseIdFilter.Builder()
|
||||
.groupId(groupId)
|
||||
.artifactId(artifactId)
|
||||
.version(version)
|
||||
.build();
|
||||
|
||||
KieContainerStatusFilter statusFilter = KieContainerStatusFilter.parseFromNullableString(status);
|
||||
KieContainerResourceFilter containerFilter = new KieContainerResourceFilter(releaseIdFilter, statusFilter);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@PutMapping(path = "/{kieServerName}/containers/{" + CONTAINER_ID + "}",
|
||||
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response createContainer(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@PathVariable(CONTAINER_ID) String id,
|
||||
String containerPayload) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@PutMapping(path = "/{kieServerName}/containers/{" + CONTAINER_ID + "}/status/activated",
|
||||
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||
produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response activateContainer(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@PathVariable(CONTAINER_ID) String id) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@PutMapping(path="/{kieServerName}/containers/{" + CONTAINER_ID + "}/status/deactivated",
|
||||
consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response deactivateContainer(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@PathVariable(CONTAINER_ID) String id) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(path="/{kieServerName}/containers/{" + CONTAINER_ID + "}",
|
||||
consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response getContainerInfo(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@PathVariable(CONTAINER_ID) String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping(path="/{kieServerName}/containers/{" + CONTAINER_ID + "}",
|
||||
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response disposeContainer(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@PathVariable(CONTAINER_ID) String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(path="/{kieServerName}/containers/{" + CONTAINER_ID + "}/scanner",
|
||||
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response getScannerInfo(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@PathVariable(CONTAINER_ID) String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(path="/{kieServerName}/containers/{" + CONTAINER_ID + "}/scanner",
|
||||
consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response updateScanner(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@PathVariable(CONTAINER_ID) String id,
|
||||
String resourcePayload) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping(path="/{kieServerName}/containers/{" + CONTAINER_ID + "}/release-id",
|
||||
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response getReleaseId(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable(CONTAINER_ID) String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(path="/{kieServerName}/containers/{" + CONTAINER_ID + "}/release-id",
|
||||
consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
|
||||
produces={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response updateReleaseId(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@PathVariable(CONTAINER_ID) String id,
|
||||
String releaseIdPayload,
|
||||
@RequestParam(value = "resetBeforeUpdate", defaultValue = "false") boolean resetBeforeUpdate) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping(path="/{kieServerName}/state",consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response getServerState(@RequestHeader HttpHeaders headers) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(path="/{kieServerName}/readycheck",consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response readycheck(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping(path="/{kieServerName}/healthcheck",consumes={MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
public Response healthcheck(@RequestHeader HttpHeaders headers,
|
||||
@PathVariable("kieServerName") String kieServerName,
|
||||
@RequestParam(value = "report", defaultValue = "false") boolean report) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model;
|
||||
|
||||
public class DisplayData {
|
||||
private String spaceName;
|
||||
private String projectArtifactID;
|
||||
private String projectGroupID;
|
||||
private String projectVersion;
|
||||
private String projectDescription;
|
||||
private String projectGitAddress;
|
||||
private String projectSSHAdress;
|
||||
private String spaceOwner;
|
||||
private String containerId;
|
||||
private String kieServerArtifactId;
|
||||
private String kieServerGroupId;
|
||||
private String kieServerVersion;
|
||||
|
||||
public String getSpaceName() {
|
||||
return spaceName;
|
||||
}
|
||||
|
||||
public void setSpaceName(String spaceName) {
|
||||
this.spaceName = spaceName;
|
||||
}
|
||||
|
||||
|
||||
public String getProjectArtifactID() {
|
||||
return projectArtifactID;
|
||||
}
|
||||
|
||||
public void setProjectArtifactID(String projectArtifactID) {
|
||||
this.projectArtifactID = projectArtifactID;
|
||||
}
|
||||
|
||||
public String getProjectGroupID() {
|
||||
return projectGroupID;
|
||||
}
|
||||
|
||||
public void setProjectGroupID(String projectGroupID) {
|
||||
this.projectGroupID = projectGroupID;
|
||||
}
|
||||
|
||||
public String getProjectVersion() {
|
||||
return projectVersion;
|
||||
}
|
||||
|
||||
public void setProjectVersion(String projectVersion) {
|
||||
this.projectVersion = projectVersion;
|
||||
}
|
||||
|
||||
public String getProjectDescription() {
|
||||
return projectDescription;
|
||||
}
|
||||
|
||||
public void setProjectDescription(String projectDescription) {
|
||||
this.projectDescription = projectDescription;
|
||||
}
|
||||
|
||||
public String getProjectGitAddress() {
|
||||
return projectGitAddress;
|
||||
}
|
||||
|
||||
public void setProjectGitAddress(String projectGitAddress) {
|
||||
this.projectGitAddress = projectGitAddress;
|
||||
}
|
||||
|
||||
public String getProjectSSHAdress() {
|
||||
return projectSSHAdress;
|
||||
}
|
||||
|
||||
public void setProjectSSHAdress(String projectSSHAdress) {
|
||||
this.projectSSHAdress = projectSSHAdress;
|
||||
}
|
||||
|
||||
public String getSpaceOwner() {
|
||||
return spaceOwner;
|
||||
}
|
||||
|
||||
public void setSpaceOwner(String spaceOwner) {
|
||||
this.spaceOwner = spaceOwner;
|
||||
}
|
||||
|
||||
|
||||
public String getContainerId() {
|
||||
return containerId;
|
||||
}
|
||||
|
||||
public void setContainerId(String containerId) {
|
||||
this.containerId = containerId;
|
||||
}
|
||||
|
||||
public String getKieServerArtifactId() {
|
||||
return kieServerArtifactId;
|
||||
}
|
||||
|
||||
public void setKieServerArtifactId(String kieServerArtifactId) {
|
||||
this.kieServerArtifactId = kieServerArtifactId;
|
||||
}
|
||||
|
||||
public String getKieServerGroupId() {
|
||||
return kieServerGroupId;
|
||||
}
|
||||
|
||||
public void setKieServerGroupId(String kieServerGroupId) {
|
||||
this.kieServerGroupId = kieServerGroupId;
|
||||
}
|
||||
|
||||
public String getKieServerVersion() {
|
||||
return kieServerVersion;
|
||||
}
|
||||
|
||||
public void setKieServerVersion(String kieServerVersion) {
|
||||
this.kieServerVersion = kieServerVersion;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model;
|
||||
|
||||
public class ReturnPerso<T> {
|
||||
|
||||
private Boolean aBoolean;
|
||||
|
||||
private String error;
|
||||
|
||||
private T body;
|
||||
|
||||
public ReturnPerso(Boolean aBoolean, String error,T body) {
|
||||
this.aBoolean = aBoolean;
|
||||
this.error = error;
|
||||
this.body=body;
|
||||
}
|
||||
|
||||
public Boolean getaBoolean() {
|
||||
return aBoolean;
|
||||
}
|
||||
|
||||
public void setaBoolean(Boolean aBoolean) {
|
||||
this.aBoolean = aBoolean;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public T getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(T body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model;
|
||||
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserConnected {
|
||||
private String userName;
|
||||
|
||||
private String userPassword;
|
||||
|
||||
private List<PlatformProjectData> projectResponses = new ArrayList<>();
|
||||
|
||||
private List<String> roles = new ArrayList<>();
|
||||
|
||||
private boolean connected;
|
||||
|
||||
private String kieWorkbenchName;
|
||||
|
||||
public UserConnected() {
|
||||
}
|
||||
|
||||
public UserConnected(String userName, String userPassword) {
|
||||
this.userName = userName;
|
||||
this.userPassword = userPassword;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserPassword() {
|
||||
return userPassword;
|
||||
}
|
||||
|
||||
public void setUserPassword(String userPassword) {
|
||||
this.userPassword = userPassword;
|
||||
}
|
||||
|
||||
public String getKieWorkbenchName() {
|
||||
return kieWorkbenchName;
|
||||
}
|
||||
|
||||
public void setKieWorkbenchName(String kieWorkbenchName) {
|
||||
this.kieWorkbenchName = kieWorkbenchName;
|
||||
}
|
||||
|
||||
public List<PlatformProjectData> getProjectResponses() {
|
||||
return projectResponses;
|
||||
}
|
||||
|
||||
public void setProjectResponses(List<PlatformProjectData> projectResponses) {
|
||||
this.projectResponses = projectResponses;
|
||||
}
|
||||
|
||||
public List<String> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<String> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public boolean getConnected() {
|
||||
return connected;
|
||||
}
|
||||
|
||||
public void setConnected(boolean connected) {
|
||||
this.connected = connected;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.gitlab;
|
||||
|
||||
public class CreateProjectRequest {
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.gitlab;
|
||||
|
||||
public class GitLabConfigurationData {
|
||||
|
||||
private String url;
|
||||
|
||||
private String token;
|
||||
|
||||
private String groupName;
|
||||
|
||||
private String baseUrl;
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,368 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.gitlab;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class GroupElementResponse {
|
||||
private String id;
|
||||
private String description;
|
||||
private String default_branch;
|
||||
private Object tag_list;
|
||||
private Object owner;
|
||||
private String thePublic;
|
||||
private String archived;
|
||||
private String runners_token;
|
||||
private String visibility;
|
||||
private String visibility_level;
|
||||
private String ssh_url_to_repo;
|
||||
private String http_url_to_repo;
|
||||
private String web_url;
|
||||
private String name;
|
||||
private String name_with_namespace;
|
||||
private String path;
|
||||
private String path_with_namespace;
|
||||
private String container_registry_enabled;
|
||||
private String issues_enabled;
|
||||
private String merge_requests_enabled;
|
||||
private String wiki_enabled;
|
||||
private String builds_enabled;
|
||||
private String jobs_enabled;
|
||||
private String snippets_enabled;
|
||||
private String created_at;
|
||||
private String last_activity_at;
|
||||
private String shared_runners_enabled;
|
||||
private String lfs_enabled;
|
||||
private String creator_id;
|
||||
private Object namespace;
|
||||
private String avatar_url;
|
||||
private String star_count;
|
||||
private String forks_count;
|
||||
private String open_issues_count;
|
||||
private String public_jobs;
|
||||
private String public_builds;
|
||||
private Object shared_with_groups;
|
||||
private String only_allow_merge_if_build_succeeds;
|
||||
private String request_access_enabled;
|
||||
private String only_allow_merge_if_all_discussions_are_resolved;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDefault_branch() {
|
||||
return default_branch;
|
||||
}
|
||||
|
||||
public void setDefault_branch(String default_branch) {
|
||||
this.default_branch = default_branch;
|
||||
}
|
||||
|
||||
@JsonProperty("public")
|
||||
public String getThePublic() {
|
||||
return thePublic;
|
||||
}
|
||||
|
||||
public void setThePublic(String thePublic) {
|
||||
this.thePublic = thePublic;
|
||||
}
|
||||
|
||||
public String getContainer_registry_enabled() {
|
||||
return container_registry_enabled;
|
||||
}
|
||||
|
||||
public void setContainer_registry_enabled(String container_registry_enabled) {
|
||||
this.container_registry_enabled = container_registry_enabled;
|
||||
}
|
||||
|
||||
public Object getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(Object owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public String getBuilds_enabled() {
|
||||
return builds_enabled;
|
||||
}
|
||||
|
||||
public void setBuilds_enabled(String builds_enabled) {
|
||||
this.builds_enabled = builds_enabled;
|
||||
}
|
||||
|
||||
public String getLfs_enabled() {
|
||||
return lfs_enabled;
|
||||
}
|
||||
|
||||
public void setLfs_enabled(String lfs_enabled) {
|
||||
this.lfs_enabled = lfs_enabled;
|
||||
}
|
||||
|
||||
public String getRunners_token() {
|
||||
return runners_token;
|
||||
}
|
||||
|
||||
public void setRunners_token(String runners_token) {
|
||||
this.runners_token = runners_token;
|
||||
}
|
||||
|
||||
public String getPublic_builds() {
|
||||
return public_builds;
|
||||
}
|
||||
|
||||
public void setPublic_builds(String public_builds) {
|
||||
this.public_builds = public_builds;
|
||||
}
|
||||
|
||||
public String getOnly_allow_merge_if_build_succeeds() {
|
||||
return only_allow_merge_if_build_succeeds;
|
||||
}
|
||||
|
||||
public void setOnly_allow_merge_if_build_succeeds(String only_allow_merge_if_build_succeeds) {
|
||||
this.only_allow_merge_if_build_succeeds = only_allow_merge_if_build_succeeds;
|
||||
}
|
||||
|
||||
public String getOnly_allow_merge_if_all_discussions_are_resolved() {
|
||||
return only_allow_merge_if_all_discussions_are_resolved;
|
||||
}
|
||||
|
||||
public void setOnly_allow_merge_if_all_discussions_are_resolved(String only_allow_merge_if_all_discussions_are_resolved) {
|
||||
this.only_allow_merge_if_all_discussions_are_resolved = only_allow_merge_if_all_discussions_are_resolved;
|
||||
}
|
||||
|
||||
|
||||
public String getVisibility_level() {
|
||||
return visibility_level;
|
||||
}
|
||||
|
||||
public void setVisibility_level(String visibility_level) {
|
||||
this.visibility_level = visibility_level;
|
||||
}
|
||||
|
||||
public String getArchived() {
|
||||
return archived;
|
||||
}
|
||||
|
||||
public void setArchived(String archived) {
|
||||
this.archived = archived;
|
||||
}
|
||||
|
||||
public String getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(String visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
|
||||
public String getSsh_url_to_repo() {
|
||||
return ssh_url_to_repo;
|
||||
}
|
||||
|
||||
public void setSsh_url_to_repo(String ssh_url_to_repo) {
|
||||
this.ssh_url_to_repo = ssh_url_to_repo;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getHttp_url_to_repo() {
|
||||
return http_url_to_repo;
|
||||
}
|
||||
|
||||
public void setHttp_url_to_repo(String http_url_to_repo) {
|
||||
this.http_url_to_repo = http_url_to_repo;
|
||||
}
|
||||
|
||||
public String getWeb_url() {
|
||||
return web_url;
|
||||
}
|
||||
|
||||
public void setWeb_url(String web_url) {
|
||||
this.web_url = web_url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName_with_namespace() {
|
||||
return name_with_namespace;
|
||||
}
|
||||
|
||||
public void setName_with_namespace(String name_with_namespace) {
|
||||
this.name_with_namespace = name_with_namespace;
|
||||
}
|
||||
|
||||
public String getPath_with_namespace() {
|
||||
return path_with_namespace;
|
||||
}
|
||||
|
||||
public void setPath_with_namespace(String path_with_namespace) {
|
||||
this.path_with_namespace = path_with_namespace;
|
||||
}
|
||||
|
||||
public String getIssues_enabled() {
|
||||
return issues_enabled;
|
||||
}
|
||||
|
||||
public void setIssues_enabled(String issues_enabled) {
|
||||
this.issues_enabled = issues_enabled;
|
||||
}
|
||||
|
||||
public String getMerge_requests_enabled() {
|
||||
return merge_requests_enabled;
|
||||
}
|
||||
|
||||
public void setMerge_requests_enabled(String merge_requests_enabled) {
|
||||
this.merge_requests_enabled = merge_requests_enabled;
|
||||
}
|
||||
|
||||
public String getWiki_enabled() {
|
||||
return wiki_enabled;
|
||||
}
|
||||
|
||||
public void setWiki_enabled(String wiki_enabled) {
|
||||
this.wiki_enabled = wiki_enabled;
|
||||
}
|
||||
|
||||
public String getJobs_enabled() {
|
||||
return jobs_enabled;
|
||||
}
|
||||
|
||||
public void setJobs_enabled(String jobs_enabled) {
|
||||
this.jobs_enabled = jobs_enabled;
|
||||
}
|
||||
|
||||
public String getSnippets_enabled() {
|
||||
return snippets_enabled;
|
||||
}
|
||||
|
||||
public void setSnippets_enabled(String snippets_enabled) {
|
||||
this.snippets_enabled = snippets_enabled;
|
||||
}
|
||||
|
||||
public String getCreated_at() {
|
||||
return created_at;
|
||||
}
|
||||
|
||||
public void setCreated_at(String created_at) {
|
||||
this.created_at = created_at;
|
||||
}
|
||||
|
||||
public String getLast_activity_at() {
|
||||
return last_activity_at;
|
||||
}
|
||||
|
||||
public void setLast_activity_at(String last_activity_at) {
|
||||
this.last_activity_at = last_activity_at;
|
||||
}
|
||||
|
||||
public String getShared_runners_enabled() {
|
||||
return shared_runners_enabled;
|
||||
}
|
||||
|
||||
public void setShared_runners_enabled(String shared_runners_enabled) {
|
||||
this.shared_runners_enabled = shared_runners_enabled;
|
||||
}
|
||||
|
||||
public String getCreator_id() {
|
||||
return creator_id;
|
||||
}
|
||||
|
||||
public void setCreator_id(String creator_id) {
|
||||
this.creator_id = creator_id;
|
||||
}
|
||||
|
||||
public Object getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
public void setNamespace(Object namespace) {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
|
||||
public String getAvatar_url() {
|
||||
return avatar_url;
|
||||
}
|
||||
|
||||
public void setAvatar_url(String avatar_url) {
|
||||
this.avatar_url = avatar_url;
|
||||
}
|
||||
|
||||
public String getStar_count() {
|
||||
return star_count;
|
||||
}
|
||||
|
||||
public void setStar_count(String star_count) {
|
||||
this.star_count = star_count;
|
||||
}
|
||||
|
||||
public String getForks_count() {
|
||||
return forks_count;
|
||||
}
|
||||
|
||||
public void setForks_count(String forks_count) {
|
||||
this.forks_count = forks_count;
|
||||
}
|
||||
|
||||
public String getOpen_issues_count() {
|
||||
return open_issues_count;
|
||||
}
|
||||
|
||||
public void setOpen_issues_count(String open_issues_count) {
|
||||
this.open_issues_count = open_issues_count;
|
||||
}
|
||||
|
||||
public String getPublic_jobs() {
|
||||
return public_jobs;
|
||||
}
|
||||
|
||||
public void setPublic_jobs(String public_jobs) {
|
||||
this.public_jobs = public_jobs;
|
||||
}
|
||||
|
||||
public String getRequest_access_enabled() {
|
||||
return request_access_enabled;
|
||||
}
|
||||
|
||||
public void setRequest_access_enabled(String request_access_enabled) {
|
||||
this.request_access_enabled = request_access_enabled;
|
||||
}
|
||||
|
||||
public Object getTag_list() {
|
||||
return tag_list;
|
||||
}
|
||||
|
||||
public void setTag_list(Object tag_list) {
|
||||
this.tag_list = tag_list;
|
||||
}
|
||||
|
||||
public Object getShared_with_groups() {
|
||||
return shared_with_groups;
|
||||
}
|
||||
|
||||
public void setShared_with_groups(Object shared_with_groups) {
|
||||
this.shared_with_groups = shared_with_groups;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.gitlab;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ProjectMoveResponse {
|
||||
private String id;
|
||||
private String name;
|
||||
private String path;
|
||||
private String description;
|
||||
private String visibility_level;
|
||||
private String lfs_enabled;
|
||||
private String avatar_url;
|
||||
private String web_url;
|
||||
|
||||
private String request_access_enabled;
|
||||
|
||||
private String full_name;
|
||||
|
||||
private String full_path;
|
||||
private List<GroupElementResponse> projects;
|
||||
private List<GroupElementResponse> shared_projects;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getVisibility_level() {
|
||||
return visibility_level;
|
||||
}
|
||||
|
||||
public void setVisibility_level(String visibility_level) {
|
||||
this.visibility_level = visibility_level;
|
||||
}
|
||||
|
||||
public String getLfs_enabled() {
|
||||
return lfs_enabled;
|
||||
}
|
||||
|
||||
public void setLfs_enabled(String lfs_enabled) {
|
||||
this.lfs_enabled = lfs_enabled;
|
||||
}
|
||||
|
||||
public String getAvatar_url() {
|
||||
return avatar_url;
|
||||
}
|
||||
|
||||
public void setAvatar_url(String avatar_url) {
|
||||
this.avatar_url = avatar_url;
|
||||
}
|
||||
|
||||
public String getWeb_url() {
|
||||
return web_url;
|
||||
}
|
||||
|
||||
public void setWeb_url(String web_url) {
|
||||
this.web_url = web_url;
|
||||
}
|
||||
|
||||
public String getRequest_access_enabled() {
|
||||
return request_access_enabled;
|
||||
}
|
||||
|
||||
public void setRequest_access_enabled(String request_access_enabled) {
|
||||
this.request_access_enabled = request_access_enabled;
|
||||
}
|
||||
|
||||
public String getFull_name() {
|
||||
return full_name;
|
||||
}
|
||||
|
||||
public void setFull_name(String full_name) {
|
||||
this.full_name = full_name;
|
||||
}
|
||||
|
||||
public String getFull_path() {
|
||||
return full_path;
|
||||
}
|
||||
|
||||
public void setFull_path(String full_path) {
|
||||
this.full_path = full_path;
|
||||
}
|
||||
|
||||
public List<GroupElementResponse> getProjects() {
|
||||
return projects;
|
||||
}
|
||||
|
||||
public void setProjects(List<GroupElementResponse> projects) {
|
||||
this.projects = projects;
|
||||
}
|
||||
|
||||
public List<GroupElementResponse> getShared_projects() {
|
||||
return shared_projects;
|
||||
}
|
||||
|
||||
public void setShared_projects(List<GroupElementResponse> shared_projects) {
|
||||
this.shared_projects = shared_projects;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.jenkins;
|
||||
|
||||
public class JenkinsConfigurationData {
|
||||
|
||||
private String url;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
private String credentials;
|
||||
|
||||
private String nexusName;
|
||||
|
||||
private String nexusUrl;
|
||||
|
||||
private String jdkVersion;
|
||||
|
||||
private String groupName;
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getCredentials() {
|
||||
return credentials;
|
||||
}
|
||||
|
||||
public void setCredentials(String credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
public String getNexusName() {
|
||||
return nexusName;
|
||||
}
|
||||
|
||||
public void setNexusName(String nexusName) {
|
||||
this.nexusName = nexusName;
|
||||
}
|
||||
|
||||
public String getNexusUrl() {
|
||||
return nexusUrl;
|
||||
}
|
||||
|
||||
public void setNexusUrl(String nexusUrl) {
|
||||
this.nexusUrl = nexusUrl;
|
||||
}
|
||||
|
||||
public String getJdkVersion() {
|
||||
return jdkVersion;
|
||||
}
|
||||
|
||||
public void setJdkVersion(String jdkVersion) {
|
||||
this.jdkVersion = jdkVersion;
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
public class GitRepository {
|
||||
private String name;
|
||||
private String description;
|
||||
private String userName;
|
||||
private String password;
|
||||
private String requestType;
|
||||
private String gitURL;
|
||||
private String organizationalUnitName;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getRequestType() {
|
||||
return requestType;
|
||||
}
|
||||
|
||||
public void setRequestType(String requestType) {
|
||||
this.requestType = requestType;
|
||||
}
|
||||
|
||||
public String getGitURL() {
|
||||
return gitURL;
|
||||
}
|
||||
|
||||
public void setGitURL(String gitURL) {
|
||||
this.gitURL = gitURL;
|
||||
}
|
||||
|
||||
public String getOrganizationalUnitName() {
|
||||
return organizationalUnitName;
|
||||
}
|
||||
|
||||
public void setOrganizationalUnitName(String organizationalUnitName) {
|
||||
this.organizationalUnitName = organizationalUnitName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
public class GitRepositoryResponse {
|
||||
private String jobId;
|
||||
private String status;
|
||||
private GitRepository repository;
|
||||
|
||||
public String getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setJobId(String jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public GitRepository getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
public void setRepository(GitRepository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
public class JobStatus {
|
||||
private String status;
|
||||
private String jobId;
|
||||
private String spaceName;
|
||||
private String projectName;
|
||||
private String result;
|
||||
private Date lastModified;
|
||||
private String detailedResult[];
|
||||
private String branchName;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("JobStatus{");
|
||||
sb.append("status='").append(status).append('\'');
|
||||
sb.append(", jobId='").append(jobId).append('\'');
|
||||
sb.append(", spaceName='").append(spaceName).append('\'');
|
||||
sb.append(", projectName='").append(projectName).append('\'');
|
||||
sb.append(", result='").append(result).append('\'');
|
||||
sb.append(", lastModified=").append(lastModified);
|
||||
sb.append(", detailedResult=").append(detailedResult == null ? "null" : Arrays.asList(detailedResult).toString());
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setJobId(String jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
public String getSpaceName() {
|
||||
return spaceName;
|
||||
}
|
||||
|
||||
public void setSpaceName(String spaceName) {
|
||||
this.spaceName = spaceName;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public Date getLastModified() {
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
public void setLastModified(Date lastModified) {
|
||||
this.lastModified = lastModified;
|
||||
}
|
||||
|
||||
public String[] getDetailedResult() {
|
||||
return detailedResult;
|
||||
}
|
||||
|
||||
public void setDetailedResult(String[] detailedResult) {
|
||||
this.detailedResult = detailedResult;
|
||||
}
|
||||
|
||||
public String getBranchName() {
|
||||
return branchName;
|
||||
}
|
||||
|
||||
public void setBranchName(String branchName) {
|
||||
this.branchName = branchName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class KieConfigurationData implements Serializable {
|
||||
|
||||
private String kiewbUrl;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
public String getKiewbUrl() {
|
||||
return kiewbUrl;
|
||||
}
|
||||
|
||||
public void setKiewbUrl(String kiewbUrl) {
|
||||
this.kiewbUrl = kiewbUrl;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class KieContainerContent {
|
||||
@JsonProperty("container-id")
|
||||
private String containerId;
|
||||
|
||||
private String status;
|
||||
|
||||
@JsonProperty("release-id")
|
||||
private ReleaseDefinition releaseId;
|
||||
|
||||
@JsonProperty("resolved-release-id")
|
||||
private ReleaseDefinition resolvedReleaseId;
|
||||
|
||||
public String getContainerId() {
|
||||
return containerId;
|
||||
}
|
||||
|
||||
public void setContainerId(String containerId) {
|
||||
this.containerId = containerId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public ReleaseDefinition getReleaseId() {
|
||||
return releaseId;
|
||||
}
|
||||
|
||||
public void setReleaseId(ReleaseDefinition releaseId) {
|
||||
this.releaseId = releaseId;
|
||||
}
|
||||
|
||||
public ReleaseDefinition getResolvedReleaseId() {
|
||||
return resolvedReleaseId;
|
||||
}
|
||||
|
||||
public void setResolvedReleaseId(ReleaseDefinition resolvedReleaseId) {
|
||||
this.resolvedReleaseId = resolvedReleaseId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
public class KieContainerInfo {
|
||||
|
||||
private String containerId;
|
||||
private String artifactId;
|
||||
private String groupId;
|
||||
private String version;
|
||||
private String containerAlias;
|
||||
|
||||
public String getContainerId() {
|
||||
return containerId;
|
||||
}
|
||||
|
||||
public void setContainerId(String containerId) {
|
||||
this.containerId = containerId;
|
||||
}
|
||||
|
||||
public String getArtifactId() {
|
||||
return artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactId(String artifactId) {
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getContainerAlias() {
|
||||
return containerAlias;
|
||||
}
|
||||
|
||||
public void setContainerAlias(String containerAlias) {
|
||||
this.containerAlias = containerAlias;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
|
||||
public class KieContainerRequest {
|
||||
@JsonProperty("container-id")
|
||||
@XStreamAlias( "container-id" )
|
||||
private String containerId;
|
||||
@JsonProperty("release-id")
|
||||
@XStreamAlias( "release-id" )
|
||||
private ReleaseDefinition releaseId;
|
||||
|
||||
public String getContainerId() {
|
||||
return containerId;
|
||||
}
|
||||
|
||||
public void setContainerId(String containerId) {
|
||||
this.containerId = containerId;
|
||||
}
|
||||
|
||||
public ReleaseDefinition getReleaseId() {
|
||||
return releaseId;
|
||||
}
|
||||
|
||||
public void setReleaseId(ReleaseDefinition releaseId) {
|
||||
this.releaseId = releaseId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
public class KieProject {
|
||||
private String groupId;
|
||||
private String version;
|
||||
private String name;
|
||||
private String description;
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
public class KieProjectResponse {
|
||||
private String jobId;
|
||||
private String status;
|
||||
private String repositoryName;
|
||||
private String projectName;
|
||||
private String projectGroupId;
|
||||
private String projectVersion;
|
||||
private String description;
|
||||
|
||||
public String getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setJobId(String jobId) {
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getRepositoryName() {
|
||||
return repositoryName;
|
||||
}
|
||||
|
||||
public void setRepositoryName(String repositoryName) {
|
||||
this.repositoryName = repositoryName;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getProjectGroupId() {
|
||||
return projectGroupId;
|
||||
}
|
||||
|
||||
public void setProjectGroupId(String projectGroupId) {
|
||||
this.projectGroupId = projectGroupId;
|
||||
}
|
||||
|
||||
public String getProjectVersion() {
|
||||
return projectVersion;
|
||||
}
|
||||
|
||||
public void setProjectVersion(String projectVersion) {
|
||||
this.projectVersion = projectVersion;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
public class KieServerJobStatus {
|
||||
private String type;
|
||||
private String msg;
|
||||
private String result;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("KieServerJobStatus{");
|
||||
sb.append("type='").append(type).append('\'');
|
||||
sb.append(", msg='").append(msg).append('\'');
|
||||
sb.append(", result='").append(result).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name="release-id")
|
||||
@XStreamAlias( "release-id" )
|
||||
@JsonIgnoreProperties({"snapshot"})
|
||||
public class ReleaseDefinition {
|
||||
|
||||
@JsonProperty("artifact-id")
|
||||
@XStreamAlias( "artifact-id" )
|
||||
private String artifactId;
|
||||
@JsonProperty("group-id")
|
||||
@XStreamAlias( "group-id" )
|
||||
private String groupId;
|
||||
@XStreamAlias( "version" )
|
||||
private String version;
|
||||
|
||||
public String getArtifactId() {
|
||||
return artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactId(String artifactId) {
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Space {
|
||||
private String name;
|
||||
private String description;
|
||||
private List<SpaceProject> projects = new ArrayList<>();
|
||||
private String owner;
|
||||
private String defaultGroupId;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public List<SpaceProject> getProjects() {
|
||||
return projects;
|
||||
}
|
||||
|
||||
public void setProjects(List<SpaceProject> projects) {
|
||||
this.projects = projects;
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(String owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public String getDefaultGroupId() {
|
||||
return defaultGroupId;
|
||||
}
|
||||
|
||||
public void setDefaultGroupId(String defaultGroupId) {
|
||||
this.defaultGroupId = defaultGroupId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SpaceProject {
|
||||
private String name;
|
||||
private String spaceName;
|
||||
private String groupId;
|
||||
private String version;
|
||||
private String description;
|
||||
private List<SpaceProjectURI> publicURIs = new ArrayList<>();
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSpaceName() {
|
||||
return spaceName;
|
||||
}
|
||||
|
||||
public void setSpaceName(String spaceName) {
|
||||
this.spaceName = spaceName;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public List<SpaceProjectURI> getPublicURIs() {
|
||||
return publicURIs;
|
||||
}
|
||||
|
||||
public void setPublicURIs(List<SpaceProjectURI> publicURIs) {
|
||||
this.publicURIs = publicURIs;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
public class SpaceProjectURI {
|
||||
private String protocol;
|
||||
private String uri;
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Pymma Software
|
||||
*
|
||||
* 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.chtijbug.drools.console.service.util;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
|
||||
public class AppContext {
|
||||
|
||||
private static ApplicationContext ctx;
|
||||
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
public static void setApplicationContext(ApplicationContext applicationContext) {
|
||||
ctx = applicationContext;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Pymma Software
|
||||
*
|
||||
* 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.chtijbug.drools.console.service.util;
|
||||
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
|
||||
public class ApplicationContextProvider implements ApplicationContextAware {
|
||||
|
||||
public void setApplicationContext(ApplicationContext ctx) throws BeansException {
|
||||
AppContext.setApplicationContext(ctx);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,259 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.wbconnector;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.kie.server.api.model.*;
|
||||
import org.kie.server.controller.api.model.KieServerSetup;
|
||||
import org.kie.server.controller.api.model.runtime.ContainerList;
|
||||
import org.kie.server.controller.api.model.runtime.ServerInstanceKeyList;
|
||||
import org.kie.server.controller.api.model.spec.ContainerSpec;
|
||||
import org.kie.server.controller.api.model.spec.ServerTemplateKey;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.BufferingClientHttpRequestFactory;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StreamUtils;
|
||||
import org.springframework.web.client.RequestCallback;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Scanner;
|
||||
|
||||
@Service
|
||||
public class KieBusinessCentralConnector {
|
||||
|
||||
@Value(value = "${org.kie.server.id}")
|
||||
private String kieserverID;
|
||||
|
||||
@Value("${org.kie.server.controller}")
|
||||
private String kiewbUrl;
|
||||
|
||||
@Value("${org.kie.server.location}")
|
||||
private String controlerLocation;
|
||||
|
||||
private RestTemplate restTemplateKiewb ;
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public KieBusinessCentralConnector() {
|
||||
ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
|
||||
restTemplateKiewb= new RestTemplate(factory);
|
||||
restTemplateKiewb.setInterceptors(Collections.singletonList(new LoggingRequestResponseLoggingInterceptor()));
|
||||
mapper.registerModule(new JaxbAnnotationModule());
|
||||
}
|
||||
|
||||
public String createContainer(String username, String password, ProjectPersist projectPersist, String externalUrl){
|
||||
String completeurl;
|
||||
if (externalUrl==null || externalUrl.isEmpty()) {
|
||||
completeurl=kiewbUrl+"/controller/management/servers/"+kieserverID+"/containers/"+projectPersist.getContainerID();
|
||||
}else{
|
||||
completeurl=externalUrl+"/controller/management/servers/"+kieserverID+"/containers/"+projectPersist.getContainerID();
|
||||
}
|
||||
ContainerSpec containerSpec = new ContainerSpec();
|
||||
containerSpec.setId(projectPersist.getArtifactID()+"_"+projectPersist.getProjectVersion());
|
||||
containerSpec.setContainerName(projectPersist.getArtifactID()+"_"+projectPersist.getProjectVersion());
|
||||
containerSpec.setReleasedId(new ReleaseId());
|
||||
containerSpec.setStatus(KieContainerStatus.STARTED);
|
||||
containerSpec.getReleasedId().setArtifactId(projectPersist.getArtifactID());
|
||||
containerSpec.getReleasedId().setGroupId(projectPersist.getGroupID());
|
||||
containerSpec.getReleasedId().setVersion(projectPersist.getProjectVersion());
|
||||
|
||||
ResponseEntity<String> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.PUT, requestCallback(containerSpec, username, password), clientHttpResponse -> {
|
||||
String extractedResponse = null;
|
||||
ResponseEntity<String> extractedValue=null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
if (result==null || result.length()==0){
|
||||
|
||||
}else {
|
||||
extractedResponse = mapper.readValue(result, String.class);
|
||||
extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
return extractedValue;
|
||||
});
|
||||
if (response!= null) {
|
||||
return response.getBody();
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String updateContainer(String username, String password, ProjectPersist projectPersist, KieContainerResource kieContainerResource, String externalUrl){
|
||||
String completeurl;
|
||||
if (externalUrl==null || externalUrl.isEmpty()) {
|
||||
completeurl=kiewbUrl+"/controller/management/servers/"+kieserverID+"/containers/"+projectPersist.getContainerID();
|
||||
}else{
|
||||
completeurl=externalUrl+"/controller/management/servers/"+kieserverID+"/containers/"+projectPersist.getContainerID();
|
||||
}
|
||||
ContainerSpec containerSpec = new ContainerSpec();
|
||||
containerSpec.setId(projectPersist.getArtifactID()+"_"+projectPersist.getProjectVersion());
|
||||
containerSpec.setContainerName(projectPersist.getArtifactID()+"_"+projectPersist.getProjectVersion());
|
||||
containerSpec.setReleasedId(new ReleaseId());
|
||||
containerSpec.setStatus(KieContainerStatus.STARTED);
|
||||
containerSpec.getReleasedId().setArtifactId(projectPersist.getArtifactID());
|
||||
containerSpec.getReleasedId().setGroupId(projectPersist.getGroupID());
|
||||
containerSpec.getReleasedId().setVersion(projectPersist.getProjectVersion());
|
||||
containerSpec.setServerTemplateKey(new ServerTemplateKey());
|
||||
containerSpec.getServerTemplateKey().setId(kieserverID);
|
||||
containerSpec.getServerTemplateKey().setName(kieserverID);
|
||||
ResponseEntity<String> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.POST, requestCallback(containerSpec, username, password), clientHttpResponse -> {
|
||||
String extractedResponse = null;
|
||||
ResponseEntity<String> extractedValue=null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
if (result==null || result.length()==0){
|
||||
|
||||
}else {
|
||||
extractedResponse = mapper.readValue(result, String.class);
|
||||
extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
return extractedValue;
|
||||
});
|
||||
if (response!= null) {
|
||||
return response.getBody();
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ServerInstanceKeyList getListInstances(String username, String password){
|
||||
String completeurl=kiewbUrl+"/controller/runtime/servers/"+kieserverID+"/instances";
|
||||
|
||||
ResponseEntity<ServerInstanceKeyList> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
ServerInstanceKeyList extractedResponse;
|
||||
ResponseEntity<ServerInstanceKeyList> extractedValue=null;
|
||||
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
//Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
//String result = s.hasNext() ? s.next() : "";
|
||||
String result = StreamUtils.copyToString(clientHttpResponse.getBody(), Charset.defaultCharset());
|
||||
if (result==null || result.length()==0){
|
||||
|
||||
}else {
|
||||
extractedResponse = mapper.readValue(result, ServerInstanceKeyList.class);
|
||||
extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
return extractedValue;
|
||||
});
|
||||
if (response!= null) {
|
||||
return response.getBody();
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public ContainerList getListContainers(String username, String password,String serverInstanceId){
|
||||
String completeurl=kiewbUrl+"/controller/runtime/servers/"+kieserverID+"/instances/"+serverInstanceId+"/containers";
|
||||
|
||||
ResponseEntity<ContainerList> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
ContainerList extractedResponse;
|
||||
ResponseEntity<ContainerList> extractedValue=null;
|
||||
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
//Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
//String result = s.hasNext() ? s.next() : "";
|
||||
String result = StreamUtils.copyToString(clientHttpResponse.getBody(), Charset.defaultCharset());
|
||||
if (result==null || result.length()==0){
|
||||
|
||||
}else {
|
||||
extractedResponse = mapper.readValue(result, ContainerList.class);
|
||||
extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
return extractedValue;
|
||||
});
|
||||
if (response!= null) {
|
||||
return response.getBody();
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public KieServerSetup connectToBusinessCentral(String username, String password, String kieServerName, String externalUrl){
|
||||
String completeurl;
|
||||
if (externalUrl==null || externalUrl.isEmpty()) {
|
||||
completeurl = kiewbUrl + "/controller/server/" + kieserverID;
|
||||
}else{
|
||||
completeurl = externalUrl + "/controller/server/" + kieserverID;
|
||||
}
|
||||
KieServerInfo kieServerInfo = new KieServerInfo();
|
||||
kieServerInfo.setVersion("1.0.0");
|
||||
kieServerInfo.setServerId("1");
|
||||
kieServerInfo.setName(kieserverID);
|
||||
kieServerInfo.setMode(KieServerMode.DEVELOPMENT);
|
||||
kieServerInfo.setServerId(kieserverID);
|
||||
if (kieServerName==null || kieServerName.isEmpty()){
|
||||
kieServerInfo.setLocation(controlerLocation+"/demo");
|
||||
}else{
|
||||
kieServerInfo.setLocation(controlerLocation+"/"+kieServerName);
|
||||
}
|
||||
kieServerInfo.setCapabilities(new ArrayList<>());
|
||||
kieServerInfo.getCapabilities().add("BRM");
|
||||
ResponseEntity<KieServerSetup> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.PUT, requestCallback(kieServerInfo, username, password), clientHttpResponse -> {
|
||||
KieServerSetup extractedResponse = null;
|
||||
ResponseEntity<KieServerSetup> extractedValue=null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
if (result==null || result.length()==0){
|
||||
|
||||
}else {
|
||||
extractedResponse = mapper.readValue(result, KieServerSetup.class);
|
||||
extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
return extractedValue;
|
||||
});
|
||||
if (response!= null) {
|
||||
return response.getBody();
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private RequestCallback requestCallback(final Object content, String username, String password) {
|
||||
return clientHttpRequest -> {
|
||||
|
||||
if (content != null) {
|
||||
if (content instanceof KieServerInfo) {
|
||||
KieServerInfo kieServerSetup = (KieServerInfo) content;
|
||||
|
||||
mapper.writeValue(clientHttpRequest.getBody(), kieServerSetup);
|
||||
} else {
|
||||
mapper.writeValue(clientHttpRequest.getBody(), content);
|
||||
}
|
||||
}
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||
String auth = username + ":" + password;
|
||||
byte[] encodedAuth = Base64.encodeBase64(
|
||||
auth.getBytes(Charset.forName("UTF-8")));
|
||||
String authHeader = "Basic " + new String(encodedAuth);
|
||||
clientHttpRequest.getHeaders().add(
|
||||
HttpHeaders.AUTHORIZATION, authHeader);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package org.chtijbug.drools.console.service.wbconnector;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
class LoggingRequestResponseLoggingInterceptor implements ClientHttpRequestInterceptor {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Override
|
||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
|
||||
logRequest(request, body);
|
||||
ClientHttpResponse response = execution.execute(request, body);
|
||||
logResponse(response);
|
||||
return response;
|
||||
}
|
||||
|
||||
private void logRequest(HttpRequest request, byte[] body) throws IOException {
|
||||
|
||||
log.info("===========================request begin================================================");
|
||||
log.info("URI : {}", request.getURI());
|
||||
log.info("Method : {}", request.getMethod());
|
||||
log.info("Headers : {}", request.getHeaders());
|
||||
log.info("Request body: {}", new String(body, "UTF-8"));
|
||||
log.info("==========================request end================================================");
|
||||
|
||||
}
|
||||
|
||||
private void logResponse(ClientHttpResponse response) throws IOException {
|
||||
|
||||
log.info("============================response begin==========================================");
|
||||
log.info("Status code : {}", response.getStatusCode());
|
||||
log.info("Status text : {}", response.getStatusText());
|
||||
log.info("Headers : {}", response.getHeaders());
|
||||
log.info("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
|
||||
log.info("=======================response end=================================================");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package org.chtijbug.drools.console.util;
|
||||
|
||||
import com.vaadin.flow.data.validator.RegexpValidator;
|
||||
|
||||
public class HostnameValidator extends RegexpValidator {
|
||||
|
||||
private static final String PATTERN ="(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$)";
|
||||
|
||||
public HostnameValidator(String errorMessage) {
|
||||
super(errorMessage, PATTERN, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package org.chtijbug.drools.console.util;
|
||||
|
||||
import com.vaadin.flow.data.validator.RegexpValidator;
|
||||
|
||||
public class PasswordValidator extends RegexpValidator {
|
||||
|
||||
private static final String PATTERN = "[a-zA-Z0-9_@./*#&+-]{4,30}";
|
||||
|
||||
public PasswordValidator(String errorMessage) {
|
||||
super(errorMessage, PATTERN, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.Squelette;
|
||||
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.ConsoleDeploy;
|
||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.LeftMenuGlobal;
|
||||
import org.chtijbug.drools.console.vaadincomponent.menu.*;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class SqueletteComposant extends VerticalLayout {
|
||||
|
||||
private MenuPrincipal menuPrincipal;
|
||||
|
||||
private LeftMenuGlobal leftMenuGlobal;
|
||||
|
||||
private MenuScondaireDeployement menuScondaireDeployement;
|
||||
|
||||
private MenuSecondaireInfoUser menuSecondaireInfoUser;
|
||||
|
||||
private MenuSecondaireAssets menuSecondaireAssets;
|
||||
|
||||
private MenuSecondaireRuntime menuSecondaireRuntime;
|
||||
|
||||
private MenuSecondaireLogging menuSecondaireLogging;
|
||||
|
||||
private VerticalLayout content;
|
||||
|
||||
private VerticalLayout infoPage;
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
private ConsoleDeploy consoleDeploy;
|
||||
|
||||
public SqueletteComposant(){
|
||||
|
||||
userConnectedService= AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
|
||||
if(userConnectedService.getUserConnected()!=null) {
|
||||
|
||||
setClassName("squelette-composant-contentAll");
|
||||
|
||||
menuPrincipal = new MenuPrincipal(this);
|
||||
add(menuPrincipal);
|
||||
|
||||
HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||
horizontalLayout.setClassName("squelette-component-horizontal");
|
||||
add(horizontalLayout);
|
||||
|
||||
content = new VerticalLayout();
|
||||
content.setClassName("squelette-component-content");
|
||||
|
||||
VerticalLayout tmp=new VerticalLayout();
|
||||
tmp.setClassName("squelette-menu-secondaire");
|
||||
content.add(tmp);
|
||||
|
||||
menuScondaireDeployement = new MenuScondaireDeployement(this);
|
||||
tmp.add(menuScondaireDeployement);
|
||||
|
||||
menuSecondaireInfoUser = new MenuSecondaireInfoUser();
|
||||
tmp.add(menuSecondaireInfoUser);
|
||||
|
||||
menuSecondaireAssets = new MenuSecondaireAssets(this);
|
||||
tmp.add(menuSecondaireAssets);
|
||||
|
||||
menuSecondaireRuntime=new MenuSecondaireRuntime(this);
|
||||
tmp.add(menuSecondaireRuntime);
|
||||
|
||||
menuSecondaireLogging=new MenuSecondaireLogging(this);
|
||||
tmp.add(menuSecondaireLogging);
|
||||
|
||||
infoPage = new VerticalLayout();
|
||||
infoPage.setClassName("squelette-component-infoPage");
|
||||
content.add(infoPage);
|
||||
|
||||
|
||||
consoleDeploy=new ConsoleDeploy();
|
||||
|
||||
|
||||
content.add(consoleDeploy);
|
||||
|
||||
leftMenuGlobal = new LeftMenuGlobal();
|
||||
horizontalLayout.add(leftMenuGlobal);
|
||||
|
||||
horizontalLayout.add(content);
|
||||
}
|
||||
}
|
||||
|
||||
public void navigate(VerticalLayout verticalLayout,String pageName,VerticalLayout contentAction){
|
||||
leftMenuGlobal.getInformationStructure().getNomPage().setText(pageName);
|
||||
|
||||
leftMenuGlobal.getContentAction().removeAll();
|
||||
leftMenuGlobal.getContentAction().add(contentAction);
|
||||
|
||||
infoPage.removeAll();
|
||||
infoPage.add(verticalLayout);
|
||||
|
||||
if(pageName.equals(DeploymentView.PAGE_NAME)){
|
||||
consoleDeploy.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
public MenuPrincipal getMenuPrincipal() {
|
||||
return menuPrincipal;
|
||||
}
|
||||
|
||||
public void setMenuPrincipal(MenuPrincipal menuPrincipal) {
|
||||
this.menuPrincipal = menuPrincipal;
|
||||
}
|
||||
|
||||
public LeftMenuGlobal getLeftMenuGlobal() {
|
||||
return leftMenuGlobal;
|
||||
}
|
||||
|
||||
public MenuSecondaireAssets getMenuSecondaireAssets() {
|
||||
return menuSecondaireAssets;
|
||||
}
|
||||
|
||||
public void setMenuSecondaireAssets(MenuSecondaireAssets menuSecondaireAssets) {
|
||||
this.menuSecondaireAssets = menuSecondaireAssets;
|
||||
}
|
||||
|
||||
public MenuSecondaireRuntime getMenuSecondaireRuntime() {
|
||||
return menuSecondaireRuntime;
|
||||
}
|
||||
|
||||
public void setMenuSecondaireRuntime(MenuSecondaireRuntime menuSecondaireRuntime) {
|
||||
this.menuSecondaireRuntime = menuSecondaireRuntime;
|
||||
}
|
||||
|
||||
public void setLeftMenuGlobal(LeftMenuGlobal leftMenuGlobal) {
|
||||
this.leftMenuGlobal = leftMenuGlobal;
|
||||
}
|
||||
|
||||
public MenuScondaireDeployement getMenuScondaireDeployement() {
|
||||
return menuScondaireDeployement;
|
||||
}
|
||||
|
||||
public void setMenuScondaireDeployement(MenuScondaireDeployement menuScondaireDeployement) {
|
||||
this.menuScondaireDeployement = menuScondaireDeployement;
|
||||
}
|
||||
|
||||
public MenuSecondaireInfoUser getMenuSecondaireInfoUser() {
|
||||
return menuSecondaireInfoUser;
|
||||
}
|
||||
|
||||
public void setMenuSecondaireInfoUser(MenuSecondaireInfoUser menuSecondaireInfoUser) {
|
||||
this.menuSecondaireInfoUser = menuSecondaireInfoUser;
|
||||
}
|
||||
|
||||
public VerticalLayout getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(VerticalLayout content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public VerticalLayout getInfoPage() {
|
||||
return infoPage;
|
||||
}
|
||||
|
||||
public void setInfoPage(VerticalLayout infoPage) {
|
||||
this.infoPage = infoPage;
|
||||
}
|
||||
|
||||
public UserConnectedService getUserConnectedService() {
|
||||
return userConnectedService;
|
||||
}
|
||||
|
||||
public void setUserConnectedService(UserConnectedService userConnectedService) {
|
||||
this.userConnectedService = userConnectedService;
|
||||
}
|
||||
|
||||
public MenuSecondaireLogging getMenuSecondaireLogging() {
|
||||
return menuSecondaireLogging;
|
||||
}
|
||||
|
||||
public void setMenuSecondaireLogging(MenuSecondaireLogging menuSecondaireLogging) {
|
||||
this.menuSecondaireLogging = menuSecondaireLogging;
|
||||
}
|
||||
|
||||
public ConsoleDeploy getConsoleDeploy() {
|
||||
return consoleDeploy;
|
||||
}
|
||||
|
||||
public void setConsoleDeploy(ConsoleDeploy consoleDeploy) {
|
||||
this.consoleDeploy = consoleDeploy;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||
|
||||
|
||||
import com.vaadin.flow.component.combobox.ComboBox;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.Icon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
|
||||
@StyleSheet("css/composantperso/textFieldPerso.css")
|
||||
public class ComboBoxPerso<T> extends HorizontalLayout {
|
||||
|
||||
|
||||
ComboBox<T> comboBox;
|
||||
|
||||
public ComboBoxPerso (String caption, Icon icon){
|
||||
this.setMargin(false);
|
||||
this.setSpacing(false);
|
||||
|
||||
setClassName("horizontal-content");
|
||||
|
||||
|
||||
VerticalLayout verticalLayout=new VerticalLayout();
|
||||
verticalLayout.setClassName("content-icon");
|
||||
|
||||
icon.setClassName("passwordField-perso-icon");
|
||||
verticalLayout.add(icon);
|
||||
|
||||
comboBox =new ComboBox<>(caption);
|
||||
comboBox.setClassName("horizontal-content");
|
||||
this.add(verticalLayout);
|
||||
this.add(comboBox);
|
||||
}
|
||||
|
||||
public ComboBox<T> getComboBox() {
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
public void setComboBox(ComboBox<T> comboBox) {
|
||||
this.comboBox = comboBox;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||
|
||||
import com.vaadin.flow.component.datepicker.DatePicker;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.Icon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
|
||||
@StyleSheet("css/composantperso/datePickerPerso.css")
|
||||
public class DatePickerPerso extends HorizontalLayout {
|
||||
|
||||
DatePicker datepicker;
|
||||
|
||||
public DatePickerPerso (String caption, Icon icon){
|
||||
this.setMargin(false);
|
||||
this.setSpacing(false);
|
||||
|
||||
setClassName("horizontal-content");
|
||||
|
||||
|
||||
VerticalLayout verticalLayout=new VerticalLayout();
|
||||
verticalLayout.setClassName("content-icon");
|
||||
|
||||
icon.setClassName("datepicker-perso-icon");
|
||||
verticalLayout.add(icon);
|
||||
|
||||
datepicker =new DatePicker(caption);
|
||||
datepicker.setClassName("horizontal-content");
|
||||
this.add(verticalLayout);
|
||||
this.add(datepicker);
|
||||
}
|
||||
|
||||
public DatePicker getDatepicker() {
|
||||
return datepicker;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.dialog.Dialog;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
|
||||
@StyleSheet("css/composantperso/dialog.css")
|
||||
public class DialogPerso extends Dialog {
|
||||
|
||||
private HorizontalLayout bar;
|
||||
|
||||
private Button close;
|
||||
|
||||
public DialogPerso(){
|
||||
bar = new HorizontalLayout();
|
||||
close = new Button();
|
||||
close.setIcon(VaadinIcon.CLOSE.create());
|
||||
close.addClassName("DialogClose");
|
||||
bar.addClassName("DialogBar");
|
||||
bar.add(close);
|
||||
add(bar);
|
||||
|
||||
close.addClickListener(buttonClickEvent -> close());
|
||||
}
|
||||
|
||||
public HorizontalLayout getBar() {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(HorizontalLayout bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public Button getClose() {
|
||||
return close;
|
||||
}
|
||||
|
||||
public void setClose(Button close) {
|
||||
this.close = close;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.Icon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.textfield.PasswordField;
|
||||
|
||||
@StyleSheet("css/composantperso/textFieldPerso.css")
|
||||
public class PasswordFieldPerso extends HorizontalLayout {
|
||||
|
||||
private PasswordField passwordField;
|
||||
|
||||
public PasswordFieldPerso (String caption, Icon icon){
|
||||
this.setMargin(false);
|
||||
this.setSpacing(false);
|
||||
|
||||
|
||||
VerticalLayout verticalLayout=new VerticalLayout();
|
||||
verticalLayout.setClassName("content-icon");
|
||||
|
||||
icon.setClassName("passwordField-perso-icon");
|
||||
verticalLayout.add(icon);
|
||||
|
||||
passwordField =new PasswordField(caption);
|
||||
passwordField.setClassName("horizontal-content");
|
||||
this.add(verticalLayout);
|
||||
this.add(passwordField);
|
||||
passwordField.setRequired(true);
|
||||
}
|
||||
|
||||
public PasswordField getPasswordField() {
|
||||
return passwordField;
|
||||
}
|
||||
|
||||
public void setPasswordField(PasswordField passwordField) {
|
||||
this.passwordField = passwordField;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.Icon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
|
||||
@StyleSheet("css/composantperso/textFieldPerso.css")
|
||||
public class TextFieldPerso extends HorizontalLayout {
|
||||
|
||||
TextField textField;
|
||||
|
||||
public TextFieldPerso (String caption,String placeHolder, Icon icon){
|
||||
this.setMargin(false);
|
||||
this.setSpacing(false);
|
||||
|
||||
setClassName("content-perso-field");
|
||||
|
||||
VerticalLayout verticalLayout=new VerticalLayout();
|
||||
verticalLayout.setClassName("content-icon");
|
||||
|
||||
icon.setClassName("passwordField-perso-icon");
|
||||
verticalLayout.add(icon);
|
||||
|
||||
textField=new TextField(caption,placeHolder);
|
||||
textField.setClassName("horizontal-content");
|
||||
textField.setRequired(true);
|
||||
this.add(verticalLayout);
|
||||
this.add(textField);
|
||||
}
|
||||
|
||||
public TextField getTextField() {
|
||||
return textField;
|
||||
}
|
||||
|
||||
public void setTextField(TextField textField) {
|
||||
this.textField = textField;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.data.binder.Binder;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.GuidedDecisionTableModelTransformer;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.GuidedRuleTemplateModelTransformer;
|
||||
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
|
||||
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
||||
import org.drools.workbench.models.guided.template.backend.RuleTemplateModelXMLPersistenceImpl;
|
||||
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class AssetEdit extends Grid<HashMap<String, Object>> {
|
||||
|
||||
private transient KieRepositoryService kieRepositoryService;
|
||||
|
||||
private transient KieConfigurationData config;
|
||||
|
||||
private transient UserConnectedService userConnectedService;
|
||||
|
||||
public AssetEdit() {
|
||||
|
||||
setClassName("assetEdit-content");
|
||||
|
||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
|
||||
String assetContent = kieRepositoryService.getAssetSource(config.getKiewbUrl(),
|
||||
userConnectedService.getUserConnected().getUserName(),
|
||||
userConnectedService.getUserConnected().getUserPassword(),
|
||||
userConnectedService.getSpace(),
|
||||
userConnectedService.getProject(),
|
||||
userConnectedService.getAsset());
|
||||
Binder<HashMap<String, Object>> binder = new Binder<>();
|
||||
getEditor().setBinder(binder);
|
||||
setClassName("grid-perso");
|
||||
if (assetContent.startsWith("<decision-table52")){
|
||||
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal(assetContent);
|
||||
GuidedDecisionTableModelTransformer transform = new GuidedDecisionTableModelTransformer(model, binder, this);
|
||||
transform.run();
|
||||
}else {
|
||||
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetContent);
|
||||
GuidedRuleTemplateModelTransformer transform = new GuidedRuleTemplateModelTransformer(model,binder,this);
|
||||
transform.run();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public AssetEdit(List<HashMap<String, Object>> objects) {
|
||||
|
||||
setClassName("assetEdit-content");
|
||||
|
||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
|
||||
setClassName("grid-perso");
|
||||
|
||||
Binder<HashMap<String, Object>> binder = new Binder<>();
|
||||
getEditor().setBinder(binder);
|
||||
|
||||
if(!objects.isEmpty()){
|
||||
for(Map.Entry<String,Object> t:objects.get(0).entrySet()){
|
||||
addColumn(hashmap -> hashmap.get(t.getKey())).setHeader(t.getKey());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
setItems(objects);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dialog.Dialog;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.notification.Notification;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AssociateProjectKie extends VerticalLayout {
|
||||
|
||||
private Label label;
|
||||
|
||||
private Label label2;
|
||||
|
||||
private GridRuntime gridRuntime;
|
||||
|
||||
private Button associer;
|
||||
|
||||
private transient ProjectPersistService projectPersistService;
|
||||
|
||||
public AssociateProjectKie(DeploymentView deploymentView, Dialog dialog, ProjectPersist projectPersist) {
|
||||
|
||||
projectPersistService = AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
|
||||
setClassName("creation-runtime-content");
|
||||
|
||||
label = new Label("Define the runtime(s) for the project : " + projectPersist.getProjectName());
|
||||
label.setClassName("creation-runtime-title");
|
||||
add(label);
|
||||
|
||||
label2 = new Label("This step is essential to be able to execute the rules defined in the project");
|
||||
label2.setClassName("creation-runtime-title2");
|
||||
add(label2);
|
||||
|
||||
gridRuntime = new GridRuntime(projectPersist);
|
||||
add(gridRuntime);
|
||||
|
||||
associer = new Button("Link and Save");
|
||||
associer.setEnabled(false);
|
||||
associer.setClassName("login-application-connexion");
|
||||
add(associer);
|
||||
associer.addClickListener(buttonClickEvent -> {
|
||||
List<RuntimePersist> lstToSave = new ArrayList<>();
|
||||
List<RuntimePersist> lstToDelete = new ArrayList<>();
|
||||
for (RuntimePersist runtimePersist : gridRuntime.getSelectedItems()) {
|
||||
lstToSave.add(runtimePersist);
|
||||
}
|
||||
for (RuntimePersist runtime : gridRuntime.getRuntimeSelected()){
|
||||
boolean found=false;
|
||||
for (RuntimePersist runtimePersist : gridRuntime.getSelectedItems()) {
|
||||
if (runtimePersist.getServerName().equals(runtime.getServerName())
|
||||
&& runtimePersist.getServerPort().equals(runtime.getServerPort())){
|
||||
found=true;
|
||||
}
|
||||
|
||||
}
|
||||
if (!found){
|
||||
lstToDelete.add(runtime);
|
||||
}
|
||||
}
|
||||
if (!lstToDelete.isEmpty()){
|
||||
projectPersistService.removeAssociation(projectPersist,lstToDelete);
|
||||
}
|
||||
if (!lstToSave.isEmpty()) {
|
||||
|
||||
projectPersistService.associate(projectPersist, lstToSave);
|
||||
|
||||
}
|
||||
if (!lstToDelete.isEmpty() || !lstToSave.isEmpty()){
|
||||
deploymentView.setDataProvider();
|
||||
dialog.close();
|
||||
}
|
||||
});
|
||||
|
||||
gridRuntime.addSelectionListener(selectionEvent -> {
|
||||
associer.setEnabled(selectionEvent.getFirstSelectedItem().isPresent());
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
|
||||
public class ConsoleDeploy extends HorizontalLayout {
|
||||
|
||||
private static String activeClass = "active";
|
||||
|
||||
private transient VerticalLayout outilsBar;
|
||||
|
||||
private transient VerticalLayout content;
|
||||
|
||||
private transient HorizontalLayout titleContent;
|
||||
|
||||
private transient VerticalLayout logContent;
|
||||
|
||||
private transient Button menu;
|
||||
|
||||
private transient Button clear;
|
||||
|
||||
private transient Label title;
|
||||
|
||||
public ConsoleDeploy() {
|
||||
|
||||
setClassName("console-content-all");
|
||||
setVisible(false);
|
||||
|
||||
outilsBar = new VerticalLayout();
|
||||
outilsBar.setClassName("console-outilsBar-content");
|
||||
add(outilsBar);
|
||||
|
||||
menu = new Button("", VaadinIcon.MENU.create());
|
||||
menu.setClassName("console-button");
|
||||
menu.addClickListener(buttonClickEvent -> {
|
||||
if (isActive()) {
|
||||
removeActive();
|
||||
content.setVisible(false);
|
||||
} else {
|
||||
active();
|
||||
content.setVisible(true);
|
||||
}
|
||||
});
|
||||
outilsBar.add(menu);
|
||||
|
||||
clear = new Button("", VaadinIcon.PANEL.create());
|
||||
clear.setClassName("console-button");
|
||||
clear.addClickListener(buttonClickEvent ->
|
||||
logContent.removeAll()
|
||||
);
|
||||
outilsBar.add(clear);
|
||||
|
||||
content = new VerticalLayout();
|
||||
content.setClassName("console-content");
|
||||
add(content);
|
||||
content.setVisible(false);
|
||||
|
||||
|
||||
titleContent = new HorizontalLayout();
|
||||
titleContent.setClassName("console-content-title");
|
||||
content.add(titleContent);
|
||||
|
||||
title = new Label("Console : ");
|
||||
title.setClassName("console-title");
|
||||
titleContent.add(title);
|
||||
|
||||
logContent = new VerticalLayout();
|
||||
logContent.setClassName("console-log-content");
|
||||
content.add(logContent);
|
||||
}
|
||||
|
||||
private boolean isActive() {
|
||||
return getClassNames().contains(activeClass);
|
||||
}
|
||||
|
||||
private void removeActive() {
|
||||
|
||||
if (getClassNames().contains(activeClass)) {
|
||||
getClassNames().remove(activeClass);
|
||||
}
|
||||
}
|
||||
|
||||
private void active() {
|
||||
removeActive();
|
||||
|
||||
getClassNames().add(activeClass);
|
||||
}
|
||||
|
||||
public void setTtile(String nameProject) {
|
||||
title.setText("Console : " + nameProject);
|
||||
}
|
||||
|
||||
public VerticalLayout getLogContent() {
|
||||
return logContent;
|
||||
}
|
||||
|
||||
public void setLogContent(VerticalLayout logContent) {
|
||||
this.logContent = logContent;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,266 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||
|
||||
import com.vaadin.flow.component.AbstractField;
|
||||
import com.vaadin.flow.component.ClickEvent;
|
||||
import com.vaadin.flow.component.ComponentEventListener;
|
||||
import com.vaadin.flow.component.HasValue;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.checkbox.Checkbox;
|
||||
import com.vaadin.flow.component.dialog.Dialog;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.notification.Notification;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import org.chtijbug.drools.console.middle.JwtService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.RuntimeService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.ComboBoxPerso;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.TextFieldPerso;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.vaadin.olli.ClipboardHelper;
|
||||
|
||||
public class DefineProject extends VerticalLayout {
|
||||
|
||||
//COMPONENT
|
||||
|
||||
private ComboBoxPerso mainClass;
|
||||
|
||||
private TextFieldPerso processID;
|
||||
|
||||
private TextFieldPerso nameDeploy;
|
||||
|
||||
private Label label;
|
||||
|
||||
private Label label2;
|
||||
|
||||
private Button valider;
|
||||
|
||||
private Checkbox disableRuleLoggingCheckbox;
|
||||
|
||||
private Checkbox enableHotDeployCheckbox;
|
||||
private Checkbox useJWTToConnectCheckbox;
|
||||
|
||||
private TextFieldPerso jwtTokenTextField;
|
||||
|
||||
private TextFieldPerso jwtPeriod;
|
||||
|
||||
private Button createJWTButton;
|
||||
|
||||
private Button copyJWTTextButton;
|
||||
|
||||
private transient ProjectPersistService projectPersistService;
|
||||
|
||||
private transient RuntimeService runtimeService;
|
||||
|
||||
private boolean createMode;
|
||||
|
||||
private JwtService jwtService;
|
||||
|
||||
public DefineProject(DeploymentView deploymentView,Dialog dialog, ProjectPersist projectPersist){
|
||||
|
||||
jwtService = AppContext.getApplicationContext().getBean(JwtService.class);
|
||||
runtimeService = AppContext.getApplicationContext().getBean(RuntimeService.class);
|
||||
projectPersistService=AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
|
||||
setClassName("creation-runtime-content");
|
||||
|
||||
label=new Label("Define your project : "+projectPersist.getProjectName());
|
||||
label.setClassName("creation-runtime-title");
|
||||
add(label);
|
||||
|
||||
label2=new Label("this step is essential before you can work on your project");
|
||||
label2.setClassName("creation-runtime-title2");
|
||||
add(label2);
|
||||
|
||||
nameDeploy=new TextFieldPerso("Deployment Name ","",VaadinIcon.FILE_TEXT.create());
|
||||
nameDeploy.getTextField().setRequired(true);
|
||||
if (projectPersist.getDeploymentName()!=null
|
||||
&& projectPersist.getDeploymentName().length()>0){
|
||||
nameDeploy.getTextField().setValue((projectPersist.getDeploymentName()));
|
||||
}
|
||||
nameDeploy.getTextField().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
||||
verify();
|
||||
projectPersist.setDeploymentName(nameDeploy.getTextField().getValue().replaceAll(" ","_"));
|
||||
if(projectPersistService.getProjectRepository().findByDeploymentName(projectPersist.getDeploymentName())!=null){
|
||||
projectPersist.setDeploymentName(null);
|
||||
nameDeploy.getTextField().setValue("");
|
||||
Notification.show("Attention : a project already has this deployment name");
|
||||
}
|
||||
});
|
||||
|
||||
add(nameDeploy);
|
||||
|
||||
mainClass=new ComboBoxPerso("MainClass", VaadinIcon.TREE_TABLE.create());
|
||||
mainClass.getComboBox().setItems(projectPersist.getClassNameList());
|
||||
mainClass.getComboBox().setRequired(true);
|
||||
if (projectPersist.getMainClass()!= null
|
||||
&& projectPersist.getMainClass().length()>0){
|
||||
mainClass.getComboBox().setValue("class="+projectPersist.getMainClass());
|
||||
}
|
||||
mainClass.getComboBox().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
||||
verify();
|
||||
String mainClassName=(String)mainClass.getComboBox().getValue();
|
||||
if (mainClassName.indexOf("=")!= -1){
|
||||
mainClassName = mainClassName.substring(mainClassName.indexOf("=")+1);
|
||||
}
|
||||
projectPersist.setMainClass(mainClassName);
|
||||
});
|
||||
|
||||
add(mainClass);
|
||||
|
||||
processID=new TextFieldPerso("Process ID","",VaadinIcon.TASKS.create());
|
||||
processID.getTextField().setRequired(true);
|
||||
if (projectPersist.getProcessID()!= null
|
||||
&& projectPersist.getProcessID().length()>0){
|
||||
processID.getTextField().setValue(projectPersist.getProcessID());
|
||||
}
|
||||
processID.getTextField().setValueChangeMode(ValueChangeMode.EAGER);
|
||||
processID.getTextField().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
||||
verify();
|
||||
projectPersist.setProcessID(processID.getTextField().getValue());
|
||||
});
|
||||
|
||||
add(processID);
|
||||
|
||||
enableHotDeployCheckbox = new Checkbox("Enable Hot deployment (needs 2 runtimes)");
|
||||
if (projectPersist.isEnableHotDeploy()){
|
||||
enableHotDeployCheckbox.setValue(true);
|
||||
}else{
|
||||
enableHotDeployCheckbox.setValue(false);
|
||||
}
|
||||
enableHotDeployCheckbox.addValueChangeListener(new HasValue.ValueChangeListener<AbstractField.ComponentValueChangeEvent<Checkbox, Boolean>>() {
|
||||
@Override
|
||||
public void valueChanged(AbstractField.ComponentValueChangeEvent<Checkbox, Boolean> checkboxBooleanComponentValueChangeEvent) {
|
||||
projectPersist.setEnableHotDeploy(checkboxBooleanComponentValueChangeEvent.getValue());
|
||||
}
|
||||
});
|
||||
add(enableHotDeployCheckbox);
|
||||
|
||||
disableRuleLoggingCheckbox = new Checkbox("Disable Rule logging");
|
||||
if (projectPersist.isDisableRuleLogging()){
|
||||
disableRuleLoggingCheckbox.setValue(true);
|
||||
}else{
|
||||
disableRuleLoggingCheckbox.setValue(false);
|
||||
}
|
||||
disableRuleLoggingCheckbox.addValueChangeListener(new HasValue.ValueChangeListener<AbstractField.ComponentValueChangeEvent<Checkbox, Boolean>>() {
|
||||
@Override
|
||||
public void valueChanged(AbstractField.ComponentValueChangeEvent<Checkbox, Boolean> checkboxBooleanComponentValueChangeEvent) {
|
||||
projectPersist.setDisableRuleLogging(disableRuleLoggingCheckbox.getValue());
|
||||
}
|
||||
});
|
||||
add(disableRuleLoggingCheckbox);
|
||||
|
||||
useJWTToConnectCheckbox =new Checkbox("Use JWT token to connect to API");
|
||||
add(useJWTToConnectCheckbox);
|
||||
|
||||
|
||||
|
||||
jwtTokenTextField=new TextFieldPerso("JWT Token for API","",VaadinIcon.TASKS.create());
|
||||
|
||||
if (projectPersist.getJwtAPIToken()!= null
|
||||
&& projectPersist.getJwtAPIToken().length()>0){
|
||||
jwtTokenTextField.getTextField().setValue(projectPersist.getJwtAPIToken());
|
||||
}
|
||||
jwtTokenTextField.getTextField().setEnabled(false);
|
||||
|
||||
|
||||
add(jwtTokenTextField);
|
||||
copyJWTTextButton = new Button("Copy JWT token");
|
||||
ClipboardHelper clipboardHelper = new ClipboardHelper(projectPersist.getJwtAPIToken(), copyJWTTextButton);
|
||||
add(clipboardHelper);
|
||||
jwtPeriod=new TextFieldPerso("JWT validity for API","",VaadinIcon.TASKS.create());
|
||||
jwtPeriod.setEnabled(false);
|
||||
if (projectPersist.getJwtAPIToken()!= null
|
||||
&& projectPersist.getJwtAPIToken().length()>0){
|
||||
try {
|
||||
Claims claims = jwtService.decodeJWT(projectPersist.getJwtAPIToken());
|
||||
jwtPeriod.getTextField().setValue(claims.getExpiration().toString());
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
jwtTokenTextField.getTextField().setValue(projectPersist.getJwtAPIToken());
|
||||
}
|
||||
add(jwtPeriod);
|
||||
createJWTButton = new Button("Generate JWT token for one year");
|
||||
createJWTButton.addClickListener(new ComponentEventListener<ClickEvent<Button>>() {
|
||||
@Override
|
||||
public void onComponentEvent(ClickEvent<Button> buttonClickEvent) {
|
||||
String token = jwtService.createJWT(projectPersist, 1000*3600*24*(long)365);
|
||||
projectPersist.setJwtAPIToken(token);
|
||||
jwtTokenTextField.getTextField().setValue(token);
|
||||
Claims claims = jwtService.decodeJWT(projectPersist.getJwtAPIToken());
|
||||
jwtPeriod.getTextField().setValue(claims.getExpiration().toString());
|
||||
}
|
||||
});
|
||||
add(createJWTButton);
|
||||
if (projectPersist.isUseJWTToConnect()){
|
||||
useJWTToConnectCheckbox.setValue(true);
|
||||
}else{
|
||||
useJWTToConnectCheckbox.setValue(false);
|
||||
jwtTokenTextField.getTextField().setValue("");
|
||||
jwtTokenTextField.setEnabled(false);
|
||||
projectPersist.setJwtAPIToken(null);
|
||||
createJWTButton.setEnabled(false);
|
||||
jwtPeriod.getTextField().setValue("");
|
||||
copyJWTTextButton.setEnabled(false);
|
||||
}
|
||||
useJWTToConnectCheckbox.addValueChangeListener(new HasValue.ValueChangeListener<AbstractField.ComponentValueChangeEvent<Checkbox, Boolean>>() {
|
||||
@Override
|
||||
public void valueChanged(AbstractField.ComponentValueChangeEvent<Checkbox, Boolean> checkboxBooleanComponentValueChangeEvent) {
|
||||
projectPersist.setUseJWTToConnect(useJWTToConnectCheckbox.getValue());
|
||||
if (!useJWTToConnectCheckbox.getValue()){
|
||||
jwtTokenTextField.getTextField().setValue("");
|
||||
createJWTButton.setEnabled(false);
|
||||
projectPersist.setJwtAPIToken(null);
|
||||
jwtPeriod.getTextField().setValue("");
|
||||
copyJWTTextButton.setEnabled(false);
|
||||
}else{
|
||||
jwtTokenTextField.setEnabled(true);
|
||||
copyJWTTextButton.setEnabled(true);
|
||||
createJWTButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
valider=new Button("Save");
|
||||
if (projectPersist.getProcessID()!= null
|
||||
&& projectPersist.getProcessID().length()>0){
|
||||
valider.setEnabled(true);
|
||||
createMode=false;
|
||||
}else {
|
||||
valider.setEnabled(false);
|
||||
createMode=true;
|
||||
}
|
||||
valider.setClassName("login-application-connexion");
|
||||
valider.addClickListener(buttonClickEvent -> {
|
||||
if (createMode) {
|
||||
projectPersist.setStatus(ProjectPersist.DEFINI);
|
||||
}
|
||||
runtimeService.updateRuntimes(projectPersist);
|
||||
projectPersistService.getProjectRepository().save(projectPersist);
|
||||
deploymentView.setDataProvider();
|
||||
dialog.close();
|
||||
});
|
||||
add(valider);
|
||||
|
||||
}
|
||||
public void verify(){
|
||||
if(nameDeploy.getTextField().isInvalid()||nameDeploy.getTextField().getValue().isEmpty()||nameDeploy.getTextField().getValue()==null&&
|
||||
processID.getTextField().isInvalid()||processID.getTextField().getValue().isEmpty()||processID.getTextField().getValue()==null&&
|
||||
mainClass.getComboBox().isInvalid()||mainClass.getComboBox().getValue()==null){
|
||||
valider.setEnabled(false);
|
||||
}else {
|
||||
valider.setEnabled(true);
|
||||
}
|
||||
}
|
||||
public void verifyToken(){
|
||||
|
||||
valider.setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,401 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.textfield.TextArea;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
import com.vaadin.flow.data.provider.ConfigurableFilterDataProvider;
|
||||
import com.vaadin.flow.data.provider.ListDataProvider;
|
||||
import com.vaadin.flow.data.renderer.ComponentRenderer;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import com.vaadin.flow.function.SerializablePredicate;
|
||||
import org.chtijbug.drools.console.service.IndexerService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||
import org.chtijbug.drools.logging.Fact;
|
||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||
|
||||
private TextField eventType;
|
||||
|
||||
private TextField positionExecution;
|
||||
|
||||
private TextField ruleName;
|
||||
|
||||
private TextField packageName;
|
||||
|
||||
private TextField ruleFlowGroup;
|
||||
|
||||
|
||||
private String strEventType = "EventType";
|
||||
|
||||
private String strPositionExecution = "Position";
|
||||
|
||||
private String strRuleName = "RuleName";
|
||||
|
||||
private String strPackageName = "Package";
|
||||
|
||||
private String strRuleFlowGroup = "RuleFlowGroup";
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
private ListDataProvider<BusinessTransactionAction> dataProvider;
|
||||
private ConfigurableFilterDataProvider<BusinessTransactionAction, Void, SerializablePredicate<BusinessTransactionAction>> filterDataProvider;
|
||||
|
||||
private transient IndexerService indexerService;
|
||||
|
||||
public GridActionLogging(String idRequest) {
|
||||
|
||||
mapper.setDateFormat(new SimpleDateFormat("dd-MM-yyyy hh:mm"));
|
||||
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
|
||||
|
||||
setClassName("action-log-grid-perso");
|
||||
setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||
setVerticalScrollingEnabled(true);
|
||||
|
||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
Label label = new Label();
|
||||
if (runtimePersist.getRuleExecution() != null) {
|
||||
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getStartDate()));
|
||||
}
|
||||
return label;
|
||||
})).setHeader("Début").setResizable(true);
|
||||
|
||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
Label label = new Label();
|
||||
if (runtimePersist.getRuleExecution() != null) {
|
||||
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getEndDate()));
|
||||
}
|
||||
return label;
|
||||
})).setHeader("Fin").setResizable(true);
|
||||
|
||||
|
||||
Grid.Column<BusinessTransactionAction> enventTypeC = addColumn(runtimePersist -> runtimePersist.getEventType());
|
||||
this.eventType = new TextField(strEventType);
|
||||
this.eventType.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
this.eventType.addValueChangeListener(e ->
|
||||
refreshtGrid(this.eventType.getValue(), strEventType)
|
||||
);
|
||||
enventTypeC.setHeader(this.eventType).setResizable(true);
|
||||
|
||||
Grid.Column<BusinessTransactionAction> positionC = addColumn(runtimePersist -> runtimePersist.getEventNumber());
|
||||
|
||||
positionExecution = new TextField(strPositionExecution);
|
||||
positionExecution.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
positionExecution.addValueChangeListener(e ->
|
||||
refreshtGrid(positionExecution.getValue(), strPositionExecution)
|
||||
);
|
||||
positionC.setHeader(positionExecution).setResizable(true);
|
||||
positionC.setWidth("3%");
|
||||
|
||||
Grid.Column<BusinessTransactionAction> ruleNameC = addColumn(runtimePersist -> runtimePersist.getRuleExecution() != null ? runtimePersist.getRuleExecution().getRuleName() : "");
|
||||
ruleName = new TextField(strRuleName);
|
||||
ruleName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
ruleName.addValueChangeListener(e ->
|
||||
refreshtGrid(ruleName.getValue(), strRuleName)
|
||||
);
|
||||
ruleNameC.setHeader(ruleName).setResizable(true);
|
||||
|
||||
Grid.Column<BusinessTransactionAction> versionC = addColumn(runtimePersist -> runtimePersist.getRuleExecution() != null ? runtimePersist.getRuleExecution().getPackageName() : "");
|
||||
packageName = new TextField(strPackageName);
|
||||
packageName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
packageName.addValueChangeListener(e ->
|
||||
refreshtGrid(packageName.getValue(), strPackageName)
|
||||
);
|
||||
versionC.setHeader(packageName).setResizable(true);
|
||||
|
||||
Grid.Column<BusinessTransactionAction> ruleflowC = addColumn(runtimePersist -> runtimePersist.getRuleflowGroupName() != null ? runtimePersist.getRuleflowGroupName() : "");
|
||||
ruleFlowGroup = new TextField(strRuleFlowGroup);
|
||||
ruleFlowGroup.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
ruleFlowGroup.addValueChangeListener(e ->
|
||||
refreshtGrid(ruleFlowGroup.getValue(), strRuleFlowGroup)
|
||||
);
|
||||
ruleflowC.setHeader(ruleFlowGroup).setResizable(true);
|
||||
|
||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||
HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||
if (runtimePersist.getInputData() != null && runtimePersist.getInputData().getRealFact() != null) {
|
||||
Button inputData = new Button("Input data");
|
||||
inputData.setClassName("menu-button");
|
||||
inputData.setEnabled(true);
|
||||
inputData.addClickListener(buttonClickEvent -> {
|
||||
DialogPerso dialogPerso1 = new DialogPerso();
|
||||
|
||||
BusinessTransactionAction b = runtimePersist;
|
||||
|
||||
if (b != null && b.getInputData() != null && b.getInputData().getRealFact() != null) {
|
||||
|
||||
VerticalLayout verticalLayout = new VerticalLayout();
|
||||
Label label = new Label(b.getEventType().name());
|
||||
label.setClassName("creation-runtime-title");
|
||||
verticalLayout.add(label);
|
||||
verticalLayout.setClassName("content-action-logging");
|
||||
|
||||
TextArea textArea = new TextArea(b.getInputData().getFactType().name() + "-" + b.getInputData().getFullClassName());
|
||||
textArea.setReadOnly(true);
|
||||
textArea.setClassName("content-log");
|
||||
try {
|
||||
mapper.setDateFormat(new SimpleDateFormat("dd-MM-yyyy hh:mm"));
|
||||
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getInputData().getRealFact());
|
||||
textArea.setValue(text);
|
||||
} catch (JsonProcessingException e) {
|
||||
textArea.setValue(
|
||||
b.getInputData().getRealFact().toString().replace(",", ",\n")
|
||||
.replaceAll("\\{", "\\{\n")
|
||||
.replaceAll("\\}", "\n\\}")
|
||||
.replaceAll("\\[", "\n\\[")
|
||||
|
||||
);
|
||||
}
|
||||
verticalLayout.add(textArea);
|
||||
dialogPerso1.add(verticalLayout);
|
||||
}
|
||||
|
||||
dialogPerso1.open();
|
||||
});
|
||||
horizontalLayout.add(inputData);
|
||||
}
|
||||
if (runtimePersist.getFact() != null && runtimePersist.getFact().getRealFact() != null) {
|
||||
Button realFact = new Button("Insert Data");
|
||||
realFact.setClassName("menu-button");
|
||||
realFact.setEnabled(true);
|
||||
realFact.addClickListener(buttonClickEvent -> {
|
||||
DialogPerso dialogPerso1 = new DialogPerso();
|
||||
|
||||
BusinessTransactionAction b = runtimePersist;
|
||||
|
||||
if (b != null && b.getFact() != null && b.getFact().getRealFact() != null) {
|
||||
|
||||
VerticalLayout verticalLayout = new VerticalLayout();
|
||||
Label label = new Label(b.getEventType().name());
|
||||
label.setClassName("creation-runtime-title");
|
||||
verticalLayout.add(label);
|
||||
verticalLayout.setClassName("content-action-logging");
|
||||
|
||||
TextArea textArea = new TextArea(b.getFact().getFactType().name() + "-" + b.getFact().getFullClassName());
|
||||
textArea.setReadOnly(true);
|
||||
textArea.setClassName("content-log");
|
||||
try {
|
||||
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getFact().getRealFact());
|
||||
textArea.setValue(text);
|
||||
} catch (JsonProcessingException e) {
|
||||
textArea.setValue(
|
||||
b.getFact().getRealFact().toString().replace(",", ",\n")
|
||||
.replace("\\{", "\\{\n")
|
||||
.replace("\\}", "\n\\}")
|
||||
.replace("\\[", "\n\\[")
|
||||
|
||||
);
|
||||
}
|
||||
verticalLayout.add(textArea);
|
||||
dialogPerso1.add(verticalLayout);
|
||||
}
|
||||
|
||||
dialogPerso1.open();
|
||||
});
|
||||
horizontalLayout.add(realFact);
|
||||
}
|
||||
if (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getThenFacts() != null && !runtimePersist.getRuleExecution().getThenFacts().isEmpty()) {
|
||||
Button whenFact = new Button("When Data");
|
||||
whenFact.setClassName("menu-button");
|
||||
whenFact.setEnabled(true);
|
||||
whenFact.addClickListener(buttonClickEvent -> {
|
||||
DialogPerso dialogPerso1 = new DialogPerso();
|
||||
|
||||
BusinessTransactionAction b = runtimePersist;
|
||||
|
||||
if (b != null && b.getRuleExecution() != null && b.getRuleExecution().getWhenFacts() != null) {
|
||||
|
||||
VerticalLayout verticalLayout = new VerticalLayout();
|
||||
Label label = new Label(b.getEventType().name() + " - " + (b.getRuleExecution() != null && b.getRuleExecution().getRuleName() != null ? b.getRuleExecution().getRuleName() : ""));
|
||||
label.setClassName("creation-runtime-title");
|
||||
verticalLayout.add(label);
|
||||
verticalLayout.setClassName("content-action-logging");
|
||||
for (Fact fact : b.getRuleExecution().getWhenFacts()) {
|
||||
if (fact != null && fact.getRealFact() != null) {
|
||||
|
||||
TextArea textArea = new TextArea(fact.getFactType().name() + "-" + fact.getFullClassName());
|
||||
textArea.setReadOnly(true);
|
||||
textArea.setClassName("content-log");
|
||||
try {
|
||||
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(fact.getRealFact());
|
||||
textArea.setValue(text);
|
||||
} catch (JsonProcessingException e) {
|
||||
textArea.setValue(
|
||||
fact.getRealFact().toString().replace(",", ",\n")
|
||||
.replace("\\{", "\\{\n")
|
||||
.replace("\\}", "\n\\}")
|
||||
.replace("\\[", "\n\\[")
|
||||
|
||||
);
|
||||
}
|
||||
verticalLayout.add(textArea);
|
||||
}
|
||||
}
|
||||
dialogPerso1.add(verticalLayout);
|
||||
}
|
||||
|
||||
dialogPerso1.open();
|
||||
});
|
||||
horizontalLayout.add(whenFact);
|
||||
}
|
||||
if (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getThenFacts() != null
|
||||
&& !runtimePersist.getRuleExecution().getThenFacts().isEmpty()) {
|
||||
|
||||
Button thenFact = new Button("Then data");
|
||||
thenFact.setClassName("menu-button");
|
||||
thenFact.setEnabled(true);
|
||||
thenFact.addClickListener(buttonClickEvent -> {
|
||||
DialogPerso dialogPerso1 = new DialogPerso();
|
||||
|
||||
BusinessTransactionAction b = runtimePersist;
|
||||
|
||||
if (b != null && b.getRuleExecution() != null
|
||||
&& b.getRuleExecution().getThenFacts() != null) {
|
||||
|
||||
VerticalLayout verticalLayout = new VerticalLayout();
|
||||
Label label = new Label(b.getEventType().name() + " - " + (b.getRuleExecution() != null && b.getRuleExecution().getRuleName() != null ? b.getRuleExecution().getRuleName() : ""));
|
||||
label.setClassName("creation-runtime-title");
|
||||
verticalLayout.add(label);
|
||||
verticalLayout.setClassName("content-action-logging");
|
||||
for (Fact fact : b.getRuleExecution().getThenFacts()) {
|
||||
if (fact != null && fact.getRealFact() != null) {
|
||||
|
||||
TextArea textArea = new TextArea(fact.getFactType().name() + "-" + fact.getFullClassName());
|
||||
textArea.setReadOnly(true);
|
||||
textArea.setClassName("content-log");
|
||||
try {
|
||||
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(fact.getRealFact());
|
||||
textArea.setValue(text);
|
||||
} catch (JsonProcessingException e) {
|
||||
textArea.setValue(
|
||||
fact.getRealFact().toString().replace(",", ",\n")
|
||||
.replace("\\{", "\\{\n")
|
||||
.replace("\\}", "\n\\}")
|
||||
.replace("\\[", "\n\\[")
|
||||
|
||||
);
|
||||
}
|
||||
verticalLayout.add(textArea);
|
||||
}
|
||||
}
|
||||
dialogPerso1.add(verticalLayout);
|
||||
}
|
||||
dialogPerso1.open();
|
||||
});
|
||||
horizontalLayout.add(thenFact);
|
||||
}
|
||||
if (runtimePersist.getOutputData() != null && runtimePersist.getOutputData().getRealFact() != null) {
|
||||
Button outputData = new Button("Output data");
|
||||
outputData.setClassName("menu-button");
|
||||
outputData.setEnabled(true);
|
||||
outputData.addClickListener(buttonClickEvent -> {
|
||||
DialogPerso dialogPerso1 = new DialogPerso();
|
||||
|
||||
BusinessTransactionAction b = runtimePersist;
|
||||
|
||||
if (b != null && b.getOutputData() != null && b.getOutputData().getRealFact() != null) {
|
||||
|
||||
VerticalLayout verticalLayout = new VerticalLayout();
|
||||
Label label = new Label(b.getEventType().name());
|
||||
label.setClassName("creation-runtime-title");
|
||||
verticalLayout.add(label);
|
||||
verticalLayout.setClassName("content-action-logging");
|
||||
|
||||
TextArea textArea = new TextArea(b.getOutputData().getFactType().name() + "-" + b.getOutputData().getFullClassName());
|
||||
textArea.setReadOnly(true);
|
||||
textArea.setClassName("content-log");
|
||||
try {
|
||||
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getOutputData().getRealFact());
|
||||
textArea.setValue(text);
|
||||
} catch (JsonProcessingException e) {
|
||||
textArea.setValue(
|
||||
b.getOutputData().getRealFact().toString().replace(",", ",\n")
|
||||
.replace("\\{", "\\{\n")
|
||||
.replace("\\}", "\n\\}")
|
||||
.replace("\\[", "\n\\[")
|
||||
|
||||
);
|
||||
}
|
||||
verticalLayout.add(textArea);
|
||||
|
||||
|
||||
dialogPerso1.add(verticalLayout);
|
||||
}
|
||||
|
||||
dialogPerso1.open();
|
||||
});
|
||||
horizontalLayout.add(outputData);
|
||||
}
|
||||
return horizontalLayout;
|
||||
})).setHeader("Action");
|
||||
setDataProvider(idRequest);
|
||||
}
|
||||
|
||||
private void refreshtGrid(String value, String type) {
|
||||
|
||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(), type));
|
||||
getDataProvider().refreshAll();
|
||||
}
|
||||
|
||||
private SerializablePredicate<BusinessTransactionAction> filterGrid(String value, String type) {
|
||||
SerializablePredicate<BusinessTransactionAction> columnPredicate = null;
|
||||
if (value.equals(" ") || type.equals(" ")) {
|
||||
columnPredicate = runtimePersist -> (true);
|
||||
} else {
|
||||
if (type.equals(strPositionExecution)) {
|
||||
columnPredicate = runtimePersist -> (String.valueOf(runtimePersist.getEventNumber()).equals(value));
|
||||
|
||||
} else if (type.equals(strEventType)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getEventType() != null && runtimePersist.getEventType().toString().toUpperCase().contains(value));
|
||||
|
||||
} else if (type.equals(strRuleName)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getRuleName() != null && runtimePersist.getRuleExecution().getRuleName().toUpperCase().contains(value));
|
||||
} else if (type.equals(strPackageName)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getPackageName() != null && runtimePersist.getRuleExecution().getPackageName().toUpperCase().contains(value));
|
||||
} else if (type.equals(strRuleFlowGroup)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getRuleflowGroupName() != null && runtimePersist.getRuleflowGroupName().toUpperCase().contains(value));
|
||||
}
|
||||
|
||||
}
|
||||
return columnPredicate;
|
||||
}
|
||||
|
||||
public void setDataProvider(String id) {
|
||||
|
||||
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(id, Sort.by(new Sort.Order(Sort.Direction.ASC, "eventNumber")), PageRequest.of(0, 5000));
|
||||
|
||||
if (businessTransactionPersistences != null) {
|
||||
dataProvider = new ListDataProvider<>(businessTransactionPersistences);
|
||||
|
||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
setDataProvider(filterDataProvider);
|
||||
|
||||
reinitFilter();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void reinitFilter() {
|
||||
positionExecution.setValue("");
|
||||
ruleName.setValue("");
|
||||
eventType.setValue("");
|
||||
packageName.setValue("");
|
||||
ruleFlowGroup.setValue("");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
import com.vaadin.flow.data.provider.ConfigurableFilterDataProvider;
|
||||
import com.vaadin.flow.data.provider.ListDataProvider;
|
||||
import com.vaadin.flow.data.renderer.ComponentRenderer;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import com.vaadin.flow.function.SerializablePredicate;
|
||||
import org.chtijbug.drools.console.service.IndexerService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class GridLogging extends Grid<BusinessTransactionPersistence> {
|
||||
|
||||
private TextField groupeId;
|
||||
|
||||
private TextField artefactId;
|
||||
|
||||
private TextField version;
|
||||
|
||||
private TextField containerId;
|
||||
|
||||
private TextField serverName;
|
||||
|
||||
private String strGroupeId ="GroupeId";
|
||||
|
||||
private String strArtefactId ="ArtefactId";
|
||||
|
||||
private String strVersion ="Version";
|
||||
|
||||
private String strContainerId ="ContainerId";
|
||||
|
||||
private String strServerName ="ServerName";
|
||||
|
||||
private ListDataProvider<BusinessTransactionPersistence> dataProvider;
|
||||
private ConfigurableFilterDataProvider<BusinessTransactionPersistence,Void,SerializablePredicate<BusinessTransactionPersistence>> filterDataProvider;
|
||||
|
||||
private transient IndexerService indexerService;
|
||||
|
||||
public GridLogging(){
|
||||
|
||||
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
|
||||
|
||||
setClassName("log-grid-perso");
|
||||
setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||
|
||||
|
||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||
return new Label(runtimePersist.getHour()+":"+runtimePersist.getMinute()+":"+runtimePersist.getMillis()+" ->"+runtimePersist.getDay()+"/"+runtimePersist.getMonth()+"/"+runtimePersist.getYear());
|
||||
})).setHeader("Date");
|
||||
|
||||
|
||||
Grid.Column<BusinessTransactionPersistence> transactionIdC=addColumn(runtimePersist -> runtimePersist.getTransactionId()).setHeader("TransactionId");
|
||||
|
||||
Grid.Column<BusinessTransactionPersistence> groupIdC=addColumn(runtimePersist -> runtimePersist.getGroupID());
|
||||
groupeId =new TextField(strGroupeId);
|
||||
groupeId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
groupeId.addValueChangeListener(e -> {
|
||||
refreshtGrid(groupeId.getValue(), strGroupeId);
|
||||
});
|
||||
groupIdC.setHeader(groupeId);
|
||||
|
||||
Grid.Column<BusinessTransactionPersistence> artefactIdC=addColumn(runtimePersist -> runtimePersist.getArtefactID());
|
||||
artefactId =new TextField(strArtefactId);
|
||||
artefactId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
artefactId.addValueChangeListener(e -> {
|
||||
refreshtGrid(artefactId.getValue(), strArtefactId);
|
||||
});
|
||||
artefactIdC.setHeader(artefactId);
|
||||
|
||||
Grid.Column<BusinessTransactionPersistence> containerIdC=addColumn(runtimePersist -> runtimePersist.getContainerId());
|
||||
containerId =new TextField(strContainerId);
|
||||
containerId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
containerId.addValueChangeListener(e -> {
|
||||
refreshtGrid(containerId.getValue(), strContainerId);
|
||||
});
|
||||
containerIdC.setHeader(containerId);
|
||||
|
||||
Grid.Column<BusinessTransactionPersistence> versionC=addColumn(runtimePersist -> runtimePersist.getVersion());
|
||||
version =new TextField(strVersion);
|
||||
version.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
version.addValueChangeListener(e -> {
|
||||
refreshtGrid(version.getValue(), strVersion);
|
||||
});
|
||||
versionC.setHeader(version);
|
||||
|
||||
Grid.Column<BusinessTransactionPersistence> serverNameC=addColumn(runtimePersist -> runtimePersist.getServerName());
|
||||
serverName =new TextField(strServerName);
|
||||
serverName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
serverName.addValueChangeListener(e -> {
|
||||
refreshtGrid(serverName.getValue(), strServerName);
|
||||
});
|
||||
serverNameC.setHeader(serverName);
|
||||
|
||||
setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(PageRequest.of(0,100)).getContent());
|
||||
}
|
||||
private void refreshtGrid(String value,String type){
|
||||
|
||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(),type));
|
||||
getDataProvider().refreshAll();
|
||||
}
|
||||
private SerializablePredicate<BusinessTransactionPersistence> filterGrid(String value, String type){
|
||||
SerializablePredicate<BusinessTransactionPersistence> columnPredicate = null;
|
||||
if(value.equals(" ")||type.equals(" ")){
|
||||
columnPredicate = runtimePersist -> (true);
|
||||
}else {
|
||||
if (type.equals(strGroupeId)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getGroupID()!=null&&runtimePersist.getGroupID().toUpperCase().contains(value));
|
||||
|
||||
}else if (type.equals(strArtefactId)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getArtefactID()!=null&&runtimePersist.getArtefactID().toUpperCase().contains(value));
|
||||
}else if (type.equals(strServerName)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getServerName()!=null&&runtimePersist.getServerName().toUpperCase().contains(value));
|
||||
}else if (type.equals(strVersion)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getVersion()!=null&&runtimePersist.getVersion().toUpperCase().contains(value));
|
||||
}else if (type.equals(strContainerId)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getContainerId()!=null&&runtimePersist.getContainerId().toUpperCase().contains(value));
|
||||
}
|
||||
}
|
||||
return columnPredicate;
|
||||
}
|
||||
|
||||
public void setDataProvider(List<BusinessTransactionPersistence> b){
|
||||
|
||||
|
||||
List<BusinessTransactionPersistence> businessTransactionPersistences=null;
|
||||
|
||||
if(b!=null) {
|
||||
|
||||
businessTransactionPersistences=new ArrayList<>(b);
|
||||
|
||||
Collections.sort(businessTransactionPersistences, new Comparator<BusinessTransactionPersistence>() {
|
||||
@Override
|
||||
public int compare(BusinessTransactionPersistence businessTransactionPersistence, BusinessTransactionPersistence t1) {
|
||||
|
||||
return indexerService.toDate(businessTransactionPersistence.getYear(), businessTransactionPersistence.getMonth(), businessTransactionPersistence.getDay(), businessTransactionPersistence.getHour(), businessTransactionPersistence.getMinute(), businessTransactionPersistence.getMillis()).compareTo(
|
||||
indexerService.toDate(t1.getYear(), t1.getMonth(), t1.getDay(), t1.getHour(), t1.getMinute(), t1.getMillis()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
dataProvider = new ListDataProvider<>(businessTransactionPersistences);
|
||||
|
||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
setDataProvider(filterDataProvider);
|
||||
|
||||
reinitFilter();
|
||||
|
||||
}
|
||||
}
|
||||
public void reinitFilter(){
|
||||
groupeId.setValue("");
|
||||
artefactId.setValue("");
|
||||
version.setValue("");
|
||||
containerId.setValue("");
|
||||
serverName.setValue("");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,203 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.component.grid.GridSelectionModel;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.notification.Notification;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
import com.vaadin.flow.data.provider.ConfigurableFilterDataProvider;
|
||||
import com.vaadin.flow.data.provider.ListDataProvider;
|
||||
import com.vaadin.flow.data.renderer.ComponentRenderer;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import com.vaadin.flow.function.SerializablePredicate;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.RuntimeService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GridRuntime extends Grid<RuntimePersist> {
|
||||
|
||||
private TextField runtimeName;
|
||||
|
||||
private TextField hostName;
|
||||
|
||||
private TextField branch;
|
||||
|
||||
private TextField version;
|
||||
|
||||
private TextField status;
|
||||
|
||||
private String strRuntimeName = "Runtime Name";
|
||||
|
||||
private String strHostName = "Hostname";
|
||||
|
||||
private String strBranch = "Branch";
|
||||
|
||||
private String strVersion = "Version";
|
||||
|
||||
private String strStatus = "State";
|
||||
|
||||
private List<RuntimePersist> runtimeSelected = new ArrayList<>();
|
||||
|
||||
private transient ProjectPersistService projectPersistService;
|
||||
private transient RuntimeService runtimeService;
|
||||
|
||||
private ListDataProvider<RuntimePersist> dataProvider;
|
||||
private ConfigurableFilterDataProvider<RuntimePersist, Void, SerializablePredicate<RuntimePersist>> filterDataProvider;
|
||||
|
||||
private ProjectPersist projectPersist = null;
|
||||
private GridSelectionModel<RuntimePersist> selectionModel;
|
||||
|
||||
public GridRuntime(ProjectPersist projectPersist) {
|
||||
this.projectPersist = projectPersist;
|
||||
init();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public GridRuntime() {
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
projectPersistService = AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
runtimeService = AppContext.getApplicationContext().getBean(RuntimeService.class);
|
||||
|
||||
setClassName("deployment-grid-perso");
|
||||
selectionModel = setSelectionMode(SelectionMode.MULTI);
|
||||
selectionModel.deselectAll();
|
||||
Grid.Column<RuntimePersist> runtimeNameCo = addColumn(runtimePersist -> runtimePersist.getServerName());
|
||||
runtimeName = new TextField(strRuntimeName);
|
||||
runtimeName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
runtimeName.addValueChangeListener(e -> {
|
||||
refreshtGrid(runtimeName.getValue(), strRuntimeName);
|
||||
});
|
||||
runtimeNameCo.setHeader(runtimeName);
|
||||
|
||||
Grid.Column<RuntimePersist> hostnameCo = addColumn(runtimePersist -> runtimePersist.getServerUrl());
|
||||
hostName = new TextField(strHostName);
|
||||
hostName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
hostName.addValueChangeListener(e -> {
|
||||
refreshtGrid(hostName.getValue(), strHostName);
|
||||
});
|
||||
hostnameCo.setHeader(hostName);
|
||||
|
||||
Grid.Column<RuntimePersist> versionCo = addColumn(runtimePersist -> runtimePersist.getVersion());
|
||||
version = new TextField(strVersion);
|
||||
version.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
version.addValueChangeListener(e -> {
|
||||
refreshtGrid(version.getValue(), strVersion);
|
||||
});
|
||||
versionCo.setHeader(version);
|
||||
Grid.Column<RuntimePersist> statusCo = addColumn(runtimePersist -> runtimePersist.getBranch());
|
||||
branch = new TextField(strBranch);
|
||||
branch.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
branch.addValueChangeListener(e -> {
|
||||
refreshtGrid(branch.getValue(), strBranch);
|
||||
});
|
||||
statusCo.setHeader(branch);
|
||||
|
||||
Grid.Column<RuntimePersist> branchCo = addColumn(runtimePersist -> runtimePersist.getStatus());
|
||||
status = new TextField(strStatus);
|
||||
status.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
status.addValueChangeListener(e -> {
|
||||
refreshtGrid(status.getValue(), strVersion);
|
||||
});
|
||||
branchCo.setHeader(status);
|
||||
|
||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||
List<String> serverList = new ArrayList<>();
|
||||
serverList.add(runtimePersist.getServerName());
|
||||
List<ProjectPersist> projectPersists = projectPersistService.getProjectRepository().findByServerNamesIn(serverList);
|
||||
|
||||
Label label = new Label(projectPersists != null ? projectPersists.size() + "" : "0");
|
||||
|
||||
return label;
|
||||
})).setHeader("associated projects");
|
||||
setDataProvider();
|
||||
}
|
||||
|
||||
private void refreshtGrid(String value, String type) {
|
||||
|
||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(), type));
|
||||
getDataProvider().refreshAll();
|
||||
}
|
||||
|
||||
private SerializablePredicate<RuntimePersist> filterGrid(String value, String type) {
|
||||
SerializablePredicate<RuntimePersist> columnPredicate = null;
|
||||
if (value.equals(" ") || type.equals(" ")) {
|
||||
columnPredicate = runtimePersist -> (true);
|
||||
} else {
|
||||
if (type.equals(strHostName)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getServerUrl() != null && runtimePersist.getServerUrl().toUpperCase().contains(value));
|
||||
|
||||
} else if (type.equals(strRuntimeName)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getServerName() != null && runtimePersist.getServerName().toUpperCase().contains(value));
|
||||
|
||||
} else if (type.equals(strVersion)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getVersion() != null && runtimePersist.getVersion().toUpperCase().contains(value));
|
||||
}
|
||||
}
|
||||
return columnPredicate;
|
||||
}
|
||||
|
||||
public List<RuntimePersist> getRuntimeSelected() {
|
||||
return runtimeSelected;
|
||||
}
|
||||
|
||||
public void setDataProvider() {
|
||||
|
||||
List<RuntimePersist> runtimePersists = runtimeService.getRuntimeRepository().findAll();
|
||||
|
||||
if (runtimePersists != null) {
|
||||
Map<String, String> urlMap = new HashMap<>();
|
||||
List<RuntimePersist> runtimeToShow = new ArrayList<>();
|
||||
for (RuntimePersist runtimePersist : runtimePersists) {
|
||||
if (urlMap.containsKey(runtimePersist.getServerName()) == false) {
|
||||
|
||||
urlMap.put(runtimePersist.getServerName(), runtimePersist.getServerUrl());
|
||||
RuntimePersist runtimePersist1 = runtimePersist.duplicate();
|
||||
if (projectPersist != null) {
|
||||
List<String> serverList = new ArrayList<>();
|
||||
serverList.add(runtimePersist.getServerName());
|
||||
List<ProjectPersist> projectPersists = projectPersistService.getProjectRepository().findByServerNamesIn(serverList);
|
||||
if (projectPersist.getServerNames().contains(runtimePersist.getServerName())
|
||||
|| projectPersists.size() == 0) {
|
||||
runtimeToShow.add(runtimePersist1);
|
||||
if (projectPersist.getServerNames().contains(runtimePersist1.getServerName())) {
|
||||
selectionModel.select(runtimePersist1);
|
||||
runtimeSelected.add(runtimePersist);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
runtimeToShow.add(runtimePersist1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dataProvider = new ListDataProvider<>(runtimeToShow);
|
||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
setDataProvider(filterDataProvider);
|
||||
for (RuntimePersist runtimePersist : dataProvider.getItems()) {
|
||||
if (projectPersist!= null && projectPersist.getServerNames().contains(runtimePersist.getServerName())) {
|
||||
selectionModel.select(runtimePersist);
|
||||
}
|
||||
}
|
||||
|
||||
reinitFilter();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void reinitFilter() {
|
||||
hostName.setValue("");
|
||||
version.setValue("");
|
||||
runtimeName.setValue("");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview.service;
|
||||
|
||||
import com.vaadin.flow.data.binder.Binder;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.AssetEdit;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.ColumnDefinition;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.DecisionTable;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.GuidedException;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.Row;
|
||||
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class GuidedDecisionTableModelTransformer {
|
||||
|
||||
private GuidedDecisionTable52 model;
|
||||
|
||||
private Binder binder;
|
||||
|
||||
private AssetEdit assetEdit;
|
||||
|
||||
public GuidedDecisionTableModelTransformer(GuidedDecisionTable52 model, Binder binder, AssetEdit assetEdit) {
|
||||
this.model = model;
|
||||
this.binder = binder;
|
||||
this.assetEdit = assetEdit;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
DecisionTable decisionTable = new DecisionTable(model);
|
||||
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
||||
if (!columnDefinition.isHideColumn()) {
|
||||
assetEdit.addColumn(hashmap -> hashmap.get(columnDefinition.getHeader())).setHeader(columnDefinition.getHeader());
|
||||
}
|
||||
}
|
||||
fillTable(decisionTable);
|
||||
} catch (GuidedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void fillTable(DecisionTable decisionTable) {
|
||||
List<HashMap<String, Object>> rows = new ArrayList<>();
|
||||
for (int i = 0; i < decisionTable.getRows().size(); i++) {
|
||||
Row row = decisionTable.getRows().get(i);
|
||||
HashMap<String, Object> newRow = new HashMap<>();
|
||||
rows.add(newRow);
|
||||
int k = 0;
|
||||
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
||||
newRow.put(columnDefinition.getHeader(), row.getRowElements().get(k).getValue());
|
||||
k++;
|
||||
}
|
||||
}
|
||||
assetEdit.setItems(rows);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.componentview.service;
|
||||
|
||||
import com.vaadin.flow.data.binder.Binder;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.AssetEdit;
|
||||
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
||||
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class GuidedRuleTemplateModelTransformer {
|
||||
|
||||
private TemplateModel model;
|
||||
|
||||
private Binder binder;
|
||||
|
||||
private AssetEdit assetEdit;
|
||||
|
||||
public GuidedRuleTemplateModelTransformer(TemplateModel model, Binder binder,AssetEdit assetEdit) {
|
||||
this.model = model;
|
||||
this.binder = binder;
|
||||
this.assetEdit = assetEdit;
|
||||
}
|
||||
public void run(){
|
||||
InterpolationVariable[] variablesList = model.getInterpolationVariablesList();
|
||||
for (InterpolationVariable i : variablesList) {
|
||||
assetEdit.addColumn(hashmap -> hashmap.get(i.getVarName())).setHeader(i.getVarName());
|
||||
}
|
||||
fillTable(model);
|
||||
}
|
||||
private void fillTable(TemplateModel model) {
|
||||
InterpolationVariable[] variablesList = model.getInterpolationVariablesList();
|
||||
String[][] contenuTable = model.getTableAsArray();
|
||||
List<HashMap<String, Object>> rows = new ArrayList<>();
|
||||
for (int i = 0; i < model.getRowsCount(); i++) {
|
||||
HashMap<String, Object> newRow = new HashMap<>();
|
||||
rows.add(newRow);
|
||||
String[] ligne = contenuTable[i];
|
||||
int k = 0;
|
||||
for (InterpolationVariable j : variablesList) {
|
||||
newRow.put(j.getVarName(), ligne[k]);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
assetEdit.setItems(rows);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,226 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Pymma Software
|
||||
*
|
||||
* 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.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||
|
||||
|
||||
import org.drools.workbench.models.guided.dtable.shared.model.*;
|
||||
import org.kie.soup.project.datamodel.oracle.DataType;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* Date: 26/04/12
|
||||
* Time: 14:29
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class ColumnDefinition {
|
||||
private int columnNumber;
|
||||
private ColumnType columnType;
|
||||
private boolean hideColumn;
|
||||
private boolean hasDefaultValue;
|
||||
private String defaultValue;
|
||||
private String fieldType;
|
||||
private String header;
|
||||
private RowNumberCol52 rowNumberCol52;
|
||||
private DescriptionCol52 descriptionCol52;
|
||||
private AttributeCol52 attributeCol52;
|
||||
private ConditionCol52 conditionCol52;
|
||||
private ActionInsertFactCol52 actionInsertFact52;
|
||||
private DTCellValue52 defaultValueCell;
|
||||
private ActionSetFieldCol52 actionSetFieldCol52;
|
||||
|
||||
public ColumnDefinition(int columnNumber, RowNumberCol52 rowNumberCol52) {
|
||||
this.columnNumber = columnNumber;
|
||||
this.columnType = ColumnType.ROW_NUMBER;
|
||||
this.fieldType = DataType.TYPE_NUMERIC_INTEGER;
|
||||
this.rowNumberCol52 = rowNumberCol52;
|
||||
this.header = rowNumberCol52.getHeader();
|
||||
}
|
||||
|
||||
public ColumnDefinition(int columnNumber, DescriptionCol52 descriptionCol52) {
|
||||
this.columnNumber = columnNumber;
|
||||
this.columnType = ColumnType.DESCRIPTION;
|
||||
this.header = descriptionCol52.getHeader();
|
||||
this.fieldType = DataType.TYPE_STRING;
|
||||
this.descriptionCol52 = descriptionCol52;
|
||||
}
|
||||
|
||||
public ColumnDefinition(int columnNumber, AttributeCol52 attributeCol52) {
|
||||
this.attributeCol52 = attributeCol52;
|
||||
this.columnNumber = columnNumber;
|
||||
this.columnType = ColumnType.ATTRIBUTE;
|
||||
this.fieldType = DataType.TYPE_STRING;
|
||||
if (attributeCol52.getDefaultValue() != null) {
|
||||
this.hasDefaultValue = true;
|
||||
this.defaultValueCell = attributeCol52.getDefaultValue();
|
||||
this.defaultValue = getValue(attributeCol52.getDefaultValue());
|
||||
}
|
||||
this.header = attributeCol52.getHeader();
|
||||
this.hideColumn = attributeCol52.isHideColumn();
|
||||
}
|
||||
|
||||
public ColumnDefinition(int columnNumber, ConditionCol52 conditionCol52) {
|
||||
this.conditionCol52 = conditionCol52;
|
||||
this.columnNumber = columnNumber;
|
||||
this.columnType = ColumnType.CONDITION;
|
||||
this.fieldType = conditionCol52.getFieldType();
|
||||
if (conditionCol52.getDefaultValue() != null) {
|
||||
this.hasDefaultValue = true;
|
||||
this.defaultValue = getValue(conditionCol52.getDefaultValue());
|
||||
}
|
||||
this.hideColumn = conditionCol52.isHideColumn();
|
||||
this.header = conditionCol52.getHeader();
|
||||
}
|
||||
|
||||
public ColumnDefinition(int columnNumber, ActionSetFieldCol52 actionSetFieldCol52) {
|
||||
this.actionSetFieldCol52 = actionSetFieldCol52;
|
||||
this.columnNumber = columnNumber;
|
||||
this.columnType = ColumnType.ACTION;
|
||||
this.fieldType = actionSetFieldCol52.getType();
|
||||
this.header = actionSetFieldCol52.getHeader();
|
||||
if (actionSetFieldCol52.getDefaultValue() != null
|
||||
&& !(DataType.DataTypes.STRING.equals(actionSetFieldCol52.getDefaultValue().getDataType()) && actionSetFieldCol52.getDefaultValue().getStringValue().isEmpty())) {
|
||||
this.hasDefaultValue = true;
|
||||
this.defaultValue = getValue(actionSetFieldCol52.getDefaultValue());
|
||||
|
||||
}
|
||||
this.hideColumn = actionSetFieldCol52.isHideColumn();
|
||||
this.header = actionSetFieldCol52.getHeader();
|
||||
}
|
||||
|
||||
public ColumnDefinition(int columnNumber, ActionInsertFactCol52 actionInsertFact52) {
|
||||
this.actionInsertFact52 = actionInsertFact52;
|
||||
this.columnNumber = columnNumber;
|
||||
this.columnType = ColumnType.ACTION;
|
||||
this.fieldType = actionInsertFact52.getType();
|
||||
this.header = actionInsertFact52.getHeader();
|
||||
if (actionInsertFact52.getDefaultValue() != null
|
||||
&& !(DataType.DataTypes.STRING.equals(actionInsertFact52.getDefaultValue().getDataType()) && actionInsertFact52.getDefaultValue().getStringValue().isEmpty())) {
|
||||
this.hasDefaultValue = true;
|
||||
this.defaultValue = getValue(actionInsertFact52.getDefaultValue());
|
||||
|
||||
}
|
||||
this.hideColumn = actionInsertFact52.isHideColumn();
|
||||
this.header = actionInsertFact52.getHeader();
|
||||
}
|
||||
|
||||
public static String getValue(DTCellValue52 cell) {
|
||||
String value = null;
|
||||
switch (cell.getDataType()) {
|
||||
case BOOLEAN:
|
||||
value = Boolean.toString(cell.getBooleanValue());
|
||||
break;
|
||||
case NUMERIC_BIGDECIMAL:
|
||||
if (cell.getNumericValue() != null) {
|
||||
value = cell.getNumericValue().toString();
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
break;
|
||||
case NUMERIC:
|
||||
if (cell.getNumericValue() != null) {
|
||||
value = cell.getNumericValue().toString();
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
break;
|
||||
case NUMERIC_INTEGER:
|
||||
if (cell.getNumericValue() != null) {
|
||||
value = cell.getNumericValue().toString();
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
break;
|
||||
case NUMERIC_DOUBLE:
|
||||
if (cell.getNumericValue() != null) {
|
||||
value = cell.getNumericValue().toString();
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
break;
|
||||
case STRING:
|
||||
value = cell.getStringValue();
|
||||
break;
|
||||
case DATE:
|
||||
if (cell.getDateValue() != null) {
|
||||
value = cell.getDateValue().toString();
|
||||
} else {
|
||||
value = "";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/**
|
||||
* STRING,
|
||||
NUMERIC,
|
||||
NUMERIC_BIGDECIMAL,
|
||||
NUMERIC_BIGINTEGER,
|
||||
NUMERIC_BYTE,
|
||||
NUMERIC_DOUBLE,
|
||||
NUMERIC_FLOAT,
|
||||
NUMERIC_INTEGER,
|
||||
NUMERIC_LONG,
|
||||
NUMERIC_SHORT,
|
||||
DATE,
|
||||
BOOLEAN
|
||||
*/
|
||||
return value;
|
||||
}
|
||||
|
||||
public int getColumnNumber() {
|
||||
return columnNumber;
|
||||
}
|
||||
|
||||
public ColumnType getColumnDefinition() {
|
||||
return columnType;
|
||||
}
|
||||
|
||||
public boolean isHideColumn() {
|
||||
return hideColumn;
|
||||
}
|
||||
|
||||
public boolean isHasDefaultValue() {
|
||||
return hasDefaultValue;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public AttributeCol52 getAttributeCol52() {
|
||||
return attributeCol52;
|
||||
}
|
||||
|
||||
public ConditionCol52 getPattern52() {
|
||||
return conditionCol52;
|
||||
}
|
||||
|
||||
public ActionInsertFactCol52 getActionInsertFact52() {
|
||||
return actionInsertFact52;
|
||||
}
|
||||
|
||||
public String getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public String getHeader() {
|
||||
return header;
|
||||
}
|
||||
|
||||
public void setHeader(String header) {
|
||||
this.header = header;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Pymma Software
|
||||
*
|
||||
* 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.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* Date: 26/04/12
|
||||
* Time: 14:31
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public enum ColumnType {
|
||||
ROW_NUMBER, DESCRIPTION, ATTRIBUTE, CONDITION, ACTION
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Pymma Software
|
||||
*
|
||||
* 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.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||
|
||||
|
||||
import org.drools.workbench.models.guided.dtable.shared.model.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DecisionTable {
|
||||
private String name;
|
||||
private GuidedDecisionTable52 guidedDecisionTable52;
|
||||
private List<ColumnDefinition> columnDefinitionList = new ArrayList<>();
|
||||
private List<Row> rows = new ArrayList<>();
|
||||
|
||||
public DecisionTable(GuidedDecisionTable52 guidedDecisionTable52) throws GuidedException {
|
||||
this.guidedDecisionTable52 = guidedDecisionTable52;
|
||||
this.name = this.guidedDecisionTable52.getTableName();
|
||||
ColumnDefinition rowNumberColumn = new ColumnDefinition(0, guidedDecisionTable52.getRowNumberCol());
|
||||
rowNumberColumn.setHeader("ID");
|
||||
columnDefinitionList.add(rowNumberColumn);
|
||||
ColumnDefinition descriptionColumn = new ColumnDefinition(1, guidedDecisionTable52.getDescriptionCol());
|
||||
descriptionColumn.setHeader("Description");
|
||||
columnDefinitionList.add(descriptionColumn);
|
||||
int columnNumber = 2;
|
||||
for (AttributeCol52 attributeCol52 : this.guidedDecisionTable52.getAttributeCols()) {
|
||||
ColumnDefinition columnDefinition = new ColumnDefinition(columnNumber, attributeCol52);
|
||||
columnDefinition.setHeader(attributeCol52.getAttribute());
|
||||
columnDefinitionList.add(columnDefinition);
|
||||
columnNumber++;
|
||||
|
||||
}
|
||||
for (Pattern52 pattern52 : this.guidedDecisionTable52.getPatterns()) {
|
||||
for (ConditionCol52 conditionCol52 : pattern52.getChildColumns()) {
|
||||
ColumnDefinition columnDefinition = new ColumnDefinition(columnNumber, conditionCol52);
|
||||
columnDefinitionList.add(columnDefinition);
|
||||
columnNumber++;
|
||||
}
|
||||
}
|
||||
for (ActionCol52 actionCol52 : this.guidedDecisionTable52.getActionCols()) {
|
||||
if (actionCol52 instanceof ActionInsertFactCol52) {
|
||||
ActionInsertFactCol52 actionInsertFactCol52 = (ActionInsertFactCol52) actionCol52;
|
||||
ColumnDefinition columnDefinition = new ColumnDefinition(columnNumber, actionInsertFactCol52);
|
||||
columnDefinitionList.add(columnDefinition);
|
||||
columnNumber++;
|
||||
}else if (actionCol52 instanceof ActionSetFieldCol52){
|
||||
ActionSetFieldCol52 actionSetFieldCol52 = (ActionSetFieldCol52) actionCol52;
|
||||
ColumnDefinition columnDefinition = new ColumnDefinition(columnNumber, actionSetFieldCol52);
|
||||
columnDefinitionList.add(columnDefinition);
|
||||
columnNumber++;
|
||||
}
|
||||
}
|
||||
for (List<DTCellValue52> line : this.guidedDecisionTable52.getData()) {
|
||||
try {
|
||||
Row newRow = new Row(line, this);
|
||||
rows.add(newRow);
|
||||
} catch (GuidedException e) {
|
||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||
e.setClassName("DecisionTable.Constructor");
|
||||
e.setAttribute("Data");
|
||||
e.setValue(line.toString());
|
||||
throw chtijbugDroolsRestException;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Row createEmptyRow(int rowNumber) throws GuidedException {
|
||||
for (int j = rowNumber; j < this.rows.size(); j++) {
|
||||
this.rows.get(j).updateRowNumber(j + 1);
|
||||
}
|
||||
Row newRow = new Row(this, rowNumber);
|
||||
rows.add(newRow);
|
||||
this.guidedDecisionTable52.getData().add(newRow.getCellValue52List());
|
||||
return newRow;
|
||||
}
|
||||
|
||||
private void removeRow(int rowNumber) throws GuidedException {
|
||||
rows.remove(rowNumber);
|
||||
this.guidedDecisionTable52.getData().remove(rowNumber);
|
||||
for (int j = rowNumber; j < this.rows.size(); j++) {
|
||||
this.rows.get(j).updateRowNumber(j);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearAllData() {
|
||||
this.guidedDecisionTable52.getData().clear();
|
||||
this.getRows().clear();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public GuidedDecisionTable52 getGuidedDecisionTable52() {
|
||||
return guidedDecisionTable52;
|
||||
}
|
||||
|
||||
public List<ColumnDefinition> getColumnDefinitionList() {
|
||||
return columnDefinitionList;
|
||||
}
|
||||
|
||||
public List<Row> getRows() {
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Pymma Software
|
||||
*
|
||||
* 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.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||
|
||||
public class GuidedException extends Exception {
|
||||
private String className;
|
||||
private String attribute;
|
||||
private String value;
|
||||
|
||||
public GuidedException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
public GuidedException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public String getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
public void setAttribute(String attribute) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Pymma Software
|
||||
*
|
||||
* 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.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||
|
||||
import org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Row {
|
||||
private DecisionTable decisionTable;
|
||||
private List<RowElement> rowElements = new ArrayList<>();
|
||||
private List<DTCellValue52> cellValue52List;
|
||||
|
||||
|
||||
protected Row(DecisionTable decisionTable, int rowNumber) throws GuidedException {
|
||||
this.decisionTable = decisionTable;
|
||||
this.cellValue52List = new ArrayList<>();
|
||||
for (ColumnDefinition col : this.decisionTable.getColumnDefinitionList()) {
|
||||
RowElement newRowElement = new RowElement(col);
|
||||
this.cellValue52List.add(newRowElement.getDtCellValue52());
|
||||
if (col.getColumnNumber() == 0) {
|
||||
try {
|
||||
String newString = String.valueOf(rowNumber);
|
||||
newRowElement.setValue(newString);
|
||||
} catch (Exception e) {
|
||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||
chtijbugDroolsRestException.setClassName("Row");
|
||||
chtijbugDroolsRestException.setValue(decisionTable.toString());
|
||||
chtijbugDroolsRestException.setAttribute("protected Row(DecisionTable decisionTable,int rowNumber) throws ChtijbugDroolsRestException");
|
||||
throw chtijbugDroolsRestException;
|
||||
}
|
||||
}
|
||||
this.addRowElement(newRowElement);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected Row(List<DTCellValue52> cellValue52List, DecisionTable decisionTable) throws GuidedException {
|
||||
this.decisionTable = decisionTable;
|
||||
this.cellValue52List = cellValue52List;
|
||||
for (ColumnDefinition col : this.decisionTable.getColumnDefinitionList()) {
|
||||
RowElement newRowElement = new RowElement(col, cellValue52List.get(col.getColumnNumber()));
|
||||
this.addRowElement(newRowElement);
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateRowNumber(int newRowNumber) throws GuidedException {
|
||||
RowElement rowNumberElement = rowElements.get(0);
|
||||
try {
|
||||
rowNumberElement.setValue(String.valueOf(newRowNumber));
|
||||
} catch (Exception e) {
|
||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||
chtijbugDroolsRestException.setAttribute("protected void updateRowNumber(int newRowNumber) throws ChtijbugDroolsRestExceptio");
|
||||
chtijbugDroolsRestException.setClassName("Row");
|
||||
throw chtijbugDroolsRestException;
|
||||
}
|
||||
}
|
||||
|
||||
public List<RowElement> getRowElements() {
|
||||
return rowElements;
|
||||
}
|
||||
|
||||
public void addRowElement(RowElement newRowElement) {
|
||||
this.rowElements.add(newRowElement);
|
||||
}
|
||||
|
||||
public List<DTCellValue52> getCellValue52List() {
|
||||
return cellValue52List;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Pymma Software
|
||||
*
|
||||
* 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.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||
|
||||
|
||||
import org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52;
|
||||
import org.kie.soup.project.datamodel.oracle.DataType;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* Date: 26/04/12
|
||||
* Time: 14:47
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class RowElement {
|
||||
private static String rowEelement ="RowElement";
|
||||
|
||||
private ColumnDefinition columnDefinition;
|
||||
private String value = "";
|
||||
private DTCellValue52 dtCellValue52;
|
||||
|
||||
|
||||
|
||||
public RowElement(ColumnDefinition columnDefinition, DTCellValue52 dtCellValue52) throws GuidedException {
|
||||
this.columnDefinition = columnDefinition;
|
||||
this.dtCellValue52 = dtCellValue52;
|
||||
this.value = ColumnDefinition.getValue(this.dtCellValue52);
|
||||
}
|
||||
|
||||
public RowElement(ColumnDefinition columnDefinition) throws GuidedException {
|
||||
this.columnDefinition = columnDefinition;
|
||||
this.dtCellValue52 = new DTCellValue52();
|
||||
|
||||
if (this.columnDefinition.isHasDefaultValue()) {
|
||||
this.value = this.columnDefinition.getDefaultValue();
|
||||
if (this.columnDefinition.getColumnDefinition() == ColumnType.ROW_NUMBER) {
|
||||
int rowNumber = Integer.parseInt(value);
|
||||
this.dtCellValue52.setNumericValue(rowNumber + 1);
|
||||
this.value = value;
|
||||
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.DESCRIPTION) {
|
||||
this.dtCellValue52.setStringValue(value);
|
||||
|
||||
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.ATTRIBUTE) {
|
||||
this.dtCellValue52.setStringValue(value);
|
||||
try {
|
||||
setValuedtCell(this.value);
|
||||
} catch (Exception e) {
|
||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||
chtijbugDroolsRestException.setClassName(rowEelement);
|
||||
chtijbugDroolsRestException.setAttribute(this.columnDefinition.toString());
|
||||
chtijbugDroolsRestException.setValue(this.value);
|
||||
throw chtijbugDroolsRestException;
|
||||
}
|
||||
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.CONDITION) {
|
||||
try {
|
||||
setValuedtCell(this.value);
|
||||
} catch (Exception e) {
|
||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||
chtijbugDroolsRestException.setClassName(rowEelement);
|
||||
chtijbugDroolsRestException.setAttribute(this.columnDefinition.toString());
|
||||
chtijbugDroolsRestException.setValue(this.value);
|
||||
throw chtijbugDroolsRestException;
|
||||
}
|
||||
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.ACTION) {
|
||||
try {
|
||||
setValuedtCell(this.value);
|
||||
} catch (Exception e) {
|
||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||
chtijbugDroolsRestException.setClassName(rowEelement);
|
||||
chtijbugDroolsRestException.setAttribute(this.columnDefinition.toString());
|
||||
chtijbugDroolsRestException.setValue(this.value);
|
||||
throw chtijbugDroolsRestException;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) throws Exception {
|
||||
this.value = value;
|
||||
setValuedtCell(value);
|
||||
}
|
||||
|
||||
public ColumnDefinition getColumnDefinition() {
|
||||
return columnDefinition;
|
||||
}
|
||||
|
||||
public DTCellValue52 getDtCellValue52() {
|
||||
return dtCellValue52;
|
||||
}
|
||||
|
||||
private void setValuedtCell(String aValue) throws Exception {
|
||||
if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_STRING)) {
|
||||
this.dtCellValue52.setStringValue(aValue);
|
||||
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_BIGDECIMAL)) {
|
||||
this.dtCellValue52.setNumericValue(new BigDecimal(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_BIGINTEGER)) {
|
||||
this.dtCellValue52.setNumericValue(new BigInteger(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_BYTE)) {
|
||||
this.dtCellValue52.setNumericValue(Byte.parseByte(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_DOUBLE)) {
|
||||
this.dtCellValue52.setNumericValue( Double.parseDouble(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase("DOUBLE")) {
|
||||
this.dtCellValue52.setNumericValue(Double.parseDouble(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_FLOAT)) {
|
||||
this.dtCellValue52.setNumericValue(Float.parseFloat(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_INTEGER)) {
|
||||
this.dtCellValue52.setNumericValue(Integer.parseInt(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_LONG)) {
|
||||
this.dtCellValue52.setNumericValue( Long.parseLong(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_SHORT)) {
|
||||
this.dtCellValue52.setNumericValue(Short.parseShort(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_DATE)) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat();
|
||||
Date newDate = sdf.parse(aValue);
|
||||
this.dtCellValue52.setDateValue(newDate);
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_BOOLEAN)) {
|
||||
this.dtCellValue52.setBooleanValue( Boolean.parseBoolean(aValue));
|
||||
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC)) {
|
||||
this.dtCellValue52.setNumericValue( Double.parseDouble(aValue));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.notification.Notification;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import org.chtijbug.drools.console.service.IndexerService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.TextFieldPerso;
|
||||
import org.chtijbug.drools.console.view.ActionLoggingView;
|
||||
import org.chtijbug.drools.console.view.LoggingView;
|
||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ActionLogging extends VerticalLayout {
|
||||
private static String active="active";
|
||||
|
||||
private Button viewAction;
|
||||
|
||||
private TextFieldPerso transactionIdSearch;
|
||||
|
||||
private transient IndexerService indexerService;
|
||||
|
||||
public ActionLogging(LoggingView loggingView){
|
||||
|
||||
indexerService= AppContext.getApplicationContext().getBean(IndexerService.class);
|
||||
|
||||
setClassName("leftMenu-global-action");
|
||||
|
||||
transactionIdSearch=new TextFieldPerso("Search by TransactionId","",VaadinIcon.SEARCH.create());
|
||||
transactionIdSearch.getTextField().setValueChangeMode(ValueChangeMode.EAGER);
|
||||
transactionIdSearch.getTextField().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
||||
|
||||
try {
|
||||
|
||||
if (textFieldStringComponentValueChangeEvent.getValue().isEmpty()) {
|
||||
loggingView.getTitle().setText("Logging : ");
|
||||
loggingView.getGridLogging().setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(PageRequest.of(0, 100)).getContent());
|
||||
} else {
|
||||
List<BusinessTransactionPersistence> b = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(textFieldStringComponentValueChangeEvent.getValue(), PageRequest.of(0, 100));
|
||||
|
||||
if (b != null) {
|
||||
loggingView.getTitle().setText("Logging : " + textFieldStringComponentValueChangeEvent.getValue());
|
||||
loggingView.getGridLogging().setDataProvider(b);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
transactionIdSearch.getTextField().setValue("");
|
||||
Notification.show("Valeur invalide");
|
||||
}
|
||||
});
|
||||
add(transactionIdSearch);
|
||||
|
||||
viewAction =new Button("View Details", VaadinIcon.INFO.create());
|
||||
viewAction.setClassName("leftMenu-global-button");
|
||||
viewAction.setEnabled(false);
|
||||
|
||||
add(viewAction);
|
||||
|
||||
viewAction.addClickListener(buttonClickEvent -> {
|
||||
active(viewAction);
|
||||
|
||||
BusinessTransactionPersistence b=loggingView.getGridLogging().getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(b!=null) {
|
||||
DialogPerso dialog = new DialogPerso();
|
||||
|
||||
dialog.add(new ActionLoggingView(b,dialog));
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains(active);
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains(active)){
|
||||
button.getClassNames().remove(active);
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(viewAction);
|
||||
button.getClassNames().add(active);
|
||||
}
|
||||
|
||||
public Button getViewAction() {
|
||||
return viewAction;
|
||||
}
|
||||
|
||||
public void setViewAction(Button viewAction) {
|
||||
this.viewAction = viewAction;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.middle.JwtService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.AssociateProjectKie;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.DefineProject;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
|
||||
public class DeploymentAction extends VerticalLayout {
|
||||
|
||||
|
||||
private Button definirProject;
|
||||
|
||||
private Button associateKieServer;
|
||||
|
||||
private Button deployer;
|
||||
|
||||
private ProjectPersistService projectPersistService;
|
||||
private DeploymentView deploymentView;
|
||||
|
||||
public DeploymentAction(SqueletteComposant squeletteComposant,DeploymentView deploymentView){
|
||||
setClassName("leftMenu-global-action");
|
||||
this.deploymentView=deploymentView;
|
||||
projectPersistService= AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
|
||||
definirProject =new Button("Define your project", VaadinIcon.CODE.create());
|
||||
definirProject.setClassName("leftMenu-global-button");
|
||||
definirProject.setEnabled(false);
|
||||
add(definirProject);
|
||||
definirProject.addClickListener(buttonClickEvent -> {
|
||||
active(definirProject);
|
||||
|
||||
ProjectPersist projectPersist=deploymentView.getProjectPersistGrid().getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(projectPersist!=null) {
|
||||
DialogPerso dialog = new DialogPerso();
|
||||
dialog.add(new DefineProject(deploymentView,dialog,projectPersist));
|
||||
dialog.open();
|
||||
}
|
||||
});
|
||||
|
||||
associateKieServer =new Button("Associate project/Kie Server", VaadinIcon.RETWEET.create());
|
||||
associateKieServer.setClassName("leftMenu-global-button");
|
||||
associateKieServer.setEnabled(false);
|
||||
add(associateKieServer);
|
||||
associateKieServer.addClickListener(buttonClickEvent -> {
|
||||
active(associateKieServer);
|
||||
|
||||
ProjectPersist projectPersist=deploymentView.getProjectPersistGrid().getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(projectPersist!=null) {
|
||||
DialogPerso dialog = new DialogPerso();
|
||||
dialog.add(new AssociateProjectKie(deploymentView,dialog,projectPersist));
|
||||
dialog.open();
|
||||
}
|
||||
});
|
||||
|
||||
deployer =new Button("Deploy", VaadinIcon.EXTERNAL_LINK.create());
|
||||
deployer.setClassName("leftMenu-global-button");
|
||||
deployer.setEnabled(false);
|
||||
add(deployer);
|
||||
deployer.addClickListener(buttonClickEvent -> {
|
||||
active(deployer);
|
||||
|
||||
ProjectPersist projectPersist=deploymentView.getProjectPersistGrid().getSelectedItems().stream().findFirst().get();
|
||||
if(projectPersist!=null) {
|
||||
squeletteComposant.getConsoleDeploy().setTtile(projectPersist.getDeploymentName());
|
||||
projectPersistService.deployer(projectPersist,deploymentView,getUI().get());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(definirProject);
|
||||
removeActive(associateKieServer);
|
||||
removeActive(deployer);
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
|
||||
public Button getDefinirProject() {
|
||||
return definirProject;
|
||||
}
|
||||
|
||||
public void setDefinirProject(Button definirProject) {
|
||||
this.definirProject = definirProject;
|
||||
}
|
||||
|
||||
public Button getAssociateKieServer() {
|
||||
return associateKieServer;
|
||||
}
|
||||
|
||||
public void setAssociateKieServer(Button associateKieServer) {
|
||||
this.associateKieServer = associateKieServer;
|
||||
}
|
||||
|
||||
public Button getDeployer() {
|
||||
return deployer;
|
||||
}
|
||||
|
||||
public void setDeployer(Button deployer) {
|
||||
this.deployer = deployer;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
|
||||
public class RuntimesAction extends VerticalLayout {
|
||||
|
||||
// private Button addRuntime;
|
||||
|
||||
|
||||
public RuntimesAction(SqueletteComposant squeletteComposant){
|
||||
|
||||
setClassName("leftMenu-global-action");
|
||||
|
||||
/**
|
||||
addRuntime=new Button("add runtime", VaadinIcon.PLUS.create());
|
||||
addRuntime.setClassName("leftMenu-global-button");
|
||||
add(addRuntime);
|
||||
|
||||
DialogPerso dialog=new DialogPerso();
|
||||
dialog.add(new AddRuntime(dialog,squeletteComposant));
|
||||
|
||||
addRuntime.addClickListener(buttonClickEvent -> {
|
||||
active(addRuntime);
|
||||
|
||||
dialog.open();
|
||||
});
|
||||
**/
|
||||
}
|
||||
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
// removeActive(addRuntime);
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.ComboBoxPerso;
|
||||
import org.chtijbug.drools.console.view.TemplateView;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class TemplatesAction extends VerticalLayout {
|
||||
|
||||
private Button refresh;
|
||||
|
||||
private Button duplicate;
|
||||
|
||||
private Button edit;
|
||||
|
||||
private ComboBoxPerso<ProjectPersist> spaceSelection;
|
||||
|
||||
private ProjectPersistService projectPersistService;
|
||||
|
||||
public TemplatesAction(TemplateView templateView){
|
||||
|
||||
setClassName("leftMenu-global-action");
|
||||
projectPersistService = AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
Map<String, ProjectPersist> map = projectPersistService.findProjectsConnectedUser();
|
||||
|
||||
spaceSelection = new ComboBoxPerso<>("Project",VaadinIcon.SEARCH.create());
|
||||
spaceSelection.getComboBox().setItems(map.values());
|
||||
spaceSelection.getComboBox().setItemLabelGenerator(ProjectPersist::getKieProjectName);
|
||||
|
||||
spaceSelection.getComboBox().addValueChangeListener(valueChangeEvent -> {
|
||||
templateView.setDataProvider(spaceSelection.getComboBox());
|
||||
});
|
||||
add(spaceSelection);
|
||||
|
||||
|
||||
refresh =new Button("Refresh", VaadinIcon.ROTATE_LEFT.create());
|
||||
refresh.setClassName("leftMenu-global-button");
|
||||
add(refresh);
|
||||
refresh.addClickListener(buttonClickEvent -> {
|
||||
active(refresh);
|
||||
templateView.refreshList(spaceSelection.getComboBox());
|
||||
});
|
||||
|
||||
duplicate =new Button("Duplicate",VaadinIcon.TOOLS.create());
|
||||
duplicate.setClassName("leftMenu-global-button");
|
||||
duplicate.setEnabled(false);
|
||||
add(duplicate);
|
||||
duplicate.addClickListener(buttonClickEvent -> {
|
||||
active(duplicate);
|
||||
templateView.duplicate();
|
||||
|
||||
});
|
||||
edit =new Button("Edit",VaadinIcon.EDIT.create());
|
||||
edit.setEnabled(false);
|
||||
edit.setClassName("leftMenu-global-button");
|
||||
add(edit);
|
||||
edit.addClickListener(buttonClickEvent -> {
|
||||
active(edit);
|
||||
templateView.edit(spaceSelection.getComboBox());
|
||||
});
|
||||
}
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(refresh);
|
||||
removeActive(duplicate);
|
||||
removeActive(edit);
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
public Button getRefresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public void setRefresh(Button refresh) {
|
||||
this.refresh = refresh;
|
||||
}
|
||||
|
||||
public Button getDuplicate() {
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
public void setDuplicate(Button duplicate) {
|
||||
this.duplicate = duplicate;
|
||||
}
|
||||
|
||||
public Button getEdit() {
|
||||
return edit;
|
||||
}
|
||||
|
||||
public void setEdit(Button edit) {
|
||||
this.edit = edit;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.leftMenu;
|
||||
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.html.Image;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.server.InputStreamFactory;
|
||||
import com.vaadin.flow.server.StreamResource;
|
||||
import org.chtijbug.drools.console.service.RuntimeService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class InformationStructure extends VerticalLayout {
|
||||
|
||||
private Label nomPage;
|
||||
|
||||
private Label numberProject;
|
||||
|
||||
private Label numberKieWb;
|
||||
|
||||
private Label numberKieServer;
|
||||
|
||||
private Image logo;
|
||||
|
||||
private String strProject="Number of projects : ";
|
||||
|
||||
private String strKieWb="Number of kie-workbench : ";
|
||||
|
||||
private String strKieServer="Number of Kie-Server : ";
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
public InformationStructure(){
|
||||
|
||||
userConnectedService= AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
runtimeService=AppContext.getApplicationContext().getBean(RuntimeService.class);
|
||||
|
||||
setClassName("leftMenu-global-infoStructure-content");
|
||||
|
||||
VerticalLayout verticalLayout=new VerticalLayout();
|
||||
verticalLayout.setClassName("leftMenu-global-infoStrcutre-contentTitre");
|
||||
add(verticalLayout);
|
||||
|
||||
nomPage=new Label("Accueil");
|
||||
nomPage.setClassName("leftMenu-global-inforStructure-titre");
|
||||
verticalLayout.add(nomPage);
|
||||
|
||||
InputStreamFactory inputStreamFactory=new InputStreamFactory() {
|
||||
@Override
|
||||
public InputStream createInputStream() {
|
||||
return getClass().getResourceAsStream("/images/book.png");
|
||||
}
|
||||
};
|
||||
|
||||
StreamResource str=new StreamResource("logo",inputStreamFactory);
|
||||
|
||||
logo=new Image(str,"");
|
||||
logo.setClassName("leftMenu-global-inforStructure-logo");
|
||||
add(logo);
|
||||
|
||||
VerticalLayout verticalLayout1=new VerticalLayout();
|
||||
verticalLayout1.setClassName("leftMenu-global-inforStructure-content-label");
|
||||
add(verticalLayout1);
|
||||
|
||||
numberKieServer=new Label(strKieServer+"0");
|
||||
numberKieServer.setClassName("leftMenu-global-inforStructure-label");
|
||||
verticalLayout1.add(numberKieServer);
|
||||
|
||||
List<RuntimePersist> runtimePersists=runtimeService.getRuntimeRepository().findAll();
|
||||
|
||||
actualiseKieServer(runtimePersists.size());
|
||||
|
||||
numberKieWb=new Label(strKieWb+"0");
|
||||
numberKieWb.setClassName("leftMenu-global-inforStructure-label");
|
||||
verticalLayout1.add(numberKieWb);
|
||||
|
||||
numberProject=new Label(strProject+"0");
|
||||
numberProject.setClassName("leftMenu-global-inforStructure-label");
|
||||
verticalLayout1.add(numberProject);
|
||||
actualiseProject(userConnectedService.getUserConnected().getProjectResponses().size());
|
||||
}
|
||||
|
||||
public void actualiseKieWb(Integer numberOfKieWb){
|
||||
numberKieWb.setText(strKieWb+numberOfKieWb);
|
||||
}
|
||||
public void actualiseKieServer(Integer numberOfKieServer){
|
||||
numberKieServer.setText(strKieServer+numberOfKieServer);
|
||||
}
|
||||
public void actualiseProject(Integer numberOfProject){
|
||||
numberProject.setText(strProject+numberOfProject);
|
||||
}
|
||||
|
||||
public Label getNomPage() {
|
||||
return nomPage;
|
||||
}
|
||||
|
||||
public void setNomPage(Label nomPage) {
|
||||
this.nomPage = nomPage;
|
||||
}
|
||||
|
||||
public Label getNumberProject() {
|
||||
return numberProject;
|
||||
}
|
||||
|
||||
public Label getNumberKieWb() {
|
||||
return numberKieWb;
|
||||
}
|
||||
|
||||
public Label getNumberKieServer() {
|
||||
return numberKieServer;
|
||||
}
|
||||
|
||||
public Image getLogo() {
|
||||
return logo;
|
||||
}
|
||||
|
||||
public void setLogo(Image logo) {
|
||||
this.logo = logo;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.leftMenu;
|
||||
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.html.Anchor;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class LeftMenuGlobal extends VerticalLayout {
|
||||
|
||||
private Boolean visibility=true;
|
||||
|
||||
private InformationStructure informationStructure;
|
||||
|
||||
private VerticalLayout contentAction;
|
||||
|
||||
|
||||
public LeftMenuGlobal(){
|
||||
|
||||
setClassName("leftMenu-global-content");
|
||||
|
||||
informationStructure=new InformationStructure();
|
||||
add(informationStructure);
|
||||
|
||||
contentAction=new VerticalLayout();
|
||||
contentAction.setClassName("leftMenu-content-action");
|
||||
add(contentAction);
|
||||
|
||||
|
||||
HorizontalLayout horizontalLayout=new HorizontalLayout();
|
||||
horizontalLayout.setClassName("leftMenu-global-infoEntreprise");
|
||||
add(horizontalLayout);
|
||||
|
||||
Anchor aproposFooter=new Anchor("https://pymma-software.heron-software.com/","A propos");
|
||||
aproposFooter.setClassName("footer-button");
|
||||
horizontalLayout.add(aproposFooter);
|
||||
|
||||
Anchor contactFooter=new Anchor("https://pymma-software.heron-software.com/contact","Contact");
|
||||
contactFooter.setClassName("footer-button");
|
||||
horizontalLayout.add(contactFooter);
|
||||
|
||||
}
|
||||
|
||||
public InformationStructure getInformationStructure() {
|
||||
return informationStructure;
|
||||
}
|
||||
|
||||
public void setInformationStructure(InformationStructure informationStructure) {
|
||||
this.informationStructure = informationStructure;
|
||||
}
|
||||
|
||||
public VerticalLayout getContentAction() {
|
||||
return contentAction;
|
||||
}
|
||||
|
||||
public void setContentAction(VerticalLayout contentAction) {
|
||||
this.contentAction = contentAction;
|
||||
}
|
||||
|
||||
public Boolean getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(Boolean visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.login;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.data.binder.Binder;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.util.PasswordValidator;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.PasswordFieldPerso;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.TextFieldPerso;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class FormulaireComposant extends VerticalLayout {
|
||||
|
||||
//Composant
|
||||
|
||||
private Label title;
|
||||
|
||||
private TextFieldPerso username;
|
||||
|
||||
private PasswordFieldPerso password;
|
||||
|
||||
private Button login;
|
||||
|
||||
private Button forgotPassword;
|
||||
|
||||
//METIER
|
||||
|
||||
private Binder<UserConnected> userConnectedBinder;
|
||||
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
private KieConfigurationData configKie;
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
private ProjectPersistService projectPersistService;
|
||||
|
||||
public FormulaireComposant(){
|
||||
|
||||
projectPersistService=AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
kieRepositoryService= AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
configKie= AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
userConnectedService=AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
|
||||
setClassName("login-application-layout");
|
||||
|
||||
userConnectedBinder=new Binder<>();
|
||||
userConnectedBinder.setBean(new UserConnected());
|
||||
|
||||
//FORMULAIRE
|
||||
|
||||
title=new Label("Sign in ");
|
||||
title.setClassName("login-application-title");
|
||||
add(title);
|
||||
|
||||
username=new TextFieldPerso("Username","", VaadinIcon.USER.create());
|
||||
username.getTextField().setValueChangeMode(ValueChangeMode.EAGER);
|
||||
username.getTextField().addValueChangeListener(textFieldStringComponentValueChangeEvent -> verifyValidity());
|
||||
userConnectedBinder.forField(username.getTextField())
|
||||
.bind(
|
||||
userConnected -> userConnected.getUserName(),
|
||||
(userConnected, s) -> userConnected.setUserName(s));
|
||||
|
||||
add(username);
|
||||
|
||||
password=new PasswordFieldPerso("Password", VaadinIcon.PASSWORD.create());
|
||||
password.getPasswordField().setValueChangeMode(ValueChangeMode.EAGER);
|
||||
password.getPasswordField().addValueChangeListener(textFieldStringComponentValueChangeEvent -> verifyValidity());
|
||||
userConnectedBinder.forField(password.getPasswordField())
|
||||
.withValidator(new PasswordValidator("Ce n'est pas un password valide"))
|
||||
.bind(
|
||||
userConnected -> userConnected.getUserPassword(),
|
||||
(userConnected, s) -> userConnected.setUserPassword(s));
|
||||
|
||||
|
||||
|
||||
add(password);
|
||||
|
||||
forgotPassword=new Button("Forgot password?");
|
||||
forgotPassword.setClassName("footer-button");
|
||||
add(forgotPassword);
|
||||
|
||||
login=new Button("Connexion");
|
||||
login.setEnabled(false);
|
||||
login.setClassName("login-application-connexion");
|
||||
login.addClickListener(buttonClickEvent ->{
|
||||
Boolean test=connexion();
|
||||
|
||||
if(test){
|
||||
getUI().get().navigate("accueil");
|
||||
}else {
|
||||
login.setEnabled(false);
|
||||
username.getTextField().setValue("");
|
||||
password.getPasswordField().setValue("");
|
||||
}
|
||||
});
|
||||
add(login);
|
||||
if (configKie.getPassword()!= null) {
|
||||
password.getPasswordField().setValue(configKie.getPassword());
|
||||
}
|
||||
if (configKie.getUserName()!= null) {
|
||||
username.getTextField().setValue(configKie.getUserName());
|
||||
}
|
||||
|
||||
}
|
||||
public void verifyValidity(){
|
||||
if(!username.getTextField().isInvalid()&&username.getTextField().getValue()!=null&&!username.getTextField().isEmpty()&&
|
||||
!password.getPasswordField().isInvalid()&&password.getPasswordField().getValue()!=null&&!password.getPasswordField().isEmpty()){
|
||||
login.setEnabled(true);
|
||||
}else {
|
||||
login.setEnabled(false);
|
||||
}
|
||||
}
|
||||
public boolean connexion(){
|
||||
UserConnected connected = kieRepositoryService.login(
|
||||
configKie.getKiewbUrl(),
|
||||
userConnectedBinder.getBean().getUserName(),
|
||||
userConnectedBinder.getBean().getUserPassword(),
|
||||
configKie.getName());
|
||||
|
||||
if(connected!=null) {
|
||||
connected.setConnected(true);
|
||||
userConnectedService.addUserToSession(connected);
|
||||
//projectPersistService.saveIfnotExist(connected.getProjectResponses(),configKie.getName());
|
||||
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Label getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(Label title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public TextFieldPerso getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(TextFieldPerso username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public PasswordFieldPerso getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(PasswordFieldPerso password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Button getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public void setLogin(Button login) {
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
public Button getForgotPassword() {
|
||||
return forgotPassword;
|
||||
}
|
||||
|
||||
public void setForgotPassword(Button forgotPassword) {
|
||||
this.forgotPassword = forgotPassword;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.login;
|
||||
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class FormulaireInfoComposant extends VerticalLayout {
|
||||
|
||||
public Label title;
|
||||
|
||||
public Label paragraphe;
|
||||
|
||||
public FormulaireInfoComposant(){
|
||||
|
||||
setClassName("login-application-layout-FormulaireInfo");
|
||||
|
||||
title=new Label("How to connect?");
|
||||
title.setClassName("login-application-layout-FormulaireInfo-Title");
|
||||
add(title);
|
||||
|
||||
paragraphe=new Label("To access this application, make sure you already have an account on the kie-workbench");
|
||||
paragraphe.setClassName("login-application-layout-FormulaireInfo-Paragraphe");
|
||||
add(paragraphe);
|
||||
}
|
||||
|
||||
public Label getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(Label title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public Label getParagraphe() {
|
||||
return paragraphe;
|
||||
}
|
||||
|
||||
public void setParagraphe(Label paragraphe) {
|
||||
this.paragraphe = paragraphe;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.login;
|
||||
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class LoginComponent extends HorizontalLayout {
|
||||
|
||||
private FormulaireComposant layoutLeft;
|
||||
|
||||
private FormulaireInfoComposant layoutRight;
|
||||
|
||||
public LoginComponent(){
|
||||
|
||||
setClassName("login-formulaire-globalLayout");
|
||||
|
||||
layoutLeft=new FormulaireComposant();
|
||||
layoutRight=new FormulaireInfoComposant();
|
||||
|
||||
add(layoutLeft);
|
||||
add(layoutRight);
|
||||
}
|
||||
|
||||
public FormulaireComposant getLayoutLeft() {
|
||||
return layoutLeft;
|
||||
}
|
||||
|
||||
public void setLayoutLeft(FormulaireComposant layoutLeft) {
|
||||
this.layoutLeft = layoutLeft;
|
||||
}
|
||||
|
||||
public FormulaireInfoComposant getLayoutRight() {
|
||||
return layoutRight;
|
||||
}
|
||||
|
||||
public void setLayoutRight(FormulaireInfoComposant layoutRight) {
|
||||
this.layoutRight = layoutRight;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.login;
|
||||
|
||||
import com.vaadin.flow.component.checkbox.Checkbox;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class TextInfoComponent extends VerticalLayout {
|
||||
|
||||
private Label title;
|
||||
|
||||
private HorizontalLayout separator;
|
||||
|
||||
|
||||
public TextInfoComponent(){
|
||||
|
||||
setClassName("login-layout-textInfo");
|
||||
|
||||
title=new Label("Drools kie-platform");
|
||||
title.setClassName("login-title");
|
||||
add(title);
|
||||
|
||||
separator=new HorizontalLayout();
|
||||
separator.setClassName("separator");
|
||||
add(separator);
|
||||
|
||||
add(row("Dynamic management of kie-servers"));
|
||||
add(row("Facilitates the process drools as a whole"));
|
||||
|
||||
}
|
||||
|
||||
public HorizontalLayout row(String text){
|
||||
|
||||
HorizontalLayout horizontalLayout=new HorizontalLayout();
|
||||
horizontalLayout.setClassName("login-textInfo-layoutContent");
|
||||
|
||||
Checkbox checkbox=new Checkbox();
|
||||
checkbox.setValue(true);
|
||||
checkbox.setEnabled(false);
|
||||
horizontalLayout.add(checkbox);
|
||||
checkbox.setClassName("login-textInfo-button");
|
||||
|
||||
Label label=new Label(text);
|
||||
horizontalLayout.add(label);
|
||||
label.setClassName("login-textInfo-paragraph");
|
||||
|
||||
return horizontalLayout;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,256 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.html.Image;
|
||||
import com.vaadin.flow.component.icon.Icon;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.server.InputStreamFactory;
|
||||
import com.vaadin.flow.server.StreamResource;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class MenuPrincipal extends HorizontalLayout {
|
||||
|
||||
//COMPONENT
|
||||
|
||||
private Image logo;
|
||||
|
||||
private Button deployement;
|
||||
|
||||
private Button assets;
|
||||
|
||||
private Button runtimes;
|
||||
|
||||
private Button infoUser;
|
||||
|
||||
private Button hamburger;
|
||||
|
||||
private Button logging;
|
||||
|
||||
//METIER
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
public MenuPrincipal(SqueletteComposant squeletteComposant){
|
||||
|
||||
userConnectedService= AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
boolean isAdmin=false;
|
||||
if (userConnectedService.getUserConnected().getRoles() != null
|
||||
&& userConnectedService.getUserConnected().getRoles().contains("admin")){
|
||||
isAdmin=true;
|
||||
}
|
||||
addClassName("menu-principal-menubar-content");
|
||||
|
||||
InputStreamFactory inputStreamFactory=new InputStreamFactory() {
|
||||
@Override
|
||||
public InputStream createInputStream() {
|
||||
return getClass().getResourceAsStream("/images/pymma.png");
|
||||
}
|
||||
};
|
||||
|
||||
StreamResource str=new StreamResource("logo",inputStreamFactory);
|
||||
|
||||
logo=new Image(str,"");
|
||||
logo.setClassName("menu-principal-logoPresentation");
|
||||
|
||||
Icon icon=VaadinIcon.MENU.create();
|
||||
icon.setClassName("icon-menuPrincipal");
|
||||
|
||||
|
||||
hamburger=new Button("",icon);
|
||||
hamburger.setClassName("hamburger");
|
||||
add(hamburger);
|
||||
|
||||
hamburger.addClickListener(buttonClickEvent -> {
|
||||
if(squeletteComposant.getLeftMenuGlobal().getVisibility()) {
|
||||
squeletteComposant.getLeftMenuGlobal().setVisible(false);
|
||||
squeletteComposant.getLeftMenuGlobal().setVisibility(false);
|
||||
}else {
|
||||
squeletteComposant.getLeftMenuGlobal().setVisible(true);
|
||||
squeletteComposant.getLeftMenuGlobal().setVisibility(true);
|
||||
}
|
||||
});
|
||||
|
||||
deployement=new Button("Artifact");
|
||||
deployement.setClassName("menu-principal-button");
|
||||
add(deployement);
|
||||
deployement.addClickListener(buttonClickEvent -> {
|
||||
|
||||
if(!isActive(deployement)) {
|
||||
active(deployement);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(true);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(false);
|
||||
|
||||
}else {
|
||||
removeActive(deployement);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(false);
|
||||
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
assets=new Button("Assets");
|
||||
assets.setClassName("menu-principal-button");
|
||||
add(assets);
|
||||
assets.addClickListener(buttonClickEvent -> {
|
||||
|
||||
if(!isActive(assets)) {
|
||||
active(assets);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(true);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(false);
|
||||
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(false);
|
||||
|
||||
}else {
|
||||
removeActive(assets);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(false);
|
||||
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
runtimes=new Button("Runtimes");
|
||||
runtimes.setClassName("menu-principal-button");
|
||||
add(runtimes);
|
||||
runtimes.addClickListener(buttonClickEvent -> {
|
||||
|
||||
if(!isActive(runtimes)) {
|
||||
active(runtimes);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(false);
|
||||
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(true);
|
||||
}else {
|
||||
removeActive(runtimes);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
logging=new Button("Logging");
|
||||
logging.setClassName("menu-principal-button");
|
||||
add(logging);
|
||||
logging.addClickListener(buttonClickEvent -> {
|
||||
|
||||
if(!isActive(logging)) {
|
||||
active(logging);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(true);
|
||||
|
||||
}else {
|
||||
removeActive(logging);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
add(logo);
|
||||
|
||||
infoUser=new Button(userConnectedService.getUserConnected().getUserName(), VaadinIcon.USER.create());
|
||||
infoUser.setClassName("menu-principal-button-user");
|
||||
infoUser.addClickListener(buttonClickEvent -> {
|
||||
if(!isActive(infoUser)) {
|
||||
active(infoUser);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(true);
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(false);
|
||||
|
||||
}else {
|
||||
removeActive(infoUser);
|
||||
squeletteComposant.getMenuScondaireDeployement().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireInfoUser().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireAssets().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireRuntime().setVisible(false);
|
||||
squeletteComposant.getMenuSecondaireLogging().setVisible(false);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
add(infoUser);
|
||||
|
||||
}
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(infoUser);
|
||||
removeActive(deployement);
|
||||
removeActive(assets);
|
||||
removeActive(runtimes);
|
||||
removeActive(logging);
|
||||
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
|
||||
public Image getLogo() {
|
||||
return logo;
|
||||
}
|
||||
|
||||
public void setLogo(Image logo) {
|
||||
this.logo = logo;
|
||||
}
|
||||
|
||||
public Button getDeployement() {
|
||||
return deployement;
|
||||
}
|
||||
|
||||
public void setDeployement(Button deployement) {
|
||||
this.deployement = deployement;
|
||||
}
|
||||
|
||||
public Button getInfoUser() {
|
||||
return infoUser;
|
||||
}
|
||||
|
||||
public void setInfoUser(Button infoUser) {
|
||||
this.infoUser = infoUser;
|
||||
}
|
||||
|
||||
public UserConnectedService getUserConnectedService() {
|
||||
return userConnectedService;
|
||||
}
|
||||
|
||||
public void setUserConnectedService(UserConnectedService userConnectedService) {
|
||||
this.userConnectedService = userConnectedService;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.DeploymentAction;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class MenuScondaireDeployement extends HorizontalLayout {
|
||||
|
||||
private Button deployment;
|
||||
|
||||
public MenuScondaireDeployement(SqueletteComposant squeletteComposant){
|
||||
setVisible(false);
|
||||
|
||||
setClassName("menu-secondaire-content");
|
||||
|
||||
|
||||
deployment =new Button("Deployment",VaadinIcon.EJECT.create());
|
||||
deployment.setClassName("menu-secondaire-button");
|
||||
add(deployment);
|
||||
deployment.addClickListener(buttonClickEvent -> {
|
||||
if(!isActive(deployment)) {
|
||||
active(deployment);
|
||||
}
|
||||
DeploymentView deploymentView=new DeploymentView(squeletteComposant);
|
||||
|
||||
DeploymentAction deploymentAction=new DeploymentAction(squeletteComposant,deploymentView);
|
||||
deploymentView.setDeploymentAction(deploymentAction);
|
||||
squeletteComposant.navigate(deploymentView,DeploymentView.PAGE_NAME,deploymentAction);
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(deployment);
|
||||
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
|
||||
public Button getDeployment() {
|
||||
return deployment;
|
||||
}
|
||||
|
||||
public void setDeployment(Button deployment) {
|
||||
this.deployment = deployment;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.TemplatesAction;
|
||||
import org.chtijbug.drools.console.view.TemplateView;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class MenuSecondaireAssets extends HorizontalLayout {
|
||||
|
||||
private Button assetsView;
|
||||
|
||||
public MenuSecondaireAssets(SqueletteComposant squeletteComposant){
|
||||
setVisible(false);
|
||||
|
||||
setClassName("menu-secondaire-content");
|
||||
|
||||
assetsView =new Button("Templates",VaadinIcon.ARCHIVE.create());
|
||||
assetsView.setClassName("menu-secondaire-button");
|
||||
add(assetsView);
|
||||
assetsView.addClickListener(buttonClickEvent -> {
|
||||
if(!isActive(assetsView)) {
|
||||
active(assetsView);
|
||||
}
|
||||
TemplateView templateView=new TemplateView();
|
||||
TemplatesAction templatesAction=new TemplatesAction(templateView);
|
||||
templateView.setTemplatesAction(templatesAction);
|
||||
squeletteComposant.navigate(templateView,TemplateView.PAGE_NAME,templatesAction);
|
||||
});
|
||||
}
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(assetsView);
|
||||
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class MenuSecondaireInfoUser extends HorizontalLayout {
|
||||
|
||||
private Button infoUser;
|
||||
|
||||
private Button disconnect;
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
public MenuSecondaireInfoUser() {
|
||||
setVisible(false);
|
||||
|
||||
userConnectedService= AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
|
||||
setClassName("menu-secondaire-content");
|
||||
|
||||
infoUser=new Button("Information User", VaadinIcon.INFO.create());
|
||||
infoUser.setClassName("menu-secondaire-button");
|
||||
add(infoUser);
|
||||
|
||||
disconnect=new Button("Disconnect",VaadinIcon.SIGN_OUT.create());
|
||||
disconnect.setClassName("menu-secondaire-button");
|
||||
disconnect.addClickListener(buttonClickEvent -> {
|
||||
userConnectedService.disconnect();
|
||||
getUI().get().navigate("");
|
||||
});
|
||||
add(disconnect);
|
||||
|
||||
}
|
||||
|
||||
public Button getInfoUser() {
|
||||
return infoUser;
|
||||
}
|
||||
|
||||
public void setInfoUser(Button infoUser) {
|
||||
this.infoUser = infoUser;
|
||||
}
|
||||
|
||||
public Button getDisconnect() {
|
||||
return disconnect;
|
||||
}
|
||||
|
||||
public void setDisconnect(Button disconnect) {
|
||||
this.disconnect = disconnect;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.ActionLogging;
|
||||
import org.chtijbug.drools.console.view.LoggingView;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class MenuSecondaireLogging extends HorizontalLayout {
|
||||
private static String active="active";
|
||||
|
||||
private Button logging;
|
||||
|
||||
public MenuSecondaireLogging(SqueletteComposant squeletteComposant){
|
||||
setVisible(false);
|
||||
|
||||
setClassName("menu-secondaire-content");
|
||||
|
||||
|
||||
logging =new Button("Gestion-logging", VaadinIcon.OFFICE.create());
|
||||
logging.setClassName("menu-secondaire-button");
|
||||
add(logging);
|
||||
logging.addClickListener(buttonClickEvent -> {
|
||||
if(!isActive(logging)) {
|
||||
active(logging);
|
||||
}
|
||||
LoggingView loggingView=new LoggingView();
|
||||
|
||||
ActionLogging actionLogging=new ActionLogging(loggingView);
|
||||
loggingView.setActionLogging(actionLogging);
|
||||
squeletteComposant.navigate(loggingView,LoggingView.PAGE_NAME,actionLogging);
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains(active);
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains(active)){
|
||||
button.getClassNames().remove(active);
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(logging);
|
||||
|
||||
button.getClassNames().add(active);
|
||||
}
|
||||
|
||||
public Button getLogging() {
|
||||
return logging;
|
||||
}
|
||||
|
||||
public void setLogging(Button logging) {
|
||||
this.logging = logging;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.RuntimesAction;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
import org.chtijbug.drools.console.view.RuntimesView;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class MenuSecondaireRuntime extends HorizontalLayout {
|
||||
|
||||
private Button gestionRuntime;
|
||||
|
||||
public MenuSecondaireRuntime(SqueletteComposant squeletteComposant){
|
||||
setVisible(false);
|
||||
|
||||
setClassName("menu-secondaire-content");
|
||||
|
||||
|
||||
gestionRuntime =new Button("Gestion", VaadinIcon.OUTBOX.create());
|
||||
gestionRuntime.setClassName("menu-secondaire-button");
|
||||
add(gestionRuntime);
|
||||
gestionRuntime.addClickListener(buttonClickEvent -> {
|
||||
if(!isActive(gestionRuntime)) {
|
||||
active(gestionRuntime);
|
||||
}
|
||||
RuntimesView deploymentView=new RuntimesView();
|
||||
RuntimesAction deploymentAction=new RuntimesAction(squeletteComposant);
|
||||
squeletteComposant.navigate(deploymentView,DeploymentView.PAGE_NAME,deploymentAction);
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(gestionRuntime);
|
||||
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
|
||||
public Button getGestionRuntime() {
|
||||
return gestionRuntime;
|
||||
}
|
||||
|
||||
public void setGestionRuntime(Button gestionRuntime) {
|
||||
this.gestionRuntime = gestionRuntime;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
import com.vaadin.flow.component.dependency.HtmlImport;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.page.Push;
|
||||
import com.vaadin.flow.router.BeforeEnterEvent;
|
||||
import com.vaadin.flow.router.BeforeEnterObserver;
|
||||
import com.vaadin.flow.router.Route;
|
||||
import com.vaadin.flow.shared.communication.PushMode;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Push(PushMode.AUTOMATIC)
|
||||
@StyleSheet("css/accueil.css")
|
||||
@HtmlImport("frontend://styles/shared-styles.html")
|
||||
@Route("accueil")
|
||||
public class AccueilView extends SqueletteComposant implements BeforeEnterObserver {
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeEnter(BeforeEnterEvent beforeEnterEvent) {
|
||||
|
||||
if (getUserConnectedService().getUserConnected()==null) {
|
||||
beforeEnterEvent.rerouteTo(LoginView.class);
|
||||
Optional<UI> theUI = UI.getCurrent().getUI();
|
||||
if (theUI.isPresent()) {
|
||||
theUI.get().getPage().executeJavaScript("window.alert($0)", "Session expiré, veuillez-vous reconnecter");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.helger.commons.csv.CSVWriter;
|
||||
import com.vaadin.flow.component.html.Anchor;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.server.StreamResource;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.chtijbug.drools.console.service.IndexerService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.GridActionLogging;
|
||||
import org.chtijbug.drools.logging.Fact;
|
||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
||||
import org.chtijbug.drools.proxy.persistence.model.EventType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ActionLoggingView extends VerticalLayout {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ActionLoggingView.class);
|
||||
|
||||
private transient IndexerService indexerService;
|
||||
|
||||
private Label title;
|
||||
|
||||
private GridActionLogging gridActionLogging;
|
||||
|
||||
private String uniqueID;
|
||||
private String dbID;
|
||||
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public ActionLoggingView(BusinessTransactionPersistence businessTransactionPersistence, DialogPerso dialogPerso) {
|
||||
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
|
||||
dialogPerso.getClose().setVisible(false);
|
||||
this.uniqueID = businessTransactionPersistence.getTransactionId();
|
||||
this.dbID = businessTransactionPersistence.getId();
|
||||
if (this.uniqueID==null){
|
||||
this.uniqueID=this.dbID;
|
||||
}
|
||||
title = new Label("TransactionID : " + businessTransactionPersistence.getTransactionId() + "--" + businessTransactionPersistence.getId());
|
||||
title.setClassName("creation-runtime-title");
|
||||
|
||||
add(title);
|
||||
|
||||
|
||||
gridActionLogging = new GridActionLogging(businessTransactionPersistence.getId());
|
||||
Anchor anchor = new Anchor(new StreamResource(uniqueID.trim().toLowerCase()+".csv", this::getInputStream), "Export as CSV");
|
||||
anchor.getElement().setAttribute("download", true);
|
||||
add(gridActionLogging, anchor);
|
||||
}
|
||||
|
||||
private InputStream getInputStream() {
|
||||
try {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
|
||||
CSVWriter csvWriter = new CSVWriter(stringWriter);
|
||||
csvWriter.setSeparatorChar(';');
|
||||
csvWriter.writeNext("start", "end", "eventtype", "position", "rulename", "package", "ruleflowgroup", "processID", "IOData", "when", "then");
|
||||
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(dbID, Sort.by(new Sort.Order(Sort.Direction.ASC, "eventNumber")), PageRequest.of(0, 5000));
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
for (BusinessTransactionAction c : businessTransactionPersistences) {
|
||||
|
||||
String ruleName = "";
|
||||
String packageName = "";
|
||||
String beginDate = "";
|
||||
String endDate = "";
|
||||
String inputData = "";
|
||||
String outputData = "";
|
||||
if (c.getInputData() != null) {
|
||||
inputData = mapper.writeValueAsString(c.getInputData().getRealFact());
|
||||
}
|
||||
if (c.getOutputData() != null) {
|
||||
outputData = mapper.writeValueAsString(c.getOutputData().getRealFact());
|
||||
}
|
||||
if (c.getRuleExecution() != null) {
|
||||
ruleName = c.getRuleExecution().getRuleName();
|
||||
packageName = c.getRuleExecution().getPackageName();
|
||||
beginDate = simpleDateFormat.format(c.getRuleExecution().getStartDate());
|
||||
endDate = simpleDateFormat.format(c.getRuleExecution().getEndDate());
|
||||
}
|
||||
if (c.getEventType().equals(EventType.INPUT)) {
|
||||
csvWriter.writeNext("", "", c.getEventType().name(), String.valueOf(c.getEventNumber()), "", "", "", "", "", "", "",c.getInputData().getFullClassName(),inputData);
|
||||
} else if (c.getEventType().equals(EventType.OUPUT)) {
|
||||
csvWriter.writeNext("", "", c.getEventType().name(), String.valueOf(c.getEventNumber()), "", "", "", "", "", "", "",c.getOutputData().getFullClassName(),outputData);
|
||||
} else if (c.getEventType().equals(EventType.STARTPROCESS)) {
|
||||
csvWriter.writeNext("", "", c.getEventType().name(), String.valueOf(c.getEventNumber()), "", "", "", "", "", "", "");
|
||||
} else if (c.getEventType().equals(EventType.STOPPROCESS)) {
|
||||
csvWriter.writeNext("", "", c.getEventType().name(), String.valueOf(c.getEventNumber()), "", "", "", "", "", "", "");
|
||||
} else if (c.getEventType().equals(EventType.STARTRULEFLOWGROUP)
|
||||
|| c.getEventType().equals(EventType.STOPTRULEFLOWGROUP)) {
|
||||
csvWriter.writeNext("", "", "" + c.getEventType().name(), String.valueOf(c.getEventNumber()), "", "", c.getRuleflowGroupName());
|
||||
} else if (c.getEventType().equals(EventType.STARTPROCESS)
|
||||
|| c.getEventType().equals(EventType.STOPPROCESS)) {
|
||||
csvWriter.writeNext("", "", c.getEventType().name(), String.valueOf(c.getEventNumber()), "", "", "", c.getProcessID(), "", "", "");
|
||||
} else if (c.getEventType().equals(EventType.RULE)) {
|
||||
List<String> datas = new ArrayList<>();
|
||||
datas.add(simpleDateFormat.format(c.getRuleExecution().getStartDate()));
|
||||
datas.add(simpleDateFormat.format(c.getRuleExecution().getEndDate()));
|
||||
datas.add(c.getEventType().name());
|
||||
datas.add(String.valueOf(c.getEventNumber()));
|
||||
datas.add(c.getRuleExecution().getRuleName());
|
||||
datas.add(c.getRuleExecution().getPackageName());
|
||||
datas.add(c.getRuleflowGroupName());
|
||||
datas.add(c.getProcessID());
|
||||
datas.add("");
|
||||
datas.add("");
|
||||
|
||||
for (Fact f : c.getRuleExecution().getWhenFacts()){
|
||||
datas.add(f.getFullClassName());
|
||||
datas.add(mapper.writeValueAsString(f.getRealFact()));
|
||||
}
|
||||
for (Fact f : c.getRuleExecution().getThenFacts()){
|
||||
datas.add(f.getFullClassName());
|
||||
datas.add(mapper.writeValueAsString(f.getRealFact()));
|
||||
}
|
||||
csvWriter.writeAll(Collections.singletonList(datas));
|
||||
} else {
|
||||
csvWriter.writeNext(beginDate, endDate, c.getEventType().name(), String.valueOf(c.getEventNumber()),
|
||||
ruleName, packageName, c.getRuleflowGroupName(), c.getProcessID()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return IOUtils.toInputStream(stringWriter.toString(), StandardCharsets.UTF_8.name());
|
||||
|
||||
} catch (IOException e) {
|
||||
logger.error("getInputStream.csvWriter",e);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,300 +0,0 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
import com.vaadin.flow.component.combobox.ComboBox;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
import com.vaadin.flow.data.provider.ConfigurableFilterDataProvider;
|
||||
import com.vaadin.flow.data.provider.ListDataProvider;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import com.vaadin.flow.function.SerializablePredicate;
|
||||
import com.vaadin.flow.shared.communication.PushMode;
|
||||
import org.chtijbug.drools.console.AddLog;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.DeploymentAction;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class DeploymentView extends VerticalLayout implements AddLog {
|
||||
|
||||
public static final String PAGE_NAME = "Deployment";
|
||||
|
||||
//GRID composant
|
||||
private static final String STR_NAME_DEPLOY = "Deploy name";
|
||||
private static final String STR_NAME_PROJECT = "Project name";
|
||||
private static final String STR_GROUPE_ID = "Groupe ID";
|
||||
private static final String STR_BRANCH_NAME = "Branch Name";
|
||||
private static final String STR_ARTEFACT_ID = "Artefact ID";
|
||||
|
||||
//TEXTFIELD search
|
||||
private static final String STR_PROCESS_ID = "Process ID";
|
||||
private static final String STR_SERVER_NAME = "Server Name";
|
||||
private static final String STR_STATUS = "Status";
|
||||
private Grid<ProjectPersist> projectPersistGrid;
|
||||
|
||||
private ConfigurableFilterDataProvider<ProjectPersist, Void, SerializablePredicate<ProjectPersist>> filterDataProvider;
|
||||
private DeploymentAction deploymentAction;
|
||||
|
||||
//CONSTANTE Textfield
|
||||
private TextField nameDeploy;
|
||||
private TextField nameProject;
|
||||
private TextField groupeId;
|
||||
private TextField branchName;
|
||||
private TextField artifactId;
|
||||
private TextField processId;
|
||||
private TextField serverName;
|
||||
private ComboBox status;
|
||||
|
||||
//SERVICE
|
||||
private transient ProjectPersistService projectPersistService;
|
||||
|
||||
private SqueletteComposant squeletteComposant;
|
||||
|
||||
public DeploymentView(SqueletteComposant squeletteComposant) {
|
||||
|
||||
this.squeletteComposant = squeletteComposant;
|
||||
projectPersistService = AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
|
||||
setClassName("deployment-content");
|
||||
|
||||
add(new Label("Project"));
|
||||
|
||||
projectPersistGrid = new Grid<>();
|
||||
projectPersistGrid.setClassName("deployment-grid-perso");
|
||||
projectPersistGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||
|
||||
|
||||
Grid.Column<ProjectPersist> deployNameCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getDeploymentName());
|
||||
nameDeploy = new TextField(STR_NAME_DEPLOY);
|
||||
nameDeploy.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
nameDeploy.addValueChangeListener(e ->
|
||||
refreshtGrid(nameDeploy.getValue(), STR_NAME_DEPLOY)
|
||||
);
|
||||
deployNameCo.setHeader(nameDeploy);
|
||||
|
||||
Grid.Column<ProjectPersist> nameProjectCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getProjectName());
|
||||
nameProject = new TextField(STR_NAME_PROJECT);
|
||||
nameProject.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
nameProject.addValueChangeListener(e -> {
|
||||
refreshtGrid(nameProject.getValue(), STR_NAME_PROJECT);
|
||||
});
|
||||
nameProjectCo.setHeader(nameProject);
|
||||
|
||||
projectPersistGrid.addColumn(projectPersist -> projectPersist.getMainClass()).setHeader("ClassName")
|
||||
.setComparator((projectPersist, t1) -> projectPersist.getMainClass().compareTo(t1.getMainClass()));
|
||||
|
||||
Grid.Column<ProjectPersist> branchCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getBranch());
|
||||
branchName = new TextField(STR_BRANCH_NAME);
|
||||
branchName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
branchName.addValueChangeListener(e -> {
|
||||
refreshtGrid(groupeId.getValue(), STR_BRANCH_NAME);
|
||||
});
|
||||
branchCo.setHeader(branchName);
|
||||
|
||||
|
||||
Grid.Column<ProjectPersist> groupIdCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getGroupID());
|
||||
groupeId = new TextField(STR_GROUPE_ID);
|
||||
groupeId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
groupeId.addValueChangeListener(e -> {
|
||||
refreshtGrid(groupeId.getValue(), STR_GROUPE_ID);
|
||||
});
|
||||
groupIdCo.setHeader(groupeId);
|
||||
|
||||
Grid.Column<ProjectPersist> artifactIDCO = projectPersistGrid.addColumn(projectPersist -> projectPersist.getArtifactID());
|
||||
artifactId = new TextField(STR_ARTEFACT_ID);
|
||||
artifactId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
artifactId.addValueChangeListener(e -> {
|
||||
refreshtGrid(artifactId.getValue(), STR_ARTEFACT_ID);
|
||||
});
|
||||
artifactIDCO.setHeader(artifactId);
|
||||
|
||||
Grid.Column<ProjectPersist> processIDco = projectPersistGrid.addColumn(projectPersist -> projectPersist.getProcessID());
|
||||
processId = new TextField(STR_PROCESS_ID);
|
||||
processId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
processId.addValueChangeListener(e ->
|
||||
refreshtGrid(processId.getValue(), STR_PROCESS_ID));
|
||||
processIDco.setHeader(processId);
|
||||
|
||||
|
||||
Grid.Column<ProjectPersist> serverNameCo = projectPersistGrid.addColumn(projectPersist -> {
|
||||
String result = null;
|
||||
for (String servName : projectPersist.getServerNames()) {
|
||||
if (result != null) {
|
||||
result = result + ":" + servName;
|
||||
} else {
|
||||
result = servName;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
serverName = new TextField(STR_SERVER_NAME);
|
||||
serverName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
serverName.addValueChangeListener(e ->
|
||||
refreshtGrid(serverName.getValue(), STR_SERVER_NAME)
|
||||
);
|
||||
serverNameCo.setHeader(serverName);
|
||||
|
||||
|
||||
projectPersistGrid.addColumn(projectPersist -> projectPersist.getProjectVersion()).setHeader("Version")
|
||||
.setComparator((projectPersist, t1) -> projectPersist.getProjectVersion().compareTo(t1.getProjectVersion()));
|
||||
|
||||
|
||||
Grid.Column<ProjectPersist> statusCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getStatus());
|
||||
status = new ComboBox(STR_PROCESS_ID);
|
||||
status.setClassName("deployment-combobox");
|
||||
|
||||
ArrayList<String> tmp = new ArrayList<>();
|
||||
tmp.add(ProjectPersist.DEFINI);
|
||||
tmp.add(ProjectPersist.Deployable);
|
||||
tmp.add(ProjectPersist.ADEFINIR);
|
||||
tmp.add(" ");
|
||||
status.setItems(tmp);
|
||||
status.addValueChangeListener(e ->
|
||||
refreshtGrid(status.getValue() != null ? status.getValue().toString() : " ", STR_STATUS)
|
||||
);
|
||||
statusCo.setHeader(status);
|
||||
|
||||
add(projectPersistGrid);
|
||||
|
||||
setDataProvider();
|
||||
|
||||
projectPersistGrid.addSelectionListener(selectionEvent -> {
|
||||
|
||||
if (selectionEvent.getFirstSelectedItem().isPresent()) {
|
||||
majAction(selectionEvent.getFirstSelectedItem().get());
|
||||
} else {
|
||||
getDeploymentAction().getAssociateKieServer().setEnabled(false);
|
||||
getDeploymentAction().getDefinirProject().setEnabled(false);
|
||||
getDeploymentAction().getDeployer().setEnabled(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshtGrid(String value, String type) {
|
||||
|
||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(), type));
|
||||
projectPersistGrid.getDataProvider().refreshAll();
|
||||
}
|
||||
|
||||
private SerializablePredicate<ProjectPersist> filterGrid(String value, String type) {
|
||||
SerializablePredicate<ProjectPersist> columnPredicate = null;
|
||||
|
||||
if (value.equals("") || value.equals(" ") || type.equals(" ")) {
|
||||
columnPredicate = asset -> (true);
|
||||
} else {
|
||||
if (type.equals(STR_ARTEFACT_ID)) {
|
||||
columnPredicate = asset -> (
|
||||
asset.getArtifactID() != null && asset.getArtifactID().toUpperCase().contains(value.toUpperCase()));
|
||||
} else if (type.equals(STR_GROUPE_ID)) {
|
||||
columnPredicate = asset -> (asset.getGroupID() != null && asset.getGroupID().toUpperCase().contains(value.toUpperCase()));
|
||||
} else if (type.equals(STR_NAME_DEPLOY)) {
|
||||
columnPredicate = asset -> (asset.getDeploymentName() != null && asset.getDeploymentName().toUpperCase().contains(value.toUpperCase()));
|
||||
} else if (type.equals(STR_NAME_PROJECT)) {
|
||||
columnPredicate = asset -> (asset.getProjectName() != null && asset.getProjectName().toString().toUpperCase().contains(value.toUpperCase()));
|
||||
} else if (type.equals(STR_PROCESS_ID)) {
|
||||
columnPredicate = asset -> (asset.getProcessID() != null && asset.getProcessID().toUpperCase().contains(value.toUpperCase()));
|
||||
} else if (type.equals(STR_STATUS)) {
|
||||
columnPredicate = asset -> (asset.getStatus() != null && asset.getStatus().equalsIgnoreCase(value));
|
||||
}
|
||||
}
|
||||
return columnPredicate;
|
||||
}
|
||||
|
||||
public void setDataProvider() {
|
||||
|
||||
Map<String, ProjectPersist> projectPersists = projectPersistService.findProjectsConnectedUser();
|
||||
if (projectPersists != null) {
|
||||
ListDataProvider<ProjectPersist> dataProvider = new ListDataProvider<>(projectPersists.values());
|
||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
projectPersistGrid.setDataProvider(filterDataProvider);
|
||||
reinitFilter();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void reinitFilter() {
|
||||
|
||||
artifactId.setValue("");
|
||||
groupeId.setValue("");
|
||||
processId.setValue("");
|
||||
nameProject.setValue("");
|
||||
nameDeploy.setValue("");
|
||||
}
|
||||
|
||||
public void majAction(ProjectPersist projectPersist) {
|
||||
if (projectPersist.getStatus().equals(ProjectPersist.DEFINI)) {
|
||||
|
||||
getDeploymentAction().getAssociateKieServer().setEnabled(true);
|
||||
getDeploymentAction().getDefinirProject().setEnabled(true);
|
||||
getDeploymentAction().getDeployer().setEnabled(false);
|
||||
|
||||
} else if (projectPersist.getStatus().equals(ProjectPersist.ADEFINIR)) {
|
||||
|
||||
getDeploymentAction().getAssociateKieServer().setEnabled(false);
|
||||
getDeploymentAction().getDefinirProject().setEnabled(true);
|
||||
getDeploymentAction().getDeployer().setEnabled(false);
|
||||
} else if (projectPersist.getStatus().equals(ProjectPersist.Deployable)) {
|
||||
|
||||
getDeploymentAction().getAssociateKieServer().setEnabled(true);
|
||||
getDeploymentAction().getDefinirProject().setEnabled(true);
|
||||
getDeploymentAction().getDeployer().setEnabled(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRow(String textToAdd, UI ui) {
|
||||
|
||||
ui.access(() -> {
|
||||
|
||||
HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||
horizontalLayout.setClassName("console-row");
|
||||
Label date = new Label(new Date() + " : ");
|
||||
date.setClassName("console-date");
|
||||
horizontalLayout.add(date);
|
||||
horizontalLayout.add(new Label(textToAdd));
|
||||
squeletteComposant.getConsoleDeploy().getLogContent().getElement().getNode().markAsDirty();
|
||||
squeletteComposant.getConsoleDeploy().getLogContent().add(horizontalLayout);
|
||||
});
|
||||
|
||||
ui.getSession().lock();
|
||||
try {
|
||||
ui.getPushConfiguration().setPushMode(PushMode.AUTOMATIC);
|
||||
ui.push();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ui.getSession().unlock();
|
||||
|
||||
} finally {
|
||||
ui.getSession().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public Grid<ProjectPersist> getProjectPersistGrid() {
|
||||
return projectPersistGrid;
|
||||
}
|
||||
|
||||
public void setProjectPersistGrid(Grid<ProjectPersist> projectPersistGrid) {
|
||||
this.projectPersistGrid = projectPersistGrid;
|
||||
}
|
||||
|
||||
public DeploymentAction getDeploymentAction() {
|
||||
return deploymentAction;
|
||||
}
|
||||
|
||||
public void setDeploymentAction(DeploymentAction deploymentAction) {
|
||||
this.deploymentAction = deploymentAction;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
import com.vaadin.flow.component.ClickEvent;
|
||||
import com.vaadin.flow.component.ComponentEventListener;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.html.Span;
|
||||
import com.vaadin.flow.component.notification.Notification;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.upload.Upload;
|
||||
import com.vaadin.flow.component.upload.receivers.MemoryBuffer;
|
||||
import com.vaadin.flow.server.StreamResource;
|
||||
import org.chtijbug.drools.console.service.DecisionTableExcelService;
|
||||
import org.chtijbug.drools.console.service.GuidedRuleTemplateExcelService;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.AssetEdit;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.ColumnDefinition;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.DecisionTable;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.GuidedException;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.Row;
|
||||
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
||||
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
|
||||
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
||||
import org.drools.workbench.models.guided.template.backend.RuleTemplateModelXMLPersistenceImpl;
|
||||
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
||||
import org.vaadin.olli.FileDownloadWrapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class EditTemplateView extends VerticalLayout {
|
||||
private static int GuidedRuleTemplate = 1;
|
||||
private static int DecisionTable = 2;
|
||||
|
||||
private int tableType;
|
||||
|
||||
private Button exportExcel;
|
||||
|
||||
private Upload importExcel;
|
||||
|
||||
private Label title;
|
||||
|
||||
private Button saveButton;
|
||||
|
||||
|
||||
private AssetEdit assetEdit;
|
||||
|
||||
private GuidedRuleTemplateExcelService guidedRuleTemplateExcelService;
|
||||
|
||||
private DecisionTableExcelService decisionTableExcelService;
|
||||
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
private KieConfigurationData config;
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
private String assetName;
|
||||
|
||||
public String getAssetContent(){
|
||||
if (tableType==GuidedRuleTemplate){
|
||||
return guidedRuleTemplateExcelService.getAssetContent();
|
||||
}else{
|
||||
return decisionTableExcelService.getAssetContent();
|
||||
}
|
||||
}
|
||||
|
||||
public EditTemplateView(DialogPerso dialogPerso, String nameTemplate) {
|
||||
this.assetName=nameTemplate;
|
||||
if (nameTemplate.contains(".gdst") == false) {
|
||||
guidedRuleTemplateExcelService = AppContext.getApplicationContext().getBean(GuidedRuleTemplateExcelService.class);
|
||||
tableType = GuidedRuleTemplate;
|
||||
} else {
|
||||
decisionTableExcelService = AppContext.getApplicationContext().getBean(DecisionTableExcelService.class);
|
||||
tableType = DecisionTable;
|
||||
}
|
||||
kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
|
||||
dialogPerso.getClose().setVisible(false);
|
||||
|
||||
|
||||
MemoryBuffer fileBuffer = new MemoryBuffer();
|
||||
|
||||
|
||||
importExcel = new Upload(fileBuffer);
|
||||
importExcel.setDropLabel(new Span("drag and Drop Excel file here"));
|
||||
importExcel.setClassName("menu-upload");
|
||||
importExcel.setId("exampleupload");
|
||||
|
||||
dialogPerso.getBar().add(importExcel);
|
||||
|
||||
importExcel.addSucceededListener(succeededEvent -> {
|
||||
|
||||
if (!succeededEvent.getFileName().contains("xlsx")) {
|
||||
|
||||
Notification.show("The file is incompatible, it must be in xlsx format");
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
if (tableType == GuidedRuleTemplate) {
|
||||
List<HashMap<String, Object>> objects = guidedRuleTemplateExcelService.importExcel(fileBuffer.getInputStream());
|
||||
if (objects != null && objects.size() > 0) {
|
||||
if (objects.get(0).values().size() != assetEdit.getColumns().size()) {
|
||||
Notification.show("Unable to add columns with the excel import for the moment");
|
||||
} else {
|
||||
remove(assetEdit);
|
||||
assetEdit = new AssetEdit(objects);
|
||||
add(assetEdit);
|
||||
String assetSource=this.getAssetContent();
|
||||
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetSource);
|
||||
int id=model.getColsCount();
|
||||
model.clearRows();
|
||||
for (Map<String,Object> line : objects){
|
||||
String[] cols =new String[model.getColsCount()];
|
||||
int k=0;
|
||||
for (InterpolationVariable interpolationVariable : model.getInterpolationVariablesList()){
|
||||
|
||||
Object o = line.get(interpolationVariable.getVarName());
|
||||
if (o!= null) {
|
||||
cols[k] = o.toString();
|
||||
}
|
||||
k++;
|
||||
}
|
||||
model.addRow(cols);
|
||||
}
|
||||
|
||||
model.setIdCol(id);
|
||||
assetSource = RuleTemplateModelXMLPersistenceImpl.getInstance().marshal(model);
|
||||
kieRepositoryService.updateAssetSource(config.getKiewbUrl(),
|
||||
userConnectedService.getUserConnected().getUserName(),
|
||||
userConnectedService.getUserConnected().getUserPassword(),
|
||||
userConnectedService.getSpace(),
|
||||
userConnectedService.getProject(),
|
||||
userConnectedService.getAsset(), assetSource);
|
||||
}
|
||||
} else {
|
||||
Notification.show("illegible or empty document");
|
||||
}
|
||||
} else {
|
||||
List<HashMap<String, Object>> objects = decisionTableExcelService.importExcel(fileBuffer.getInputStream());
|
||||
if (objects != null && objects.size() > 0) {
|
||||
Notification.show("Unable to add columns with the excel import for the moment");
|
||||
}else{
|
||||
remove(assetEdit);
|
||||
assetEdit = new AssetEdit(objects);
|
||||
add(assetEdit);
|
||||
String assetSource=this.getAssetContent();
|
||||
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal(assetSource);
|
||||
org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.DecisionTable decisionTable = new DecisionTable(model);
|
||||
decisionTable.getRows().clear();
|
||||
List<ColumnDefinition> columnDefinitions = decisionTable.getColumnDefinitionList();
|
||||
int k=0;
|
||||
for (HashMap<String, Object> line : objects){
|
||||
Row row = decisionTable.createEmptyRow(k);
|
||||
for (ColumnDefinition columnDefinition : columnDefinitions){
|
||||
line.get(columnDefinition.getHeader());
|
||||
|
||||
}
|
||||
}
|
||||
k++;
|
||||
}
|
||||
|
||||
|
||||
//row.
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
Notification.show("The file is incompatible, it must be in xlsx format");
|
||||
} catch (GuidedException e) {
|
||||
Notification.show("error "+e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
importExcel.addFailedListener(failedEvent -> {
|
||||
Notification.show("Error in the upload, please start again with another file");
|
||||
});
|
||||
FileDownloadWrapper fileDownloadWrapper = null;
|
||||
if (tableType == GuidedRuleTemplate) {
|
||||
fileDownloadWrapper = new FileDownloadWrapper(
|
||||
new StreamResource(nameTemplate + ".xlsx",
|
||||
() -> guidedRuleTemplateExcelService.exportExcel(nameTemplate)));
|
||||
} else {
|
||||
fileDownloadWrapper = new FileDownloadWrapper(
|
||||
new StreamResource(nameTemplate + ".xlsx",
|
||||
() -> decisionTableExcelService.exportExcel(nameTemplate)));
|
||||
}
|
||||
exportExcel = new Button("Export excel");
|
||||
fileDownloadWrapper.wrapComponent(exportExcel);
|
||||
exportExcel.setClassName("menu-button-asset-edit");
|
||||
|
||||
|
||||
dialogPerso.getBar().add(fileDownloadWrapper);
|
||||
|
||||
|
||||
title = new Label(nameTemplate);
|
||||
title.setClassName("creation-runtime-title");
|
||||
|
||||
add(title);
|
||||
|
||||
assetEdit = new AssetEdit();
|
||||
|
||||
add(assetEdit);
|
||||
saveButton = new Button("Save");
|
||||
add(saveButton);
|
||||
saveButton.addClickListener(new ComponentEventListener<ClickEvent<Button>>() {
|
||||
@Override
|
||||
public void onComponentEvent(ClickEvent<Button> buttonClickEvent) {
|
||||
System.out.println("TODO");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.vaadincomponent.componentview.GridLogging;
|
||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.ActionLogging;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class LoggingView extends VerticalLayout {
|
||||
|
||||
public static final String PAGE_NAME = "Logging";
|
||||
|
||||
private Label title;
|
||||
|
||||
private GridLogging gridLogging;
|
||||
|
||||
private ActionLogging actionLogging;
|
||||
|
||||
public LoggingView() {
|
||||
|
||||
title = new Label("Logging : ");
|
||||
|
||||
add(title);
|
||||
|
||||
gridLogging = new GridLogging();
|
||||
|
||||
add(gridLogging);
|
||||
|
||||
|
||||
gridLogging.addSelectionListener(selectionEvent ->
|
||||
actionLogging.getViewAction().setEnabled(selectionEvent.getFirstSelectedItem().isPresent())
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
public static String getPageName() {
|
||||
return PAGE_NAME;
|
||||
}
|
||||
|
||||
public GridLogging getGridLogging() {
|
||||
return gridLogging;
|
||||
}
|
||||
|
||||
public void setGridLogging(GridLogging gridLogging) {
|
||||
this.gridLogging = gridLogging;
|
||||
}
|
||||
|
||||
public ActionLogging getActionLogging() {
|
||||
return actionLogging;
|
||||
}
|
||||
|
||||
public void setActionLogging(ActionLogging actionLogging) {
|
||||
this.actionLogging = actionLogging;
|
||||
}
|
||||
|
||||
public Label getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(Label title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
editor.link_modal.header
Reference in a new issue