Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51820053b1 |
519 changed files with 95744 additions and 12909 deletions
43
.github/workflows/main.yml
vendored
43
.github/workflows/main.yml
vendored
|
|
@ -1,43 +0,0 @@
|
||||||
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
|
|
||||||
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
|
|
||||||
|
|
||||||
name: Maven Package
|
|
||||||
|
|
||||||
run-name: Release run ${{ github.run_number }} view
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
schedule:
|
|
||||||
- cron: "0 3 * * *"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: self-hosted
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set up JDK 1.8
|
|
||||||
uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: 1.8
|
|
||||||
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: Publish to GitHub Packages Apache Maven
|
|
||||||
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
11
.gitignore
vendored
11
.gitignore
vendored
|
|
@ -1,11 +0,0 @@
|
||||||
# Created by .ignore support plugin (hsz.mobi)
|
|
||||||
*.iml
|
|
||||||
overlays/
|
|
||||||
node/
|
|
||||||
node_modules/
|
|
||||||
.classpath
|
|
||||||
.project
|
|
||||||
.settings/
|
|
||||||
target/
|
|
||||||
.java-version
|
|
||||||
.idea/
|
|
||||||
|
|
@ -17,15 +17,13 @@ services:
|
||||||
- gitdata:/home/niodir
|
- gitdata:/home/niodir
|
||||||
- lucenedata:/home/lucene
|
- lucenedata:/home/lucene
|
||||||
hostname: kie-wb.pymma
|
hostname: kie-wb.pymma
|
||||||
environment:
|
|
||||||
PYMMA_OPTS: " -DconnectionString=mongodb://mongodb:27017 -Dname=businessProxyDB "
|
|
||||||
links:
|
|
||||||
- businessProxyDB:mongodb
|
|
||||||
depends_on:
|
|
||||||
- businessProxyDB
|
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.5
|
ipv4_address: 172.27.1.5
|
||||||
|
links:
|
||||||
|
- keycloak:keycloak
|
||||||
|
depends_on:
|
||||||
|
- keycloak
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
- 8001:8001
|
- 8001:8001
|
||||||
|
|
@ -36,8 +34,6 @@ services:
|
||||||
admin-console:
|
admin-console:
|
||||||
image: runtime-admin-console
|
image: runtime-admin-console
|
||||||
container_name: "admin-console"
|
container_name: "admin-console"
|
||||||
environment:
|
|
||||||
PYMMA_OPTS: " -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
|
||||||
hostname: admin.pymma
|
hostname: admin.pymma
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
|
|
@ -45,13 +41,13 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 8200:8200
|
- 8200:8200
|
||||||
links:
|
links:
|
||||||
- kie-wb:kie-wb
|
|
||||||
- businessProxyDB:mongodb
|
- businessProxyDB:mongodb
|
||||||
- kafka1:kafka1
|
- elasticsearchhost:elasticdb
|
||||||
- kafka2:kafka2
|
- kie-wb
|
||||||
- kafka3:kafka3
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- businessProxyDB
|
- businessProxyDB
|
||||||
|
- elasticsearchhost
|
||||||
|
- kie-wb
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -65,7 +61,7 @@ services:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.15
|
ipv4_address: 172.27.1.15
|
||||||
ports:
|
ports:
|
||||||
- 12099:12099
|
- 8080:12099
|
||||||
links:
|
links:
|
||||||
- runtime-reverse-proxy:reverse-proxy
|
- runtime-reverse-proxy:reverse-proxy
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
@ -74,15 +70,14 @@ services:
|
||||||
|
|
||||||
|
|
||||||
#-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y
|
#-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y
|
||||||
|
|
||||||
|
|
||||||
runtime-proxy-1:
|
runtime-proxy-1:
|
||||||
image: runtime-proxy
|
image: runtime-proxy
|
||||||
container_name: "runtime-proxy-1"
|
container_name: "runtime-proxy-1"
|
||||||
volumes:
|
volumes:
|
||||||
- kieserverdir:/niodir-kieserver
|
- kieserverdir:/niodir-kieserver
|
||||||
environment:
|
environment:
|
||||||
PYMMA_OPTS: "-Dorg.kie.server.id=server1 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
PYMMA_OPTS: "-Dorg.kie.server.id=server1 "
|
||||||
|
hostname: proxy1.pymma
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.22
|
ipv4_address: 172.27.1.22
|
||||||
|
|
@ -92,9 +87,6 @@ services:
|
||||||
links:
|
links:
|
||||||
- businessProxyDB:mongodb
|
- businessProxyDB:mongodb
|
||||||
- kie-wb:kie-wb
|
- kie-wb:kie-wb
|
||||||
- kafka1:kafka1
|
|
||||||
- kafka2:kafka2
|
|
||||||
- kafka3:kafka3
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- businessProxyDB
|
- businessProxyDB
|
||||||
- kie-wb
|
- kie-wb
|
||||||
|
|
@ -106,7 +98,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- kieserverdir:/niodir-kieserver
|
- kieserverdir:/niodir-kieserver
|
||||||
environment:
|
environment:
|
||||||
PYMMA_OPTS: "-Dorg.kie.server.id=server2 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
PYMMA_OPTS: "-Dorg.kie.server.id=server2"
|
||||||
|
hostname: proxy2.pymma
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.32
|
ipv4_address: 172.27.1.32
|
||||||
|
|
@ -116,9 +109,6 @@ services:
|
||||||
links:
|
links:
|
||||||
- businessProxyDB:mongodb
|
- businessProxyDB:mongodb
|
||||||
- kie-wb:kie-wb
|
- kie-wb:kie-wb
|
||||||
- kafka1:kafka1
|
|
||||||
- kafka2:kafka2
|
|
||||||
- kafka3:kafka3
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- businessProxyDB
|
- businessProxyDB
|
||||||
- kie-wb
|
- kie-wb
|
||||||
|
|
@ -130,7 +120,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- kieserverdir:/niodir-kieserver
|
- kieserverdir:/niodir-kieserver
|
||||||
environment:
|
environment:
|
||||||
PYMMA_OPTS: "-Dorg.kie.server.id=server3 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
PYMMA_OPTS: "-Dorg.kie.server.id=server3"
|
||||||
|
hostname: proxy3.pymma
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.42
|
ipv4_address: 172.27.1.42
|
||||||
|
|
@ -140,9 +131,6 @@ services:
|
||||||
links:
|
links:
|
||||||
- businessProxyDB:mongodb
|
- businessProxyDB:mongodb
|
||||||
- kie-wb:kie-wb
|
- kie-wb:kie-wb
|
||||||
- kafka1:kafka1
|
|
||||||
- kafka2:kafka2
|
|
||||||
- kafka3:kafka3
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- businessProxyDB
|
- businessProxyDB
|
||||||
- kie-wb
|
- kie-wb
|
||||||
|
|
@ -154,7 +142,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- kieserverdir:/niodir-kieserver
|
- kieserverdir:/niodir-kieserver
|
||||||
environment:
|
environment:
|
||||||
PYMMA_OPTS: "-Dorg.kie.server.id=server4 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
PYMMA_OPTS: "-Dorg.kie.server.id=server4"
|
||||||
|
hostname: proxy4.pymma
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.52
|
ipv4_address: 172.27.1.52
|
||||||
|
|
@ -164,9 +153,6 @@ services:
|
||||||
links:
|
links:
|
||||||
- businessProxyDB:mongodb
|
- businessProxyDB:mongodb
|
||||||
- kie-wb:kie-wb
|
- kie-wb:kie-wb
|
||||||
- kafka1:kafka1
|
|
||||||
- kafka2:kafka2
|
|
||||||
- kafka3:kafka3
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- businessProxyDB
|
- businessProxyDB
|
||||||
- kie-wb
|
- kie-wb
|
||||||
|
|
@ -178,7 +164,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- kieserverdir:/niodir-kieserver
|
- kieserverdir:/niodir-kieserver
|
||||||
environment:
|
environment:
|
||||||
PYMMA_OPTS: "-Dorg.kie.server.id=server5 -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
PYMMA_OPTS: "-Dorg.kie.server.id=server5"
|
||||||
|
hostname: proxy5.pymma
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.62
|
ipv4_address: 172.27.1.62
|
||||||
|
|
@ -188,9 +175,6 @@ services:
|
||||||
links:
|
links:
|
||||||
- businessProxyDB:mongodb
|
- businessProxyDB:mongodb
|
||||||
- kie-wb:kie-wb
|
- kie-wb:kie-wb
|
||||||
- kafka1:kafka1
|
|
||||||
- kafka2:kafka2
|
|
||||||
- kafka3:kafka3
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- businessProxyDB
|
- businessProxyDB
|
||||||
- kie-wb
|
- kie-wb
|
||||||
|
|
@ -206,33 +190,51 @@ services:
|
||||||
ipv4_address: 172.27.1.23
|
ipv4_address: 172.27.1.23
|
||||||
links:
|
links:
|
||||||
- businessProxyDB:mongodb
|
- businessProxyDB:mongodb
|
||||||
- kafka1:kafka1
|
- elasticsearchhost:elasticdb
|
||||||
- kafka2:kafka2
|
|
||||||
- kafka3:kafka3
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- businessProxyDB
|
- businessProxyDB
|
||||||
|
- elasticsearchhost
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
runtime-reverse-proxy:
|
runtime-reverse-proxy:
|
||||||
image: runtime-reverse-proxy
|
image: runtime-reverse-proxy
|
||||||
container_name: "runtime-reverse-proxy"
|
container_name: "runtime-reverse-proxy"
|
||||||
environment:
|
|
||||||
PYMMA_OPTS: " -Dkafka.bootstrapAddress=kafka1:19092,kafka2:19093,kafka3:19094 "
|
|
||||||
hostname: reverse-proxy.pymma
|
hostname: reverse-proxy.pymma
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.25
|
ipv4_address: 172.27.1.25
|
||||||
links:
|
links:
|
||||||
- businessProxyDB:mongodb
|
- businessProxyDB:mongodb
|
||||||
- kafka1:kafka1
|
|
||||||
- kafka2:kafka2
|
|
||||||
- kafka3:kafka3
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- businessProxyDB
|
- businessProxyDB
|
||||||
ports:
|
ports:
|
||||||
- 9500:9500
|
- 9500:9500
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
elasticsearchhost:
|
||||||
|
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.2
|
||||||
|
container_name: "elasticsearchhost"
|
||||||
|
environment:
|
||||||
|
- network.host=0.0.0.0
|
||||||
|
- cluster.name=elasticsearch
|
||||||
|
ulimits:
|
||||||
|
memlock:
|
||||||
|
soft: -1
|
||||||
|
hard: -1
|
||||||
|
volumes:
|
||||||
|
- esdata2:/usr/share/elasticsearch/data
|
||||||
|
hostname: es.pymma
|
||||||
|
networks:
|
||||||
|
drools-network-dev:
|
||||||
|
ipv4_address: 172.27.1.7
|
||||||
|
ports:
|
||||||
|
- 9300:9300
|
||||||
|
- 9200:9200
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
businessProxyDB:
|
businessProxyDB:
|
||||||
image: mongo
|
image: mongo
|
||||||
container_name: "businessProxyDB"
|
container_name: "businessProxyDB"
|
||||||
|
|
@ -248,167 +250,65 @@ services:
|
||||||
command: mongod
|
command: mongod
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
kafka_manager:
|
postgres:
|
||||||
image: hlebalbau/kafka-manager:stable
|
image: keycloak-db
|
||||||
ports:
|
volumes:
|
||||||
- "9000:9000"
|
- pgdata1:/var/lib/postgresql/data
|
||||||
hostname: kafka_manager.pymma
|
- pgdata2:/home/pgdata
|
||||||
|
hostname: pg.pymma
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.89
|
ipv4_address: 172.27.1.200
|
||||||
|
ports:
|
||||||
|
- 6666:5432
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
keycloak:
|
||||||
|
image: jboss/keycloak:5.0.0
|
||||||
|
environment:
|
||||||
|
DB_VENDOR: POSTGRES
|
||||||
|
DB_ADDR: 172.27.1.200
|
||||||
|
DB_DATABASE: keycloakdb
|
||||||
|
DB_USER: keycloak_user
|
||||||
|
DB_SCHEMA: public
|
||||||
|
DB_PASSWORD: keycloak_user
|
||||||
|
KEYCLOAK_USER: admin
|
||||||
|
KEYCLOAK_PASSWORD: admin
|
||||||
|
# Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the PostgreSQL JDBC driver documentation in order to use it.
|
||||||
|
#JDBC_PARAMS: "ssl=true"
|
||||||
|
hostname: keycloak.pymma
|
||||||
|
networks:
|
||||||
|
drools-network-dev:
|
||||||
|
ipv4_address: 172.27.1.201
|
||||||
links:
|
links:
|
||||||
- zoo1:zoo1
|
- postgres:postgres
|
||||||
- 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:
|
ports:
|
||||||
- "2181:2181"
|
- 10080:8080
|
||||||
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:
|
depends_on:
|
||||||
- zoo1
|
- postgres
|
||||||
- zoo2
|
|
||||||
- zoo3
|
|
||||||
|
|
||||||
kafka2:
|
dps:
|
||||||
image: confluentinc/cp-kafka:5.5.0
|
image: defreitas/dns-proxy-server:2.13.2
|
||||||
hostname: kafka2.pymma
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- /etc/resolv.conf:/etc/resolv.conf
|
||||||
|
environment:
|
||||||
|
- MG_LOG_LEVEL=ERROR
|
||||||
|
hostname: dns.pymma
|
||||||
networks:
|
networks:
|
||||||
drools-network-dev:
|
drools-network-dev:
|
||||||
ipv4_address: 172.27.1.104
|
ipv4_address: 172.27.1.233
|
||||||
ports:
|
ports:
|
||||||
- "9093:9093"
|
- 5380:5380
|
||||||
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:
|
volumes:
|
||||||
mongodb:
|
mongodb:
|
||||||
mongodb_config:
|
mongodb_config:
|
||||||
gitdata:
|
gitdata:
|
||||||
lucenedata:
|
lucenedata:
|
||||||
|
esdata2:
|
||||||
kieserverdir:
|
kieserverdir:
|
||||||
zoo1_data:
|
pgdata1:
|
||||||
zoo2_data:
|
pgdata2:
|
||||||
zoo3_data:
|
|
||||||
zoo1_data_datalog:
|
|
||||||
zoo2_data_datalog:
|
|
||||||
zoo3_data_datalog:
|
|
||||||
kafka1_data:
|
|
||||||
kafka2_data:
|
|
||||||
kafka3_data:
|
|
||||||
|
|
@ -12,10 +12,11 @@
|
||||||
<artifactId>drools-framework-admin-console</artifactId>
|
<artifactId>drools-framework-admin-console</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<vaadin.version>12.0.7</vaadin.version>
|
<vaadin.version>12.0.5</vaadin.version>
|
||||||
<spring-boot.version>${spring.boot.version}</spring-boot.version>
|
<spring-boot.version>2.1.2.RELEASE</spring-boot.version>
|
||||||
<spring-version>${spring.version}</spring-version>
|
<spring-version>5.1.2.RELEASE</spring-version>
|
||||||
<webapp.directory>src/main/webapp</webapp.directory>
|
<webapp.directory>src/main/webapp</webapp.directory>
|
||||||
|
<jbpm.version>7.15.0.Final</jbpm.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -49,15 +50,12 @@
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -65,15 +63,7 @@
|
||||||
<artifactId>poi</artifactId>
|
<artifactId>poi</artifactId>
|
||||||
<version>4.0.1</version>
|
<version>4.0.1</version>
|
||||||
</dependency>
|
</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 -->
|
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
|
|
@ -85,10 +75,6 @@
|
||||||
<artifactId>kie-server-api</artifactId>
|
<artifactId>kie-server-api</artifactId>
|
||||||
<version>${jbpm.version}</version>
|
<version>${jbpm.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.uberfire</groupId>
|
|
||||||
<artifactId>uberfire-rest-client</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||||
<artifactId>drools-framework-kie-wb-rest-pojo</artifactId>
|
<artifactId>drools-framework-kie-wb-rest-pojo</artifactId>
|
||||||
|
|
@ -105,18 +91,6 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>com.offbytwo.jenkins</groupId>
|
<groupId>com.offbytwo.jenkins</groupId>
|
||||||
<artifactId>jenkins-client</artifactId>
|
<artifactId>jenkins-client</artifactId>
|
||||||
|
|
@ -128,6 +102,10 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-core</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.vaadin</groupId>
|
<groupId>com.vaadin</groupId>
|
||||||
<artifactId>vaadin-upload-flow</artifactId>
|
<artifactId>vaadin-upload-flow</artifactId>
|
||||||
|
|
@ -142,6 +120,11 @@
|
||||||
<version>1.1.0</version>
|
<version>1.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-spring</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
|
@ -152,50 +135,32 @@
|
||||||
<artifactId>spring-boot</artifactId>
|
<artifactId>spring-boot</artifactId>
|
||||||
<version>${spring-boot.version}</version>
|
<version>${spring-boot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.uberfire</groupId>
|
<groupId>org.uberfire</groupId>
|
||||||
<artifactId>uberfire-rest-client</artifactId>
|
<artifactId>uberfire-rest-client</artifactId>
|
||||||
<version>${jbpm.version}</version>
|
<version>2.9.0.Final</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.kie.server</groupId>
|
|
||||||
<artifactId>kie-server-controller-api</artifactId>
|
|
||||||
<version>${jbpm.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
<version>${spring-version}</version>
|
<version>${spring-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>2.9.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>2.9.4</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>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
<artifactId>jackson-dataformat-xml</artifactId>
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
<version>2.10.4</version>
|
<version>2.9.4</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
|
@ -211,6 +176,11 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.module</groupId>
|
||||||
|
<artifactId>jackson-module-jaxb-annotations</artifactId>
|
||||||
|
<version>2.9.4</version>
|
||||||
|
</dependency>
|
||||||
<!--dependency>
|
<!--dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
|
|
@ -236,39 +206,16 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||||
<artifactId>drools-framework-business-proxy-persistence</artifactId>
|
<artifactId>drools-framework-business-proxy-persistence</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>1.1-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||||
<artifactId>springfox-boot-starter</artifactId>
|
<artifactId>drools-framework-business-indexer-persistence</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
<scope>compile</scope>
|
||||||
<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>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
@ -298,7 +245,6 @@
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<jvmArguments>-Dvaadin.productionMode</jvmArguments>
|
<jvmArguments>-Dvaadin.productionMode</jvmArguments>
|
||||||
<executable>true</executable>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|
@ -308,15 +254,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
@ -368,19 +306,19 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>${fabri8.plugin.version}</version>
|
<version>0.21.0</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<!--registry>192.168.1.184:12500</registry-->
|
<!--registry>192.168.1.184:12500</registry-->
|
||||||
|
<dockerHost>${docker.Host}</dockerHost>
|
||||||
|
|
||||||
<!-- this is for Mac and Amazon Linux -->
|
<!-- this is for Mac and Amazon Linux -->
|
||||||
<dockerHost>unix:///var/run/docker.sock</dockerHost>
|
<!--dockerHost>unix:///var/run/docker.sock</dockerHost-->
|
||||||
|
|
||||||
<verbose>true</verbose>
|
<verbose>true</verbose>
|
||||||
<images>
|
<images>
|
||||||
<image>
|
<image>
|
||||||
<name>runtime-admin-console:${version.number}</name>
|
<name>runtime-admin-console</name>
|
||||||
<build>
|
<build>
|
||||||
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||||
|
|
||||||
|
|
@ -431,15 +369,15 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>${fabri8.plugin.version}</version>
|
<version>0.21.0</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<registry>${registry.host}</registry>
|
<registry>registry.hub.docker.com/pymmasoftware</registry>
|
||||||
<dockerHost>${docker.Host}</dockerHost>
|
<dockerHost>${docker.Host}</dockerHost>
|
||||||
<verbose>true</verbose>
|
<verbose>true</verbose>
|
||||||
<images>
|
<images>
|
||||||
<image>
|
<image>
|
||||||
<name>runtime-admin-console:${version.number}</name>
|
<name>runtime-admin-console:${project.version}</name>
|
||||||
<alias>runtime-admin-console</alias>
|
<alias>runtime-admin-console</alias>
|
||||||
<build>
|
<build>
|
||||||
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||||
|
|
@ -462,65 +400,9 @@
|
||||||
</run>
|
</run>
|
||||||
</image>
|
</image>
|
||||||
</images>
|
</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>
|
<authConfig>
|
||||||
<username>pymmasoftwaredeploy</username>
|
<username>pymmasoftwaredeploy</username>
|
||||||
<password>${dockerhub.password}</password>
|
<password>pymmalomme</password>
|
||||||
</authConfig>
|
</authConfig>
|
||||||
<retries>5</retries>
|
<retries>5</retries>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
FROM azul/zulu-openjdk-debian:11
|
FROM openjdk:8-jre-slim
|
||||||
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y wget procps
|
|
||||||
ADD application.properties /application.properties
|
ADD application.properties /application.properties
|
||||||
ADD maven/drools-framework-admin-console.jar app.jar
|
ADD maven/drools-framework-admin-console.jar app.jar
|
||||||
|
|
||||||
EXPOSE 8200
|
EXPOSE 8200
|
||||||
|
|
||||||
RUN bash -c 'touch /app.jar'
|
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","-Dspring.config.location=file:./","-jar","/app.jar"]
|
|
||||||
#ENTRYPOINT ["java","-jar","/app.jar"]
|
#ENTRYPOINT ["java","-jar","/app.jar"]
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,12 @@
|
||||||
|
spring.data.elasticsearch.cluster-nodes=elasticdb:9300
|
||||||
|
spring.data.elasticsearch.repositories.enabled=true
|
||||||
|
spring.data.elasticsearch.cluster-name=elasticsearch
|
||||||
|
spring.data.mongodb.database=businessProxyDB
|
||||||
|
spring.data.mongodb.host=mongodb:27017
|
||||||
|
|
||||||
server.port=${port:8200}
|
server.port=${port:8200}
|
||||||
kie-wb.baseurl=${PYMMA_KIE_BASE_URL:http://kie-wb:8080/kie-wb/rest}
|
kie-wb.baseurl=http://kie-wb:8080/kie-wb/rest
|
||||||
kie-wb.mainwbintern=${PYMMA_KIE_MAINWBINTERN:http://kie-wb:8080/kie-wb}
|
kie-wb.username=admin
|
||||||
kie-wb.mainwbextern=${PYMMA_KIE_MAINWBEXTERN:http://kie-wb:8080/kie-wb}
|
kie-wb.password=admin
|
||||||
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
|
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,298 +1,39 @@
|
||||||
package org.chtijbug.drools.console;
|
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.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.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
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.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.annotation.*;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
||||||
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.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
|
@Configuration
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@ComponentScan({"org.chtijbug.drools.proxy.persistence","org.chtijbug.drools.indexer"})
|
||||||
@EnableMongoRepositories("org.chtijbug.drools.proxy.persistence.repository")
|
@EnableMongoRepositories("org.chtijbug.drools.proxy.persistence.repository")
|
||||||
@EnableKafka
|
@EnableElasticsearchRepositories(basePackages = "org.chtijbug.drools.indexer.persistence.repository")
|
||||||
@PropertySource("classpath:application.properties")
|
@PropertySource("classpath:application.properties")
|
||||||
@EnableSwagger2
|
@ImportResource("classpath:applicationContext.xml")
|
||||||
@EnableScheduling
|
|
||||||
public class DroolsSpringBootConsoleApplication extends SpringBootServletInitializer {
|
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
|
@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() {
|
public ApplicationContextProvider getAppplicationContext() {
|
||||||
return new ApplicationContextProvider();
|
ApplicationContextProvider applicationContextProvider = new ApplicationContextProvider();
|
||||||
|
return applicationContextProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public KieConfigurationData createKieConfigurationData(){
|
|
||||||
KieConfigurationData kieConfigurationData = new KieConfigurationData();
|
|
||||||
kieConfigurationData.setKiewbUrl(kiewbUrl);
|
|
||||||
kieConfigurationData.setName("demo");
|
|
||||||
return kieConfigurationData;
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
return application.sources(DroolsSpringBootConsoleApplication.class);
|
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) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(DroolsSpringBootConsoleApplication.class, 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,32 +1,33 @@
|
||||||
package org.chtijbug.drools.console.restexpose;
|
package org.chtijbug.drools.console.restExpose;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import org.chtijbug.drools.console.service.IndexerService;
|
import org.chtijbug.drools.console.service.IndexerService;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionAction;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionPersistence;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/logging")
|
@RequestMapping("/api/elasticSearch")
|
||||||
@Api("/api/logging")
|
|
||||||
public class ElasticSearchExpose {
|
public class ElasticSearchExpose {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IndexerService indexerService;
|
private IndexerService indexerService;
|
||||||
|
|
||||||
@GetMapping(value = "/findLastByTransactionId")
|
@RequestMapping(value = "/findLastByTransactionId", method = RequestMethod.GET)
|
||||||
public BusinessTransactionPersistence findTransactionById(@RequestParam String transactionId, HttpServletRequest request, HttpServletResponse response) {
|
public BusinessTransactionPersistence findTransactionById(@RequestParam String transactionId, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
BusinessTransactionPersistence tmp=null;
|
BusinessTransactionPersistence tmp=null;
|
||||||
|
|
||||||
List<BusinessTransactionPersistence> businessTransactionPersistences = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(transactionId,PageRequest.of(0,5000));
|
List<BusinessTransactionPersistence> businessTransactionPersistences = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(transactionId,new PageRequest(0,5000));
|
||||||
|
|
||||||
if(businessTransactionPersistences!=null) {
|
if(businessTransactionPersistences!=null) {
|
||||||
for (BusinessTransactionPersistence b : businessTransactionPersistences) {
|
for (BusinessTransactionPersistence b : businessTransactionPersistences) {
|
||||||
|
|
@ -42,9 +43,12 @@ public class ElasticSearchExpose {
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
@GetMapping(value = "/findActionByBusinessId")
|
@RequestMapping(value = "/findActionByBusinessId", method = RequestMethod.GET)
|
||||||
public List<BusinessTransactionAction> findActionById(@RequestParam String businessId, HttpServletRequest request, HttpServletResponse response) {
|
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));
|
|
||||||
|
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(businessId,new Sort(new Sort.Order(Sort.Direction.ASC,"eventNumber")),new PageRequest(0,5000));
|
||||||
|
|
||||||
|
return businessTransactionPersistences;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -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,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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,153 @@
|
||||||
|
package org.chtijbug.drools.console.service;
|
||||||
|
|
||||||
|
import javassist.bytecode.ByteArray;
|
||||||
|
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.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ExcelService {
|
||||||
|
|
||||||
|
|
||||||
|
private KieRepositoryService kieRepositoryService;
|
||||||
|
private KieConfigurationData config;
|
||||||
|
|
||||||
|
private UserConnectedService userConnectedService;
|
||||||
|
|
||||||
|
|
||||||
|
public ExcelService(){
|
||||||
|
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||||
|
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||||
|
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<HashMap<String,Object>> importExcel(InputStream inputStream) throws IOException {
|
||||||
|
|
||||||
|
Workbook workbook= WorkbookFactory.create(inputStream);
|
||||||
|
|
||||||
|
DataFormatter dataFormatter = new DataFormatter();
|
||||||
|
|
||||||
|
List<HashMap<String,Object>> 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 = kieRepositoryService.getAssetSource(config.getKiewbUrl(),
|
||||||
|
userConnectedService.getUserConnected().getUserName(),
|
||||||
|
userConnectedService.getUserConnected().getUserPassword(),
|
||||||
|
userConnectedService.getSpace(),
|
||||||
|
userConnectedService.getProject(),
|
||||||
|
userConnectedService.getAsset());
|
||||||
|
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Workbook workbook = new XSSFWorkbook();
|
||||||
|
CreationHelper createHelper = 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(rows!=null&&rows.size()!=0){
|
||||||
|
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();
|
||||||
|
try {
|
||||||
|
FileOutputStream fileOutputStream=new FileOutputStream("/home/guillaume/test.xlsx");
|
||||||
|
workbook.write(fileOutputStream);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
workbook.write(bos);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
byte[] barray = bos.toByteArray();
|
||||||
|
ByteArrayInputStream is = new ByteArrayInputStream(barray);
|
||||||
|
|
||||||
|
try {
|
||||||
|
workbook.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,6 @@ import org.chtijbug.drools.console.service.model.gitlab.GroupElementResponse;
|
||||||
import org.chtijbug.drools.console.service.model.gitlab.ProjectMoveResponse;
|
import org.chtijbug.drools.console.service.model.gitlab.ProjectMoveResponse;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
|
@ -19,7 +18,6 @@ import java.util.List;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@DependsOn("applicationContext")
|
|
||||||
public class GitLabRepositoryService {
|
public class GitLabRepositoryService {
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,7 +31,7 @@ public class GitLabRepositoryService {
|
||||||
public List<GroupElementResponse> getListGitRepostitories(String url, String token, String groupName) {
|
public List<GroupElementResponse> getListGitRepostitories(String url, String token, String groupName) {
|
||||||
|
|
||||||
String completeurl = url + "/groups/" + groupName + "/projects";
|
String completeurl = url + "/groups/" + groupName + "/projects";
|
||||||
logger.info("url gitlab : {}" , completeurl);
|
logger.info("url gitlab : " + completeurl);
|
||||||
ResponseEntity<List<GroupElementResponse>> response = restTemplateKiewb
|
ResponseEntity<List<GroupElementResponse>> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, token), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.GET, requestCallback(null, token), clientHttpResponse -> {
|
||||||
List<GroupElementResponse> extractedResponse = null;
|
List<GroupElementResponse> extractedResponse = null;
|
||||||
|
|
@ -43,7 +41,8 @@ public class GitLabRepositoryService {
|
||||||
GroupElementResponse[] values = mapper.readValue(result, GroupElementResponse[].class);
|
GroupElementResponse[] values = mapper.readValue(result, GroupElementResponse[].class);
|
||||||
extractedResponse = Arrays.asList(values);
|
extractedResponse = Arrays.asList(values);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity<List<GroupElementResponse>> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
return extractedValue;
|
||||||
});
|
});
|
||||||
List<GroupElementResponse> reponseMoteur;
|
List<GroupElementResponse> reponseMoteur;
|
||||||
|
|
||||||
|
|
@ -54,7 +53,7 @@ public class GitLabRepositoryService {
|
||||||
public GroupElementResponse createProjectForUser(String url, String token, String projectName) {
|
public GroupElementResponse createProjectForUser(String url, String token, String projectName) {
|
||||||
|
|
||||||
String completeurl = url + "/projects?name=" + projectName;
|
String completeurl = url + "/projects?name=" + projectName;
|
||||||
logger.info("url moteur reco : {}", completeurl);
|
logger.info("url moteur reco : " + completeurl);
|
||||||
ResponseEntity<GroupElementResponse> response = restTemplateKiewb
|
ResponseEntity<GroupElementResponse> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
||||||
GroupElementResponse extractedResponse = null;
|
GroupElementResponse extractedResponse = null;
|
||||||
|
|
@ -63,7 +62,8 @@ public class GitLabRepositoryService {
|
||||||
String result = s.hasNext() ? s.next() : "";
|
String result = s.hasNext() ? s.next() : "";
|
||||||
extractedResponse = mapper.readValue(result, GroupElementResponse.class);
|
extractedResponse = mapper.readValue(result, GroupElementResponse.class);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity<GroupElementResponse> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
return extractedValue;
|
||||||
});
|
});
|
||||||
GroupElementResponse reponseMoteur;
|
GroupElementResponse reponseMoteur;
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class GitLabRepositoryService {
|
||||||
public ProjectMoveResponse moveProjectTpGroup(String url, String token, String projectid, String groupName) {
|
public ProjectMoveResponse moveProjectTpGroup(String url, String token, String projectid, String groupName) {
|
||||||
|
|
||||||
String completeurl = url + "/groups/" + groupName + "/projects/" + projectid;
|
String completeurl = url + "/groups/" + groupName + "/projects/" + projectid;
|
||||||
logger.info("url moteur reco : {}" , completeurl);
|
logger.info("url moteur reco : " + completeurl);
|
||||||
ResponseEntity<ProjectMoveResponse> response = restTemplateKiewb
|
ResponseEntity<ProjectMoveResponse> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
||||||
ProjectMoveResponse extractedResponse = null;
|
ProjectMoveResponse extractedResponse = null;
|
||||||
|
|
@ -83,7 +83,8 @@ public class GitLabRepositoryService {
|
||||||
String result = s.hasNext() ? s.next() : "";
|
String result = s.hasNext() ? s.next() : "";
|
||||||
extractedResponse = mapper.readValue(result, ProjectMoveResponse.class);
|
extractedResponse = mapper.readValue(result, ProjectMoveResponse.class);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity<ProjectMoveResponse> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
return extractedValue;
|
||||||
});
|
});
|
||||||
ProjectMoveResponse reponseMoteur;
|
ProjectMoveResponse reponseMoteur;
|
||||||
|
|
||||||
|
|
@ -102,7 +103,7 @@ public class GitLabRepositoryService {
|
||||||
clientHttpRequest.getHeaders().add(
|
clientHttpRequest.getHeaders().add(
|
||||||
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
|
||||||
String authHeader = token;
|
String authHeader = new String(token);
|
||||||
clientHttpRequest.getHeaders().add(
|
clientHttpRequest.getHeaders().add(
|
||||||
"Private-Token", authHeader);
|
"Private-Token", authHeader);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package org.chtijbug.drools.console.service;
|
package org.chtijbug.drools.console.service;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
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 org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
|
@ -12,24 +9,18 @@ import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@DependsOn("applicationContext")
|
|
||||||
public class GitRepositoryService {
|
public class GitRepositoryService {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(GitRepositoryService.class);
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
GitRepositoryService service = new GitRepositoryService();
|
GitRepositoryService service = new GitRepositoryService();
|
||||||
service.executeCommand("cd /Users/nheron/kie-base-jbpm-6/niodir/.niogit/nico1.git && ./hooks/post-commit ");
|
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 {
|
public void addHookToRepo(String projectName, String gitBaseUrl) throws IOException {
|
||||||
String fileBase = System.getProperty("org.uberfire.nio.git.dir");
|
String fileBase = System.getProperty("org.uberfire.nio.git.dir");
|
||||||
if (fileBase != null) {
|
if (fileBase != null) {
|
||||||
if (gitRepoBase==null || gitBaseUrl.length()==0){
|
String gitdirectory = fileBase + "/.niogit/" + projectName + ".git";
|
||||||
gitRepoBase=".niogit";
|
String gitFileName = fileBase + "/.niogit/" + projectName + ".git/hooks/post-commit";
|
||||||
}
|
|
||||||
String gitdirectory = fileBase + "/"+gitRepoBase+"/" + projectName + ".git";
|
|
||||||
String gitFileName = fileBase + "/"+gitRepoBase+"/" + projectName + ".git/hooks/post-commit";
|
|
||||||
/**
|
/**
|
||||||
* #!/bin/sh
|
* #!/bin/sh
|
||||||
* REPO=git@gitlab.pymma-software.com:nheron/jbpm-edop-base-example.git
|
* REPO=git@gitlab.pymma-software.com:nheron/jbpm-edop-base-example.git
|
||||||
|
|
@ -47,40 +38,37 @@ public class GitRepositoryService {
|
||||||
stringBuilder.append("cd $currentDir ").append("\n");
|
stringBuilder.append("cd $currentDir ").append("\n");
|
||||||
File file = new File(gitFileName);
|
File file = new File(gitFileName);
|
||||||
FileUtils.writeStringToFile(file, stringBuilder.toString());
|
FileUtils.writeStringToFile(file, stringBuilder.toString());
|
||||||
boolean executable = file.setExecutable(true, true);
|
file.setExecutable(true, true);
|
||||||
logger.info("executable {}",executable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeHookPush(String projectName, String gitRepoBase,String gitBaseUrl) {
|
public void executeHookPush(String projectName, String gitBaseUrl) {
|
||||||
String fileBase = System.getProperty("org.uberfire.nio.git.dir");
|
String fileBase = System.getProperty("org.uberfire.nio.git.dir");
|
||||||
if (fileBase != null) {
|
if (fileBase != null) {
|
||||||
if (gitRepoBase==null || gitBaseUrl.length()==0){
|
|
||||||
gitRepoBase=".niogit";
|
String gitFileName = fileBase + "/.niogit/" + projectName + ".git/hooks/post-commit";
|
||||||
}
|
|
||||||
String gitFileName = fileBase + "/"+gitRepoBase+"/" + projectName + ".git/hooks/post-commit";
|
|
||||||
this.executeCommand(gitFileName);
|
this.executeCommand(gitFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String executeCommand(String command) {
|
private String executeCommand(String command) {
|
||||||
|
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuffer output = new StringBuffer();
|
||||||
|
|
||||||
Process process;
|
Process process;
|
||||||
try {
|
try {
|
||||||
logger.info(command);
|
System.out.println(command);
|
||||||
logger.info("============Command start======================");
|
System.out.println("============Command start======================");
|
||||||
process = Runtime.getRuntime().exec(command);
|
process = Runtime.getRuntime().exec(command);
|
||||||
process.waitFor();
|
process.waitFor();
|
||||||
logger.info("=============Command Stop=====================");
|
System.out.println("=============Command Stop=====================");
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
String line = "";
|
String line = "";
|
||||||
try {
|
try {
|
||||||
while ((line = reader.readLine()) != null)
|
while ((line = reader.readLine()) != null)
|
||||||
logger.info(line);
|
System.out.println(line);
|
||||||
} finally {
|
} finally {
|
||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
|
|
@ -96,7 +84,7 @@ public class GitRepositoryService {
|
||||||
String line = "";
|
String line = "";
|
||||||
try {
|
try {
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
logger.info(line);
|
System.out.println(line);
|
||||||
// Traitement du flux d'erreur de l'application si besoin est
|
// Traitement du flux d'erreur de l'application si besoin est
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -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,17 +1,14 @@
|
||||||
package org.chtijbug.drools.console.service;
|
package org.chtijbug.drools.console.service;
|
||||||
|
|
||||||
|
import org.chtijbug.drools.indexer.persistence.repository.BusinessTransactionActionRepository;
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionActionRepository;
|
import org.chtijbug.drools.indexer.persistence.repository.BusinessTransactionPersistenceRepository;
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionPersistenceRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@DependsOn("applicationContext")
|
|
||||||
public class IndexerService {
|
public class IndexerService {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ import com.offbytwo.jenkins.model.View;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.chtijbug.drools.console.service.model.gitlab.GitLabConfigurationData;
|
import org.chtijbug.drools.console.service.model.gitlab.GitLabConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.model.jenkins.JenkinsConfigurationData;
|
import org.chtijbug.drools.console.service.model.jenkins.JenkinsConfigurationData;
|
||||||
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
@ -19,11 +19,11 @@ import java.net.URISyntaxException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@DependsOn("applicationContext")
|
|
||||||
public class JenkinsService {
|
public class JenkinsService {
|
||||||
JenkinsServer jenkins = null;
|
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 {
|
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 {
|
||||||
|
KieConfigurationData configKie = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||||
GitLabConfigurationData configGitLab = AppContext.getApplicationContext().getBean(GitLabConfigurationData.class);
|
GitLabConfigurationData configGitLab = AppContext.getApplicationContext().getBean(GitLabConfigurationData.class);
|
||||||
JenkinsConfigurationData jenkinsConfigurationData = AppContext.getApplicationContext().getBean(JenkinsConfigurationData.class);
|
JenkinsConfigurationData jenkinsConfigurationData = AppContext.getApplicationContext().getBean(JenkinsConfigurationData.class);
|
||||||
|
|
||||||
|
|
@ -57,9 +57,9 @@ public class JenkinsService {
|
||||||
} else {
|
} else {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
try {
|
try {
|
||||||
this.wait(1000);
|
Thread.currentThread().wait(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw e;
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -6,74 +6,95 @@ import org.apache.commons.codec.binary.Base64;
|
||||||
import org.chtijbug.drools.console.AddLog;
|
import org.chtijbug.drools.console.AddLog;
|
||||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
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.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.api.UserLoginInformation;
|
||||||
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
||||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
|
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||||
import org.chtijbug.guvnor.server.jaxrs.model.WorkspaceAuthData;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.http.*;
|
||||||
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.stereotype.Service;
|
||||||
import org.springframework.web.client.RequestCallback;
|
import org.springframework.web.client.RequestCallback;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.Charset;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@DependsOn("applicationContext")
|
|
||||||
public class KieRepositoryService {
|
public class KieRepositoryService {
|
||||||
|
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(KieRepositoryService.class);
|
private static Logger logger = LoggerFactory.getLogger(KieRepositoryService.class);
|
||||||
|
|
||||||
private static String chtijbugprefix="/chtijbug/";
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserRepository userRepository;
|
|
||||||
|
|
||||||
private RestTemplate restTemplateKiewb = new RestTemplate();
|
private RestTemplate restTemplateKiewb = new RestTemplate();
|
||||||
|
|
||||||
private ObjectMapper mapper = new ObjectMapper();
|
private ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
private String pojoToStringMethod(String assetContent,List<HashMap<String,Object>> objects){
|
||||||
|
|
||||||
public void updateAssetSource(String url, String username, String password, String spaceName, String projectName, String assetName, String assetSource) {
|
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetContent);
|
||||||
|
int i=0;
|
||||||
|
model.clearRows();
|
||||||
|
for(HashMap<String,Object> t:objects){
|
||||||
|
|
||||||
String completeurl = url + chtijbugprefix + spaceName + "/" + projectName + "/asset/" + assetName + "/source";
|
List<String> row=new ArrayList<>();
|
||||||
logger.info("url updateAssetSource : {}", completeurl);
|
for (Map.Entry<String,Object> entry:t.entrySet()){
|
||||||
|
row.add(String.valueOf(entry.getValue()));
|
||||||
|
}
|
||||||
|
model.addRow(i,row.toArray(new String[row.size()]));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
restTemplateKiewb
|
|
||||||
.execute(completeurl, HttpMethod.PUT, requestCallback(assetSource, username, password), clientHttpResponse -> {
|
return RuleTemplateModelXMLPersistenceImpl.getInstance().marshal(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAssetSource(String url, String username, String password, String spaceName, String projectName, String assetName,List<HashMap<String,Object>> objects) {
|
||||||
|
|
||||||
|
String assetContent = getAssetSource(url,
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
spaceName,
|
||||||
|
projectName,
|
||||||
|
assetName);
|
||||||
|
|
||||||
|
|
||||||
|
String completeurl = url + "/chtijbug/" + spaceName + "/" + projectName + "/assets/" + assetName + "/source";
|
||||||
|
|
||||||
|
String content=pojoToStringMethod(assetContent,objects);
|
||||||
|
logger.info("url moteur reco : " + completeurl);
|
||||||
|
|
||||||
|
ResponseEntity response = restTemplateKiewb
|
||||||
|
.execute(completeurl, HttpMethod.POST, requestCallback(content, username, password), clientHttpResponse -> {
|
||||||
String extractedResponse = null;
|
String extractedResponse = null;
|
||||||
if (clientHttpResponse.getBody() != null) {
|
if (clientHttpResponse.getBody() != null) {
|
||||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||||
String result = s.hasNext() ? s.next() : "";
|
String result = s.hasNext() ? s.next() : "";
|
||||||
extractedResponse = result;
|
extractedResponse = result;
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
return extractedValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// restTemplateKiewb.exchange(completeurl, HttpMethod.POST, requestCallBack(content, username, password), void.class);
|
||||||
|
System.out.println("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAssetSource(String url, String username, String password, String spaceName, String projectName, String assetName) {
|
public String getAssetSource(String url, String username, String password, String spaceName, String projectName, String assetName) {
|
||||||
String completeurl = url + chtijbugprefix + spaceName + "/" + projectName + "/assets/" + assetName + "/source";
|
String completeurl = url + "/chtijbug/" + spaceName + "/" + projectName + "/assets/" + assetName + "/source";
|
||||||
logger.info("url getAssetSource : {}", completeurl);
|
logger.info("url moteur reco : " + completeurl);
|
||||||
ResponseEntity<String> response = restTemplateKiewb
|
ResponseEntity<String> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||||
String result=null;
|
String extractedResponse = null;
|
||||||
if (clientHttpResponse.getBody() != null) {
|
if (clientHttpResponse.getBody() != null) {
|
||||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||||
result = s.hasNext() ? s.next() : "";
|
String result = s.hasNext() ? s.next() : "";
|
||||||
|
extractedResponse = result;
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(result, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity<String> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
return extractedValue;
|
||||||
});
|
});
|
||||||
String reponseMoteur;
|
String reponseMoteur;
|
||||||
|
|
||||||
|
|
@ -81,38 +102,30 @@ public class KieRepositoryService {
|
||||||
return reponseMoteur;
|
return reponseMoteur;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlatformProjectData> getListSpaces2(String url, String username, String password) {
|
public List<PlatformProjectResponse> getListSpaces2(String url, String username, String password) {
|
||||||
String completeurl = url + chtijbugprefix+"detailedSpaces";
|
String completeurl = url + "/chtijbug/detailedSpaces";
|
||||||
logger.info("url getListSpaces2 :{} ", completeurl);
|
logger.info("url moteur reco : " + completeurl);
|
||||||
ResponseEntity<List<PlatformProjectData>> response = restTemplateKiewb
|
ResponseEntity<List<PlatformProjectResponse>> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||||
List<PlatformProjectData> extractedResponse = null;
|
List<PlatformProjectResponse> extractedResponse = null;
|
||||||
if (clientHttpResponse.getBody() != null) {
|
if (clientHttpResponse.getBody() != null) {
|
||||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||||
String result = s.hasNext() ? s.next() : "";
|
String result = s.hasNext() ? s.next() : "";
|
||||||
PlatformProjectData[] values = mapper.readValue(result, PlatformProjectData[].class);
|
PlatformProjectResponse[] values = mapper.readValue(result, PlatformProjectResponse[].class);
|
||||||
extractedResponse = Arrays.asList(values);
|
extractedResponse = Arrays.asList(values);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity<List<PlatformProjectResponse>> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
return extractedValue;
|
||||||
});
|
});
|
||||||
List<PlatformProjectData> reponseMoteur;
|
List<PlatformProjectResponse> reponseMoteur;
|
||||||
|
|
||||||
reponseMoteur = response.getBody();
|
reponseMoteur = response.getBody();
|
||||||
return reponseMoteur;
|
return reponseMoteur;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserConnected login(String url, String username, String password,String workbenchName) {
|
public UserConnected login(String url, String username, String password) {
|
||||||
|
String completeurl = url + "/chtijbug/login";
|
||||||
User user = userRepository.findByLogin(username);
|
logger.info("url moteur reco : " + completeurl);
|
||||||
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
|
ResponseEntity<UserLoginInformation> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||||
UserLoginInformation extractedResponse = null;
|
UserLoginInformation extractedResponse = null;
|
||||||
|
|
@ -122,50 +135,8 @@ public class KieRepositoryService {
|
||||||
extractedResponse = mapper.readValue(result, UserLoginInformation.class);
|
extractedResponse = mapper.readValue(result, UserLoginInformation.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity<UserLoginInformation> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
});
|
return extractedValue;
|
||||||
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();
|
UserConnected userConnected = new UserConnected();
|
||||||
|
|
||||||
|
|
@ -174,17 +145,14 @@ public class KieRepositoryService {
|
||||||
userConnected.setUserPassword(password);
|
userConnected.setUserPassword(password);
|
||||||
userConnected.setUserPassword(password);
|
userConnected.setUserPassword(password);
|
||||||
userConnected.getProjectResponses().addAll(responseBody.getProjects());
|
userConnected.getProjectResponses().addAll(responseBody.getProjects());
|
||||||
userConnected.getRoles().addAll(responseBody.getRoles());
|
|
||||||
userConnected.setUserName(username);
|
userConnected.setUserName(username);
|
||||||
userConnected.setKieWorkbenchName(workbenchName);
|
|
||||||
return userConnected;
|
return userConnected;
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Asset> getListAssets(String url, String username, String password, String spaceName, String projectName) {
|
public List<Asset> getListAssets(String url, String username, String password, String spaceName, String projectName) {
|
||||||
String completeurl = url + chtijbugprefix + spaceName + "/" + projectName + "/assets";
|
String completeurl = url + "/chtijbug/" + spaceName + "/" + projectName + "/assets";
|
||||||
logger.info("url getListAssets : {}" , completeurl);
|
logger.info("url moteur reco : " + completeurl);
|
||||||
ResponseEntity<List<Asset>> response = restTemplateKiewb
|
ResponseEntity<List<Asset>> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||||
List<Asset> extractedResponse = null;
|
List<Asset> extractedResponse = null;
|
||||||
|
|
@ -194,7 +162,8 @@ public class KieRepositoryService {
|
||||||
Asset[] values = mapper.readValue(result, Asset[].class);
|
Asset[] values = mapper.readValue(result, Asset[].class);
|
||||||
extractedResponse = Arrays.asList(values);
|
extractedResponse = Arrays.asList(values);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity<List<Asset>> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
return extractedValue;
|
||||||
});
|
});
|
||||||
List<Asset> reponseMoteur;
|
List<Asset> reponseMoteur;
|
||||||
|
|
||||||
|
|
@ -202,12 +171,9 @@ public class KieRepositoryService {
|
||||||
return reponseMoteur;
|
return reponseMoteur;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JobStatus buildProject(String url, String username, String password, String space, String project, String branchName,String command, AddLog workOnGoingView, UI ui) {
|
public JobStatus buildProject(String url, String username, String password, String space, String project, String command, AddLog workOnGoingView, UI ui) {
|
||||||
String completeurl= url + "/spaces/" + space + "/projects/" + project + "/maven/" + command;
|
String completeurl = url + "/spaces/" + space + "/projects/" + project + "/maven/" + command;
|
||||||
if (branchName!= null && branchName.length()>0){
|
logger.info("url Maven install : " + completeurl);
|
||||||
completeurl= url + "/spaces/" + space + "/projects/" + project +"/branches/"+branchName+ "/maven/" + command;
|
|
||||||
}
|
|
||||||
logger.info("url buildProject Maven install : {}" , completeurl);
|
|
||||||
ResponseEntity<JobStatus> response = restTemplateKiewb
|
ResponseEntity<JobStatus> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.POST, requestCallback(null, username, password), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.POST, requestCallback(null, username, password), clientHttpResponse -> {
|
||||||
JobStatus extractedResponse = null;
|
JobStatus extractedResponse = null;
|
||||||
|
|
@ -217,19 +183,20 @@ public class KieRepositoryService {
|
||||||
JobStatus values = mapper.readValue(result, JobStatus.class);
|
JobStatus values = mapper.readValue(result, JobStatus.class);
|
||||||
extractedResponse = values;
|
extractedResponse = values;
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity<JobStatus> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
return extractedValue;
|
||||||
});
|
});
|
||||||
JobStatus reponseMoteur;
|
JobStatus reponseMoteur;
|
||||||
|
|
||||||
reponseMoteur = response.getBody();
|
reponseMoteur = response.getBody();
|
||||||
workOnGoingView.addRow(reponseMoteur.toString(), ui);
|
workOnGoingView.addRow(reponseMoteur.toString(),ui);
|
||||||
return reponseMoteur;
|
return reponseMoteur;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JobStatus getStatusJobID(String url, String username, String password, String jobID) {
|
public JobStatus getStatusJobID(String url, String username, String password, String jobID) {
|
||||||
|
|
||||||
String completeurl = url + "/jobs/" + jobID;
|
String completeurl = url + "/jobs/" + jobID;
|
||||||
logger.info("url getStatusJobID : {}" , completeurl);
|
logger.info("url moteur reco : " + completeurl);
|
||||||
ResponseEntity<JobStatus> response = restTemplateKiewb
|
ResponseEntity<JobStatus> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||||
JobStatus extractedResponse = null;
|
JobStatus extractedResponse = null;
|
||||||
|
|
@ -239,7 +206,8 @@ public class KieRepositoryService {
|
||||||
extractedResponse = mapper.readValue(result, JobStatus.class);
|
extractedResponse = mapper.readValue(result, JobStatus.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
ResponseEntity<JobStatus> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
|
return extractedValue;
|
||||||
});
|
});
|
||||||
JobStatus reponseMoteur;
|
JobStatus reponseMoteur;
|
||||||
|
|
||||||
|
|
@ -247,63 +215,39 @@ public class KieRepositoryService {
|
||||||
return reponseMoteur;
|
return reponseMoteur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HttpEntity requestCallBack(final Object content, String username, String password){
|
||||||
|
HttpHeaders httpHeaders=new HttpHeaders();
|
||||||
|
httpHeaders.add(
|
||||||
|
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
httpHeaders.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);
|
||||||
|
httpHeaders.add(
|
||||||
|
HttpHeaders.AUTHORIZATION, authHeader);
|
||||||
|
HttpEntity httpEntity=new HttpEntity(content,httpHeaders);
|
||||||
|
|
||||||
|
|
||||||
|
return httpEntity;
|
||||||
|
}
|
||||||
|
|
||||||
private RequestCallback requestCallback(final Object content, String username, String password) {
|
private RequestCallback requestCallback(final Object content, String username, String password) {
|
||||||
return clientHttpRequest -> {
|
return clientHttpRequest -> {
|
||||||
if (content != null) {
|
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);
|
mapper.writeValue(clientHttpRequest.getBody(), content);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
clientHttpRequest.getHeaders().add(
|
clientHttpRequest.getHeaders().add(
|
||||||
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
||||||
clientHttpRequest.getHeaders().add(
|
clientHttpRequest.getHeaders().add(
|
||||||
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||||
String auth = username + ":" + password;
|
String auth = username + ":" + password;
|
||||||
byte[] encodedAuth = Base64.encodeBase64(
|
byte[] encodedAuth = Base64.encodeBase64(
|
||||||
auth.getBytes(StandardCharsets.UTF_8));
|
auth.getBytes(Charset.forName("UTF-8")));
|
||||||
String authHeader = "Basic " + new String(encodedAuth);
|
String authHeader = "Basic " + new String(encodedAuth);
|
||||||
clientHttpRequest.getHeaders().add(
|
clientHttpRequest.getHeaders().add(
|
||||||
HttpHeaders.AUTHORIZATION, authHeader);
|
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,33 +1,31 @@
|
||||||
package org.chtijbug.drools.console.service;
|
package org.chtijbug.drools.console.service;
|
||||||
|
|
||||||
import com.vaadin.flow.component.UI;
|
import com.vaadin.flow.component.UI;
|
||||||
import org.chtijbug.drools.ReverseProxyUpdate;
|
import com.vaadin.flow.server.VaadinSession;
|
||||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
|
||||||
import org.chtijbug.drools.console.AddLog;
|
import org.chtijbug.drools.console.AddLog;
|
||||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
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.JobStatus;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.proxy.persistence.json.KieProject;
|
import org.chtijbug.drools.proxy.persistence.json.KeyProject;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.*;
|
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.*;
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
|
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||||
import org.slf4j.Logger;
|
import org.chtijbug.drools.proxy.persistence.repository.ContainerRepository;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
||||||
|
import org.chtijbug.drools.proxy.persistence.repository.RuntimeRepository;
|
||||||
|
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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 org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@DependsOn("applicationContext")
|
|
||||||
public class ProjectPersistService {
|
public class ProjectPersistService {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProjectPersistService.class);
|
public static String PROJECT = "4";
|
||||||
|
|
||||||
private static String projectVariable = "4";
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProjectRepository projectRepository;
|
private ProjectRepository projectRepository;
|
||||||
|
|
@ -37,208 +35,95 @@ public class ProjectPersistService {
|
||||||
|
|
||||||
private KieConfigurationData config;
|
private KieConfigurationData config;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserRepository userRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserRolesRepository userRolesRepository;
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserConnectedService userConnectedService;
|
private UserConnectedService userConnectedService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private JobService jobService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ContainerRepository containerRepository;
|
private ContainerRepository containerRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ContainerRuntimeRepository containerRuntimeRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RuntimeRepository runtimeRepository;
|
private RuntimeRepository runtimeRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private KieWorkbenchRepository workbenchRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplateProxyUpdate;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserGroupsRepository userGroupsRepository;
|
|
||||||
|
|
||||||
|
|
||||||
public ProjectPersistService() {
|
public ProjectPersistService() {
|
||||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectPersist saveorUpdateProject(PlatformProjectData platformProjectData, KieWorkbench kieWorkbench) {
|
public static String getPROJECT() {
|
||||||
ProjectPersist projectPersist = projectRepository.findByProjectNameAndBranch(new KieProject(platformProjectData.getSpaceName(), platformProjectData.getName()), platformProjectData.getBranch());
|
return PROJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setPROJECT(String PROJECT) {
|
||||||
|
ProjectPersistService.PROJECT = PROJECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveIfnotExist(List<PlatformProjectResponse> platformProjectResponses) {
|
||||||
|
|
||||||
|
for (PlatformProjectResponse platformProjectResponse : platformProjectResponses) {
|
||||||
|
|
||||||
|
ProjectPersist projectPersist = projectRepository.findByProjectName(new KeyProject(platformProjectResponse.getSpaceName(), platformProjectResponse.getName()));
|
||||||
|
|
||||||
if (projectPersist == null) {
|
if (projectPersist == null) {
|
||||||
projectPersist = platformProjectResponseToProjectPersist(platformProjectData);
|
projectPersist = platformProjectResponseToProjectPersist(platformProjectResponse);
|
||||||
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);
|
projectRepository.save(projectPersist);
|
||||||
|
addProjectToSession(projectPersist, true);
|
||||||
|
|
||||||
}
|
|
||||||
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 {
|
} else {
|
||||||
userGroups.setWorkspaceUserGroup(workspaceUserGroup);
|
projectPersist.getClassNameList().clear();
|
||||||
userGroups=userGroupsRepository.save(userGroups);
|
for (String className : platformProjectResponse.getJavaClasses()){
|
||||||
|
projectPersist.getClassNameList().add(className);
|
||||||
|
projectRepository.save(projectPersist);
|
||||||
|
}
|
||||||
|
addProjectToSession(projectPersist, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return userGroups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserGroups createWorkSpaceGroupIfNeeded(String workSpaceName, KieWorkbench kieWorkbench) {
|
public HashMap<String, ProjectPersist> getProjectsSession() {
|
||||||
UserGroups userGroupsWorkSpace = userGroupsRepository.findByName("wrk_" + workSpaceName);
|
return (HashMap<String, ProjectPersist>) VaadinSession.getCurrent().getAttribute(PROJECT);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addProjectToSession(ProjectPersist projectPersist,boolean isModifiable) {
|
||||||
|
|
||||||
return userGroupsWorkSpace;
|
HashMap<String, ProjectPersist> projectPersists = getProjectsSession();
|
||||||
|
|
||||||
|
if (projectPersists == null) {
|
||||||
|
projectPersists = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, ProjectPersist> findProjectsConnectedUser() {
|
if (isModifiable) {
|
||||||
//VaadinSession.getCurrent().get
|
projectPersists.put(projectPersist.getProjectName().toString(), projectPersist);
|
||||||
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 {
|
} else {
|
||||||
List<UserGroups> userGroups = user.getUserGroups();
|
|
||||||
|
|
||||||
}
|
ProjectPersist tmp = projectPersists.get(projectPersist.getProjectName().toString());
|
||||||
Map<String, ProjectPersist> map = new HashMap<>();
|
if (tmp == null) {
|
||||||
for (ProjectPersist projectPersist : projectPersists) {
|
projectPersists.put(projectPersist.getProjectName().toString(), projectPersist);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VaadinSession.getCurrent().setAttribute(PROJECT, projectPersists);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean associate(ProjectPersist projectPersist, List<RuntimePersist> runtimePersists) {
|
public boolean associate(ProjectPersist projectPersist, List<RuntimePersist> runtimePersists) {
|
||||||
|
|
||||||
|
projectPersist.getServerNames().clear();
|
||||||
|
for (RuntimePersist runtimePersist : runtimePersists) {
|
||||||
|
List<String> names = new ArrayList<String>();
|
||||||
|
names.add(runtimePersist.getServerName());
|
||||||
|
List<ProjectPersist> projectPersists = projectRepository.findByServerNamesInAndDeploymentName(names, projectPersist.getDeploymentName());
|
||||||
|
//if (projectPersists.size() != 0) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
projectPersist.getServerNames().add(runtimePersist.getServerName());
|
||||||
|
}
|
||||||
|
|
||||||
projectPersist.setStatus(ProjectPersist.Deployable);
|
projectPersist.setStatus(ProjectPersist.Deployable);
|
||||||
projectPersist.setContainerID(projectPersist.getDeploymentName() + "-" + projectPersist.getProjectName());
|
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);
|
projectRepository.save(projectPersist);
|
||||||
kafkaTemplateProxyUpdate.send(KafkaTopicConstants.REVERSE_PROXY, reverseProxyUpdate);
|
addProjectToSession(projectPersist, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -251,58 +136,64 @@ public class ProjectPersistService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectPersist platformProjectResponseToProjectPersist(PlatformProjectData platformProjectResponse) {
|
public ProjectPersist platformProjectResponseToProjectPersist(PlatformProjectResponse platformProjectResponse) {
|
||||||
ProjectPersist projectPersist = new ProjectPersist();
|
ProjectPersist projectPersist = new ProjectPersist();
|
||||||
projectPersist.setArtifactID(platformProjectResponse.getArtifactId());
|
projectPersist.setArtifactID(platformProjectResponse.getArtifactId());
|
||||||
projectPersist.setGroupID(platformProjectResponse.getGroupId());
|
projectPersist.setGroupID(platformProjectResponse.getGroupId());
|
||||||
projectPersist.setProjectName(new KieProject(platformProjectResponse.getSpaceName(), platformProjectResponse.getName()));
|
projectPersist.setProjectName(new KeyProject(platformProjectResponse.getSpaceName(), platformProjectResponse.getName()));
|
||||||
projectPersist.setProjectVersion(platformProjectResponse.getVersion());
|
projectPersist.setProjectVersion(platformProjectResponse.getVersion());
|
||||||
projectPersist.setBranch(platformProjectResponse.getBranch());
|
|
||||||
projectPersist.setStatus(ProjectPersist.ADEFINIR);
|
projectPersist.setStatus(ProjectPersist.ADEFINIR);
|
||||||
projectPersist.setClassNameList(platformProjectResponse.getJavaClasses());
|
projectPersist.setClassNameList(platformProjectResponse.getJavaClasses());
|
||||||
return projectPersist;
|
return projectPersist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void waitForJobToBeEnded(String url, String username, String password, ProjectPersist projectPersist, AddLog workOnGoingView, UI ui) {
|
public void waitForJobToBeEnded(String url, String username, String password, ProjectPersist projectPersist, AddLog workOnGoingView, UI ui) {
|
||||||
|
|
||||||
UserConnected userConnected = userConnectedService.getUserConnected();
|
UserConnected userConnected = userConnectedService.getUserConnected();
|
||||||
|
|
||||||
Thread thread = new Thread() {
|
Thread thread = new Thread() {
|
||||||
@Override
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
JobStatus result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
JobStatus result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), projectPersist.getBranch(), "compile", workOnGoingView, ui);
|
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), "compile", workOnGoingView, ui);
|
||||||
|
|
||||||
jobService.executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
||||||
|
|
||||||
result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), projectPersist.getBranch(), "install", workOnGoingView, ui);
|
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), "install", workOnGoingView, ui);
|
||||||
|
|
||||||
jobService.executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
|
||||||
|
|
||||||
|
executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
||||||
|
|
||||||
|
// ContainerPojoPersist toto = containerRepository.findByServerNameAndContainerId(projectPersist.getContainerID());
|
||||||
for (String serverName : projectPersist.getServerNames()) {
|
for (String serverName : projectPersist.getServerNames()) {
|
||||||
|
List<RuntimePersist> kieservers = runtimeRepository.findByServerName(serverName);
|
||||||
|
if (kieservers.size() == 1) {
|
||||||
List<ContainerRuntimePojoPersist> existingContainers = containerRuntimeRepository.findByServerNameAndContainerId(serverName, projectPersist.getContainerID());
|
ContainerPojoPersist existingContainer = containerRepository.findByServerNameAndContainerId(serverName, projectPersist.getContainerID());
|
||||||
if (!existingContainers.isEmpty()) {
|
if (existingContainer == null) {
|
||||||
for (ContainerRuntimePojoPersist containerRuntimePojoPersist : existingContainers) {
|
ContainerPojoPersist newContainer = new ContainerPojoPersist();
|
||||||
containerRuntimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name());
|
newContainer.setStatus(ContainerPojoPersist.STATUS.TODEPLOY.toString());
|
||||||
containerRuntimeRepository.save(containerRuntimePojoPersist);
|
newContainer.setClassName(projectPersist.getMainClass());
|
||||||
}
|
newContainer.setProcessID(projectPersist.getProcessID());
|
||||||
|
newContainer.setContainerId(projectPersist.getContainerID());
|
||||||
|
newContainer.setServerName(serverName);
|
||||||
|
newContainer.setGroupId(projectPersist.getGroupID());
|
||||||
|
newContainer.setArtifactId(projectPersist.getArtifactID());
|
||||||
|
newContainer.setVersion(projectPersist.getProjectVersion());
|
||||||
|
containerRepository.save(newContainer);
|
||||||
} else {
|
} else {
|
||||||
List<RuntimePersist> servers = runtimeRepository.findByServerName(serverName);
|
existingContainer.setStatus(ContainerPojoPersist.STATUS.TODEPLOY.toString());
|
||||||
for (RuntimePersist server : servers) {
|
containerRepository.save(existingContainer);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//remove container from other runtime
|
||||||
|
List<ContainerPojoPersist> containerPojoPersists = containerRepository.findByContainerId(projectPersist.getContainerID());
|
||||||
|
for (ContainerPojoPersist container : containerPojoPersists){
|
||||||
|
if (projectPersist.getServerNames().contains(container.getServerName())==false){
|
||||||
|
container.setStatus(ContainerPojoPersist.STATUS.TODELETE.toString());
|
||||||
|
containerRepository.save(container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -311,6 +202,32 @@ public class ProjectPersistService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private 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";
|
||||||
|
workOnGoingView.addRow("JobID=" + jobID + " finished", ui);
|
||||||
|
} else if ("ACCEPTED".equals(jobStatus.getStatus())
|
||||||
|
|| ("APPROVED".equals(jobStatus.getStatus()))) {
|
||||||
|
try {
|
||||||
|
workOnGoingView.addRow("JobID=" + jobID + " not yet finished", ui);
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} /*else if("RESOURCE_NOT_EXIST".equals(jobStatus.getStatus())||
|
||||||
|
"SERVER_ERROR".equals(jobStatus.getStatus())||
|
||||||
|
"FAIL".equals(jobStatus.getStatus())){
|
||||||
|
isJobDone = "ERROR";
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ProjectRepository getProjectRepository() {
|
public ProjectRepository getProjectRepository() {
|
||||||
return projectRepository;
|
return projectRepository;
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,12 @@
|
||||||
package org.chtijbug.drools.console.service;
|
package org.chtijbug.drools.console.service;
|
||||||
|
|
||||||
import org.chtijbug.drools.console.service.model.ReturnPerso;
|
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.repository.RuntimeRepository;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||||
import org.kie.server.api.model.KieServerInfo;
|
import org.kie.server.api.model.KieServerInfo;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
@ -21,10 +15,7 @@ import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@DependsOn("applicationContext")
|
|
||||||
public class RuntimeService {
|
public class RuntimeService {
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,36 +24,30 @@ public class RuntimeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RuntimeRepository runtimeRepository;
|
private RuntimeRepository runtimeRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ContainerRepository containerRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ContainerRuntimeRepository containerRuntimeRepository;
|
|
||||||
|
|
||||||
private RestTemplate restTemplateKiewb = new RestTemplate();
|
private RestTemplate restTemplateKiewb = new RestTemplate();
|
||||||
|
|
||||||
public ReturnPerso<KieServerInfo> verifyIfKieServerExist(String url) {
|
public ReturnPerso verifyIfKieServerExist(String url) {
|
||||||
String completeurl = url + "/api/server/details";
|
String completeurl = url + "/api/server/details";
|
||||||
logger.info("url pverifyIfKieServerExist :{} " , completeurl);
|
logger.info("url project content : " + completeurl);
|
||||||
|
|
||||||
HttpHeaders httpHeaders=new HttpHeaders();
|
HttpHeaders httpHeaders=new HttpHeaders();
|
||||||
|
|
||||||
HttpEntity<Object> httpEntity=new HttpEntity<>(httpHeaders);
|
HttpEntity httpEntity=new HttpEntity(httpHeaders);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ResponseEntity<KieServerInfo> response = restTemplateKiewb.exchange(completeurl,
|
ResponseEntity<KieServerInfo> response = restTemplateKiewb.exchange(completeurl,
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
httpEntity,
|
httpEntity,
|
||||||
new ParameterizedTypeReference<>() {
|
new ParameterizedTypeReference<KieServerInfo>() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.getBody() != null ) {
|
if (response.getBody() != null ) {
|
||||||
return new ReturnPerso<>(true,"the runtime has been successfully added",response.getBody());
|
return new ReturnPerso(true,"the runtime has been successfully added",response.getBody());
|
||||||
} else {
|
} else {
|
||||||
return new ReturnPerso<>(false,"server error ",null);
|
return new ReturnPerso(false,"server error ",null);
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return new ReturnPerso<>(false,"The hostname is incorrect",null);
|
return new ReturnPerso(false,"The hostname is incorrect",null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,22 +62,4 @@ public class RuntimeService {
|
||||||
public void setRuntimeRepository(RuntimeRepository runtimeRepository) {
|
public void setRuntimeRepository(RuntimeRepository runtimeRepository) {
|
||||||
this.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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,16 @@ package org.chtijbug.drools.console.service;
|
||||||
|
|
||||||
import com.vaadin.flow.server.VaadinSession;
|
import com.vaadin.flow.server.VaadinSession;
|
||||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@DependsOn("applicationContext")
|
|
||||||
public class UserConnectedService {
|
public class UserConnectedService {
|
||||||
|
|
||||||
public final static String USER = "1";
|
public static String USER = "1";
|
||||||
public final static String ASSET = "2";
|
public static String ASSET = "2";
|
||||||
public final static String SPACE = "3";
|
public static String SPACE = "3";
|
||||||
public final static String PROJECT = "4";
|
public static String PROJECT = "4";
|
||||||
public final static String CURRENTPROJECT = "5";
|
public static String CURRENTPROJECT = "5";
|
||||||
|
|
||||||
|
|
||||||
public UserConnected getUserConnected() {
|
public UserConnected getUserConnected() {
|
||||||
|
|
|
||||||
|
|
@ -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,6 +1,6 @@
|
||||||
package org.chtijbug.drools.console.service.model;
|
package org.chtijbug.drools.console.service.model;
|
||||||
|
|
||||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
|
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -10,14 +10,12 @@ public class UserConnected {
|
||||||
|
|
||||||
private String userPassword;
|
private String userPassword;
|
||||||
|
|
||||||
private List<PlatformProjectData> projectResponses = new ArrayList<>();
|
private List<PlatformProjectResponse> projectResponses = new ArrayList<>();
|
||||||
|
|
||||||
private List<String> roles = new ArrayList<>();
|
private List<String> roles = new ArrayList<>();
|
||||||
|
|
||||||
private boolean connected;
|
private boolean connected;
|
||||||
|
|
||||||
private String kieWorkbenchName;
|
|
||||||
|
|
||||||
public UserConnected() {
|
public UserConnected() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,19 +40,12 @@ public class UserConnected {
|
||||||
this.userPassword = userPassword;
|
this.userPassword = userPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKieWorkbenchName() {
|
|
||||||
return kieWorkbenchName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKieWorkbenchName(String kieWorkbenchName) {
|
public List<PlatformProjectResponse> getProjectResponses() {
|
||||||
this.kieWorkbenchName = kieWorkbenchName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PlatformProjectData> getProjectResponses() {
|
|
||||||
return projectResponses;
|
return projectResponses;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectResponses(List<PlatformProjectData> projectResponses) {
|
public void setProjectResponses(List<PlatformProjectResponse> projectResponses) {
|
||||||
this.projectResponses = projectResponses;
|
this.projectResponses = projectResponses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ public class JobStatus {
|
||||||
private String result;
|
private String result;
|
||||||
private Date lastModified;
|
private Date lastModified;
|
||||||
private String detailedResult[];
|
private String detailedResult[];
|
||||||
private String branchName;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
@ -82,12 +81,4 @@ public class JobStatus {
|
||||||
public void setDetailedResult(String[] detailedResult) {
|
public void setDetailedResult(String[] detailedResult) {
|
||||||
this.detailedResult = detailedResult;
|
this.detailedResult = detailedResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBranchName() {
|
|
||||||
return branchName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBranchName(String branchName) {
|
|
||||||
this.branchName = branchName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
package org.chtijbug.drools.console.service.model.kie;
|
package org.chtijbug.drools.console.service.model.kie;
|
||||||
|
|
||||||
import java.io.Serializable;
|
public class KieConfigurationData {
|
||||||
|
|
||||||
public class KieConfigurationData implements Serializable {
|
|
||||||
|
|
||||||
private String kiewbUrl;
|
private String kiewbUrl;
|
||||||
|
|
||||||
|
|
@ -10,7 +8,6 @@ public class KieConfigurationData implements Serializable {
|
||||||
|
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
|
|
||||||
public String getKiewbUrl() {
|
public String getKiewbUrl() {
|
||||||
|
|
@ -37,11 +34,4 @@ public class KieConfigurationData implements Serializable {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -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=================================================");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -7,6 +7,6 @@ public class PasswordValidator extends RegexpValidator {
|
||||||
private static final String PATTERN = "[a-zA-Z0-9_@./*#&+-]{4,30}";
|
private static final String PATTERN = "[a-zA-Z0-9_@./*#&+-]{4,30}";
|
||||||
|
|
||||||
public PasswordValidator(String errorMessage) {
|
public PasswordValidator(String errorMessage) {
|
||||||
super(errorMessage, PATTERN, true);
|
super(errorMessage, "[a-zA-Z0-9_@./#*&+-]{4,30}", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ package org.chtijbug.drools.console.util;
|
||||||
|
|
||||||
import com.vaadin.flow.data.validator.RegexpValidator;
|
import com.vaadin.flow.data.validator.RegexpValidator;
|
||||||
|
|
||||||
public class HostnameValidator extends 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])$)";
|
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) {
|
public hostnameValidator(String errorMessage) {
|
||||||
super(errorMessage, PATTERN, true);
|
super(errorMessage, PATTERN, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
||||||
|
|
||||||
|
|
||||||
import com.vaadin.flow.component.combobox.ComboBox;
|
import com.vaadin.flow.component.combobox.ComboBox;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
||||||
|
|
||||||
import com.vaadin.flow.component.datepicker.DatePicker;
|
import com.vaadin.flow.component.datepicker.DatePicker;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.Icon;
|
import com.vaadin.flow.component.icon.Icon;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.Icon;
|
import com.vaadin.flow.component.icon.Icon;
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.Squelette;
|
package org.chtijbug.drools.console.vaadinComponent.Squelette;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
import com.vaadin.flow.component.splitlayout.SplitLayout;
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentview.ConsoleDeploy;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.ConsoleDeploy;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.LeftMenuGlobal;
|
import org.chtijbug.drools.console.vaadinComponent.leftMenu.LeftMenuGlobal;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.menu.*;
|
import org.chtijbug.drools.console.vaadinComponent.menu.*;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
|
|
@ -98,7 +100,7 @@ public class SqueletteComposant extends VerticalLayout {
|
||||||
infoPage.removeAll();
|
infoPage.removeAll();
|
||||||
infoPage.add(verticalLayout);
|
infoPage.add(verticalLayout);
|
||||||
|
|
||||||
if(pageName.equals(DeploymentView.PAGE_NAME)){
|
if(pageName.equals(DeploymentView.pageName)){
|
||||||
consoleDeploy.setVisible(true);
|
consoleDeploy.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,33 +1,38 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||||
|
import com.vaadin.flow.component.button.Button;
|
||||||
|
import com.vaadin.flow.component.datepicker.DatePicker;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.grid.Grid;
|
import com.vaadin.flow.component.grid.Grid;
|
||||||
|
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.binder.Binder;
|
import com.vaadin.flow.data.binder.Binder;
|
||||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
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.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.GuidedDecisionTableModelTransformer;
|
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
||||||
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.backend.RuleTemplateModelXMLPersistenceImpl;
|
||||||
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.text.DateFormat;
|
||||||
import java.util.List;
|
import java.text.ParseException;
|
||||||
import java.util.Map;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class AssetEdit extends Grid<HashMap<String, Object>> {
|
public class AssetEdit extends Grid<HashMap<String, Object>> {
|
||||||
|
|
||||||
private transient KieRepositoryService kieRepositoryService;
|
private KieRepositoryService kieRepositoryService;
|
||||||
|
private KieConfigurationData config;
|
||||||
|
|
||||||
private transient KieConfigurationData config;
|
private UserConnectedService userConnectedService;
|
||||||
|
|
||||||
private transient UserConnectedService userConnectedService;
|
|
||||||
|
|
||||||
public AssetEdit() {
|
public AssetEdit() {
|
||||||
|
|
||||||
|
|
@ -43,19 +48,21 @@ public class AssetEdit extends Grid<HashMap<String, Object>> {
|
||||||
userConnectedService.getSpace(),
|
userConnectedService.getSpace(),
|
||||||
userConnectedService.getProject(),
|
userConnectedService.getProject(),
|
||||||
userConnectedService.getAsset());
|
userConnectedService.getAsset());
|
||||||
|
|
||||||
|
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetContent);
|
||||||
|
InterpolationVariable[] variablesList = model.getInterpolationVariablesList();
|
||||||
|
|
||||||
|
setClassName("grid-perso");
|
||||||
|
|
||||||
Binder<HashMap<String, Object>> binder = new Binder<>();
|
Binder<HashMap<String, Object>> binder = new Binder<>();
|
||||||
getEditor().setBinder(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();
|
|
||||||
|
|
||||||
|
|
||||||
|
for (InterpolationVariable i : variablesList) {
|
||||||
|
addColumn(hashmap -> hashmap.get(i.getVarName())).setHeader(i.getVarName());
|
||||||
}
|
}
|
||||||
|
fillTable(model);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetEdit(List<HashMap<String, Object>> objects) {
|
public AssetEdit(List<HashMap<String, Object>> objects) {
|
||||||
|
|
@ -71,7 +78,7 @@ public class AssetEdit extends Grid<HashMap<String, Object>> {
|
||||||
Binder<HashMap<String, Object>> binder = new Binder<>();
|
Binder<HashMap<String, Object>> binder = new Binder<>();
|
||||||
getEditor().setBinder(binder);
|
getEditor().setBinder(binder);
|
||||||
|
|
||||||
if(!objects.isEmpty()){
|
if(objects.size()>0){
|
||||||
for(Map.Entry<String,Object> t:objects.get(0).entrySet()){
|
for(Map.Entry<String,Object> t:objects.get(0).entrySet()){
|
||||||
addColumn(hashmap -> hashmap.get(t.getKey())).setHeader(t.getKey());
|
addColumn(hashmap -> hashmap.get(t.getKey())).setHeader(t.getKey());
|
||||||
|
|
||||||
|
|
@ -81,5 +88,27 @@ public class AssetEdit extends Grid<HashMap<String, Object>> {
|
||||||
setItems(objects);
|
setItems(objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void maj(List<HashMap<String, Object>> objects){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void fillTable(TemplateModel model) {
|
||||||
|
InterpolationVariable[] variablesList = model.getInterpolationVariablesList();
|
||||||
|
DateFormat format = new SimpleDateFormat("dd-MMM-yyyy", Locale.FRANCE);
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setItems(rows);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dialog.Dialog;
|
import com.vaadin.flow.component.dialog.Dialog;
|
||||||
|
|
@ -24,7 +24,7 @@ public class AssociateProjectKie extends VerticalLayout {
|
||||||
|
|
||||||
private Button associer;
|
private Button associer;
|
||||||
|
|
||||||
private transient ProjectPersistService projectPersistService;
|
private ProjectPersistService projectPersistService;
|
||||||
|
|
||||||
public AssociateProjectKie(DeploymentView deploymentView, Dialog dialog, ProjectPersist projectPersist) {
|
public AssociateProjectKie(DeploymentView deploymentView, Dialog dialog, ProjectPersist projectPersist) {
|
||||||
|
|
||||||
|
|
@ -49,39 +49,30 @@ public class AssociateProjectKie extends VerticalLayout {
|
||||||
add(associer);
|
add(associer);
|
||||||
associer.addClickListener(buttonClickEvent -> {
|
associer.addClickListener(buttonClickEvent -> {
|
||||||
List<RuntimePersist> lstToSave = new ArrayList<>();
|
List<RuntimePersist> lstToSave = new ArrayList<>();
|
||||||
List<RuntimePersist> lstToDelete = new ArrayList<>();
|
|
||||||
for (RuntimePersist runtimePersist : gridRuntime.getSelectedItems()) {
|
for (RuntimePersist runtimePersist : gridRuntime.getSelectedItems()) {
|
||||||
lstToSave.add(runtimePersist);
|
lstToSave.add(runtimePersist);
|
||||||
}
|
}
|
||||||
for (RuntimePersist runtime : gridRuntime.getRuntimeSelected()){
|
if (lstToSave.size()>0) {
|
||||||
boolean found=false;
|
|
||||||
for (RuntimePersist runtimePersist : gridRuntime.getSelectedItems()) {
|
|
||||||
if (runtimePersist.getServerName().equals(runtime.getServerName())
|
|
||||||
&& runtimePersist.getServerPort().equals(runtime.getServerPort())){
|
|
||||||
found=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
boolean tmp = projectPersistService.associate(projectPersist,lstToSave);
|
||||||
if (!found){
|
|
||||||
lstToDelete.add(runtime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!lstToDelete.isEmpty()){
|
|
||||||
projectPersistService.removeAssociation(projectPersist,lstToDelete);
|
|
||||||
}
|
|
||||||
if (!lstToSave.isEmpty()) {
|
|
||||||
|
|
||||||
projectPersistService.associate(projectPersist, lstToSave);
|
if (tmp == true) {
|
||||||
|
|
||||||
}
|
|
||||||
if (!lstToDelete.isEmpty() || !lstToSave.isEmpty()){
|
|
||||||
deploymentView.setDataProvider();
|
deploymentView.setDataProvider();
|
||||||
dialog.close();
|
dialog.close();
|
||||||
|
} else {
|
||||||
|
associer.setEnabled(false);
|
||||||
|
Notification.show("There is already a project of this name on this runtime");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gridRuntime.addSelectionListener(selectionEvent -> {
|
gridRuntime.addSelectionListener(selectionEvent -> {
|
||||||
associer.setEnabled(selectionEvent.getFirstSelectedItem().isPresent());
|
if (selectionEvent.getFirstSelectedItem() != null && selectionEvent.getFirstSelectedItem().isPresent()) {
|
||||||
|
|
||||||
|
associer.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
associer.setEnabled(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,96 +1,96 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
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.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
import com.vaadin.flow.component.html.Label;
|
||||||
|
import com.vaadin.flow.component.page.Push;
|
||||||
|
import org.chtijbug.drools.console.AddLog;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
public class ConsoleDeploy extends HorizontalLayout {
|
public class ConsoleDeploy extends HorizontalLayout {
|
||||||
|
|
||||||
private static String activeClass = "active";
|
public VerticalLayout outilsBar;
|
||||||
|
|
||||||
private transient VerticalLayout outilsBar;
|
public VerticalLayout content;
|
||||||
|
|
||||||
private transient VerticalLayout content;
|
public HorizontalLayout titleContent;
|
||||||
|
|
||||||
private transient HorizontalLayout titleContent;
|
public VerticalLayout logContent;
|
||||||
|
|
||||||
private transient VerticalLayout logContent;
|
public Button menu;
|
||||||
|
|
||||||
private transient Button menu;
|
public Button clear;
|
||||||
|
|
||||||
private transient Button clear;
|
private Label title;
|
||||||
|
|
||||||
private transient Label title;
|
public ConsoleDeploy(){
|
||||||
|
|
||||||
public ConsoleDeploy() {
|
|
||||||
|
|
||||||
setClassName("console-content-all");
|
setClassName("console-content-all");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|
||||||
outilsBar = new VerticalLayout();
|
outilsBar=new VerticalLayout();
|
||||||
outilsBar.setClassName("console-outilsBar-content");
|
outilsBar.setClassName("console-outilsBar-content");
|
||||||
add(outilsBar);
|
add(outilsBar);
|
||||||
|
|
||||||
menu = new Button("", VaadinIcon.MENU.create());
|
menu=new Button("",VaadinIcon.MENU.create());
|
||||||
menu.setClassName("console-button");
|
menu.setClassName("console-button");
|
||||||
menu.addClickListener(buttonClickEvent -> {
|
menu.addClickListener(buttonClickEvent -> {
|
||||||
if (isActive()) {
|
if(isActive()){
|
||||||
removeActive();
|
removeActive();
|
||||||
content.setVisible(false);
|
content.setVisible(false);
|
||||||
} else {
|
}else {
|
||||||
active();
|
active();
|
||||||
content.setVisible(true);
|
content.setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
outilsBar.add(menu);
|
outilsBar.add(menu);
|
||||||
|
|
||||||
clear = new Button("", VaadinIcon.PANEL.create());
|
clear=new Button("", VaadinIcon.PANEL.create());
|
||||||
clear.setClassName("console-button");
|
clear.setClassName("console-button");
|
||||||
clear.addClickListener(buttonClickEvent ->
|
clear.addClickListener(buttonClickEvent -> {
|
||||||
logContent.removeAll()
|
logContent.removeAll();
|
||||||
);
|
});
|
||||||
outilsBar.add(clear);
|
outilsBar.add(clear);
|
||||||
|
|
||||||
content = new VerticalLayout();
|
content=new VerticalLayout();
|
||||||
content.setClassName("console-content");
|
content.setClassName("console-content");
|
||||||
add(content);
|
add(content);
|
||||||
content.setVisible(false);
|
content.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
titleContent = new HorizontalLayout();
|
titleContent=new HorizontalLayout();
|
||||||
titleContent.setClassName("console-content-title");
|
titleContent.setClassName("console-content-title");
|
||||||
content.add(titleContent);
|
content.add(titleContent);
|
||||||
|
|
||||||
title = new Label("Console : ");
|
title=new Label("Console : ");
|
||||||
title.setClassName("console-title");
|
title.setClassName("console-title");
|
||||||
titleContent.add(title);
|
titleContent.add(title);
|
||||||
|
|
||||||
logContent = new VerticalLayout();
|
logContent=new VerticalLayout();
|
||||||
logContent.setClassName("console-log-content");
|
logContent.setClassName("console-log-content");
|
||||||
content.add(logContent);
|
content.add(logContent);
|
||||||
}
|
}
|
||||||
|
private boolean isActive(){
|
||||||
private boolean isActive() {
|
return getClassNames().contains("active");
|
||||||
return getClassNames().contains(activeClass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeActive() {
|
private void removeActive() {
|
||||||
|
|
||||||
if (getClassNames().contains(activeClass)) {
|
if(getClassNames().contains("active")){
|
||||||
getClassNames().remove(activeClass);
|
getClassNames().remove("active");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void active(){
|
||||||
private void active() {
|
|
||||||
removeActive();
|
removeActive();
|
||||||
|
|
||||||
getClassNames().add(activeClass);
|
getClassNames().add("active");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTtile(String nameProject) {
|
public void setTtile(String nameProject){
|
||||||
title.setText("Console : " + nameProject);
|
title.setText("Console : "+nameProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VerticalLayout getLogContent() {
|
public VerticalLayout getLogContent() {
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
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.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.ProjectPersistService;
|
||||||
|
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class DefineProject extends VerticalLayout {
|
||||||
|
|
||||||
|
//COMPONENT
|
||||||
|
|
||||||
|
private ComboBoxPerso mainClass;
|
||||||
|
|
||||||
|
private TextFieldPerso processID;
|
||||||
|
|
||||||
|
private TextFieldPerso nameDeploy;
|
||||||
|
|
||||||
|
private Label label;
|
||||||
|
|
||||||
|
private Label label2;
|
||||||
|
|
||||||
|
private Button valider;
|
||||||
|
|
||||||
|
//METIER
|
||||||
|
|
||||||
|
private UserConnectedService userConnectedService;
|
||||||
|
|
||||||
|
private ProjectPersistService projectPersistService;
|
||||||
|
private boolean createMode;
|
||||||
|
|
||||||
|
public DefineProject(DeploymentView deploymentView,Dialog dialog, ProjectPersist projectPersist){
|
||||||
|
|
||||||
|
userConnectedService= AppContext.getApplicationContext().getBean(UserConnectedService.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 associate your project with a workbench");
|
||||||
|
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="+(String)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);
|
||||||
|
|
||||||
|
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==true) {
|
||||||
|
projectPersist.setStatus(ProjectPersist.DEFINI);
|
||||||
|
}
|
||||||
|
projectPersistService.addProjectToSession(projectPersist,true);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.checkbox.Checkbox;
|
||||||
|
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.indexer.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="RuleFlouwGroup";
|
||||||
|
|
||||||
|
private ListDataProvider<BusinessTransactionAction> dataProvider;
|
||||||
|
private ConfigurableFilterDataProvider<BusinessTransactionAction,Void,SerializablePredicate<BusinessTransactionAction>> filterDataProvider;
|
||||||
|
|
||||||
|
private IndexerService indexerService;
|
||||||
|
|
||||||
|
public GridActionLogging(String idRequest){
|
||||||
|
|
||||||
|
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
|
||||||
|
|
||||||
|
setClassName("action-log-grid-perso");
|
||||||
|
setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||||
|
|
||||||
|
|
||||||
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
|
|
||||||
|
SimpleDateFormat simpleDateFormat=new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
|
||||||
|
Label label=new Label();
|
||||||
|
if(runtimePersist.getRuleExecution()!=null) {
|
||||||
|
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getStartDate()));
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
})).setHeader("Début");
|
||||||
|
|
||||||
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
|
|
||||||
|
SimpleDateFormat simpleDateFormat=new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
|
||||||
|
Label label=new Label();
|
||||||
|
if(runtimePersist.getRuleExecution()!=null) {
|
||||||
|
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getEndDate()));
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
})).setHeader("Fin");
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
|
|
||||||
|
Checkbox label=new Checkbox();
|
||||||
|
label.setEnabled(false);
|
||||||
|
label.setValue(false);
|
||||||
|
|
||||||
|
if(runtimePersist.getInputData()!=null&&runtimePersist.getInputData().getRealFact()!=null){
|
||||||
|
label.setValue(true);
|
||||||
|
}
|
||||||
|
if(runtimePersist.getFact()!=null&&runtimePersist.getFact().getRealFact()!=null){
|
||||||
|
label.setValue(true);
|
||||||
|
}
|
||||||
|
if(runtimePersist.getRuleExecution()!=null&&runtimePersist.getRuleExecution().getThenFacts()!=null&&runtimePersist.getRuleExecution().getThenFacts().size()>0){
|
||||||
|
label.setValue(true);
|
||||||
|
}
|
||||||
|
if(runtimePersist.getRuleExecution()!=null&&runtimePersist.getRuleExecution().getWhenFacts()!=null&&runtimePersist.getRuleExecution().getWhenFacts().size()>0){
|
||||||
|
label.setValue(true);
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
})).setHeader("Data?");
|
||||||
|
|
||||||
|
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,new Sort(new Sort.Order(Sort.Direction.ASC,"eventNumber")),new PageRequest(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,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||||
|
|
||||||
import com.vaadin.flow.component.grid.Grid;
|
import com.vaadin.flow.component.grid.Grid;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
|
|
@ -10,7 +10,7 @@ import com.vaadin.flow.data.value.ValueChangeMode;
|
||||||
import com.vaadin.flow.function.SerializablePredicate;
|
import com.vaadin.flow.function.SerializablePredicate;
|
||||||
import org.chtijbug.drools.console.service.IndexerService;
|
import org.chtijbug.drools.console.service.IndexerService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionPersistence;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -43,7 +43,7 @@ public class GridLogging extends Grid<BusinessTransactionPersistence> {
|
||||||
private ListDataProvider<BusinessTransactionPersistence> dataProvider;
|
private ListDataProvider<BusinessTransactionPersistence> dataProvider;
|
||||||
private ConfigurableFilterDataProvider<BusinessTransactionPersistence,Void,SerializablePredicate<BusinessTransactionPersistence>> filterDataProvider;
|
private ConfigurableFilterDataProvider<BusinessTransactionPersistence,Void,SerializablePredicate<BusinessTransactionPersistence>> filterDataProvider;
|
||||||
|
|
||||||
private transient IndexerService indexerService;
|
private IndexerService indexerService;
|
||||||
|
|
||||||
public GridLogging(){
|
public GridLogging(){
|
||||||
|
|
||||||
|
|
@ -54,7 +54,10 @@ public class GridLogging extends Grid<BusinessTransactionPersistence> {
|
||||||
|
|
||||||
|
|
||||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
return new Label(runtimePersist.getHour()+":"+runtimePersist.getMinute()+":"+runtimePersist.getMillis()+" ->"+runtimePersist.getDay()+"/"+runtimePersist.getMonth()+"/"+runtimePersist.getYear());
|
|
||||||
|
Label label=new Label(runtimePersist.getHour()+":"+runtimePersist.getMinute()+":"+runtimePersist.getMillis()+" ->"+runtimePersist.getDay()+"/"+runtimePersist.getMonth()+"/"+runtimePersist.getYear());
|
||||||
|
|
||||||
|
return label;
|
||||||
})).setHeader("Date");
|
})).setHeader("Date");
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -100,7 +103,7 @@ public class GridLogging extends Grid<BusinessTransactionPersistence> {
|
||||||
});
|
});
|
||||||
serverNameC.setHeader(serverName);
|
serverNameC.setHeader(serverName);
|
||||||
|
|
||||||
setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(PageRequest.of(0,100)).getContent());
|
setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(new PageRequest(0,100)).getContent());
|
||||||
}
|
}
|
||||||
private void refreshtGrid(String value,String type){
|
private void refreshtGrid(String value,String type){
|
||||||
|
|
||||||
|
|
@ -0,0 +1,153 @@
|
||||||
|
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.grid.Grid;
|
||||||
|
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 com.vaadin.flow.component.html.Label;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GridRuntime extends Grid<RuntimePersist> {
|
||||||
|
|
||||||
|
private TextField runtimeName;
|
||||||
|
|
||||||
|
private TextField hostName;
|
||||||
|
|
||||||
|
private TextField version;
|
||||||
|
|
||||||
|
private TextField status;
|
||||||
|
|
||||||
|
private String strRuntimeName="Runtime Name";
|
||||||
|
|
||||||
|
private String strHostName="Hostname";
|
||||||
|
|
||||||
|
private String strVersion="Version";
|
||||||
|
|
||||||
|
private String strStatus="State";
|
||||||
|
|
||||||
|
private ProjectPersistService projectPersistService;
|
||||||
|
private RuntimeService runtimeService;
|
||||||
|
|
||||||
|
private ListDataProvider<RuntimePersist> dataProvider;
|
||||||
|
private ConfigurableFilterDataProvider<RuntimePersist,Void,SerializablePredicate<RuntimePersist>> filterDataProvider;
|
||||||
|
|
||||||
|
private ProjectPersist projectPersist;
|
||||||
|
|
||||||
|
public GridRuntime(ProjectPersist projectPersist){
|
||||||
|
this.projectPersist = projectPersist;
|
||||||
|
init();
|
||||||
|
//dataProvider.get
|
||||||
|
for (RuntimePersist runtimePersist : dataProvider.getItems()){
|
||||||
|
if (projectPersist.getServerNames().contains(runtimePersist.getServerName())){
|
||||||
|
getSelectionModel().select(runtimePersist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridRuntime() {
|
||||||
|
init();
|
||||||
|
|
||||||
|
}
|
||||||
|
private void init(){
|
||||||
|
projectPersistService = AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||||
|
runtimeService= AppContext.getApplicationContext().getBean(RuntimeService.class);
|
||||||
|
|
||||||
|
setClassName("deployment-grid-perso");
|
||||||
|
setSelectionMode(Grid.SelectionMode.MULTI);
|
||||||
|
|
||||||
|
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.getHostname());
|
||||||
|
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.getStatus());
|
||||||
|
status=new TextField(strStatus);
|
||||||
|
status.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
|
status.addValueChangeListener(e -> {
|
||||||
|
refreshtGrid(status.getValue(), strVersion);
|
||||||
|
});
|
||||||
|
statusCo.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.getHostname()!=null&&runtimePersist.getHostname().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 void setDataProvider(){
|
||||||
|
|
||||||
|
List<RuntimePersist> runtimePersists = runtimeService.getRuntimeRepository().findAll();
|
||||||
|
if(runtimePersists!=null) {
|
||||||
|
dataProvider = new ListDataProvider<>(runtimePersists);
|
||||||
|
|
||||||
|
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||||
|
setDataProvider(filterDataProvider);
|
||||||
|
|
||||||
|
reinitFilter();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void reinitFilter(){
|
||||||
|
hostName.setValue("");
|
||||||
|
version.setValue("");
|
||||||
|
runtimeName.setValue("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
|
|
@ -7,23 +7,22 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||||
import org.chtijbug.drools.console.service.IndexerService;
|
import org.chtijbug.drools.console.service.IndexerService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.TextFieldPerso;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.TextFieldPerso;
|
||||||
import org.chtijbug.drools.console.view.ActionLoggingView;
|
import org.chtijbug.drools.console.view.ActionLoggingView;
|
||||||
import org.chtijbug.drools.console.view.LoggingView;
|
import org.chtijbug.drools.console.view.LoggingView;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionPersistence;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ActionLogging extends VerticalLayout {
|
public class ActionLogging extends VerticalLayout {
|
||||||
private static String active="active";
|
|
||||||
|
|
||||||
private Button viewAction;
|
private Button viewAction;
|
||||||
|
|
||||||
private TextFieldPerso transactionIdSearch;
|
private TextFieldPerso transactionIdSearch;
|
||||||
|
|
||||||
private transient IndexerService indexerService;
|
private IndexerService indexerService;
|
||||||
|
|
||||||
public ActionLogging(LoggingView loggingView){
|
public ActionLogging(LoggingView loggingView){
|
||||||
|
|
||||||
|
|
@ -39,9 +38,9 @@ public class ActionLogging extends VerticalLayout {
|
||||||
|
|
||||||
if (textFieldStringComponentValueChangeEvent.getValue().isEmpty()) {
|
if (textFieldStringComponentValueChangeEvent.getValue().isEmpty()) {
|
||||||
loggingView.getTitle().setText("Logging : ");
|
loggingView.getTitle().setText("Logging : ");
|
||||||
loggingView.getGridLogging().setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(PageRequest.of(0, 100)).getContent());
|
loggingView.getGridLogging().setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(new PageRequest(0, 100)).getContent());
|
||||||
} else {
|
} else {
|
||||||
List<BusinessTransactionPersistence> b = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(textFieldStringComponentValueChangeEvent.getValue(), PageRequest.of(0, 100));
|
List<BusinessTransactionPersistence> b = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(textFieldStringComponentValueChangeEvent.getValue(), new PageRequest(0, 100));
|
||||||
|
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
loggingView.getTitle().setText("Logging : " + textFieldStringComponentValueChangeEvent.getValue());
|
loggingView.getTitle().setText("Logging : " + textFieldStringComponentValueChangeEvent.getValue());
|
||||||
|
|
@ -79,17 +78,17 @@ public class ActionLogging extends VerticalLayout {
|
||||||
|
|
||||||
}
|
}
|
||||||
private boolean isActive(Button button){
|
private boolean isActive(Button button){
|
||||||
return button.getClassNames().contains(active);
|
return button.getClassNames().contains("active");
|
||||||
}
|
}
|
||||||
private void removeActive(Button button) {
|
private void removeActive(Button button) {
|
||||||
|
|
||||||
if(button.getClassNames().contains(active)){
|
if(button.getClassNames().contains("active")){
|
||||||
button.getClassNames().remove(active);
|
button.getClassNames().remove("active");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void active(Button button){
|
private void active(Button button){
|
||||||
removeActive(viewAction);
|
removeActive(viewAction);
|
||||||
button.getClassNames().add(active);
|
button.getClassNames().add("active");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Button getViewAction() {
|
public Button getViewAction() {
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
|
import com.vaadin.flow.component.dialog.Dialog;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
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.ProjectPersistService;
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentview.AssociateProjectKie;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.AssociateProjectKie;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentview.DefineProject;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.DefineProject;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
|
|
||||||
|
|
@ -24,14 +23,14 @@ public class DeploymentAction extends VerticalLayout {
|
||||||
private Button deployer;
|
private Button deployer;
|
||||||
|
|
||||||
private ProjectPersistService projectPersistService;
|
private ProjectPersistService projectPersistService;
|
||||||
private DeploymentView deploymentView;
|
|
||||||
|
|
||||||
public DeploymentAction(SqueletteComposant squeletteComposant,DeploymentView deploymentView){
|
public DeploymentAction(SqueletteComposant squeletteComposant,DeploymentView deploymentView){
|
||||||
setClassName("leftMenu-global-action");
|
setClassName("leftMenu-global-action");
|
||||||
this.deploymentView=deploymentView;
|
|
||||||
projectPersistService= AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
projectPersistService= AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||||
|
|
||||||
definirProject =new Button("Define your project", VaadinIcon.CODE.create());
|
definirProject =new Button("Défine your project", VaadinIcon.CODE.create());
|
||||||
definirProject.setClassName("leftMenu-global-button");
|
definirProject.setClassName("leftMenu-global-button");
|
||||||
definirProject.setEnabled(false);
|
definirProject.setEnabled(false);
|
||||||
add(definirProject);
|
add(definirProject);
|
||||||
|
|
@ -63,7 +62,7 @@ public class DeploymentAction extends VerticalLayout {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
deployer =new Button("Deploy", VaadinIcon.EXTERNAL_LINK.create());
|
deployer =new Button("Déployer", VaadinIcon.EXTERNAL_LINK.create());
|
||||||
deployer.setClassName("leftMenu-global-button");
|
deployer.setClassName("leftMenu-global-button");
|
||||||
deployer.setEnabled(false);
|
deployer.setEnabled(false);
|
||||||
add(deployer);
|
add(deployer);
|
||||||
|
|
@ -78,9 +77,6 @@ public class DeploymentAction extends VerticalLayout {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private boolean isActive(Button button){
|
private boolean isActive(Button button){
|
||||||
return button.getClassNames().contains("active");
|
return button.getClassNames().contains("active");
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||||
|
|
||||||
public class RuntimesAction extends VerticalLayout {
|
public class RuntimesAction extends VerticalLayout {
|
||||||
|
|
||||||
|
|
@ -1,15 +1,12 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
|
import com.vaadin.flow.component.combobox.ComboBox;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.ComboBoxPerso;
|
||||||
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.console.view.TemplateView;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class TemplatesAction extends VerticalLayout {
|
public class TemplatesAction extends VerticalLayout {
|
||||||
|
|
||||||
|
|
@ -19,20 +16,16 @@ public class TemplatesAction extends VerticalLayout {
|
||||||
|
|
||||||
private Button edit;
|
private Button edit;
|
||||||
|
|
||||||
private ComboBoxPerso<ProjectPersist> spaceSelection;
|
private ComboBoxPerso<PlatformProjectResponse> spaceSelection;
|
||||||
|
|
||||||
private ProjectPersistService projectPersistService;
|
|
||||||
|
|
||||||
public TemplatesAction(TemplateView templateView){
|
public TemplatesAction(TemplateView templateView){
|
||||||
|
|
||||||
setClassName("leftMenu-global-action");
|
setClassName("leftMenu-global-action");
|
||||||
projectPersistService = AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
|
||||||
Map<String, ProjectPersist> map = projectPersistService.findProjectsConnectedUser();
|
|
||||||
|
|
||||||
spaceSelection = new ComboBoxPerso<>("Project",VaadinIcon.SEARCH.create());
|
spaceSelection = new ComboBoxPerso<>("Project",VaadinIcon.SEARCH.create());
|
||||||
spaceSelection.getComboBox().setItems(map.values());
|
spaceSelection.getComboBox().setItems(templateView.getUserConnectedService().getUserConnected().getProjectResponses());
|
||||||
spaceSelection.getComboBox().setItemLabelGenerator(ProjectPersist::getKieProjectName);
|
spaceSelection.getComboBox().setItemLabelGenerator(PlatformProjectResponse::getName);
|
||||||
|
|
||||||
spaceSelection.getComboBox().addValueChangeListener(valueChangeEvent -> {
|
spaceSelection.getComboBox().addValueChangeListener(valueChangeEvent -> {
|
||||||
templateView.setDataProvider(spaceSelection.getComboBox());
|
templateView.setDataProvider(spaceSelection.getComboBox());
|
||||||
});
|
});
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.leftMenu;
|
package org.chtijbug.drools.console.vaadinComponent.leftMenu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Image;
|
import com.vaadin.flow.component.html.Image;
|
||||||
|
|
@ -74,7 +74,7 @@ public class InformationStructure extends VerticalLayout {
|
||||||
|
|
||||||
List<RuntimePersist> runtimePersists=runtimeService.getRuntimeRepository().findAll();
|
List<RuntimePersist> runtimePersists=runtimeService.getRuntimeRepository().findAll();
|
||||||
|
|
||||||
actualiseKieServer(runtimePersists.size());
|
actualiseKieServer(runtimePersists!=null?runtimePersists.size():0);
|
||||||
|
|
||||||
numberKieWb=new Label(strKieWb+"0");
|
numberKieWb=new Label(strKieWb+"0");
|
||||||
numberKieWb.setClassName("leftMenu-global-inforStructure-label");
|
numberKieWb.setClassName("leftMenu-global-inforStructure-label");
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.leftMenu;
|
package org.chtijbug.drools.console.vaadinComponent.leftMenu;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Anchor;
|
import com.vaadin.flow.component.html.Anchor;
|
||||||
|
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.component.orderedlayout.HorizontalLayout;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.login;
|
package org.chtijbug.drools.console.vaadinComponent.login;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -14,8 +14,8 @@ import org.chtijbug.drools.console.service.model.UserConnected;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.util.PasswordValidator;
|
import org.chtijbug.drools.console.util.PasswordValidator;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.PasswordFieldPerso;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.PasswordFieldPerso;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.TextFieldPerso;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.TextFieldPerso;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class FormulaireComposant extends VerticalLayout {
|
public class FormulaireComposant extends VerticalLayout {
|
||||||
|
|
@ -104,12 +104,9 @@ public class FormulaireComposant extends VerticalLayout {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
add(login);
|
add(login);
|
||||||
if (configKie.getPassword()!= null) {
|
|
||||||
password.getPasswordField().setValue(configKie.getPassword());
|
password.getPasswordField().setValue(configKie.getPassword());
|
||||||
}
|
|
||||||
if (configKie.getUserName()!= null) {
|
|
||||||
username.getTextField().setValue(configKie.getUserName());
|
username.getTextField().setValue(configKie.getUserName());
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void verifyValidity(){
|
public void verifyValidity(){
|
||||||
|
|
@ -124,13 +121,12 @@ public class FormulaireComposant extends VerticalLayout {
|
||||||
UserConnected connected = kieRepositoryService.login(
|
UserConnected connected = kieRepositoryService.login(
|
||||||
configKie.getKiewbUrl(),
|
configKie.getKiewbUrl(),
|
||||||
userConnectedBinder.getBean().getUserName(),
|
userConnectedBinder.getBean().getUserName(),
|
||||||
userConnectedBinder.getBean().getUserPassword(),
|
userConnectedBinder.getBean().getUserPassword());
|
||||||
configKie.getName());
|
|
||||||
|
|
||||||
if(connected!=null) {
|
if(connected!=null) {
|
||||||
connected.setConnected(true);
|
connected.setConnected(true);
|
||||||
userConnectedService.addUserToSession(connected);
|
userConnectedService.addUserToSession(connected);
|
||||||
//projectPersistService.saveIfnotExist(connected.getProjectResponses(),configKie.getName());
|
projectPersistService.saveIfnotExist(connected.getProjectResponses());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}else {
|
}else {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.login;
|
package org.chtijbug.drools.console.vaadinComponent.login;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.login;
|
package org.chtijbug.drools.console.vaadinComponent.login;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class LoginComponent extends HorizontalLayout {
|
public class LoginComponent extends HorizontalLayout {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.login;
|
package org.chtijbug.drools.console.vaadinComponent.login;
|
||||||
|
|
||||||
import com.vaadin.flow.component.checkbox.Checkbox;
|
import com.vaadin.flow.component.checkbox.Checkbox;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
package org.chtijbug.drools.console.vaadinComponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -10,7 +10,7 @@ import com.vaadin.flow.server.InputStreamFactory;
|
||||||
import com.vaadin.flow.server.StreamResource;
|
import com.vaadin.flow.server.StreamResource;
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
|
@ -41,11 +41,7 @@ public class MenuPrincipal extends HorizontalLayout {
|
||||||
public MenuPrincipal(SqueletteComposant squeletteComposant){
|
public MenuPrincipal(SqueletteComposant squeletteComposant){
|
||||||
|
|
||||||
userConnectedService= AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
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");
|
addClassName("menu-principal-menubar-content");
|
||||||
|
|
||||||
InputStreamFactory inputStreamFactory=new InputStreamFactory() {
|
InputStreamFactory inputStreamFactory=new InputStreamFactory() {
|
||||||
|
|
@ -78,7 +74,7 @@ public class MenuPrincipal extends HorizontalLayout {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
deployement=new Button("Artifact");
|
deployement=new Button("Déployment");
|
||||||
deployement.setClassName("menu-principal-button");
|
deployement.setClassName("menu-principal-button");
|
||||||
add(deployement);
|
add(deployement);
|
||||||
deployement.addClickListener(buttonClickEvent -> {
|
deployement.addClickListener(buttonClickEvent -> {
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
package org.chtijbug.drools.console.vaadinComponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.DeploymentAction;
|
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.DeploymentAction;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
|
|
@ -30,7 +30,7 @@ public class MenuScondaireDeployement extends HorizontalLayout {
|
||||||
|
|
||||||
DeploymentAction deploymentAction=new DeploymentAction(squeletteComposant,deploymentView);
|
DeploymentAction deploymentAction=new DeploymentAction(squeletteComposant,deploymentView);
|
||||||
deploymentView.setDeploymentAction(deploymentAction);
|
deploymentView.setDeploymentAction(deploymentAction);
|
||||||
squeletteComposant.navigate(deploymentView,DeploymentView.PAGE_NAME,deploymentAction);
|
squeletteComposant.navigate(deploymentView,DeploymentView.pageName,deploymentAction);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
package org.chtijbug.drools.console.vaadinComponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.TemplatesAction;
|
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.TemplatesAction;
|
||||||
import org.chtijbug.drools.console.view.TemplateView;
|
import org.chtijbug.drools.console.view.TemplateView;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
|
|
@ -28,7 +28,7 @@ public class MenuSecondaireAssets extends HorizontalLayout {
|
||||||
TemplateView templateView=new TemplateView();
|
TemplateView templateView=new TemplateView();
|
||||||
TemplatesAction templatesAction=new TemplatesAction(templateView);
|
TemplatesAction templatesAction=new TemplatesAction(templateView);
|
||||||
templateView.setTemplatesAction(templatesAction);
|
templateView.setTemplatesAction(templatesAction);
|
||||||
squeletteComposant.navigate(templateView,TemplateView.PAGE_NAME,templatesAction);
|
squeletteComposant.navigate(templateView,TemplateView.pageName,templatesAction);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private boolean isActive(Button button){
|
private boolean isActive(Button button){
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
package org.chtijbug.drools.console.vaadinComponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
package org.chtijbug.drools.console.vaadinComponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.ActionLogging;
|
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||||
|
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.ActionLogging;
|
||||||
|
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.RuntimesAction;
|
||||||
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
import org.chtijbug.drools.console.view.LoggingView;
|
import org.chtijbug.drools.console.view.LoggingView;
|
||||||
|
import org.chtijbug.drools.console.view.RuntimesView;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class MenuSecondaireLogging extends HorizontalLayout {
|
public class MenuSecondaireLogging extends HorizontalLayout {
|
||||||
private static String active="active";
|
|
||||||
|
|
||||||
private Button logging;
|
private Button logging;
|
||||||
|
|
||||||
|
|
@ -31,23 +34,23 @@ public class MenuSecondaireLogging extends HorizontalLayout {
|
||||||
|
|
||||||
ActionLogging actionLogging=new ActionLogging(loggingView);
|
ActionLogging actionLogging=new ActionLogging(loggingView);
|
||||||
loggingView.setActionLogging(actionLogging);
|
loggingView.setActionLogging(actionLogging);
|
||||||
squeletteComposant.navigate(loggingView,LoggingView.PAGE_NAME,actionLogging);
|
squeletteComposant.navigate(loggingView,LoggingView.pageName,actionLogging);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isActive(Button button){
|
private boolean isActive(Button button){
|
||||||
return button.getClassNames().contains(active);
|
return button.getClassNames().contains("active");
|
||||||
}
|
}
|
||||||
private void removeActive(Button button) {
|
private void removeActive(Button button) {
|
||||||
|
|
||||||
if(button.getClassNames().contains(active)){
|
if(button.getClassNames().contains("active")){
|
||||||
button.getClassNames().remove(active);
|
button.getClassNames().remove("active");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void active(Button button){
|
private void active(Button button){
|
||||||
removeActive(logging);
|
removeActive(logging);
|
||||||
|
|
||||||
button.getClassNames().add(active);
|
button.getClassNames().add("active");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Button getLogging() {
|
public Button getLogging() {
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package org.chtijbug.drools.console.vaadincomponent.menu;
|
package org.chtijbug.drools.console.vaadinComponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.RuntimesAction;
|
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.RuntimesAction;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
import org.chtijbug.drools.console.view.RuntimesView;
|
import org.chtijbug.drools.console.view.RuntimesView;
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ public class MenuSecondaireRuntime extends HorizontalLayout {
|
||||||
}
|
}
|
||||||
RuntimesView deploymentView=new RuntimesView();
|
RuntimesView deploymentView=new RuntimesView();
|
||||||
RuntimesAction deploymentAction=new RuntimesAction(squeletteComposant);
|
RuntimesAction deploymentAction=new RuntimesAction(squeletteComposant);
|
||||||
squeletteComposant.navigate(deploymentView,DeploymentView.PAGE_NAME,deploymentAction);
|
squeletteComposant.navigate(deploymentView,DeploymentView.pageName,deploymentAction);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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,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,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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -8,9 +8,7 @@ import com.vaadin.flow.router.BeforeEnterEvent;
|
||||||
import com.vaadin.flow.router.BeforeEnterObserver;
|
import com.vaadin.flow.router.BeforeEnterObserver;
|
||||||
import com.vaadin.flow.router.Route;
|
import com.vaadin.flow.router.Route;
|
||||||
import com.vaadin.flow.shared.communication.PushMode;
|
import com.vaadin.flow.shared.communication.PushMode;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Push(PushMode.AUTOMATIC)
|
@Push(PushMode.AUTOMATIC)
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
|
|
@ -24,10 +22,7 @@ public class AccueilView extends SqueletteComposant implements BeforeEnterObserv
|
||||||
|
|
||||||
if (getUserConnectedService().getUserConnected()==null) {
|
if (getUserConnectedService().getUserConnected()==null) {
|
||||||
beforeEnterEvent.rerouteTo(LoginView.class);
|
beforeEnterEvent.rerouteTo(LoginView.class);
|
||||||
Optional<UI> theUI = UI.getCurrent().getUI();
|
UI.getCurrent().getUI().get().getPage().executeJavaScript("window.alert($0)", "Session expiré, veuillez-vous reconnecter");
|
||||||
if (theUI.isPresent()) {
|
|
||||||
theUI.get().getPage().executeJavaScript("window.alert($0)", "Session expiré, veuillez-vous reconnecter");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,151 +1,229 @@
|
||||||
package org.chtijbug.drools.console.view;
|
package org.chtijbug.drools.console.view;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.vaadin.flow.component.button.Button;
|
||||||
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.html.Label;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.server.StreamResource;
|
import com.vaadin.flow.component.textfield.TextArea;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.service.IndexerService;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.GridActionLogging;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionAction;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionPersistence;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentview.GridActionLogging;
|
|
||||||
import org.chtijbug.drools.logging.Fact;
|
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 {
|
public class ActionLoggingView extends VerticalLayout {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ActionLoggingView.class);
|
|
||||||
|
|
||||||
private transient IndexerService indexerService;
|
|
||||||
|
|
||||||
private Label title;
|
private Label title;
|
||||||
|
|
||||||
private GridActionLogging gridActionLogging;
|
private GridActionLogging gridActionLogging;
|
||||||
|
|
||||||
private String uniqueID;
|
private Button inputData;
|
||||||
private String dbID;
|
|
||||||
|
|
||||||
private ObjectMapper mapper = new ObjectMapper();
|
private Button realFact;
|
||||||
|
|
||||||
|
private Button whenFact;
|
||||||
|
|
||||||
|
private Button thenFact;
|
||||||
|
|
||||||
|
public ActionLoggingView(BusinessTransactionPersistence businessTransactionPersistence,DialogPerso dialogPerso){
|
||||||
|
|
||||||
public ActionLoggingView(BusinessTransactionPersistence businessTransactionPersistence, DialogPerso dialogPerso) {
|
|
||||||
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
|
|
||||||
dialogPerso.getClose().setVisible(false);
|
dialogPerso.getClose().setVisible(false);
|
||||||
this.uniqueID = businessTransactionPersistence.getTransactionId();
|
|
||||||
this.dbID = businessTransactionPersistence.getId();
|
inputData=new Button("View InputData");
|
||||||
if (this.uniqueID==null){
|
inputData.setClassName("menu-button");
|
||||||
this.uniqueID=this.dbID;
|
inputData.setEnabled(false);
|
||||||
}
|
|
||||||
title = new Label("TransactionID : " + businessTransactionPersistence.getTransactionId() + "--" + businessTransactionPersistence.getId());
|
|
||||||
|
dialogPerso.getBar().add(inputData);
|
||||||
|
|
||||||
|
realFact=new Button("View RealFact");
|
||||||
|
realFact.setClassName("menu-button");
|
||||||
|
realFact.setEnabled(false);
|
||||||
|
|
||||||
|
dialogPerso.getBar().add(realFact);
|
||||||
|
|
||||||
|
whenFact=new Button("View WhenFact");
|
||||||
|
whenFact.setClassName("menu-button");
|
||||||
|
whenFact.setEnabled(false);
|
||||||
|
|
||||||
|
dialogPerso.getBar().add(whenFact);
|
||||||
|
|
||||||
|
thenFact=new Button("View ThenFact");
|
||||||
|
thenFact.setClassName("menu-button");
|
||||||
|
thenFact.setEnabled(false);
|
||||||
|
|
||||||
|
dialogPerso.getBar().add(thenFact);
|
||||||
|
|
||||||
|
title=new Label("TransactionID : "+businessTransactionPersistence.getId());
|
||||||
title.setClassName("creation-runtime-title");
|
title.setClassName("creation-runtime-title");
|
||||||
|
|
||||||
add(title);
|
add(title);
|
||||||
|
|
||||||
|
|
||||||
gridActionLogging = new GridActionLogging(businessTransactionPersistence.getId());
|
gridActionLogging=new GridActionLogging(businessTransactionPersistence.getId());
|
||||||
Anchor anchor = new Anchor(new StreamResource(uniqueID.trim().toLowerCase()+".csv", this::getInputStream), "Export as CSV");
|
add(gridActionLogging);
|
||||||
anchor.getElement().setAttribute("download", true);
|
|
||||||
add(gridActionLogging, anchor);
|
gridActionLogging.addSelectionListener(selectionEvent -> {
|
||||||
|
|
||||||
|
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||||
|
|
||||||
|
if(b!=null){
|
||||||
|
if(b.getInputData()!=null&&b.getInputData().getRealFact()!=null){
|
||||||
|
inputData.setEnabled(true);
|
||||||
|
}else {
|
||||||
|
inputData.setEnabled(false);
|
||||||
|
}
|
||||||
|
if(b.getFact()!=null&&b.getFact().getRealFact()!=null){
|
||||||
|
realFact.setEnabled(true);
|
||||||
|
}else {
|
||||||
|
realFact.setEnabled(false);
|
||||||
|
}
|
||||||
|
if(b.getRuleExecution()!=null&&b.getRuleExecution().getThenFacts()!=null&&b.getRuleExecution().getThenFacts().size()>0){
|
||||||
|
thenFact.setEnabled(true);
|
||||||
|
}else {
|
||||||
|
thenFact.setEnabled(false);
|
||||||
|
}
|
||||||
|
if(b.getRuleExecution()!=null&&b.getRuleExecution().getWhenFacts()!=null&&b.getRuleExecution().getWhenFacts().size()>0){
|
||||||
|
whenFact.setEnabled(true);
|
||||||
|
}else {
|
||||||
|
whenFact.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = "";
|
inputData.addClickListener(buttonClickEvent -> {
|
||||||
String packageName = "";
|
DialogPerso dialogPerso1=new DialogPerso();
|
||||||
String beginDate = "";
|
|
||||||
String endDate = "";
|
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||||
String inputData = "";
|
|
||||||
String outputData = "";
|
if(b!=null&&b.getInputData()!=null&&b.getInputData().getRealFact()!=null){
|
||||||
if (c.getInputData() != null) {
|
|
||||||
inputData = mapper.writeValueAsString(c.getInputData().getRealFact());
|
VerticalLayout verticalLayout=new VerticalLayout();
|
||||||
}
|
Label label=new Label(b.getEventType()+" - "+(b.getRuleExecution()!=null&&b.getRuleExecution().getRuleName()!=null?b.getRuleExecution().getRuleName():""));
|
||||||
if (c.getOutputData() != null) {
|
label.setClassName("creation-runtime-title");
|
||||||
outputData = mapper.writeValueAsString(c.getOutputData().getRealFact());
|
verticalLayout.add(label);
|
||||||
}
|
verticalLayout.setClassName("content-action-logging");
|
||||||
if (c.getRuleExecution() != null) {
|
|
||||||
ruleName = c.getRuleExecution().getRuleName();
|
TextArea textArea=new TextArea(b.getInputData().getFactType().name());
|
||||||
packageName = c.getRuleExecution().getPackageName();
|
textArea.setReadOnly(true);
|
||||||
beginDate = simpleDateFormat.format(c.getRuleExecution().getStartDate());
|
textArea.setClassName("content-log");
|
||||||
endDate = simpleDateFormat.format(c.getRuleExecution().getEndDate());
|
textArea.setValue(
|
||||||
}
|
b.getInputData().getRealFact().toString().replaceAll(",",",\n")
|
||||||
if (c.getEventType().equals(EventType.INPUT)) {
|
.replaceAll("\\{","\\{\n")
|
||||||
csvWriter.writeNext("", "", c.getEventType().name(), String.valueOf(c.getEventNumber()), "", "", "", "", "", "", "",c.getInputData().getFullClassName(),inputData);
|
.replaceAll("\\}","\n\\}")
|
||||||
} else if (c.getEventType().equals(EventType.OUPUT)) {
|
.replaceAll("\\[","\n\\[")
|
||||||
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()
|
|
||||||
);
|
);
|
||||||
}
|
verticalLayout.add(textArea);
|
||||||
|
|
||||||
|
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
|
|
||||||
return IOUtils.toInputStream(stringWriter.toString(), StandardCharsets.UTF_8.name());
|
realFact.addClickListener(buttonClickEvent -> {
|
||||||
|
DialogPerso dialogPerso1=new DialogPerso();
|
||||||
|
|
||||||
} catch (IOException e) {
|
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||||
logger.error("getInputStream.csvWriter",e);
|
|
||||||
|
|
||||||
return null;
|
if(b!=null&&b.getFact()!=null&&b.getFact().getRealFact()!=null){
|
||||||
|
|
||||||
|
VerticalLayout verticalLayout=new VerticalLayout();
|
||||||
|
Label label=new Label(b.getEventType()+" - "+(b.getRuleExecution()!=null&&b.getRuleExecution().getRuleName()!=null?b.getRuleExecution().getRuleName():""));
|
||||||
|
label.setClassName("creation-runtime-title");
|
||||||
|
verticalLayout.add(label);
|
||||||
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
|
||||||
|
TextArea textArea=new TextArea(b.getFact().getFactType().name());
|
||||||
|
textArea.setReadOnly(true);
|
||||||
|
textArea.setClassName("content-log");
|
||||||
|
textArea.setValue(
|
||||||
|
b.getFact().getRealFact().toString().replaceAll(",",",\n")
|
||||||
|
.replaceAll("\\{","\\{\n")
|
||||||
|
.replaceAll("\\}","\n\\}")
|
||||||
|
.replaceAll("\\[","\n\\[")
|
||||||
|
|
||||||
|
);
|
||||||
|
verticalLayout.add(textArea);
|
||||||
|
|
||||||
|
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
|
|
||||||
|
thenFact.addClickListener(buttonClickEvent -> {
|
||||||
|
DialogPerso dialogPerso1=new DialogPerso();
|
||||||
|
|
||||||
|
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||||
|
|
||||||
|
if(b!=null&&b.getRuleExecution()!=null&&b.getRuleExecution().getThenFacts()!=null){
|
||||||
|
|
||||||
|
VerticalLayout verticalLayout=new VerticalLayout();
|
||||||
|
Label label=new Label(b.getEventType()+" - "+(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());
|
||||||
|
textArea.setReadOnly(true);
|
||||||
|
textArea.setClassName("content-log");
|
||||||
|
textArea.setValue(
|
||||||
|
fact.getRealFact().toString().replaceAll(",",",\n")
|
||||||
|
.replaceAll("\\{","\\{\n")
|
||||||
|
.replaceAll("\\}","\n\\}")
|
||||||
|
.replaceAll("\\[","\n\\[")
|
||||||
|
|
||||||
|
);
|
||||||
|
verticalLayout.add(textArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
|
whenFact.addClickListener(buttonClickEvent -> {
|
||||||
|
DialogPerso dialogPerso1=new DialogPerso();
|
||||||
|
|
||||||
|
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||||
|
|
||||||
|
if(b!=null&&b.getRuleExecution()!=null&&b.getRuleExecution().getWhenFacts()!=null){
|
||||||
|
|
||||||
|
VerticalLayout verticalLayout=new VerticalLayout();
|
||||||
|
Label label=new Label(b.getEventType()+" - "+(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());
|
||||||
|
textArea.setReadOnly(true);
|
||||||
|
textArea.setClassName("content-log");
|
||||||
|
textArea.setValue(
|
||||||
|
fact.getRealFact().toString().replaceAll(",",",\n")
|
||||||
|
.replaceAll("\\{","\\{\n")
|
||||||
|
.replaceAll("\\}","\n\\}")
|
||||||
|
.replaceAll("\\[","\n\\[")
|
||||||
|
|
||||||
|
);
|
||||||
|
verticalLayout.add(textArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,32 +17,31 @@ import com.vaadin.flow.shared.communication.PushMode;
|
||||||
import org.chtijbug.drools.console.AddLog;
|
import org.chtijbug.drools.console.AddLog;
|
||||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.DeploymentAction;
|
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.DeploymentAction;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class DeploymentView extends VerticalLayout implements AddLog {
|
public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
|
|
||||||
public static final String PAGE_NAME = "Deployment";
|
public static final String pageName = "Deployment";
|
||||||
|
|
||||||
//GRID composant
|
//GRID composant
|
||||||
private static final String STR_NAME_DEPLOY = "Deploy name";
|
private final String strNameDeploy = "Deploy name";
|
||||||
private static final String STR_NAME_PROJECT = "Project name";
|
private final String strNameProject = "Project name";
|
||||||
private static final String STR_GROUPE_ID = "Groupe ID";
|
private final String strGroupeId = "Groupe ID";
|
||||||
private static final String STR_BRANCH_NAME = "Branch Name";
|
private final String strArtefactID = "Artefact ID";
|
||||||
private static final String STR_ARTEFACT_ID = "Artefact ID";
|
|
||||||
|
|
||||||
//TEXTFIELD search
|
//TEXTFIELD search
|
||||||
private static final String STR_PROCESS_ID = "Process ID";
|
private final String strProcessID = "Process ID";
|
||||||
private static final String STR_SERVER_NAME = "Server Name";
|
private final String strServerName = "Server Name";
|
||||||
private static final String STR_STATUS = "Status";
|
private final String strStatus = "Status";
|
||||||
private Grid<ProjectPersist> projectPersistGrid;
|
private Grid<ProjectPersist> projectPersistGrid;
|
||||||
|
private ListDataProvider<ProjectPersist> dataProvider;
|
||||||
private ConfigurableFilterDataProvider<ProjectPersist, Void, SerializablePredicate<ProjectPersist>> filterDataProvider;
|
private ConfigurableFilterDataProvider<ProjectPersist, Void, SerializablePredicate<ProjectPersist>> filterDataProvider;
|
||||||
private DeploymentAction deploymentAction;
|
private DeploymentAction deploymentAction;
|
||||||
|
|
||||||
|
|
@ -50,14 +49,13 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
private TextField nameDeploy;
|
private TextField nameDeploy;
|
||||||
private TextField nameProject;
|
private TextField nameProject;
|
||||||
private TextField groupeId;
|
private TextField groupeId;
|
||||||
private TextField branchName;
|
|
||||||
private TextField artifactId;
|
private TextField artifactId;
|
||||||
private TextField processId;
|
private TextField processId;
|
||||||
private TextField serverName;
|
private TextField serverName;
|
||||||
private ComboBox status;
|
private ComboBox status;
|
||||||
|
|
||||||
//SERVICE
|
//SERVICE
|
||||||
private transient ProjectPersistService projectPersistService;
|
private ProjectPersistService projectPersistService;
|
||||||
|
|
||||||
private SqueletteComposant squeletteComposant;
|
private SqueletteComposant squeletteComposant;
|
||||||
|
|
||||||
|
|
@ -76,73 +74,65 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
|
|
||||||
|
|
||||||
Grid.Column<ProjectPersist> deployNameCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getDeploymentName());
|
Grid.Column<ProjectPersist> deployNameCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getDeploymentName());
|
||||||
nameDeploy = new TextField(STR_NAME_DEPLOY);
|
nameDeploy = new TextField(strNameDeploy);
|
||||||
nameDeploy.setValueChangeMode(ValueChangeMode.EAGER);
|
nameDeploy.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
nameDeploy.addValueChangeListener(e ->
|
nameDeploy.addValueChangeListener(e -> {
|
||||||
refreshtGrid(nameDeploy.getValue(), STR_NAME_DEPLOY)
|
refreshtGrid(nameDeploy.getValue(), strNameDeploy);
|
||||||
);
|
});
|
||||||
deployNameCo.setHeader(nameDeploy);
|
deployNameCo.setHeader(nameDeploy);
|
||||||
|
|
||||||
Grid.Column<ProjectPersist> nameProjectCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getProjectName());
|
Grid.Column<ProjectPersist> nameProjectCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getProjectName());
|
||||||
nameProject = new TextField(STR_NAME_PROJECT);
|
nameProject = new TextField(strNameProject);
|
||||||
nameProject.setValueChangeMode(ValueChangeMode.EAGER);
|
nameProject.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
nameProject.addValueChangeListener(e -> {
|
nameProject.addValueChangeListener(e -> {
|
||||||
refreshtGrid(nameProject.getValue(), STR_NAME_PROJECT);
|
refreshtGrid(nameProject.getValue(), strNameProject);
|
||||||
});
|
});
|
||||||
nameProjectCo.setHeader(nameProject);
|
nameProjectCo.setHeader(nameProject);
|
||||||
|
|
||||||
projectPersistGrid.addColumn(projectPersist -> projectPersist.getMainClass()).setHeader("ClassName")
|
projectPersistGrid.addColumn(projectPersist -> projectPersist.getMainClass()).setHeader("ClassName")
|
||||||
.setComparator((projectPersist, t1) -> projectPersist.getMainClass().compareTo(t1.getMainClass()));
|
.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());
|
Grid.Column<ProjectPersist> groupIdCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getGroupID());
|
||||||
groupeId = new TextField(STR_GROUPE_ID);
|
groupeId = new TextField(strGroupeId);
|
||||||
groupeId.setValueChangeMode(ValueChangeMode.EAGER);
|
groupeId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
groupeId.addValueChangeListener(e -> {
|
groupeId.addValueChangeListener(e -> {
|
||||||
refreshtGrid(groupeId.getValue(), STR_GROUPE_ID);
|
refreshtGrid(groupeId.getValue(), strGroupeId);
|
||||||
});
|
});
|
||||||
groupIdCo.setHeader(groupeId);
|
groupIdCo.setHeader(groupeId);
|
||||||
|
|
||||||
Grid.Column<ProjectPersist> artifactIDCO = projectPersistGrid.addColumn(projectPersist -> projectPersist.getArtifactID());
|
Grid.Column<ProjectPersist> artifactIDCO = projectPersistGrid.addColumn(projectPersist -> projectPersist.getArtifactID());
|
||||||
artifactId = new TextField(STR_ARTEFACT_ID);
|
artifactId = new TextField(strArtefactID);
|
||||||
artifactId.setValueChangeMode(ValueChangeMode.EAGER);
|
artifactId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
artifactId.addValueChangeListener(e -> {
|
artifactId.addValueChangeListener(e -> {
|
||||||
refreshtGrid(artifactId.getValue(), STR_ARTEFACT_ID);
|
refreshtGrid(artifactId.getValue(), strArtefactID);
|
||||||
});
|
});
|
||||||
artifactIDCO.setHeader(artifactId);
|
artifactIDCO.setHeader(artifactId);
|
||||||
|
|
||||||
Grid.Column<ProjectPersist> processIDco = projectPersistGrid.addColumn(projectPersist -> projectPersist.getProcessID());
|
Grid.Column<ProjectPersist> processIDco = projectPersistGrid.addColumn(projectPersist -> projectPersist.getProcessID());
|
||||||
processId = new TextField(STR_PROCESS_ID);
|
processId = new TextField(strProcessID);
|
||||||
processId.setValueChangeMode(ValueChangeMode.EAGER);
|
processId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
processId.addValueChangeListener(e ->
|
processId.addValueChangeListener(e -> {
|
||||||
refreshtGrid(processId.getValue(), STR_PROCESS_ID));
|
refreshtGrid(processId.getValue(), strProcessID);
|
||||||
|
});
|
||||||
processIDco.setHeader(processId);
|
processIDco.setHeader(processId);
|
||||||
|
|
||||||
|
|
||||||
Grid.Column<ProjectPersist> serverNameCo = projectPersistGrid.addColumn(projectPersist -> {
|
Grid.Column<ProjectPersist> serverNameCo = projectPersistGrid.addColumn(projectPersist -> {
|
||||||
String result = null;
|
String result = null;
|
||||||
for (String servName : projectPersist.getServerNames()) {
|
for (String serverName : projectPersist.getServerNames()) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
result = result + ":" + servName;
|
result = result + ":" + serverName;
|
||||||
} else {
|
} else {
|
||||||
result = servName;
|
result = serverName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
serverName = new TextField(STR_SERVER_NAME);
|
serverName = new TextField(strServerName);
|
||||||
serverName.setValueChangeMode(ValueChangeMode.EAGER);
|
serverName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
serverName.addValueChangeListener(e ->
|
serverName.addValueChangeListener(e -> {
|
||||||
refreshtGrid(serverName.getValue(), STR_SERVER_NAME)
|
refreshtGrid(serverName.getValue(), strServerName);
|
||||||
);
|
});
|
||||||
serverNameCo.setHeader(serverName);
|
serverNameCo.setHeader(serverName);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -151,7 +141,7 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
|
|
||||||
|
|
||||||
Grid.Column<ProjectPersist> statusCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getStatus());
|
Grid.Column<ProjectPersist> statusCo = projectPersistGrid.addColumn(projectPersist -> projectPersist.getStatus());
|
||||||
status = new ComboBox(STR_PROCESS_ID);
|
status = new ComboBox(strProcessID);
|
||||||
status.setClassName("deployment-combobox");
|
status.setClassName("deployment-combobox");
|
||||||
|
|
||||||
ArrayList<String> tmp = new ArrayList<>();
|
ArrayList<String> tmp = new ArrayList<>();
|
||||||
|
|
@ -160,9 +150,9 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
tmp.add(ProjectPersist.ADEFINIR);
|
tmp.add(ProjectPersist.ADEFINIR);
|
||||||
tmp.add(" ");
|
tmp.add(" ");
|
||||||
status.setItems(tmp);
|
status.setItems(tmp);
|
||||||
status.addValueChangeListener(e ->
|
status.addValueChangeListener(e -> {
|
||||||
refreshtGrid(status.getValue() != null ? status.getValue().toString() : " ", STR_STATUS)
|
refreshtGrid(status.getValue() != null ? status.getValue().toString() : " ", strStatus);
|
||||||
);
|
});
|
||||||
statusCo.setHeader(status);
|
statusCo.setHeader(status);
|
||||||
|
|
||||||
add(projectPersistGrid);
|
add(projectPersistGrid);
|
||||||
|
|
@ -171,7 +161,7 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
|
|
||||||
projectPersistGrid.addSelectionListener(selectionEvent -> {
|
projectPersistGrid.addSelectionListener(selectionEvent -> {
|
||||||
|
|
||||||
if (selectionEvent.getFirstSelectedItem().isPresent()) {
|
if (selectionEvent.getFirstSelectedItem() != null && selectionEvent.getFirstSelectedItem().isPresent()) {
|
||||||
majAction(selectionEvent.getFirstSelectedItem().get());
|
majAction(selectionEvent.getFirstSelectedItem().get());
|
||||||
} else {
|
} else {
|
||||||
getDeploymentAction().getAssociateKieServer().setEnabled(false);
|
getDeploymentAction().getAssociateKieServer().setEnabled(false);
|
||||||
|
|
@ -179,6 +169,7 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
getDeploymentAction().getDeployer().setEnabled(false);
|
getDeploymentAction().getDeployer().setEnabled(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//add(new ConsoleDeploy());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshtGrid(String value, String type) {
|
private void refreshtGrid(String value, String type) {
|
||||||
|
|
@ -193,19 +184,19 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
if (value.equals("") || value.equals(" ") || type.equals(" ")) {
|
if (value.equals("") || value.equals(" ") || type.equals(" ")) {
|
||||||
columnPredicate = asset -> (true);
|
columnPredicate = asset -> (true);
|
||||||
} else {
|
} else {
|
||||||
if (type.equals(STR_ARTEFACT_ID)) {
|
if (type.equals(strArtefactID)) {
|
||||||
columnPredicate = asset -> (
|
columnPredicate = asset -> (
|
||||||
asset.getArtifactID() != null && asset.getArtifactID().toUpperCase().contains(value.toUpperCase()));
|
asset.getArtifactID() != null && asset.getArtifactID().toUpperCase().contains(value.toUpperCase()));
|
||||||
} else if (type.equals(STR_GROUPE_ID)) {
|
} else if (type.equals(strGroupeId)) {
|
||||||
columnPredicate = asset -> (asset.getGroupID() != null && asset.getGroupID().toUpperCase().contains(value.toUpperCase()));
|
columnPredicate = asset -> (asset.getGroupID() != null && asset.getGroupID().toUpperCase().contains(value.toUpperCase()));
|
||||||
} else if (type.equals(STR_NAME_DEPLOY)) {
|
} else if (type.equals(strNameDeploy)) {
|
||||||
columnPredicate = asset -> (asset.getDeploymentName() != null && asset.getDeploymentName().toUpperCase().contains(value.toUpperCase()));
|
columnPredicate = asset -> (asset.getDeploymentName() != null && asset.getDeploymentName().toUpperCase().contains(value.toUpperCase()));
|
||||||
} else if (type.equals(STR_NAME_PROJECT)) {
|
} else if (type.equals(strNameProject)) {
|
||||||
columnPredicate = asset -> (asset.getProjectName() != null && asset.getProjectName().toString().toUpperCase().contains(value.toUpperCase()));
|
columnPredicate = asset -> (asset.getProjectName() != null && asset.getProjectName().toString().toUpperCase().contains(value.toUpperCase()));
|
||||||
} else if (type.equals(STR_PROCESS_ID)) {
|
} else if (type.equals(strProcessID)) {
|
||||||
columnPredicate = asset -> (asset.getProcessID() != null && asset.getProcessID().toUpperCase().contains(value.toUpperCase()));
|
columnPredicate = asset -> (asset.getProcessID() != null && asset.getProcessID().toUpperCase().contains(value.toUpperCase()));
|
||||||
} else if (type.equals(STR_STATUS)) {
|
} else if (type.equals(strStatus)) {
|
||||||
columnPredicate = asset -> (asset.getStatus() != null && asset.getStatus().equalsIgnoreCase(value));
|
columnPredicate = asset -> (asset.getStatus() != null && asset.getStatus().toUpperCase().equals(value.toUpperCase()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return columnPredicate;
|
return columnPredicate;
|
||||||
|
|
@ -213,11 +204,15 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
|
|
||||||
public void setDataProvider() {
|
public void setDataProvider() {
|
||||||
|
|
||||||
Map<String, ProjectPersist> projectPersists = projectPersistService.findProjectsConnectedUser();
|
HashMap<String, ProjectPersist> projectPersists = projectPersistService.getProjectsSession();
|
||||||
if (projectPersists != null) {
|
if (projectPersists != null) {
|
||||||
ListDataProvider<ProjectPersist> dataProvider = new ListDataProvider<>(projectPersists.values());
|
dataProvider = new ListDataProvider<>(projectPersists.values());
|
||||||
|
|
||||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||||
|
|
||||||
|
|
||||||
projectPersistGrid.setDataProvider(filterDataProvider);
|
projectPersistGrid.setDataProvider(filterDataProvider);
|
||||||
|
|
||||||
reinitFilter();
|
reinitFilter();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +231,7 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
||||||
if (projectPersist.getStatus().equals(ProjectPersist.DEFINI)) {
|
if (projectPersist.getStatus().equals(ProjectPersist.DEFINI)) {
|
||||||
|
|
||||||
getDeploymentAction().getAssociateKieServer().setEnabled(true);
|
getDeploymentAction().getAssociateKieServer().setEnabled(true);
|
||||||
getDeploymentAction().getDefinirProject().setEnabled(true);
|
getDeploymentAction().getDefinirProject().setEnabled(false);
|
||||||
getDeploymentAction().getDeployer().setEnabled(false);
|
getDeploymentAction().getDeployer().setEnabled(false);
|
||||||
|
|
||||||
} else if (projectPersist.getStatus().equals(ProjectPersist.ADEFINIR)) {
|
} else if (projectPersist.getStatus().equals(ProjectPersist.ADEFINIR)) {
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,34 @@
|
||||||
package org.chtijbug.drools.console.view;
|
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.button.Button;
|
||||||
import com.vaadin.flow.component.html.Label;
|
|
||||||
import com.vaadin.flow.component.html.Span;
|
import com.vaadin.flow.component.html.Span;
|
||||||
import com.vaadin.flow.component.notification.Notification;
|
import com.vaadin.flow.component.notification.Notification;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.component.upload.Upload;
|
import com.vaadin.flow.component.upload.Upload;
|
||||||
|
import com.vaadin.flow.component.upload.receivers.FileBuffer;
|
||||||
import com.vaadin.flow.component.upload.receivers.MemoryBuffer;
|
import com.vaadin.flow.component.upload.receivers.MemoryBuffer;
|
||||||
|
import com.vaadin.flow.component.upload.receivers.MultiFileBuffer;
|
||||||
import com.vaadin.flow.server.StreamResource;
|
import com.vaadin.flow.server.StreamResource;
|
||||||
import org.chtijbug.drools.console.service.DecisionTableExcelService;
|
import org.chtijbug.drools.console.service.ExcelService;
|
||||||
import org.chtijbug.drools.console.service.GuidedRuleTemplateExcelService;
|
|
||||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentview.AssetEdit;
|
import com.vaadin.flow.component.html.Label;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.ColumnDefinition;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.AssetEdit;
|
||||||
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 org.vaadin.olli.FileDownloadWrapper;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class EditTemplateView extends VerticalLayout {
|
public class EditTemplateView extends VerticalLayout {
|
||||||
private static int GuidedRuleTemplate = 1;
|
|
||||||
private static int DecisionTable = 2;
|
|
||||||
|
|
||||||
private int tableType;
|
|
||||||
|
|
||||||
private Button exportExcel;
|
private Button exportExcel;
|
||||||
|
|
||||||
|
|
@ -47,14 +36,9 @@ public class EditTemplateView extends VerticalLayout {
|
||||||
|
|
||||||
private Label title;
|
private Label title;
|
||||||
|
|
||||||
private Button saveButton;
|
|
||||||
|
|
||||||
|
|
||||||
private AssetEdit assetEdit;
|
private AssetEdit assetEdit;
|
||||||
|
|
||||||
private GuidedRuleTemplateExcelService guidedRuleTemplateExcelService;
|
private ExcelService excelService;
|
||||||
|
|
||||||
private DecisionTableExcelService decisionTableExcelService;
|
|
||||||
|
|
||||||
private KieRepositoryService kieRepositoryService;
|
private KieRepositoryService kieRepositoryService;
|
||||||
|
|
||||||
|
|
@ -62,26 +46,10 @@ public class EditTemplateView extends VerticalLayout {
|
||||||
|
|
||||||
private UserConnectedService userConnectedService;
|
private UserConnectedService userConnectedService;
|
||||||
|
|
||||||
private String assetName;
|
public EditTemplateView(DialogPerso dialogPerso,String nameTemplate){
|
||||||
|
|
||||||
public String getAssetContent(){
|
excelService= AppContext.getApplicationContext().getBean(ExcelService.class);
|
||||||
if (tableType==GuidedRuleTemplate){
|
kieRepositoryService=AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||||
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.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||||
|
|
||||||
|
|
@ -91,7 +59,7 @@ public class EditTemplateView extends VerticalLayout {
|
||||||
MemoryBuffer fileBuffer = new MemoryBuffer();
|
MemoryBuffer fileBuffer = new MemoryBuffer();
|
||||||
|
|
||||||
|
|
||||||
importExcel = new Upload(fileBuffer);
|
importExcel=new Upload(fileBuffer);
|
||||||
importExcel.setDropLabel(new Span("drag and Drop Excel file here"));
|
importExcel.setDropLabel(new Span("drag and Drop Excel file here"));
|
||||||
importExcel.setClassName("menu-upload");
|
importExcel.setClassName("menu-upload");
|
||||||
importExcel.setId("exampleupload");
|
importExcel.setId("exampleupload");
|
||||||
|
|
@ -100,124 +68,62 @@ public class EditTemplateView extends VerticalLayout {
|
||||||
|
|
||||||
importExcel.addSucceededListener(succeededEvent -> {
|
importExcel.addSucceededListener(succeededEvent -> {
|
||||||
|
|
||||||
if (!succeededEvent.getFileName().contains("xlsx")) {
|
if(!succeededEvent.getFileName().contains("xlsx")){
|
||||||
|
|
||||||
Notification.show("The file is incompatible, it must be in xlsx format");
|
Notification.show("The file is incompatible, it must be in xlsx format");
|
||||||
|
|
||||||
} else {
|
}else {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (tableType == GuidedRuleTemplate) {
|
List<HashMap<String, Object>> objects= excelService.importExcel(fileBuffer.getInputStream());
|
||||||
List<HashMap<String, Object>> objects = guidedRuleTemplateExcelService.importExcel(fileBuffer.getInputStream());
|
if(objects!=null&&objects.size()>0){
|
||||||
if (objects != null && objects.size() > 0) {
|
if(objects.get(0).values().size()!=assetEdit.getColumns().size()){
|
||||||
if (objects.get(0).values().size() != assetEdit.getColumns().size()) {
|
|
||||||
Notification.show("Unable to add columns with the excel import for the moment");
|
Notification.show("Unable to add columns with the excel import for the moment");
|
||||||
} else {
|
}else {
|
||||||
remove(assetEdit);
|
remove(assetEdit);
|
||||||
assetEdit = new AssetEdit(objects);
|
assetEdit = new AssetEdit(objects);
|
||||||
add(assetEdit);
|
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(),
|
kieRepositoryService.updateAssetSource(config.getKiewbUrl(),
|
||||||
userConnectedService.getUserConnected().getUserName(),
|
userConnectedService.getUserConnected().getUserName(),
|
||||||
userConnectedService.getUserConnected().getUserPassword(),
|
userConnectedService.getUserConnected().getUserPassword(),
|
||||||
userConnectedService.getSpace(),
|
userConnectedService.getSpace(),
|
||||||
userConnectedService.getProject(),
|
userConnectedService.getProject(),
|
||||||
userConnectedService.getAsset(), assetSource);
|
userConnectedService.getAsset(),objects);
|
||||||
}
|
}
|
||||||
} else {
|
}else {
|
||||||
Notification.show("illegible or empty document");
|
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) {
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
Notification.show("The file is incompatible, it must be in xlsx format");
|
Notification.show("The file is incompatible, it must be in xlsx format");
|
||||||
} catch (GuidedException e) {
|
|
||||||
Notification.show("error "+e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
importExcel.addFailedListener(failedEvent -> {
|
importExcel.addFailedListener(failedEvent -> {
|
||||||
Notification.show("Error in the upload, please start again with another file");
|
Notification.show("Error in the upload, please start again with another file");
|
||||||
});
|
});
|
||||||
FileDownloadWrapper fileDownloadWrapper = null;
|
|
||||||
if (tableType == GuidedRuleTemplate) {
|
FileDownloadWrapper fileDownloadWrapper=new FileDownloadWrapper(
|
||||||
fileDownloadWrapper = new FileDownloadWrapper(
|
new StreamResource("fsdfs.xlsx",
|
||||||
new StreamResource(nameTemplate + ".xlsx",
|
()->excelService.exportExcel(nameTemplate)));
|
||||||
() -> guidedRuleTemplateExcelService.exportExcel(nameTemplate)));
|
|
||||||
} else {
|
exportExcel=new Button("Export excel");
|
||||||
fileDownloadWrapper = new FileDownloadWrapper(
|
|
||||||
new StreamResource(nameTemplate + ".xlsx",
|
|
||||||
() -> decisionTableExcelService.exportExcel(nameTemplate)));
|
|
||||||
}
|
|
||||||
exportExcel = new Button("Export excel");
|
|
||||||
fileDownloadWrapper.wrapComponent(exportExcel);
|
fileDownloadWrapper.wrapComponent(exportExcel);
|
||||||
exportExcel.setClassName("menu-button-asset-edit");
|
exportExcel.setClassName("menu-button-asset-edit");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dialogPerso.getBar().add(fileDownloadWrapper);
|
dialogPerso.getBar().add(fileDownloadWrapper);
|
||||||
|
|
||||||
|
|
||||||
title = new Label(nameTemplate);
|
title=new Label(nameTemplate);
|
||||||
title.setClassName("creation-runtime-title");
|
title.setClassName("creation-runtime-title");
|
||||||
|
|
||||||
add(title);
|
add(title);
|
||||||
|
|
||||||
assetEdit = new AssetEdit();
|
assetEdit=new AssetEdit();
|
||||||
|
|
||||||
add(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");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,14 @@ package org.chtijbug.drools.console.view;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentview.GridLogging;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.GridLogging;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.ActionLogging;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.GridRuntime;
|
||||||
|
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.ActionLogging;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class LoggingView extends VerticalLayout {
|
public class LoggingView extends VerticalLayout {
|
||||||
|
|
||||||
public static final String PAGE_NAME = "Logging";
|
public static final String pageName="Logging";
|
||||||
|
|
||||||
private Label title;
|
private Label title;
|
||||||
|
|
||||||
|
|
@ -17,25 +18,29 @@ public class LoggingView extends VerticalLayout {
|
||||||
|
|
||||||
private ActionLogging actionLogging;
|
private ActionLogging actionLogging;
|
||||||
|
|
||||||
public LoggingView() {
|
public LoggingView(){
|
||||||
|
|
||||||
title = new Label("Logging : ");
|
title=new Label("Logging : ");
|
||||||
|
|
||||||
add(title);
|
add(title);
|
||||||
|
|
||||||
gridLogging = new GridLogging();
|
gridLogging=new GridLogging();
|
||||||
|
|
||||||
add(gridLogging);
|
add(gridLogging);
|
||||||
|
|
||||||
|
|
||||||
gridLogging.addSelectionListener(selectionEvent ->
|
gridLogging.addSelectionListener(selectionEvent -> {
|
||||||
actionLogging.getViewAction().setEnabled(selectionEvent.getFirstSelectedItem().isPresent())
|
|
||||||
|
|
||||||
);
|
if(selectionEvent.getFirstSelectedItem()!=null&&selectionEvent.getFirstSelectedItem().isPresent()) {
|
||||||
|
actionLogging.getViewAction().setEnabled(true);
|
||||||
|
}else {
|
||||||
|
actionLogging.getViewAction().setEnabled(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPageName() {
|
public static String getPageName() {
|
||||||
return PAGE_NAME;
|
return pageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridLogging getGridLogging() {
|
public GridLogging getGridLogging() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.chtijbug.drools.console.view;
|
package org.chtijbug.drools.console.view;
|
||||||
|
|
||||||
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Anchor;
|
import com.vaadin.flow.component.html.Anchor;
|
||||||
import com.vaadin.flow.component.html.Image;
|
import com.vaadin.flow.component.html.Image;
|
||||||
|
|
@ -8,8 +9,8 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.router.Route;
|
import com.vaadin.flow.router.Route;
|
||||||
import com.vaadin.flow.server.InputStreamFactory;
|
import com.vaadin.flow.server.InputStreamFactory;
|
||||||
import com.vaadin.flow.server.StreamResource;
|
import com.vaadin.flow.server.StreamResource;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.login.LoginComponent;
|
import org.chtijbug.drools.console.vaadinComponent.login.LoginComponent;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.login.TextInfoComponent;
|
import org.chtijbug.drools.console.vaadinComponent.login.TextInfoComponent;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package org.chtijbug.drools.console.view;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentview.GridRuntime;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.GridRuntime;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class RuntimesView extends VerticalLayout {
|
public class RuntimesView extends VerticalLayout {
|
||||||
|
|
@ -13,7 +13,7 @@ public class RuntimesView extends VerticalLayout {
|
||||||
|
|
||||||
public RuntimesView(){
|
public RuntimesView(){
|
||||||
|
|
||||||
add(new Label("Runtimes stored"));
|
add(new Label("Runtimes enrigistré"));
|
||||||
add(new GridRuntime());
|
add(new GridRuntime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.chtijbug.drools.console.view;
|
||||||
|
|
||||||
import com.vaadin.flow.component.combobox.ComboBox;
|
import com.vaadin.flow.component.combobox.ComboBox;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
import com.vaadin.flow.component.dialog.Dialog;
|
||||||
import com.vaadin.flow.component.grid.Grid;
|
import com.vaadin.flow.component.grid.Grid;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.component.textfield.TextField;
|
import com.vaadin.flow.component.textfield.TextField;
|
||||||
|
|
@ -10,39 +11,30 @@ import com.vaadin.flow.data.provider.ListDataProvider;
|
||||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||||
import com.vaadin.flow.function.SerializablePredicate;
|
import com.vaadin.flow.function.SerializablePredicate;
|
||||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
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.UserConnectedService;
|
||||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.TemplatesAction;
|
import org.chtijbug.drools.console.vaadinComponent.componentView.AssetEdit;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.TemplatesAction;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.UserGroups;
|
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.UserGroupsRepository;
|
|
||||||
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
||||||
|
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class TemplateView extends VerticalLayout {
|
public class TemplateView extends VerticalLayout {
|
||||||
|
|
||||||
public static final String PAGE_NAME = "Templates";
|
public static final String pageName="Templates";
|
||||||
|
|
||||||
private transient KieConfigurationData config;
|
private KieConfigurationData config;
|
||||||
|
|
||||||
private transient KieRepositoryService kieRepositoryService;
|
private KieRepositoryService kieRepositoryService;
|
||||||
|
|
||||||
private transient UserConnected userConnected;
|
private UserConnected userConnected;
|
||||||
|
|
||||||
private transient UserConnectedService userConnectedService;
|
private UserConnectedService userConnectedService;
|
||||||
|
|
||||||
private transient UserGroupsRepository userGroupsRepository;
|
|
||||||
|
|
||||||
private transient ProjectPersistService projectPersistService;
|
|
||||||
|
|
||||||
private ListDataProvider<Asset> dataProvider;
|
private ListDataProvider<Asset> dataProvider;
|
||||||
|
|
||||||
|
|
@ -50,7 +42,7 @@ public class TemplateView extends VerticalLayout {
|
||||||
|
|
||||||
private TextField searchTemplate;
|
private TextField searchTemplate;
|
||||||
|
|
||||||
private ConfigurableFilterDataProvider<Asset, Void, SerializablePredicate<Asset>> filterDataProvider;
|
private ConfigurableFilterDataProvider<Asset,Void,SerializablePredicate<Asset>> filterDataProvider;
|
||||||
|
|
||||||
private TemplatesAction templatesAction;
|
private TemplatesAction templatesAction;
|
||||||
|
|
||||||
|
|
@ -58,44 +50,39 @@ public class TemplateView extends VerticalLayout {
|
||||||
|
|
||||||
setClassName("template-content");
|
setClassName("template-content");
|
||||||
|
|
||||||
dataProvider = new ListDataProvider<>(new ArrayList<>());
|
dataProvider=new ListDataProvider<>(new ArrayList<>());
|
||||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||||
|
|
||||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||||
this.userGroupsRepository = AppContext.getApplicationContext().getBean(UserGroupsRepository.class);
|
|
||||||
this.userConnected = userConnectedService.getUserConnected();
|
this.userConnected = userConnectedService.getUserConnected();
|
||||||
this.projectPersistService = AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
|
||||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||||
|
|
||||||
assetListGrid = new Grid<>();
|
assetListGrid = new Grid();
|
||||||
assetListGrid.setClassName("templates-grid-perso");
|
assetListGrid.setClassName("templates-grid-perso");
|
||||||
assetListGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
|
assetListGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||||
|
|
||||||
Grid.Column<Asset> assetColumn = assetListGrid.addColumn(Asset::getTitle);
|
Grid.Column<Asset> assetColumn=assetListGrid.addColumn(asset -> asset.getTitle());
|
||||||
searchTemplate = new TextField("title");
|
searchTemplate=new TextField("title");
|
||||||
searchTemplate.setValueChangeMode(ValueChangeMode.EAGER);
|
searchTemplate.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
searchTemplate.addValueChangeListener(e ->
|
searchTemplate.addValueChangeListener(e -> {
|
||||||
refreshtGrid(searchTemplate.getValue(), "title")
|
refreshtGrid(searchTemplate.getValue(), "title");
|
||||||
);
|
});
|
||||||
assetColumn.setHeader(searchTemplate);
|
assetColumn.setHeader(searchTemplate);
|
||||||
add(assetListGrid);
|
add(assetListGrid);
|
||||||
|
|
||||||
assetListGrid.addSelectionListener(selectionEvent ->
|
assetListGrid.addSelectionListener(selectionEvent -> {
|
||||||
templatesAction.getEdit().setEnabled(assetListGrid.getSelectedItems() != null)
|
if(assetListGrid.getSelectedItems()==null){
|
||||||
);
|
templatesAction.getEdit().setEnabled(false);
|
||||||
|
}else {
|
||||||
|
templatesAction.getEdit().setEnabled(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataProvider(ComboBox<ProjectPersist> spaceSelection) {
|
public void setDataProvider(ComboBox<PlatformProjectResponse> spaceSelection){
|
||||||
ProjectPersist response = spaceSelection.getValue();
|
PlatformProjectResponse response = spaceSelection.getValue();
|
||||||
if (response != null) {
|
List<Asset> tmp = kieRepositoryService.getListAssets(config.getKiewbUrl(), userConnected.getUserName(), userConnected.getUserPassword(), response.getSpaceName(), response.getName());
|
||||||
UserGroups projectGroups = userGroupsRepository.findUserGroupsByProjectPersist(response);
|
|
||||||
String workspaceName = projectGroups.getWorkspaceUserGroup().getSpaceName();
|
|
||||||
List<Asset> tmp = kieRepositoryService.getListAssets(config.getKiewbUrl(),
|
|
||||||
userConnected.getUserName(),
|
|
||||||
userConnected.getUserPassword(),
|
|
||||||
workspaceName,
|
|
||||||
projectGroups.getProjectName());
|
|
||||||
List<Asset> result = new ArrayList<>();
|
List<Asset> result = new ArrayList<>();
|
||||||
for (Asset asset : tmp) {
|
for (Asset asset : tmp) {
|
||||||
if (asset.getTitle().endsWith(".template")
|
if (asset.getTitle().endsWith(".template")
|
||||||
|
|
@ -103,55 +90,41 @@ public class TemplateView extends VerticalLayout {
|
||||||
result.add(asset);
|
result.add(asset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dataProvider = new ListDataProvider<>(result);
|
dataProvider=new ListDataProvider<>(result);
|
||||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
|
||||||
assetListGrid.setDataProvider(filterDataProvider);
|
|
||||||
reinitFilter();
|
|
||||||
} else {
|
|
||||||
List<Asset> result = new ArrayList<>();
|
|
||||||
dataProvider = new ListDataProvider<>(result);
|
|
||||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||||
assetListGrid.setDataProvider(filterDataProvider);
|
assetListGrid.setDataProvider(filterDataProvider);
|
||||||
reinitFilter();
|
reinitFilter();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void refreshList(ComboBox<ProjectPersist> spaceSelection) {
|
public void refreshList(ComboBox<PlatformProjectResponse> spaceSelection) {
|
||||||
spaceSelection.setItems(projectPersistService.findProjectsConnectedUser().values());
|
spaceSelection.setItems(userConnected.getProjectResponses());
|
||||||
}
|
}
|
||||||
|
public void edit(ComboBox<PlatformProjectResponse> spaceSelection){
|
||||||
public void edit(ComboBox<ProjectPersist> spaceSelection) {
|
|
||||||
Set<Asset> selectedElements = assetListGrid.getSelectedItems();
|
Set<Asset> selectedElements = assetListGrid.getSelectedItems();
|
||||||
if (selectedElements.toArray().length > 0) {
|
if (selectedElements.toArray().length > 0) {
|
||||||
Optional<Asset> assetOptional = selectedElements.stream().findFirst();
|
String assetName = selectedElements.stream().findFirst().get().getTitle();
|
||||||
if (assetOptional.isPresent()) {
|
|
||||||
String assetName = assetOptional.get().getTitle();
|
|
||||||
if (assetName != null) {
|
if (assetName != null) {
|
||||||
|
PlatformProjectResponse response = spaceSelection.getValue();
|
||||||
userConnectedService.addAssetToSession(assetName);
|
userConnectedService.addAssetToSession(assetName);
|
||||||
UserGroups projectGroups = userGroupsRepository.findUserGroupsByProjectPersist(spaceSelection.getValue());
|
userConnectedService.addProjectToSession(response.getName());
|
||||||
String workspaceName = projectGroups.getWorkspaceUserGroup().getSpaceName();
|
userConnectedService.addSpaceToSession(response.getSpaceName());
|
||||||
userConnectedService.addProjectToSession(projectGroups.getProjectName());
|
DialogPerso dialog=new DialogPerso();
|
||||||
userConnectedService.addSpaceToSession(workspaceName);
|
|
||||||
DialogPerso dialog = new DialogPerso();
|
|
||||||
|
|
||||||
dialog.add(new EditTemplateView(dialog, assetName));
|
dialog.add(new EditTemplateView(dialog,assetName));
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
private void refreshtGrid(String value,String type){
|
||||||
|
|
||||||
private void refreshtGrid(String value, String type) {
|
filterDataProvider.setFilter(filterGrid(value.toUpperCase(),type));
|
||||||
|
|
||||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(), type));
|
|
||||||
assetListGrid.getDataProvider().refreshAll();
|
assetListGrid.getDataProvider().refreshAll();
|
||||||
}
|
}
|
||||||
|
private SerializablePredicate<Asset> filterGrid(String value, String type){
|
||||||
private SerializablePredicate<Asset> filterGrid(String value, String type) {
|
|
||||||
SerializablePredicate<Asset> columnPredicate = null;
|
SerializablePredicate<Asset> columnPredicate = null;
|
||||||
if (value.equals(" ") || type.equals(" ")) {
|
if(value.equals(" ")||type.equals(" ")){
|
||||||
columnPredicate = asset -> (true);
|
columnPredicate = asset -> (true);
|
||||||
} else {
|
}else {
|
||||||
if (type.equals("Asset Title")) {
|
if (type.equals("Asset Title")) {
|
||||||
columnPredicate = asset -> (asset.getTitle().contains(value));
|
columnPredicate = asset -> (asset.getTitle().contains(value));
|
||||||
}
|
}
|
||||||
|
|
@ -167,11 +140,9 @@ public class TemplateView extends VerticalLayout {
|
||||||
this.userConnectedService = userConnectedService;
|
this.userConnectedService = userConnectedService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void duplicate() {
|
public void duplicate(){}
|
||||||
//NOP
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reinitFilter() {
|
public void reinitFilter(){
|
||||||
searchTemplate.setValue("");
|
searchTemplate.setValue("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,13 @@
|
||||||
server.port=${port:8200}
|
server.port=${port:8200}
|
||||||
kie-wb.baseurl=${PYMMA_KIE_BASE_URL:http://localhost:18080/kie-wb/rest}
|
kie-wb.baseurl=http://localhost:8080/kie-wb/rest
|
||||||
kie-wb.mainwbintern=${PYMMA_KIE_MAINWBINTERN:http://localhost:8080/kie-wb}
|
kie-wb.username=admin
|
||||||
kie-wb.mainwbextern=${PYMMA_KIE_MAINWBEXTERN:http://localhost:18080/kie-wb}
|
kie-wb.password=admin
|
||||||
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://localhost:18080/kie-wb/rest}
|
spring.data.elasticsearch.cluster-nodes=localhost:9300
|
||||||
org.kie.server.location=${PYMMA_KIE_LOCATION:http://localhost: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:localhost:28017}
|
|
||||||
|
|
||||||
|
|
||||||
|
spring.data.mongodb.database=businessProxyDB
|
||||||
|
spring.data.mongodb.host=localhost:27017
|
||||||
|
|
||||||
spring.servlet.multipart.enabled=false
|
spring.servlet.multipart.enabled=false
|
||||||
kafka.bootstrapAddress=${PYMMA_KAFKA_BOOTSTRAP:localhost:9092,localhost:9093,localhost:9094}
|
|
||||||
|
|
||||||
vaadin.urlMapping=/admin/*
|
|
||||||
|
|
||||||
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:}
|
|
||||||
spring.servlet.multipart.max-file-size=100MB
|
|
||||||
spring.servlet.multipart.max-request-size=100MB
|
|
||||||
|
|
||||||
# Server properties
|
|
||||||
server.tomcat.max-http-post-size=100000000
|
|
||||||
server.tomcat.max-swallow-size=100MB
|
|
||||||
|
|
||||||
|
|
||||||
secretkey=eRaYY7Wo24sDqKSX3IM9ASGmdGPmkTd9jo1QTy4b7P9Ze5_9hKolVX8xNrQDcNRfVEdTZNOuOyqEGhXEbdJI-ZQ19k_o9MI0y3eZN2lp9jow55FfXMiINEdt1XR85VipRLSOkT6kSpzs2x-jbLDiz9iFVzkd81YKxMgPA7VfZeQUm4n-mOmnWMaVX30zGFU4L3oPBctYKkl4dYfqYWqRNfrgPJVi5DGFjywgxx0ASEiJHtV72paI3fDR2XwlSkyhhmY-ICjCRmsJN4fX1pdoL8a18-aQrvyu4j0Os6dVPYIoPvvY0SAZtWYKHfM15g7A3HD4cVREf9cUsprCRK93w
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context-4.1.xsd">
|
||||||
|
<context:component-scan base-package="org.chtijbug.drools.console"/>
|
||||||
|
<bean class="org.chtijbug.drools.console.service.model.kie.KieConfigurationData">
|
||||||
|
<property name="userName" value="${kie-wb.username}"/>
|
||||||
|
<property name="password" value="${kie-wb.password}"/>
|
||||||
|
<property name="kiewbUrl" value="${kie-wb.baseurl}"/>
|
||||||
|
|
||||||
|
</bean>
|
||||||
|
<!--bean class="org.chtijbug.drools.console.service.model.gitlab.GitLabConfigurationData">
|
||||||
|
<property name="url" value="${gitlab.url}"/>
|
||||||
|
<property name="token" value="${gitlab.token}"/>
|
||||||
|
<property name="groupName" value="${gitlab.group}"/>
|
||||||
|
<property name="baseUrl" value="${gitlab.baseurl}"/>
|
||||||
|
</bean>
|
||||||
|
<bean class="org.chtijbug.drools.console.service.model.jenkins.JenkinsConfigurationData">
|
||||||
|
<property name="url" value="${jenkins.url}"/>
|
||||||
|
<property name="username" value="${jenkins.username}"/>
|
||||||
|
<property name="password" value="${jenkins.password}"/>
|
||||||
|
<property name="credentials" value="${jenkins.credentials}"/>
|
||||||
|
<property name="nexusName" value="${jenkins.nexusName}"/>
|
||||||
|
<property name="nexusUrl" value="${jenkins.nexusUrl}"/>
|
||||||
|
<property name="jdkVersion" value="${jenkins.jdkVersion}"/>
|
||||||
|
<property name="groupName" value="${jenkins.group}"/>
|
||||||
|
</bean-->
|
||||||
|
<bean name="applicationContext" class="org.chtijbug.drools.console.service.util.ApplicationContextProvider"/>
|
||||||
|
|
||||||
|
</beans>
|
||||||
|
|
@ -0,0 +1,184 @@
|
||||||
|
[INFO] com.pymmasoftware.jbpm:drools-framework-admin-console:war:1.0-SNAPSHOT
|
||||||
|
[INFO] +- com.pymmasoftware.jbpm:drools-framework-kie-wb-rest-pojo:jar:1.0-SNAPSHOT:compile
|
||||||
|
[INFO] | \- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.6.2.Final:compile
|
||||||
|
[INFO] | +- org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec:jar:1.0.0.Final:compile
|
||||||
|
[INFO] | +- org.glassfish.jaxb:jaxb-runtime:jar:2.3.1:compile
|
||||||
|
[INFO] | | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
|
||||||
|
[INFO] | | +- org.glassfish.jaxb:txw2:jar:2.3.1:compile
|
||||||
|
[INFO] | | +- com.sun.istack:istack-commons-runtime:jar:3.0.7:compile
|
||||||
|
[INFO] | | +- org.jvnet.staxex:stax-ex:jar:1.8:compile
|
||||||
|
[INFO] | | +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.15:compile
|
||||||
|
[INFO] | | \- javax.activation:javax.activation-api:jar:1.2.0:compile
|
||||||
|
[INFO] | \- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
|
||||||
|
[INFO] +- org.drools:drools-workbench-models-guided-template:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | +- org.kie:kie-api:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | | \- org.kie.soup:kie-soup-maven-support:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | +- org.kie:kie-internal:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | +- org.drools:drools-compiler:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | | +- org.antlr:antlr-runtime:jar:3.5.2:compile
|
||||||
|
[INFO] | | +- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:compile
|
||||||
|
[INFO] | | +- org.mvel:mvel2:jar:2.4.3.Final:compile
|
||||||
|
[INFO] | | \- com.google.protobuf:protobuf-java:jar:3.6.1:compile
|
||||||
|
[INFO] | +- org.kie.soup:kie-soup-commons:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | +- org.kie.soup:kie-soup-project-datamodel-api:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | +- org.kie.soup:kie-soup-project-datamodel-commons:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | +- org.drools:drools-workbench-models-commons:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | | \- org.apache.commons:commons-lang3:jar:3.8.1:compile
|
||||||
|
[INFO] | +- org.drools:drools-core:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | +- org.drools:drools-templates:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | +- org.drools:drools-workbench-models-datamodel-api:jar:7.15.0.Final:compile
|
||||||
|
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.4.10:compile
|
||||||
|
[INFO] | | +- xmlpull:xmlpull:jar:1.1.3.1:compile
|
||||||
|
[INFO] | | \- xpp3:xpp3_min:jar:1.1.4c:compile
|
||||||
|
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.2:compile
|
||||||
|
[INFO] +- com.offbytwo.jenkins:jenkins-client:jar:0.3.8:compile
|
||||||
|
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.9:compile
|
||||||
|
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
|
||||||
|
[INFO] | +- net.sf.json-lib:json-lib:jar:jdk15:2.4:compile
|
||||||
|
[INFO] | | +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
|
||||||
|
[INFO] | | +- commons-collections:commons-collections:jar:3.2.2:compile
|
||||||
|
[INFO] | | +- commons-logging:commons-logging:jar:1.1.1:compile
|
||||||
|
[INFO] | | \- net.sf.ezmorph:ezmorph:jar:1.0.6:compile
|
||||||
|
[INFO] | +- com.google.guava:guava:jar:13.0.1:compile
|
||||||
|
[INFO] | +- commons-lang:commons-lang:jar:2.6:compile
|
||||||
|
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.3.6:compile
|
||||||
|
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.3.3:compile
|
||||||
|
[INFO] | +- org.apache.httpcomponents:httpmime:jar:4.5.6:compile
|
||||||
|
[INFO] | +- jaxen:jaxen:jar:1.1.6:compile
|
||||||
|
[INFO] | \- xml-apis:xml-apis:jar:1.4.01:compile
|
||||||
|
[INFO] +- com.vaadin:vaadin-core:jar:12.0.2:compile
|
||||||
|
[INFO] | +- com.vaadin:flow-server:jar:1.2.3:compile
|
||||||
|
[INFO] | | +- com.vaadin.external.gwt:gwt-elemental:jar:2.8.2.vaadin2:compile
|
||||||
|
[INFO] | | +- commons-fileupload:commons-fileupload:jar:1.3.3:compile
|
||||||
|
[INFO] | | +- org.jsoup:jsoup:jar:1.10.3:compile
|
||||||
|
[INFO] | | +- com.helger:ph-css:jar:6.1.1:compile
|
||||||
|
[INFO] | | +- com.helger:ph-commons:jar:9.1.2:compile
|
||||||
|
[INFO] | | | \- com.google.code.findbugs:jsr305:jar:3.0.2:compile
|
||||||
|
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.9.3:compile
|
||||||
|
[INFO] | | \- com.vaadin.external:gentyref:jar:1.2.0.vaadin1:compile
|
||||||
|
[INFO] | +- com.vaadin:flow-push:jar:1.2.3:compile
|
||||||
|
[INFO] | | \- com.vaadin.external.atmosphere:atmosphere-runtime:jar:2.4.30.vaadin1:compile
|
||||||
|
[INFO] | | \- com.vaadin.external.slf4j:vaadin-slf4j-jdk14:jar:1.6.1:compile
|
||||||
|
[INFO] | +- com.vaadin:flow-client:jar:1.2.3:compile
|
||||||
|
[INFO] | +- com.vaadin:flow-html-components:jar:1.2.3:compile
|
||||||
|
[INFO] | +- com.vaadin:flow-data:jar:1.2.3:compile
|
||||||
|
[INFO] | | \- javax.validation:validation-api:jar:2.0.1.Final:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-lumo-theme:jar:1.2.3:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-lumo-styles:jar:1.3.3:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-icon:jar:2.1.0:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-meta:jar:2.1.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-iconset-svg:jar:2.2.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-flex-layout:jar:2.0.3:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymer:polymer:jar:2.6.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.webcomponents:webcomponentsjs:jar:1.2.6:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.webcomponents:shadycss:jar:1.5.0-1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-material-theme:jar:1.2.3:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-material-styles:jar:1.2.0:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-button-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-button:jar:2.1.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-element-mixin:jar:2.1.2:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-usage-statistics:jar:2.0.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-development-mode-detector:jar:2.0.0:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-control-state-mixin:jar:2.1.2:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-themable-mixin:jar:1.3.2:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-checkbox-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-checkbox:jar:2.2.4:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-combo-box-flow:jar:2.0.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-combo-box:jar:4.2.0:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-text-field:jar:2.1.5:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-resizable-behavior:jar:2.1.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-a11y-announcer:jar:2.1.0:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-list:jar:2.0.19:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-scroll-target-behavior:jar:2.1.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-a11y-keys-behavior:jar:2.1.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-item:jar:2.1.0:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-overlay:jar:3.2.4:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.polymerelements:iron-overlay-behavior:jar:2.3.4:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.polymerelements:iron-fit-behavior:jar:2.2.1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-date-picker-flow:jar:1.2.1:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-date-picker:jar:3.3.2:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.polymerelements:iron-media-query:jar:2.1.0:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-dialog-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-dialog:jar:2.2.1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-form-layout-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-form-layout:jar:2.1.1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-grid-flow:jar:2.1.3:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-grid:jar:5.2.5:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-icons-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-icons:jar:4.2.1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-iron-list-flow:jar:1.2.1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-list-box-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | +- org.webjars.bowergithub.vaadin:vaadin-list-box:jar:1.1.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-list-mixin:jar:2.1.2:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-ordered-layout-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-ordered-layout:jar:1.1.0:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-progress-bar-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-progress-bar:jar:1.1.0:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-radio-button-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-radio-button:jar:1.1.3:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-split-layout-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-split-layout:jar:4.1.0:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-tabs-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-tabs:jar:2.1.1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-text-field-flow:jar:1.2.1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-upload-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-upload:jar:4.2.1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-notification-flow:jar:1.2.0:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-notification:jar:1.2.1:compile
|
||||||
|
[INFO] | +- com.vaadin:vaadin-app-layout-flow:jar:1.0.3:compile
|
||||||
|
[INFO] | | \- org.webjars.bowergithub.vaadin:vaadin-app-layout:jar:1.0.2:compile
|
||||||
|
[INFO] | \- com.vaadin:vaadin-context-menu-flow:jar:1.2.2:compile
|
||||||
|
[INFO] | \- org.webjars.bowergithub.vaadin:vaadin-context-menu:jar:4.2.1:compile
|
||||||
|
[INFO] +- com.vaadin:vaadin-spring-boot-starter:jar:12.0.2:compile
|
||||||
|
[INFO] | \- org.springframework.boot:spring-boot-starter-web:jar:2.1.0.RELEASE:compile
|
||||||
|
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.1.0.RELEASE:compile
|
||||||
|
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.0.RELEASE:compile
|
||||||
|
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.0.9:test
|
||||||
|
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:test
|
||||||
|
[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.1:compile
|
||||||
|
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.11.1:compile
|
||||||
|
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
|
||||||
|
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
|
||||||
|
[INFO] | | \- org.yaml:snakeyaml:jar:1.23:runtime
|
||||||
|
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.1.0.RELEASE:compile
|
||||||
|
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.7:compile
|
||||||
|
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.7:compile
|
||||||
|
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.7:compile
|
||||||
|
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.0.RELEASE:compile
|
||||||
|
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.12:compile
|
||||||
|
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.12:compile
|
||||||
|
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.12:compile
|
||||||
|
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.13.Final:compile
|
||||||
|
[INFO] | | \- com.fasterxml:classmate:jar:1.4.0:compile
|
||||||
|
[INFO] | \- org.springframework:spring-web:jar:5.1.2.RELEASE:compile
|
||||||
|
[INFO] +- com.vaadin:vaadin-spring:jar:10.1.1:compile
|
||||||
|
[INFO] | +- org.springframework:spring-webmvc:jar:5.1.2.RELEASE:compile
|
||||||
|
[INFO] | | +- org.springframework:spring-aop:jar:5.1.2.RELEASE:compile
|
||||||
|
[INFO] | | +- org.springframework:spring-beans:jar:5.1.2.RELEASE:compile
|
||||||
|
[INFO] | | \- org.springframework:spring-expression:jar:5.1.2.RELEASE:compile
|
||||||
|
[INFO] | \- org.springframework:spring-websocket:jar:5.1.2.RELEASE:compile
|
||||||
|
[INFO] +- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.0.RELEASE:compile
|
||||||
|
[INFO] +- org.springframework.boot:spring-boot:jar:2.1.0.RELEASE:compile
|
||||||
|
[INFO] | +- org.springframework:spring-core:jar:5.1.2.RELEASE:compile
|
||||||
|
[INFO] | | \- org.springframework:spring-jcl:jar:5.1.2.RELEASE:compile
|
||||||
|
[INFO] | \- org.springframework:spring-context:jar:4.3.16.RELEASE:compile
|
||||||
|
[INFO] +- org.uberfire:uberfire-rest-client:jar:2.9.0.Final:compile
|
||||||
|
[INFO] | \- org.jboss.errai:errai-common:jar:4.3.3.Final:compile
|
||||||
|
[INFO] | +- com.google.jsinterop:jsinterop-annotations:jar:1.0.1:compile
|
||||||
|
[INFO] | +- org.jboss.errai.reflections:reflections:jar:4.3.3.Final:compile
|
||||||
|
[INFO] | | \- org.javassist:javassist:jar:3.20.0-GA:compile
|
||||||
|
[INFO] | +- junit:junit:jar:4.12:compile
|
||||||
|
[INFO] | | \- org.hamcrest:hamcrest-core:jar:1.3:compile
|
||||||
|
[INFO] | +- de.benediktmeurer.gwt-slf4j:gwt-slf4j:jar:0.0.2:compile
|
||||||
|
[INFO] | \- com.google.elemental2:elemental2-dom:jar:1.0.0-beta-1:compile
|
||||||
|
[INFO] | +- com.google.jsinterop:base:jar:1.0.0-beta-1:compile
|
||||||
|
[INFO] | +- com.google.elemental2:elemental2-core:jar:1.0.0-beta-1:compile
|
||||||
|
[INFO] | \- com.google.elemental2:elemental2-promise:jar:1.0.0-beta-1:compile
|
||||||
|
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.9.4:compile
|
||||||
|
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.4:compile
|
||||||
|
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.9.4:compile
|
||||||
|
[INFO] | +- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
|
||||||
|
[INFO] | \- com.fasterxml.woodstox:woodstox-core:jar:5.0.3:compile
|
||||||
|
[INFO] +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.4:compile
|
||||||
|
[INFO] +- commons-codec:commons-codec:jar:1.11:compile
|
||||||
|
[INFO] \- commons-io:commons-io:jar:2.1:compile
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
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>
|
|
||||||
|
|
||||||
<artifactId>drools-framework-admin-dto</artifactId>
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
package org.chtijbug.drools.console.dto;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Hashtable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class GuidedRuleTemplate {
|
|
||||||
|
|
||||||
private String workbenchName;
|
|
||||||
|
|
||||||
private String spaceName;
|
|
||||||
|
|
||||||
private String projectName;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private Hashtable definitionList = new Hashtable();
|
|
||||||
|
|
||||||
private List<GuidedRuleTemplateDataRow> rows = new ArrayList<>();
|
|
||||||
|
|
||||||
public String getWorkbenchName() {
|
|
||||||
return workbenchName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWorkbenchName(String workbenchName) {
|
|
||||||
this.workbenchName = workbenchName;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Hashtable getDefinitionList() {
|
|
||||||
return definitionList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefinitionList(Hashtable definitionList) {
|
|
||||||
this.definitionList = definitionList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<GuidedRuleTemplateDataRow> getRows() {
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRows(List<GuidedRuleTemplateDataRow> rows) {
|
|
||||||
this.rows = rows;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
package org.chtijbug.drools.console.dto;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Hashtable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class GuidedRuleTemplateDataRow {
|
|
||||||
|
|
||||||
private String lineID;
|
|
||||||
|
|
||||||
private Hashtable dataList = new Hashtable();
|
|
||||||
|
|
||||||
public String getLineID() {
|
|
||||||
return lineID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLineID(String lineID) {
|
|
||||||
this.lineID = lineID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Hashtable getDataList() {
|
|
||||||
return dataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataList(Hashtable dataList) {
|
|
||||||
this.dataList = dataList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
package org.chtijbug.drools.console.dto;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
public class VariableData {
|
|
||||||
private String varName;
|
|
||||||
private String stringValue;
|
|
||||||
private Long longValue;
|
|
||||||
private Double doubleValue;
|
|
||||||
private BigDecimal bigDecimalValue;
|
|
||||||
|
|
||||||
public String getVarName() {
|
|
||||||
return varName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVarName(String varName) {
|
|
||||||
this.varName = varName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStringValue() {
|
|
||||||
return stringValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStringValue(String stringValue) {
|
|
||||||
this.stringValue = stringValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getLongValue() {
|
|
||||||
return longValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLongValue(Long longValue) {
|
|
||||||
this.longValue = longValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getDoubleValue() {
|
|
||||||
return doubleValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDoubleValue(Double doubleValue) {
|
|
||||||
this.doubleValue = doubleValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getBigDecimalValue() {
|
|
||||||
return bigDecimalValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBigDecimalValue(BigDecimal bigDecimalValue) {
|
|
||||||
this.bigDecimalValue = bigDecimalValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
package org.chtijbug.drools.console.dto;
|
|
||||||
|
|
||||||
public class VariableDefinition {
|
|
||||||
private String varName;
|
|
||||||
private String dataType;
|
|
||||||
private String factType;
|
|
||||||
private String factField;
|
|
||||||
private String operator;
|
|
||||||
|
|
||||||
public String getVarName() {
|
|
||||||
return varName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVarName(String varName) {
|
|
||||||
this.varName = varName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDataType() {
|
|
||||||
return dataType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDataType(String dataType) {
|
|
||||||
this.dataType = dataType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFactType() {
|
|
||||||
return factType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFactType(String factType) {
|
|
||||||
this.factType = factType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFactField() {
|
|
||||||
return factField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFactField(String factField) {
|
|
||||||
this.factField = factField;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOperator() {
|
|
||||||
return operator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOperator(String operator) {
|
|
||||||
this.operator = operator;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -13,6 +13,5 @@
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>drools-framework-admin-console</module>
|
<module>drools-framework-admin-console</module>
|
||||||
<module>drools-framework-admin-dto</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>drools-framework-base-tools-parent</artifactId>
|
<artifactId>drools-framework-base-tools-parent</artifactId>
|
||||||
|
|
@ -29,29 +28,7 @@
|
||||||
<artifactId>assertj-core</artifactId>
|
<artifactId>assertj-core</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.activation</groupId>
|
|
||||||
<artifactId>javax.activation</artifactId>
|
|
||||||
<version>${javax.activation.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.xml.bind</groupId>
|
|
||||||
<artifactId>jaxb-api</artifactId>
|
|
||||||
<version>${jaxb.api.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.xml.bind</groupId>
|
|
||||||
<artifactId>jaxb-core</artifactId>
|
|
||||||
<version>${jaxb.api.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun.xml.bind</groupId>
|
|
||||||
<artifactId>jaxb-impl</artifactId>
|
|
||||||
<version>${jaxb.api.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
@ -67,18 +44,6 @@
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
|
||||||
<detectJavaApiLink>false</detectJavaApiLink>
|
|
||||||
</configuration>
|
|
||||||
</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>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
package org.chtijbug.drools.common;
|
|
||||||
|
|
||||||
public class KafkaTopicConstants {
|
|
||||||
public final static String LOGING_TOPIC ="logging";
|
|
||||||
public final static String RESPONSE_DEPLOY_TOPIC ="ResponseDeploy";
|
|
||||||
public final static String REVERSE_PROXY="proxy";
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
package org.chtijbug.drools.common.rest;
|
|
||||||
|
|
||||||
public class Constants {
|
|
||||||
public final static String AUTHORISATION_HEADER = "Authorization";
|
|
||||||
}
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||||
<artifactId>drools-framework-examples</artifactId>
|
<artifactId>drools-framework-examples</artifactId>
|
||||||
<version>1.1-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>drools-framework-loyalty-model</artifactId>
|
<artifactId>drools-framework-loyalty-model</artifactId>
|
||||||
|
|
@ -24,8 +24,6 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<detectJavaApiLink>false</detectJavaApiLink>
|
|
||||||
<detectJavaApiLink>false</detectJavaApiLink>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,234 @@
|
||||||
|
'use strict';
|
||||||
|
var mountFolder = function (connect, dir) {
|
||||||
|
return connect.static(require('path').resolve(dir));
|
||||||
|
};
|
||||||
|
var modRewrite = require('connect-modrewrite');
|
||||||
|
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
|
||||||
|
|
||||||
|
module.exports = function (grunt) {
|
||||||
|
// load all grunt tasks
|
||||||
|
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
|
||||||
|
|
||||||
|
// configurable paths
|
||||||
|
var yeomanConfig = {
|
||||||
|
app: 'src/main/webapp-components/application',
|
||||||
|
dist: 'src/main/webapp-dist'
|
||||||
|
};
|
||||||
|
|
||||||
|
grunt.initConfig({
|
||||||
|
yeoman: yeomanConfig,
|
||||||
|
watch: {
|
||||||
|
less: {
|
||||||
|
options: {
|
||||||
|
livereload: {
|
||||||
|
port: 9000,
|
||||||
|
hostname: 'localhost'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
files: ['<%= yeoman.app %>/styles/*.less'],
|
||||||
|
tasks: ['less']
|
||||||
|
},
|
||||||
|
all: {
|
||||||
|
options: {
|
||||||
|
livereload: {
|
||||||
|
port: 9000,
|
||||||
|
hostname: 'localhost'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
files: [
|
||||||
|
'<%= yeoman.app %>/{,*/}*.html',
|
||||||
|
'<%= yeoman.app %>/modules{,*/}*.html',
|
||||||
|
'{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
|
||||||
|
'<%= yeoman.app %>/modules/{,*/}*.js',
|
||||||
|
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
livereload: {
|
||||||
|
files: [
|
||||||
|
'<%= yeoman.app %>/{,*/}*.html',
|
||||||
|
'<%= yeoman.app %>/modules{,*/}*.html',
|
||||||
|
'{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
|
||||||
|
'<%= yeoman.app %>/modules/{,*/}*.js',
|
||||||
|
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
|
||||||
|
],
|
||||||
|
options: {livereload: true}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
connect: {
|
||||||
|
proxies: [
|
||||||
|
{
|
||||||
|
context: '/server',
|
||||||
|
host: 'localhost',
|
||||||
|
port: 8080,
|
||||||
|
https: false,
|
||||||
|
changeOrigin: false,
|
||||||
|
ws: true
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
livereload: {
|
||||||
|
options: {
|
||||||
|
middleware: function (connect) {
|
||||||
|
return [
|
||||||
|
proxySnippet,
|
||||||
|
modRewrite([
|
||||||
|
'!^/components(.*)|^/images(.*)|^/modules(.*)|^/styles(.*)|\\.ico /index.html'
|
||||||
|
]),
|
||||||
|
mountFolder(connect, '.tmp'),
|
||||||
|
mountFolder(connect, yeomanConfig.app)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
port: 9000,
|
||||||
|
// Change this to '0.0.0.0' to access the server from outside.
|
||||||
|
hostname: 'localhost',
|
||||||
|
ws: true
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
options: {
|
||||||
|
middleware: function (connect) {
|
||||||
|
return [
|
||||||
|
mountFolder(connect, '.tmp'),
|
||||||
|
mountFolder(connect, 'test')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
open: {
|
||||||
|
server: {
|
||||||
|
url: 'http://localhost:<%= connect.options.port %>'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clean: {
|
||||||
|
dist: {
|
||||||
|
files: [
|
||||||
|
{
|
||||||
|
dot: true,
|
||||||
|
src: [
|
||||||
|
'.tmp',
|
||||||
|
'<%= yeoman.dist %>/*',
|
||||||
|
'!<%= yeoman.dist %>/.git*'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
server: '.tmp'
|
||||||
|
},
|
||||||
|
less: {
|
||||||
|
dist: {
|
||||||
|
options: {
|
||||||
|
paths: [
|
||||||
|
"<%= yeoman.app %>/styles",
|
||||||
|
"<%= yeoman.app %>/components/bootstrap/less",
|
||||||
|
"<%= yeoman.app %>/components/font-awesome/less"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
files: {
|
||||||
|
".tmp/styles/application.css": "<%= yeoman.app %>/styles/application.less"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
concat: {
|
||||||
|
js: {
|
||||||
|
src: [
|
||||||
|
'.tmp/scripts/{,*/}*.js',
|
||||||
|
'<%= yeoman.app %>/modules/{,*/}*.js'
|
||||||
|
],
|
||||||
|
dest: '<%= yeoman.dist %>/scripts/scripts.js'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
useminPrepare: {
|
||||||
|
html: '<%= yeoman.app %>/index.html',
|
||||||
|
options: {
|
||||||
|
dest: '<%= yeoman.dist %>'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
usemin: {
|
||||||
|
html: ['<%= yeoman.dist %>/modules/{,*/}*.html', '<%= yeoman.dist %>/{,*/}*.html'],
|
||||||
|
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
|
||||||
|
options: {
|
||||||
|
dirs: ['<%= yeoman.dist %>'],
|
||||||
|
basedir: '<%= yeoman.dist %>'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cssmin: {
|
||||||
|
dist: {
|
||||||
|
files: {
|
||||||
|
'<%= yeoman.dist %>/styles/main.css': [
|
||||||
|
'<%= yeoman.app %>/styles/{,*/}*.css'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
htmlmin: {
|
||||||
|
dist: {
|
||||||
|
files: [
|
||||||
|
{
|
||||||
|
expand: true,
|
||||||
|
cwd: '<%= yeoman.app %>',
|
||||||
|
src: ['*.html', 'modules/**/*.html'],
|
||||||
|
dest: '<%= yeoman.dist %>'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rev: {
|
||||||
|
dist: {
|
||||||
|
files: {
|
||||||
|
src: [
|
||||||
|
'<%= yeoman.dist %>/scripts/{,*/}*.js',
|
||||||
|
'<%= yeoman.dist %>/styles/{,*/}*.css',
|
||||||
|
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
|
||||||
|
'<%= yeoman.dist %>/styles/fonts/*'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
copy: {
|
||||||
|
dist: {
|
||||||
|
files: [
|
||||||
|
{
|
||||||
|
expand: true,
|
||||||
|
dot: true,
|
||||||
|
cwd: '<%= yeoman.app %>',
|
||||||
|
dest: '<%= yeoman.dist %>',
|
||||||
|
src: [
|
||||||
|
'*.{ico,txt}',
|
||||||
|
'components/**/*',
|
||||||
|
'images/{,*/}*.{gif,webp}',
|
||||||
|
'images/{,*/}*.{png,jpg,jpeg}',
|
||||||
|
'{,*/}*.html',
|
||||||
|
'styles/{,*/}*.css',
|
||||||
|
'modules/**/*.html'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.registerTask('server', [
|
||||||
|
'clean:server',
|
||||||
|
'less',
|
||||||
|
'configureProxies',
|
||||||
|
'connect:livereload',
|
||||||
|
'open',
|
||||||
|
'watch'
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask('build', [
|
||||||
|
'clean:dist',
|
||||||
|
'less',
|
||||||
|
'useminPrepare',
|
||||||
|
'cssmin',
|
||||||
|
'concat',
|
||||||
|
'copy',
|
||||||
|
'rev',
|
||||||
|
'usemin'
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask('default', ['build']);
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "webapp",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"angular": "1.3.0-rc.5",
|
||||||
|
"bootstrap": "3.1.1",
|
||||||
|
"angular-animate": "1.3.0-rc.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {}
|
||||||
|
}
|
||||||
3185
drools-framework-base-tools-parent/drools-framework-examples/drools-framework-loyalty-web/package-lock.json
generated
Normal file
3185
drools-framework-base-tools-parent/drools-framework-examples/drools-framework-loyalty-web/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"name": "webapp",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"connect-modrewrite": "0.3.10",
|
||||||
|
"grunt": "^1.0.3",
|
||||||
|
"grunt-connect-proxy": "^0.2.0",
|
||||||
|
"grunt-contrib-clean": "0.4.0",
|
||||||
|
"grunt-contrib-concat": "0.1.3",
|
||||||
|
"grunt-contrib-connect": "^1.0.2",
|
||||||
|
"grunt-contrib-copy": "0.5.0",
|
||||||
|
"grunt-contrib-cssmin": "0.7.0",
|
||||||
|
"grunt-contrib-less": "^2.0.0",
|
||||||
|
"grunt-contrib-watch": "^1.1.0",
|
||||||
|
"grunt-open": "^0.2.3",
|
||||||
|
"grunt-rev": "0.1.0",
|
||||||
|
"grunt-usemin": "0.1.10",
|
||||||
|
"matchdep": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8.0"
|
||||||
|
},
|
||||||
|
"ToBeAddedAgain": {
|
||||||
|
"grunt-contrib-imagemin": "0.1.2",
|
||||||
|
"grunt-contrib-jshint": "0.3.0",
|
||||||
|
"grunt-karma": "0.3.0",
|
||||||
|
"grunt-contrib-htmlmin": "0.1.1",
|
||||||
|
"grunt-bower-requirejs": "0.4.1",
|
||||||
|
"grunt-contrib-uglify": "0.2.0",
|
||||||
|
"grunt-google-cdn": "0.1.1",
|
||||||
|
"grunt-ngmin": "0.0.2"
|
||||||
|
},
|
||||||
|
"main": "Gruntfile.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "BSD-2-Clause"
|
||||||
|
}
|
||||||
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