commit
62ab02e925
50 changed files with 2066 additions and 581 deletions
159
configuration/kie-wb/settings.xml
Normal file → Executable file
159
configuration/kie-wb/settings.xml
Normal file → Executable file
|
|
@ -12,12 +12,6 @@
|
|||
<password>tomcat</password>
|
||||
</server>
|
||||
|
||||
<server>
|
||||
<id>nheron-release</id>
|
||||
<username>nheron</username>
|
||||
<password>blqndinejavacamille</password>
|
||||
</server>
|
||||
|
||||
<server>
|
||||
<id>chtijbug-release</id>
|
||||
<username>chtijbug-dev</username>
|
||||
|
|
@ -66,17 +60,6 @@
|
|||
<username>drools-user</username>
|
||||
<password>c9dk4Hjd</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>sonatype-nexus-snapshots</id>
|
||||
<username>yxEbjet+</username>
|
||||
<password>49W6WY9RpIcx2mR7lbNBdov2/t/a6Es5hwtct+5ngoXd</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>sonatype-nexus-staging</id>
|
||||
<username>yxEbjet+</username>
|
||||
<password>49W6WY9RpIcx2mR7lbNBdov2/t/a6Es5hwtct+5ngoXd</password>
|
||||
</server>
|
||||
|
||||
</servers>
|
||||
|
||||
|
||||
|
|
@ -115,6 +98,36 @@
|
|||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>pymma-release</id>
|
||||
<name>chtijbug repo release</name>
|
||||
<url>http://nexus.pymma-software.com/nexus/content/repositories/pymma-release/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>pymma-snapshot</id>
|
||||
<name>chtijbug repo release</name>
|
||||
<url>http://nexus.pymma-software.com/nexus/content/repositories/pymma-snapshot/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
|
||||
<repository>
|
||||
|
|
@ -325,123 +338,11 @@
|
|||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<properties>
|
||||
<gpg.executable>gpg</gpg.executable>
|
||||
<gpg.passphrase>blqndine</gpg.passphrase>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
|
||||
<profile>
|
||||
<id>pymma-developpeur</id>
|
||||
|
||||
|
||||
<repositories>
|
||||
|
||||
|
||||
<repository>
|
||||
<id>jboss-developer-repository-group</id>
|
||||
<name>JBoss.org Developer Repository Group</name>
|
||||
<url>https://repository.jboss.org/nexus/content/groups/developer/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jboss-public-repository-group</id>
|
||||
<name>JBoss Public Repository Group</name>
|
||||
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>never</updatePolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>never</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jskywayperspectives</id>
|
||||
<name>skywayperspectives</name>
|
||||
<url>http://downloads.skywayperspectives.org/maven-repo/</url>
|
||||
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>kie-staging-repository-group</id>
|
||||
<name>KIE Staging Repositories</name>
|
||||
<url>https://repository.jboss.org/nexus/content/groups/kie-group</url>
|
||||
<layout>default</layout>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>never</updatePolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
<updatePolicy>never</updatePolicy>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>jboss-public-repository-group</id>
|
||||
<name>JBoss Public Maven Repository Group</name>
|
||||
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
|
||||
<layout>default</layout>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>never</updatePolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>never</updatePolicy>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<properties>
|
||||
<gpg.executable>gpg</gpg.executable>
|
||||
<gpg.passphrase>blqndine</gpg.passphrase>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
|
||||
<profile>
|
||||
<id>oss-developpeur</id>
|
||||
|
||||
|
||||
<properties>
|
||||
<gpg.executable>gpg</gpg.executable>
|
||||
<gpg.passphrase>blqndine</gpg.passphrase>
|
||||
</properties>
|
||||
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-plus-releases</id>
|
||||
<name>sonatype-plus</name>
|
||||
<url>http://oss.sonatype.org/content/repositories/releases/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>interval:20</updatePolicy>
|
||||
</releases>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype-plus-snapshots</id>
|
||||
<name>sonatype-plus</name>
|
||||
<url>http://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>interval:20</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
<activeProfiles>
|
||||
|
||||
|
|
|
|||
|
|
@ -617,26 +617,4 @@
|
|||
<remote-destination host="localhost" port="25"/>
|
||||
</outbound-socket-binding>
|
||||
</socket-binding-group>
|
||||
<deployments>
|
||||
<deployment name="kie-wb.war" runtime-name="kie-wb.war">
|
||||
<fs-archive path="/Users/nheron/workspace-chtiJBUG/code-7.5/pymma-jbpm-platform/kie-wb/target/kie-wb.war"/>
|
||||
</deployment>
|
||||
<deployment name="kie-server.war" runtime-name="kie-server.war">
|
||||
<fs-archive
|
||||
path="/Users/nheron/workspace-chtiJBUG/code-7.5/pymma-jbpm-platform/drools-framework-kie-server-parent/drools-framework-kie-server-webapp/target/kie-server.war"/>
|
||||
</deployment>
|
||||
<deployment name="swimmingpool-web.war" runtime-name="swimmingpool-web.war">
|
||||
<fs-archive
|
||||
path="/Users/nheron/workspace-chtiJBUG/code-7.5/pymma-jbpm-platform/drools-framework-examples/drools-framework-swimmingpool-web-ui/target/swimmingpool-web.war"/>
|
||||
</deployment>
|
||||
<deployment name="kie#mariadb-1.3.4#" runtime-name="kie#mariadb-1.3.4#">
|
||||
<content sha1="7a491a4fcd6416ca29dd4f35d3625c4205f6ecbd"/>
|
||||
</deployment>
|
||||
<deployment name="kie#mysql-5.1.38#" runtime-name="kie#mysql-5.1.38#">
|
||||
<content sha1="dbbd7cd309ce167ec8367de4e41c63c2c8593cc5"/>
|
||||
</deployment>
|
||||
<deployment name="kie#postgresql-9.4.1207#" runtime-name="kie#postgresql-9.4.1207#">
|
||||
<content sha1="f2ea471fbe4446057991e284a6b4b3263731f319"/>
|
||||
</deployment>
|
||||
</deployments>
|
||||
</server>
|
||||
|
|
@ -212,6 +212,12 @@
|
|||
<artifactId>commons-io</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<artifactId>drools-framewwork-business-proxy-persistence</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package org.chtijbug.drools.console;
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
|
||||
public interface AddLog {
|
||||
public void addRow(String textToAdd);
|
||||
public void addRow(String textToAdd, UI ui);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,15 +6,14 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.context.annotation.*;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
|
||||
//@ComponentScan({"com.assurfleet.front.courtier.petiteflotte.maj","com.assurfleet.jms.services"})
|
||||
@ComponentScan("org.chtijbug.drools.proxy.persistence")
|
||||
@EnableMongoRepositories("org.chtijbug.drools.proxy.persistence.repository")
|
||||
@PropertySource("classpath:application.properties")
|
||||
@ImportResource("classpath:applicationContext.xml")
|
||||
public class DroolsSpringBootConsoleApplication extends SpringBootServletInitializer {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.vaadin.flow.component.UI;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.chtijbug.drools.console.AddLog;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
|
|
@ -124,7 +125,7 @@ public class KieRepositoryService {
|
|||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public JobStatus buildProject(String url, String username, String password, String space, String project, String command, AddLog workOnGoingView) {
|
||||
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;
|
||||
logger.info("url Maven install : " + completeurl);
|
||||
ResponseEntity<JobStatus> response = restTemplateKiewb
|
||||
|
|
@ -142,7 +143,7 @@ public class KieRepositoryService {
|
|||
JobStatus reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
workOnGoingView.addRow(reponseMoteur.toString());
|
||||
workOnGoingView.addRow(reponseMoteur.toString(),ui);
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
|
|
@ -186,29 +187,4 @@ public class KieRepositoryService {
|
|||
HttpHeaders.AUTHORIZATION, authHeader);
|
||||
};
|
||||
}
|
||||
|
||||
public String waitForJobToBeEnded(String url, String username, String password, String jobID, AddLog workOnGoingView) {
|
||||
String isJobDone = "NO";
|
||||
while ("NO".equals(isJobDone)) {
|
||||
JobStatus jobStatus = this.getStatusJobID(url,
|
||||
username,
|
||||
password, jobID);
|
||||
if ("DUPLICATE_RESOURCE".equals(jobStatus.getStatus())
|
||||
|| "SUCCESS".equals(jobStatus.getStatus())) {
|
||||
isJobDone = "YES";
|
||||
workOnGoingView.addRow("JobID=" + jobID + " finished");
|
||||
} else if ("ACCEPTED".equals(jobStatus.getStatus())
|
||||
|| ("APPROVED".equals(jobStatus.getStatus()))) {
|
||||
try {
|
||||
workOnGoingView.addRow("JobID=" + jobID + " not yet finished");
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
return isJobDone;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,20 +2,23 @@ package org.chtijbug.drools.console.service;
|
|||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import com.vaadin.flow.component.UI;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.chtijbug.drools.console.AddLog;
|
||||
import org.chtijbug.drools.console.service.model.ReturnPerso;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieContainerInfo;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieServerJobStatus;
|
||||
import org.chtijbug.drools.console.service.model.kie.SpaceProject;
|
||||
import org.kie.server.api.model.KieContainerResource;
|
||||
import org.kie.server.api.model.KieServerInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RequestCallback;
|
||||
import org.springframework.web.client.ResourceAccessException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
|
@ -59,7 +62,6 @@ public class KieServerRepositoryService {
|
|||
System.out.println(reponseMoteur);
|
||||
}
|
||||
|
||||
|
||||
public List<KieContainerInfo> getContainerList(String url, String username, String password) {
|
||||
List<KieContainerInfo> results = new ArrayList<>();
|
||||
String completeurl = url ;
|
||||
|
|
@ -106,9 +108,9 @@ public class KieServerRepositoryService {
|
|||
return results;
|
||||
}
|
||||
|
||||
public KieServerJobStatus stopContainer(String url, String username, String password, String containerId, AddLog workOnGoingView) {
|
||||
public KieServerJobStatus stopContainer(String url, String username, String password, String containerId, AddLog workOnGoingView, UI ui) {
|
||||
KieServerJobStatus results = null;
|
||||
String completeurl = url + containerId;
|
||||
String completeurl = url +"/"+ containerId;
|
||||
logger.info("url kie server container : " + completeurl);
|
||||
ResponseEntity<KieServerJobStatus> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.DELETE, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
|
|
@ -124,11 +126,11 @@ public class KieServerRepositoryService {
|
|||
});
|
||||
KieServerJobStatus reponseMoteur;
|
||||
reponseMoteur = response.getBody();
|
||||
workOnGoingView.addRow(reponseMoteur.toString());
|
||||
workOnGoingView.addRow(reponseMoteur.toString(),ui);
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public KieContainerInfo createContainer(String url, String username, String password, String containerId, KieContainerResource request, AddLog workOnGoingView) {
|
||||
public KieContainerInfo createContainer(String url, String username, String password, String containerId, KieContainerResource request, AddLog workOnGoingView,UI ui) {
|
||||
String completeurl = url + "/"+containerId;
|
||||
logger.info("url kie server container : " + completeurl);
|
||||
ResponseEntity<Map<String, Object>> response = restTemplateKiewb
|
||||
|
|
@ -150,7 +152,7 @@ public class KieServerRepositoryService {
|
|||
Map<String, Object> reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
workOnGoingView.addRow(reponseMoteur.toString());
|
||||
workOnGoingView.addRow(reponseMoteur.toString(),ui);
|
||||
KieContainerInfo result = new KieContainerInfo();
|
||||
if (reponseMoteur.get("result") != null) {
|
||||
String containerID = (String) ((Map) ((Map) reponseMoteur.get("result")).get("kie-container")).get("container-id");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,210 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
import com.vaadin.flow.server.VaadinSession;
|
||||
import org.apache.tomcat.util.threads.TaskThread;
|
||||
import org.chtijbug.drools.console.AddLog;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.JobStatus;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieContainerInfo;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieServerJobStatus;
|
||||
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 org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||
import org.guvnor.rest.client.ProjectResponse;
|
||||
import org.kie.server.api.model.KieContainerResource;
|
||||
import org.kie.server.api.model.ReleaseId;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class ProjectPersistService {
|
||||
|
||||
public static String PROJECT = "4";
|
||||
|
||||
@Autowired
|
||||
private ProjectRepository projectRepository;
|
||||
|
||||
@Autowired
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
private KieConfigurationData config;
|
||||
|
||||
@Autowired
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
@Autowired
|
||||
private KieServerRepositoryService kieServerRepositoryService;
|
||||
|
||||
private String isJobDone = "NO";
|
||||
|
||||
|
||||
public ProjectPersistService(){
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void saveIfnotExist(List<PlatformProjectResponse> platformProjectResponses){
|
||||
|
||||
for(PlatformProjectResponse platformProjectResponse:platformProjectResponses) {
|
||||
|
||||
ProjectPersist projectPersist = projectRepository.findByProjectName(platformProjectResponse.getSpaceName() + "-" + platformProjectResponse.getName());
|
||||
|
||||
if (projectPersist == null) {
|
||||
projectPersist = platformProjectResponseToProjectPersist(platformProjectResponse);
|
||||
|
||||
projectRepository.save(projectPersist);
|
||||
addProjectToSession(projectPersist);
|
||||
|
||||
}else {
|
||||
addProjectToSession(projectPersist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Set<ProjectPersist> getProjectsSession() {
|
||||
return (Set<ProjectPersist>) VaadinSession.getCurrent().getAttribute(PROJECT);
|
||||
}
|
||||
|
||||
public void addProjectToSession(ProjectPersist projectPersist) {
|
||||
|
||||
Set<ProjectPersist> projectPersists=getProjectsSession();
|
||||
|
||||
if(projectPersists==null){
|
||||
projectPersists=new HashSet<>();
|
||||
}
|
||||
projectPersists.add(projectPersist);
|
||||
|
||||
VaadinSession.getCurrent().setAttribute(PROJECT, projectPersists);
|
||||
}
|
||||
public boolean associate(ProjectPersist projectPersist, RuntimePersist runtimePersist){
|
||||
|
||||
List<ProjectPersist> projectPersists=projectRepository.findByServerNameAndDeploymentName(runtimePersist.getServerName(),projectPersist.getDeploymentName());
|
||||
|
||||
if(projectPersists.size()!=0){
|
||||
return false;
|
||||
}else {
|
||||
|
||||
projectPersist.setServerName(runtimePersist.getServerName());
|
||||
projectPersist.setStatus(ProjectPersist.Deployable);
|
||||
projectPersist.setContainerID(projectPersist.getDeploymentName()+"-"+projectPersist.getProjectName());
|
||||
projectRepository.save(projectPersist);
|
||||
addProjectToSession(projectPersist);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean deployer(ProjectPersist projectPersist, AddLog addLog, UI ui){
|
||||
|
||||
|
||||
waitForJobToBeEnded(config.getKiewbUrl(), userConnectedService.getUserConnected().getUserName(),
|
||||
userConnectedService.getUserConnected().getUserPassword(), projectPersist, addLog,ui);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public ProjectPersist platformProjectResponseToProjectPersist(PlatformProjectResponse platformProjectResponse){
|
||||
ProjectPersist projectPersist=new ProjectPersist();
|
||||
projectPersist.setArtifactID(platformProjectResponse.getArtifactId());
|
||||
projectPersist.setGroupID(platformProjectResponse.getGroupId());
|
||||
projectPersist.setProjectName(platformProjectResponse.getSpaceName()+"-"+platformProjectResponse.getName());
|
||||
projectPersist.setProjectVersion(platformProjectResponse.getVersion());
|
||||
projectPersist.setStatus(ProjectPersist.ADEFINIR);
|
||||
projectPersist.setClassNameList(platformProjectResponse.getJavaClasses());
|
||||
projectPersist.setSpaceName(platformProjectResponse.getSpaceName());
|
||||
projectPersist.setOldName(platformProjectResponse.getName());
|
||||
return projectPersist;
|
||||
}
|
||||
|
||||
public String waitForJobToBeEnded(String url, String username, String password,ProjectPersist projectPersist, AddLog workOnGoingView, UI ui) {
|
||||
|
||||
UserConnected userConnected=userConnectedService.getUserConnected();
|
||||
|
||||
Thread thread=new Thread(){
|
||||
public void run() {
|
||||
|
||||
JobStatus result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), projectPersist.getSpaceName(), projectPersist.getOldName(), "compile", workOnGoingView,ui);
|
||||
|
||||
executeWrite(url,username,password,workOnGoingView,result.getJobId(),ui);
|
||||
|
||||
result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), projectPersist.getSpaceName(), projectPersist.getOldName(), "install", workOnGoingView,ui);
|
||||
|
||||
executeWrite(url,username,password,workOnGoingView,result.getJobId(),ui);
|
||||
|
||||
if (projectPersist.getContainerID() != null) {
|
||||
KieServerJobStatus jobresult = kieServerRepositoryService.stopContainer(config.getKieserverUrl(), config.getKieserverUserName(), config.getKieserverPassword(), projectPersist.getContainerID(), workOnGoingView,ui);
|
||||
if (jobresult != null
|
||||
&& "SUCCESS".equals(jobresult.getType())) {
|
||||
}
|
||||
}
|
||||
KieContainerResource newContainer = new KieContainerResource();
|
||||
newContainer.setContainerId(projectPersist.getContainerID());
|
||||
newContainer.setReleaseId(new ReleaseId());
|
||||
newContainer.getReleaseId().setArtifactId(projectPersist.getArtifactID());
|
||||
newContainer.getReleaseId().setGroupId(projectPersist.getGroupID());
|
||||
newContainer.getReleaseId().setVersion(projectPersist.getProjectVersion());
|
||||
KieContainerInfo createdContainer = kieServerRepositoryService.createContainer(config.getKieserverUrl(), config.getKieserverUserName(), config.getKieserverPassword(), projectPersist.getArtifactID(), newContainer, workOnGoingView,ui);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
|
||||
|
||||
return isJobDone;
|
||||
}
|
||||
private void executeWrite(String url, String username, String password,AddLog workOnGoingView,String jobID,UI ui){
|
||||
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 static String getPROJECT() {
|
||||
return PROJECT;
|
||||
}
|
||||
|
||||
public static void setPROJECT(String PROJECT) {
|
||||
ProjectPersistService.PROJECT = PROJECT;
|
||||
}
|
||||
|
||||
public ProjectRepository getProjectRepository() {
|
||||
return projectRepository;
|
||||
}
|
||||
|
||||
public void setProjectRepository(ProjectRepository projectRepository) {
|
||||
this.projectRepository = projectRepository;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package org.chtijbug.drools.console.service;
|
||||
|
||||
import org.chtijbug.drools.console.service.model.ReturnPerso;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.RuntimeRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.kie.server.api.model.KieServerInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Service
|
||||
public class RuntimeService {
|
||||
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(KieServerRepositoryService.class);
|
||||
|
||||
@Autowired
|
||||
private RuntimeRepository runtimeRepository;
|
||||
|
||||
private RestTemplate restTemplateKiewb = new RestTemplate();
|
||||
|
||||
public ReturnPerso verifyIfKieServerExist(String url) {
|
||||
String completeurl = url + "/api/server/details";
|
||||
logger.info("url project content : " + completeurl);
|
||||
|
||||
HttpHeaders httpHeaders=new HttpHeaders();
|
||||
|
||||
HttpEntity httpEntity=new HttpEntity(httpHeaders);
|
||||
|
||||
try {
|
||||
ResponseEntity<KieServerInfo> response = restTemplateKiewb.exchange(completeurl,
|
||||
HttpMethod.GET,
|
||||
httpEntity,
|
||||
new ParameterizedTypeReference<KieServerInfo>() {
|
||||
});
|
||||
|
||||
if (response.getBody() != null ) {
|
||||
return new ReturnPerso(true,"the runtime has been successfully added",response.getBody());
|
||||
} else {
|
||||
return new ReturnPerso(false,"server error ",null);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return new ReturnPerso(false,"The hostname is incorrect",null);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveRuntime(RuntimePersist runtimePersist) {
|
||||
runtimeRepository.save(runtimePersist);
|
||||
}
|
||||
|
||||
public RuntimeRepository getRuntimeRepository() {
|
||||
return runtimeRepository;
|
||||
}
|
||||
|
||||
public void setRuntimeRepository(RuntimeRepository runtimeRepository) {
|
||||
this.runtimeRepository = runtimeRepository;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ public class UserConnectedService {
|
|||
return (UserConnected) VaadinSession.getCurrent().getAttribute(USER);
|
||||
}
|
||||
|
||||
public void addToSession(UserConnected userConnected) {
|
||||
public void addUserToSession(UserConnected userConnected) {
|
||||
VaadinSession.getCurrent().setAttribute(USER, userConnected);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package org.chtijbug.drools.console.service.model;
|
||||
|
||||
public class ReturnPerso<T> {
|
||||
|
||||
private Boolean aBoolean;
|
||||
|
||||
private String error;
|
||||
|
||||
private T body;
|
||||
|
||||
public ReturnPerso(Boolean aBoolean, String error,T body) {
|
||||
this.aBoolean = aBoolean;
|
||||
this.error = error;
|
||||
this.body=body;
|
||||
}
|
||||
|
||||
public Boolean getaBoolean() {
|
||||
return aBoolean;
|
||||
}
|
||||
|
||||
public void setaBoolean(Boolean aBoolean) {
|
||||
this.aBoolean = aBoolean;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public T getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(T body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,19 @@
|
|||
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.orderedlayout.HorizontalLayout;
|
||||
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.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadinComponent.componentView.ConsoleDeploy;
|
||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.LeftMenuGlobal;
|
||||
import org.chtijbug.drools.console.vaadinComponent.menu.MenuPrincipal;
|
||||
import org.chtijbug.drools.console.vaadinComponent.menu.MenuScondaireDeployement;
|
||||
import org.chtijbug.drools.console.vaadinComponent.menu.MenuSecondaireAssets;
|
||||
import org.chtijbug.drools.console.vaadinComponent.menu.MenuSecondaireInfoUser;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class SqueletteComposant extends VerticalLayout {
|
||||
|
|
@ -26,40 +32,71 @@ public class SqueletteComposant extends VerticalLayout {
|
|||
|
||||
private VerticalLayout infoPage;
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
private ConsoleDeploy consoleDeploy;
|
||||
|
||||
public SqueletteComposant(){
|
||||
|
||||
userConnectedService= AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
|
||||
if(userConnectedService.getUserConnected()!=null) {
|
||||
|
||||
setClassName("squelette-composant-contentAll");
|
||||
|
||||
menuPrincipal=new MenuPrincipal(this);
|
||||
menuPrincipal = new MenuPrincipal(this);
|
||||
add(menuPrincipal);
|
||||
|
||||
|
||||
|
||||
|
||||
HorizontalLayout horizontalLayout=new HorizontalLayout();
|
||||
HorizontalLayout horizontalLayout = new HorizontalLayout();
|
||||
horizontalLayout.setClassName("squelette-component-horizontal");
|
||||
add(horizontalLayout);
|
||||
|
||||
content=new VerticalLayout();
|
||||
content = new VerticalLayout();
|
||||
content.setClassName("squelette-component-content");
|
||||
|
||||
menuScondaireDeployement=new MenuScondaireDeployement();
|
||||
content.add(menuScondaireDeployement);
|
||||
VerticalLayout tmp=new VerticalLayout();
|
||||
tmp.setClassName("squelette-menu-secondaire");
|
||||
content.add(tmp);
|
||||
|
||||
menuSecondaireInfoUser=new MenuSecondaireInfoUser();
|
||||
content.add(menuSecondaireInfoUser);
|
||||
menuScondaireDeployement = new MenuScondaireDeployement(this);
|
||||
tmp.add(menuScondaireDeployement);
|
||||
|
||||
menuSecondaireAssets=new MenuSecondaireAssets();
|
||||
content.add(menuSecondaireAssets);
|
||||
menuSecondaireInfoUser = new MenuSecondaireInfoUser();
|
||||
tmp.add(menuSecondaireInfoUser);
|
||||
|
||||
infoPage=new VerticalLayout();
|
||||
menuSecondaireAssets = new MenuSecondaireAssets(this);
|
||||
tmp.add(menuSecondaireAssets);
|
||||
|
||||
infoPage = new VerticalLayout();
|
||||
infoPage.setClassName("squelette-component-infoPage");
|
||||
content.add(infoPage);
|
||||
|
||||
leftMenuGlobal=new LeftMenuGlobal();
|
||||
|
||||
consoleDeploy=new ConsoleDeploy();
|
||||
|
||||
|
||||
content.add(consoleDeploy);
|
||||
|
||||
leftMenuGlobal = new LeftMenuGlobal();
|
||||
horizontalLayout.add(leftMenuGlobal);
|
||||
|
||||
horizontalLayout.add(content);
|
||||
}
|
||||
}
|
||||
|
||||
public void navigate(VerticalLayout verticalLayout,String pageName,VerticalLayout contentAction){
|
||||
leftMenuGlobal.getInformationStructure().getNomPage().setText(pageName);
|
||||
|
||||
leftMenuGlobal.getContentAction().removeAll();
|
||||
leftMenuGlobal.getContentAction().add(contentAction);
|
||||
|
||||
infoPage.removeAll();
|
||||
infoPage.add(verticalLayout);
|
||||
|
||||
if(pageName.equals(DeploymentView.pageName)){
|
||||
consoleDeploy.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
public MenuPrincipal getMenuPrincipal() {
|
||||
return menuPrincipal;
|
||||
|
|
@ -116,4 +153,20 @@ public class SqueletteComposant extends VerticalLayout {
|
|||
public void setInfoPage(VerticalLayout infoPage) {
|
||||
this.infoPage = infoPage;
|
||||
}
|
||||
|
||||
public UserConnectedService getUserConnectedService() {
|
||||
return userConnectedService;
|
||||
}
|
||||
|
||||
public void setUserConnectedService(UserConnectedService userConnectedService) {
|
||||
this.userConnectedService = userConnectedService;
|
||||
}
|
||||
|
||||
public ConsoleDeploy getConsoleDeploy() {
|
||||
return consoleDeploy;
|
||||
}
|
||||
|
||||
public void setConsoleDeploy(ConsoleDeploy consoleDeploy) {
|
||||
this.consoleDeploy = consoleDeploy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,22 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.dialog.Dialog;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
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.RuntimeService;
|
||||
import org.chtijbug.drools.console.service.model.ReturnPerso;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.TextFieldPerso;
|
||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.kie.server.api.model.KieServerInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class AddRuntime extends VerticalLayout {
|
||||
|
|
@ -16,13 +25,15 @@ public class AddRuntime extends VerticalLayout {
|
|||
|
||||
private TextFieldPerso port;
|
||||
|
||||
private TextFieldPerso runtimeName;
|
||||
|
||||
private Button testConnexion;
|
||||
|
||||
private Label label;
|
||||
|
||||
public AddRuntime(Dialog dialog){
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
public AddRuntime(Dialog dialog, SqueletteComposant squeletteComposant){
|
||||
|
||||
runtimeService = AppContext.getApplicationContext().getBean(RuntimeService.class);
|
||||
|
||||
setClassName("creation-runtime-content");
|
||||
|
||||
|
|
@ -30,15 +41,7 @@ public class AddRuntime extends VerticalLayout {
|
|||
label.setClassName("creation-runtime-title");
|
||||
add(label);
|
||||
|
||||
runtimeName=new TextFieldPerso("Runtime name","", VaadinIcon.USER.create());
|
||||
runtimeName.getTextField().setRequired(true);
|
||||
runtimeName.getTextField().setValueChangeMode(ValueChangeMode.EAGER);
|
||||
runtimeName.getTextField().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
||||
verify();
|
||||
});
|
||||
add(runtimeName);
|
||||
|
||||
host=new TextFieldPerso("Host","111.111.1.111",VaadinIcon.HARDDRIVE.create());
|
||||
host=new TextFieldPerso("Host","http://111.111.1.111",VaadinIcon.HARDDRIVE.create());
|
||||
host.getTextField().setRequired(true);
|
||||
host.getTextField().setValueChangeMode(ValueChangeMode.EAGER);
|
||||
host.getTextField().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
||||
|
|
@ -62,13 +65,31 @@ public class AddRuntime extends VerticalLayout {
|
|||
testConnexion.setClassName("login-application-connexion");
|
||||
add(testConnexion);
|
||||
testConnexion.addClickListener(buttonClickEvent -> {
|
||||
|
||||
ReturnPerso<KieServerInfo> returnPerso= runtimeService.verifyIfKieServerExist(
|
||||
host.getTextField().getValue()+":"+port.getTextField().getValue()
|
||||
);
|
||||
|
||||
if(returnPerso.getaBoolean()){
|
||||
Notification.show(returnPerso.getError());
|
||||
runtimeService.saveRuntime(new RuntimePersist(
|
||||
returnPerso.getBody().getName(),
|
||||
returnPerso.getBody().getVersion(),host.getTextField().getValue()+":"+port.getTextField().getValue()
|
||||
));
|
||||
|
||||
List<RuntimePersist> runtimePersists=runtimeService.getRuntimeRepository().findAll();
|
||||
squeletteComposant.getLeftMenuGlobal().getInformationStructure().actualiseKieServer(runtimePersists!=null?runtimePersists.size():0);
|
||||
dialog.close();
|
||||
}else {
|
||||
Notification.show(returnPerso.getError());
|
||||
testConnexion.setClassName("login-application-connexion-error");
|
||||
testConnexion.setIcon(VaadinIcon.ROTATE_LEFT.create());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void verify(){
|
||||
if(runtimeName.getTextField().isInvalid()||runtimeName.getTextField().getValue().isEmpty()||runtimeName.getTextField().getValue()==null&&
|
||||
port.getTextField().isInvalid()||port.getTextField().getValue().isEmpty()||port.getTextField().getValue()==null&&
|
||||
if(port.getTextField().isInvalid()||port.getTextField().getValue().isEmpty()||port.getTextField().getValue()==null&&
|
||||
host.getTextField().isInvalid()||host.getTextField().getValue().isEmpty()||host.getTextField().getValue()==null){
|
||||
testConnexion.setEnabled(false);
|
||||
}else {
|
||||
|
|
@ -93,14 +114,6 @@ public class AddRuntime extends VerticalLayout {
|
|||
this.port = port;
|
||||
}
|
||||
|
||||
public TextFieldPerso getRuntimeName() {
|
||||
return runtimeName;
|
||||
}
|
||||
|
||||
public void setRuntimeName(TextFieldPerso runtimeName) {
|
||||
this.runtimeName = runtimeName;
|
||||
}
|
||||
|
||||
public Button getTestConnexion() {
|
||||
return testConnexion;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.vaadin.flow.component.UI;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.datepicker.DatePicker;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
|
|
@ -9,12 +10,15 @@ 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.router.BeforeEnterEvent;
|
||||
import com.vaadin.flow.router.BeforeEnterObserver;
|
||||
import com.vaadin.flow.router.Route;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.util.VerifyConnectedInterface;
|
||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
||||
import org.drools.workbench.models.guided.template.backend.RuleTemplateModelXMLPersistenceImpl;
|
||||
|
|
@ -29,9 +33,8 @@ import java.time.LocalDate;
|
|||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
|
||||
@Route("AssetDetail")
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class AssetEditView extends SqueletteComposant {
|
||||
public class AssetEdit extends VerticalLayout {
|
||||
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
private KieConfigurationData config;
|
||||
|
|
@ -47,7 +50,9 @@ public class AssetEditView extends SqueletteComposant {
|
|||
private String spaceName;
|
||||
private String projectName;
|
||||
|
||||
public AssetEditView() {
|
||||
public AssetEdit() {
|
||||
|
||||
setClassName("assetEdit-content");
|
||||
|
||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
|
|
@ -60,10 +65,8 @@ public class AssetEditView extends SqueletteComposant {
|
|||
String assetContent = kieRepositoryService.getAssetSource(config.getKiewbUrl(), userConnected.getUserName(), userConnected.getUserPassword(), spaceName, projectName, assetToUpdate);
|
||||
TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(assetContent);
|
||||
|
||||
|
||||
VerticalLayout verticalLayout = new VerticalLayout();
|
||||
HorizontalLayout actionButtons = new HorizontalLayout();
|
||||
verticalLayout.add(actionButtons);
|
||||
add(actionButtons);
|
||||
startUpdate = new Button("Update");
|
||||
actionButtons.add(startUpdate);
|
||||
|
||||
|
|
@ -97,7 +100,7 @@ public class AssetEditView extends SqueletteComposant {
|
|||
actionButtons.add(undoUpdate);
|
||||
InterpolationVariable[] variablesList = model.getInterpolationVariablesList();
|
||||
gridAssetTable = new Grid<>();
|
||||
verticalLayout.add(gridAssetTable);
|
||||
add(gridAssetTable);
|
||||
gridAssetTable.setClassName("grid-perso");
|
||||
gridAssetTable.setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||
Binder<Map<String, Object>> binder = new Binder<>();
|
||||
|
|
@ -127,10 +130,7 @@ public class AssetEditView extends SqueletteComposant {
|
|||
binder.setBean(giveInitRow(model));
|
||||
fillTable(model);
|
||||
gridAssetTable.setSizeFull();
|
||||
getInfoPage().add(verticalLayout);
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
private Date toDate(String dateString) {
|
||||
|
|
@ -233,6 +233,4 @@ public class AssetEditView extends SqueletteComposant {
|
|||
gridAssetTable.setItems(rows);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.dialog.Dialog;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.notification.Notification;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AssociateProjectKie extends VerticalLayout {
|
||||
|
||||
private Label label;
|
||||
|
||||
private Label label2;
|
||||
|
||||
private GridRuntime gridRuntime;
|
||||
|
||||
private Button associer;
|
||||
|
||||
private ProjectPersistService projectPersistService;
|
||||
|
||||
public AssociateProjectKie(DeploymentView deploymentView,Dialog dialog, ProjectPersist projectPersist){
|
||||
|
||||
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);
|
||||
|
||||
gridRuntime=new GridRuntime();
|
||||
add(gridRuntime);
|
||||
|
||||
associer=new Button("Associer");
|
||||
associer.setEnabled(false);
|
||||
associer.setClassName("login-application-connexion");
|
||||
add(associer);
|
||||
associer.addClickListener(buttonClickEvent -> {
|
||||
|
||||
RuntimePersist runtimePersist=gridRuntime.getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(runtimePersist!=null) {
|
||||
|
||||
boolean tmp = projectPersistService.associate(projectPersist,runtimePersist);
|
||||
|
||||
if(tmp==true){
|
||||
deploymentView.setDataProvider();
|
||||
dialog.close();
|
||||
}else {
|
||||
associer.setEnabled(false);
|
||||
Notification.show("There is already a project of this name on this runtime");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gridRuntime.addSelectionListener(selectionEvent -> {
|
||||
if(selectionEvent.getFirstSelectedItem()!=null&&selectionEvent.getFirstSelectedItem().isPresent()) {
|
||||
|
||||
associer.setEnabled(true);
|
||||
}else {
|
||||
associer.setEnabled(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
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 VerticalLayout outilsBar;
|
||||
|
||||
public VerticalLayout content;
|
||||
|
||||
public HorizontalLayout titleContent;
|
||||
|
||||
public VerticalLayout logContent;
|
||||
|
||||
public Button menu;
|
||||
|
||||
public Button clear;
|
||||
|
||||
private Label title;
|
||||
|
||||
public ConsoleDeploy(){
|
||||
|
||||
setClassName("console-content-all");
|
||||
setVisible(false);
|
||||
|
||||
outilsBar=new VerticalLayout();
|
||||
outilsBar.setClassName("console-outilsBar-content");
|
||||
add(outilsBar);
|
||||
|
||||
menu=new Button("",VaadinIcon.MENU.create());
|
||||
menu.setClassName("console-button");
|
||||
menu.addClickListener(buttonClickEvent -> {
|
||||
if(isActive()){
|
||||
removeActive();
|
||||
content.setVisible(false);
|
||||
}else {
|
||||
active();
|
||||
content.setVisible(true);
|
||||
}
|
||||
});
|
||||
outilsBar.add(menu);
|
||||
|
||||
clear=new Button("", VaadinIcon.PANEL.create());
|
||||
clear.setClassName("console-button");
|
||||
clear.addClickListener(buttonClickEvent -> {
|
||||
logContent.removeAll();
|
||||
});
|
||||
outilsBar.add(clear);
|
||||
|
||||
content=new VerticalLayout();
|
||||
content.setClassName("console-content");
|
||||
add(content);
|
||||
content.setVisible(false);
|
||||
|
||||
|
||||
titleContent=new HorizontalLayout();
|
||||
titleContent.setClassName("console-content-title");
|
||||
content.add(titleContent);
|
||||
|
||||
title=new Label("Console : ");
|
||||
title.setClassName("console-title");
|
||||
titleContent.add(title);
|
||||
|
||||
logContent=new VerticalLayout();
|
||||
logContent.setClassName("console-log-content");
|
||||
content.add(logContent);
|
||||
}
|
||||
private boolean isActive(){
|
||||
return getClassNames().contains("active");
|
||||
}
|
||||
|
||||
private void removeActive() {
|
||||
|
||||
if(getClassNames().contains("active")){
|
||||
getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(){
|
||||
removeActive();
|
||||
|
||||
getClassNames().add("active");
|
||||
}
|
||||
|
||||
public void setTtile(String nameProject){
|
||||
title.setText("Console : "+nameProject);
|
||||
}
|
||||
|
||||
public VerticalLayout getLogContent() {
|
||||
return logContent;
|
||||
}
|
||||
|
||||
public void setLogContent(VerticalLayout logContent) {
|
||||
this.logContent = logContent;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
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.binder.Binder;
|
||||
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;
|
||||
|
||||
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("Name Deployment","",VaadinIcon.FILE_TEXT.create());
|
||||
nameDeploy.getTextField().setRequired(true);
|
||||
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);
|
||||
mainClass.getComboBox().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
||||
verify();
|
||||
projectPersist.setMainClass(mainClass.getComboBox().getValue().toString());
|
||||
});
|
||||
|
||||
add(mainClass);
|
||||
|
||||
processID=new TextFieldPerso("Process ID","",VaadinIcon.TASKS.create());
|
||||
processID.getTextField().setRequired(true);
|
||||
processID.getTextField().setValueChangeMode(ValueChangeMode.EAGER);
|
||||
processID.getTextField().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
||||
verify();
|
||||
projectPersist.setProcessID(processID.getTextField().getValue());
|
||||
});
|
||||
|
||||
add(processID);
|
||||
|
||||
valider=new Button("Valider");
|
||||
valider.setEnabled(false);
|
||||
valider.setClassName("login-application-connexion");
|
||||
valider.addClickListener(buttonClickEvent -> {
|
||||
projectPersist.setStatus(ProjectPersist.DEFINI);
|
||||
projectPersistService.addProjectToSession(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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
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.List;
|
||||
|
||||
public class GridRuntime extends Grid<RuntimePersist> {
|
||||
|
||||
private TextField runtimeName;
|
||||
|
||||
private TextField hostName;
|
||||
|
||||
private TextField version;
|
||||
|
||||
|
||||
private String strRuntimeName="Runtime Name";
|
||||
|
||||
private String strHostName="Hostname";
|
||||
|
||||
private String strVersion="Version";
|
||||
|
||||
|
||||
private ProjectPersistService projectPersistService;
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
private ListDataProvider<RuntimePersist> dataProvider;
|
||||
private ConfigurableFilterDataProvider<RuntimePersist,Void,SerializablePredicate<RuntimePersist>> filterDataProvider;
|
||||
|
||||
|
||||
public GridRuntime(){
|
||||
|
||||
projectPersistService = AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
runtimeService= AppContext.getApplicationContext().getBean(RuntimeService.class);
|
||||
|
||||
setClassName("deployment-grid-perso");
|
||||
setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||
|
||||
List<ProjectPersist> projectPersists=projectPersistService.getProjectRepository().findByServerName(runtimePersist.getServerName());
|
||||
|
||||
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("");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
||||
|
||||
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.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadinComponent.componentView.AssociateProjectKie;
|
||||
import org.chtijbug.drools.console.vaadinComponent.componentView.DefineProject;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
|
||||
public class DeploymentAction extends VerticalLayout {
|
||||
|
||||
|
||||
private Button definirProject;
|
||||
|
||||
private Button associateKieServer;
|
||||
|
||||
private Button deployer;
|
||||
|
||||
private ProjectPersistService projectPersistService;
|
||||
|
||||
|
||||
public DeploymentAction(SqueletteComposant squeletteComposant,DeploymentView deploymentView){
|
||||
setClassName("leftMenu-global-action");
|
||||
|
||||
projectPersistService= AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
|
||||
definirProject =new Button("Défine your project", VaadinIcon.CODE.create());
|
||||
definirProject.setClassName("leftMenu-global-button");
|
||||
definirProject.setEnabled(false);
|
||||
add(definirProject);
|
||||
definirProject.addClickListener(buttonClickEvent -> {
|
||||
active(definirProject);
|
||||
|
||||
ProjectPersist projectPersist=deploymentView.getProjectPersistGrid().getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(projectPersist!=null) {
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.add(new DefineProject(deploymentView,dialog,projectPersist));
|
||||
dialog.open();
|
||||
}
|
||||
});
|
||||
|
||||
associateKieServer =new Button("Associate project/Kie Server", VaadinIcon.RETWEET.create());
|
||||
associateKieServer.setClassName("leftMenu-global-button");
|
||||
associateKieServer.setEnabled(false);
|
||||
add(associateKieServer);
|
||||
associateKieServer.addClickListener(buttonClickEvent -> {
|
||||
active(associateKieServer);
|
||||
|
||||
ProjectPersist projectPersist=deploymentView.getProjectPersistGrid().getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(projectPersist!=null) {
|
||||
Dialog dialog = new Dialog();
|
||||
dialog.add(new AssociateProjectKie(deploymentView,dialog,projectPersist));
|
||||
dialog.open();
|
||||
}
|
||||
});
|
||||
|
||||
deployer =new Button("Déployer", VaadinIcon.EXTERNAL_LINK.create());
|
||||
deployer.setClassName("leftMenu-global-button");
|
||||
deployer.setEnabled(false);
|
||||
add(deployer);
|
||||
deployer.addClickListener(buttonClickEvent -> {
|
||||
active(deployer);
|
||||
|
||||
ProjectPersist projectPersist=deploymentView.getProjectPersistGrid().getSelectedItems().stream().findFirst().get();
|
||||
if(projectPersist!=null) {
|
||||
squeletteComposant.getConsoleDeploy().setTtile(projectPersist.getDeploymentName());
|
||||
projectPersistService.deployer(projectPersist,deploymentView,getUI().get());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(definirProject);
|
||||
removeActive(associateKieServer);
|
||||
removeActive(deployer);
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
|
||||
public Button getDefinirProject() {
|
||||
return definirProject;
|
||||
}
|
||||
|
||||
public void setDefinirProject(Button definirProject) {
|
||||
this.definirProject = definirProject;
|
||||
}
|
||||
|
||||
public Button getAssociateKieServer() {
|
||||
return associateKieServer;
|
||||
}
|
||||
|
||||
public void setAssociateKieServer(Button associateKieServer) {
|
||||
this.associateKieServer = associateKieServer;
|
||||
}
|
||||
|
||||
public Button getDeployer() {
|
||||
return deployer;
|
||||
}
|
||||
|
||||
public void setDeployer(Button deployer) {
|
||||
this.deployer = deployer;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.view.TemplateView;
|
||||
|
||||
public class TemplatesAction extends VerticalLayout {
|
||||
|
||||
private Button refresh;
|
||||
|
||||
private Button duplicate;
|
||||
|
||||
private Button edit;
|
||||
|
||||
public TemplatesAction(TemplateView templateView){
|
||||
|
||||
setClassName("leftMenu-global-action");
|
||||
|
||||
refresh =new Button("Refresh", VaadinIcon.ROTATE_LEFT.create());
|
||||
refresh.setClassName("leftMenu-global-button");
|
||||
add(refresh);
|
||||
refresh.addClickListener(buttonClickEvent -> {
|
||||
active(refresh);
|
||||
templateView.refreshList();
|
||||
});
|
||||
|
||||
duplicate =new Button("Duplicate",VaadinIcon.TOOLS.create());
|
||||
duplicate.setClassName("leftMenu-global-button");
|
||||
duplicate.setEnabled(false);
|
||||
add(duplicate);
|
||||
duplicate.addClickListener(buttonClickEvent -> {
|
||||
active(duplicate);
|
||||
templateView.duplicate();
|
||||
|
||||
});
|
||||
edit =new Button("Edit",VaadinIcon.EDIT.create());
|
||||
edit.setEnabled(false);
|
||||
edit.setClassName("leftMenu-global-button");
|
||||
add(edit);
|
||||
edit.addClickListener(buttonClickEvent -> {
|
||||
active(edit);
|
||||
templateView.edit();
|
||||
});
|
||||
}
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(refresh);
|
||||
removeActive(duplicate);
|
||||
removeActive(edit);
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
|
||||
public Button getRefresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public void setRefresh(Button refresh) {
|
||||
this.refresh = refresh;
|
||||
}
|
||||
|
||||
public Button getDuplicate() {
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
public void setDuplicate(Button duplicate) {
|
||||
this.duplicate = duplicate;
|
||||
}
|
||||
|
||||
public Button getEdit() {
|
||||
return edit;
|
||||
}
|
||||
|
||||
public void setEdit(Button edit) {
|
||||
this.edit = edit;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,8 +6,13 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
|||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.server.InputStreamFactory;
|
||||
import com.vaadin.flow.server.StreamResource;
|
||||
import org.chtijbug.drools.console.service.RuntimeService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class InformationStructure extends VerticalLayout {
|
||||
|
|
@ -28,8 +33,14 @@ public class InformationStructure extends VerticalLayout {
|
|||
|
||||
private String strKieServer="Number of Kie-Server : ";
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
public InformationStructure(){
|
||||
|
||||
userConnectedService= AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
runtimeService=AppContext.getApplicationContext().getBean(RuntimeService.class);
|
||||
|
||||
setClassName("leftMenu-global-infoStructure-content");
|
||||
|
||||
VerticalLayout verticalLayout=new VerticalLayout();
|
||||
|
|
@ -61,6 +72,10 @@ public class InformationStructure extends VerticalLayout {
|
|||
numberKieServer.setClassName("leftMenu-global-inforStructure-label");
|
||||
verticalLayout1.add(numberKieServer);
|
||||
|
||||
List<RuntimePersist> runtimePersists=runtimeService.getRuntimeRepository().findAll();
|
||||
|
||||
actualiseKieServer(runtimePersists!=null?runtimePersists.size():0);
|
||||
|
||||
numberKieWb=new Label(strKieWb+"0");
|
||||
numberKieWb.setClassName("leftMenu-global-inforStructure-label");
|
||||
verticalLayout1.add(numberKieWb);
|
||||
|
|
@ -68,6 +83,7 @@ public class InformationStructure extends VerticalLayout {
|
|||
numberProject=new Label(strProject+"0");
|
||||
numberProject.setClassName("leftMenu-global-inforStructure-label");
|
||||
verticalLayout1.add(numberProject);
|
||||
actualiseProject(userConnectedService.getUserConnected().getProjectResponses().size());
|
||||
}
|
||||
|
||||
public void actualiseKieWb(Integer numberOfKieWb){
|
||||
|
|
|
|||
|
|
@ -11,38 +11,23 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
|||
@StyleSheet("css/accueil.css")
|
||||
public class LeftMenuGlobal extends VerticalLayout {
|
||||
|
||||
private Button actionOne;
|
||||
|
||||
private Button actionTwo;
|
||||
|
||||
private Boolean visibility=true;
|
||||
|
||||
private InformationStructure informationStructure;
|
||||
|
||||
private VerticalLayout contentAction;
|
||||
|
||||
|
||||
public LeftMenuGlobal(){
|
||||
|
||||
setClassName("leftMenu-global-content");
|
||||
|
||||
InformationStructure informationStructure=new InformationStructure();
|
||||
informationStructure=new InformationStructure();
|
||||
add(informationStructure);
|
||||
|
||||
VerticalLayout verticalLayout=new VerticalLayout();
|
||||
verticalLayout.setClassName("leftMenu-global-action");
|
||||
add(verticalLayout);
|
||||
|
||||
actionOne=new Button("ActionOne", VaadinIcon.TOOLS.create());
|
||||
actionOne.setClassName("leftMenu-global-button");
|
||||
verticalLayout.add(actionOne);
|
||||
actionOne.addClickListener(buttonClickEvent -> {
|
||||
active(actionOne);
|
||||
});
|
||||
|
||||
actionTwo=new Button("ActionTwo",VaadinIcon.TOOLS.create());
|
||||
actionTwo.setClassName("leftMenu-global-button");
|
||||
verticalLayout.add(actionTwo);
|
||||
actionTwo.addClickListener(buttonClickEvent -> {
|
||||
active(actionTwo);
|
||||
|
||||
});
|
||||
contentAction=new VerticalLayout();
|
||||
contentAction.setClassName("leftMenu-content-action");
|
||||
add(contentAction);
|
||||
|
||||
|
||||
HorizontalLayout horizontalLayout=new HorizontalLayout();
|
||||
|
|
@ -58,36 +43,21 @@ public class LeftMenuGlobal extends VerticalLayout {
|
|||
horizontalLayout.add(contactFooter);
|
||||
|
||||
}
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(actionOne);
|
||||
removeActive(actionTwo);
|
||||
|
||||
button.getClassNames().add("active");
|
||||
public InformationStructure getInformationStructure() {
|
||||
return informationStructure;
|
||||
}
|
||||
|
||||
public Button getActionOne() {
|
||||
return actionOne;
|
||||
public void setInformationStructure(InformationStructure informationStructure) {
|
||||
this.informationStructure = informationStructure;
|
||||
}
|
||||
|
||||
public void setActionOne(Button actionOne) {
|
||||
this.actionOne = actionOne;
|
||||
public VerticalLayout getContentAction() {
|
||||
return contentAction;
|
||||
}
|
||||
|
||||
public Button getActionTwo() {
|
||||
return actionTwo;
|
||||
}
|
||||
|
||||
public void setActionTwo(Button actionTwo) {
|
||||
this.actionTwo = actionTwo;
|
||||
public void setContentAction(VerticalLayout contentAction) {
|
||||
this.contentAction = contentAction;
|
||||
}
|
||||
|
||||
public Boolean getVisibility() {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
|||
import com.vaadin.flow.data.binder.Binder;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
|
|
@ -41,8 +42,11 @@ public class FormulaireComposant extends VerticalLayout {
|
|||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
private ProjectPersistService projectPersistService;
|
||||
|
||||
public FormulaireComposant(){
|
||||
|
||||
projectPersistService=AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
kieRepositoryService= AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
configKie= AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
userConnectedService=AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
|
|
@ -120,12 +124,9 @@ public class FormulaireComposant extends VerticalLayout {
|
|||
userConnectedBinder.getBean().getUserPassword());
|
||||
|
||||
if(connected!=null) {
|
||||
connected.getProjectResponses().clear();
|
||||
connected.getProjectResponses().addAll(connected.getProjectResponses());
|
||||
connected.getRoles().clear();
|
||||
connected.getRoles().addAll(connected.getRoles());
|
||||
connected.setConnected(true);
|
||||
userConnectedService.addToSession(connected);
|
||||
userConnectedService.addUserToSession(connected);
|
||||
projectPersistService.saveIfnotExist(connected.getProjectResponses());
|
||||
|
||||
return true;
|
||||
}else {
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ public class MenuPrincipal extends HorizontalLayout {
|
|||
private void active(Button button){
|
||||
removeActive(infoUser);
|
||||
removeActive(deployement);
|
||||
removeActive(assets);
|
||||
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,36 +5,37 @@ import com.vaadin.flow.component.dependency.StyleSheet;
|
|||
import com.vaadin.flow.component.dialog.Dialog;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import org.chtijbug.drools.console.view.AddRuntime;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadinComponent.componentView.AddRuntime;
|
||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.DeploymentAction;
|
||||
import org.chtijbug.drools.console.view.DeploymentView;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class MenuScondaireDeployement extends HorizontalLayout {
|
||||
|
||||
private Button addRuntime;
|
||||
|
||||
private Button projectDeploy;
|
||||
private Button deployment;
|
||||
|
||||
private Button accueilDeployment;
|
||||
|
||||
public MenuScondaireDeployement(){
|
||||
public MenuScondaireDeployement(SqueletteComposant squeletteComposant){
|
||||
setVisible(false);
|
||||
|
||||
setClassName("menu-secondaire-content");
|
||||
|
||||
|
||||
deployment =new Button("Deployment",VaadinIcon.EJECT.create());
|
||||
deployment.setClassName("menu-secondaire-button");
|
||||
add(deployment);
|
||||
deployment.addClickListener(buttonClickEvent -> {
|
||||
if(!isActive(deployment)) {
|
||||
active(deployment);
|
||||
}
|
||||
DeploymentView deploymentView=new DeploymentView(squeletteComposant);
|
||||
|
||||
accueilDeployment=new Button("Accueil deployement",VaadinIcon.ARCHIVE.create());
|
||||
accueilDeployment.setClassName("menu-secondaire-button");
|
||||
add(accueilDeployment);
|
||||
accueilDeployment.addClickListener(buttonClickEvent -> {
|
||||
getUI().get().navigate("AssetUpdate");
|
||||
});
|
||||
|
||||
projectDeploy=new Button("Deployable project",VaadinIcon.EJECT.create());
|
||||
projectDeploy.setClassName("menu-secondaire-button");
|
||||
add(projectDeploy);
|
||||
projectDeploy.addClickListener(buttonClickEvent -> {
|
||||
getUI().get().navigate("deployment");
|
||||
DeploymentAction deploymentAction=new DeploymentAction(squeletteComposant,deploymentView);
|
||||
deploymentView.setDeploymentAction(deploymentAction);
|
||||
squeletteComposant.navigate(deploymentView,DeploymentView.pageName,deploymentAction);
|
||||
});
|
||||
|
||||
addRuntime=new Button("add runtime", VaadinIcon.PLUS.create());
|
||||
|
|
@ -42,13 +43,29 @@ public class MenuScondaireDeployement extends HorizontalLayout {
|
|||
add(addRuntime);
|
||||
|
||||
Dialog dialog=new Dialog();
|
||||
dialog.add(new AddRuntime(dialog));
|
||||
dialog.add(new AddRuntime(dialog,squeletteComposant));
|
||||
|
||||
addRuntime.addClickListener(buttonClickEvent -> {
|
||||
dialog.open();
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(addRuntime);
|
||||
removeActive(deployment);
|
||||
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
|
||||
public Button getAddRuntime() {
|
||||
return addRuntime;
|
||||
}
|
||||
|
|
@ -57,19 +74,12 @@ public class MenuScondaireDeployement extends HorizontalLayout {
|
|||
this.addRuntime = addRuntime;
|
||||
}
|
||||
|
||||
public Button getProjectDeploy() {
|
||||
return projectDeploy;
|
||||
public Button getDeployment() {
|
||||
return deployment;
|
||||
}
|
||||
|
||||
public void setProjectDeploy(Button projectDeploy) {
|
||||
this.projectDeploy = projectDeploy;
|
||||
public void setDeployment(Button deployment) {
|
||||
this.deployment = deployment;
|
||||
}
|
||||
|
||||
public Button getAccueilDeployment() {
|
||||
return accueilDeployment;
|
||||
}
|
||||
|
||||
public void setAccueilDeployment(Button accueilDeployment) {
|
||||
this.accueilDeployment = accueilDeployment;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,30 +4,45 @@ import com.vaadin.flow.component.button.Button;
|
|||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.TemplatesAction;
|
||||
import org.chtijbug.drools.console.view.TemplateView;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class MenuSecondaireAssets extends HorizontalLayout {
|
||||
|
||||
private Button details;
|
||||
private Button assetsView;
|
||||
|
||||
public MenuSecondaireAssets(){
|
||||
public MenuSecondaireAssets(SqueletteComposant squeletteComposant){
|
||||
setVisible(false);
|
||||
|
||||
setClassName("menu-secondaire-content");
|
||||
|
||||
details=new Button("Détails", VaadinIcon.INFO.create());
|
||||
details.setClassName("menu-secondaire-button");
|
||||
add(details);
|
||||
details.addClickListener(buttonClickEvent -> {
|
||||
getUI().get().navigate("AssetDetail");
|
||||
assetsView =new Button("Templates",VaadinIcon.ARCHIVE.create());
|
||||
assetsView.setClassName("menu-secondaire-button");
|
||||
add(assetsView);
|
||||
assetsView.addClickListener(buttonClickEvent -> {
|
||||
if(!isActive(assetsView)) {
|
||||
active(assetsView);
|
||||
}
|
||||
TemplateView templateView=new TemplateView();
|
||||
TemplatesAction templatesAction=new TemplatesAction(templateView);
|
||||
templateView.setTemplatesAction(templatesAction);
|
||||
squeletteComposant.navigate(templateView,TemplateView.pageName,templatesAction);
|
||||
});
|
||||
}
|
||||
|
||||
public Button getDetails() {
|
||||
return details;
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
public void setDetails(Button details) {
|
||||
this.details = details;
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(assetsView);
|
||||
|
||||
button.getClassNames().add("active");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,30 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.page.Push;
|
||||
import com.vaadin.flow.router.BeforeEnterEvent;
|
||||
import com.vaadin.flow.router.BeforeEnterObserver;
|
||||
import com.vaadin.flow.router.Route;
|
||||
import com.vaadin.flow.server.VaadinSession;
|
||||
import com.vaadin.flow.shared.communication.PushMode;
|
||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||
|
||||
@Push
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Push(PushMode.MANUAL)
|
||||
@StyleSheet("css/accueil.css")
|
||||
@Route("accueil")
|
||||
public class AccueilView extends SqueletteComposant {
|
||||
public class AccueilView extends SqueletteComposant implements BeforeEnterObserver {
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeEnter(BeforeEnterEvent beforeEnterEvent) {
|
||||
|
||||
if (getUserConnectedService().getUserConnected()==null) {
|
||||
beforeEnterEvent.rerouteTo(LoginView.class);
|
||||
UI.getCurrent().getUI().get().getPage().executeJavaScript("window.alert($0)", "Session expiré, veuillez-vous reconnecter");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,37 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.checkbox.Checkbox;
|
||||
import com.vaadin.flow.component.combobox.ComboBox;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
import com.vaadin.flow.data.provider.ConfigurableFilterDataProvider;
|
||||
import com.vaadin.flow.data.provider.ListDataProvider;
|
||||
import com.vaadin.flow.data.renderer.ComponentRenderer;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import com.vaadin.flow.function.SerializablePredicate;
|
||||
import com.vaadin.flow.router.BeforeEnterEvent;
|
||||
import com.vaadin.flow.router.BeforeEnterObserver;
|
||||
import com.vaadin.flow.router.Route;
|
||||
import org.chtijbug.drools.console.AddLog;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.KieServerRepositoryService;
|
||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.*;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.drools.console.vaadinComponent.componentView.ConsoleDeploy;
|
||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.DeploymentAction;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||
import org.guvnor.rest.client.ProjectResponse;
|
||||
import org.kie.server.api.model.KieContainerResource;
|
||||
|
|
@ -22,151 +39,275 @@ import org.kie.server.api.model.ReleaseId;
|
|||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Route("deployment")
|
||||
public class DeploymentView extends SqueletteComposant implements AddLog {
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class DeploymentView extends VerticalLayout implements AddLog{
|
||||
|
||||
public static final String pageName="Deployment";
|
||||
|
||||
//GRID composant
|
||||
|
||||
private Grid<ProjectPersist> projectPersistGrid;
|
||||
|
||||
private ListDataProvider<ProjectPersist> dataProvider;
|
||||
|
||||
private ConfigurableFilterDataProvider<ProjectPersist,Void,SerializablePredicate<ProjectPersist>> filterDataProvider;
|
||||
|
||||
private DeploymentAction deploymentAction;
|
||||
|
||||
//TEXTFIELD search
|
||||
|
||||
private TextField nameDeploy;
|
||||
|
||||
private TextField nameProject;
|
||||
|
||||
private TextField groupeId;
|
||||
|
||||
private TextField artifactId;
|
||||
|
||||
private TextField processId;
|
||||
|
||||
private TextField serverName;
|
||||
|
||||
private ComboBox status;
|
||||
|
||||
//CONSTANTE Textfield
|
||||
|
||||
private final String strNameDeploy="Deploy name";
|
||||
|
||||
private final String strNameProject="Project name";
|
||||
|
||||
private final String strGroupeId="Groupe ID";
|
||||
|
||||
private final String strArtefactID="Artefact ID";
|
||||
|
||||
private final String strProcessID="Process ID";
|
||||
|
||||
private final String strServerName="Server Name";
|
||||
|
||||
private final String strStatus="Status";
|
||||
|
||||
//SERVICE
|
||||
|
||||
private ProjectPersistService projectPersistService;
|
||||
|
||||
private SqueletteComposant squeletteComposant;
|
||||
|
||||
public DeploymentView(SqueletteComposant squeletteComposant) {
|
||||
|
||||
this.squeletteComposant=squeletteComposant;
|
||||
projectPersistService=AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
|
||||
setClassName("deployment-content");
|
||||
|
||||
add(new Label("Project"));
|
||||
|
||||
projectPersistGrid=new Grid<>();
|
||||
projectPersistGrid.setClassName("deployment-grid-perso");
|
||||
projectPersistGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||
|
||||
|
||||
final private Grid<List<String>> gridLogging = new Grid();
|
||||
final private Button buttonDeployProject = new Button("Deploy project");
|
||||
private KieConfigurationData config;
|
||||
private ComboBox<PlatformProjectResponse> spaceSelection;
|
||||
|
||||
final private TextField projectArtifactIDTextField = new TextField("Project Artifact ID");
|
||||
final private TextField projectGroupIDTextField = new TextField("Project Group ID");
|
||||
final private TextField projectVersionTextField = new TextField("Project Version");
|
||||
final private TextField containerIdTextField = new TextField("Container ID");
|
||||
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
private KieServerRepositoryService kieServerRepositoryService;
|
||||
private UserConnectedService userConnectedService;
|
||||
private UserConnected userConnected;
|
||||
private List<String> logs = new ArrayList<>();
|
||||
|
||||
public DeploymentView() {
|
||||
|
||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
this.kieServerRepositoryService = AppContext.getApplicationContext().getBean(KieServerRepositoryService.class);
|
||||
|
||||
this.userConnected = userConnectedService.getUserConnected();
|
||||
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
VerticalLayout verticalLayout = new VerticalLayout();
|
||||
Button button = new Button("Refresh");
|
||||
// button.addStyleName(Runo.BUTTON_SMALL);
|
||||
|
||||
button.addClickListener(event -> {
|
||||
this.refreshCombo();
|
||||
this.refreshList();
|
||||
Grid.Column<ProjectPersist> deployNameCo=projectPersistGrid.addColumn(projectPersist -> projectPersist.getDeploymentName());
|
||||
nameDeploy=new TextField(strNameDeploy);
|
||||
nameDeploy.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
nameDeploy.addValueChangeListener(e -> {
|
||||
refreshtGrid(nameDeploy.getValue(), strNameDeploy);
|
||||
});
|
||||
deployNameCo.setHeader(nameDeploy);
|
||||
|
||||
verticalLayout.add(button);
|
||||
|
||||
|
||||
spaceSelection = new ComboBox("Project", userConnected.getProjectResponses());
|
||||
spaceSelection.setItemLabelGenerator(ProjectResponse::getName);
|
||||
spaceSelection.addValueChangeListener(valueChangeEvent -> {
|
||||
PlatformProjectResponse response = spaceSelection.getValue();
|
||||
projectArtifactIDTextField.setValue(response.getArtifactId());
|
||||
projectGroupIDTextField.setValue(response.getGroupId());
|
||||
projectVersionTextField.setValue(response.getVersion());
|
||||
refreshList();
|
||||
Grid.Column<ProjectPersist> nameProjectCo=projectPersistGrid.addColumn(projectPersist -> projectPersist.getProjectName());
|
||||
nameProject=new TextField(strNameProject);
|
||||
nameProject.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
nameProject.addValueChangeListener(e -> {
|
||||
refreshtGrid(nameProject.getValue(), strNameProject);
|
||||
});
|
||||
nameProjectCo.setHeader(nameProject);
|
||||
|
||||
projectPersistGrid.addColumn(projectPersist -> projectPersist.getMainClass()).setHeader("ClassName")
|
||||
.setComparator((projectPersist,t1) -> projectPersist.getMainClass().compareTo(t1.getMainClass()));
|
||||
|
||||
verticalLayout.add(spaceSelection);
|
||||
|
||||
projectArtifactIDTextField.setEnabled(false);
|
||||
projectGroupIDTextField.setEnabled(false);
|
||||
projectVersionTextField.setEnabled(false);
|
||||
containerIdTextField.setEnabled(false);
|
||||
verticalLayout.add(projectArtifactIDTextField);
|
||||
verticalLayout.add(projectGroupIDTextField);
|
||||
verticalLayout.add(projectVersionTextField);
|
||||
verticalLayout.add(containerIdTextField);
|
||||
|
||||
buttonDeployProject.setEnabled(false);
|
||||
verticalLayout.add(buttonDeployProject);
|
||||
// buttonDeployProject.addStyleName(Runo.BUTTON_SMALL);
|
||||
|
||||
|
||||
buttonDeployProject.addClickListener(event -> {
|
||||
|
||||
ProjectResponse response = (ProjectResponse) spaceSelection.getValue();
|
||||
|
||||
JobStatus result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), response.getSpaceName(), response.getName(), "compile", this);
|
||||
kieRepositoryService.waitForJobToBeEnded(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), result.getJobId(), this);
|
||||
|
||||
result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), response.getSpaceName(), response.getName(), "install", this);
|
||||
|
||||
kieRepositoryService.waitForJobToBeEnded(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), result.getJobId(), this);
|
||||
if (containerIdTextField.getValue() != null && containerIdTextField.getValue().length() > 0) {
|
||||
KieServerJobStatus jobresult = kieServerRepositoryService.stopContainer(config.getKieserverUrl(), config.getKieserverUserName(), config.getKieserverPassword(), containerIdTextField.getValue(), this);
|
||||
if (jobresult != null
|
||||
&& "SUCCESS".equals(jobresult.getType())) {
|
||||
}
|
||||
|
||||
}
|
||||
KieContainerResource newContainer = new KieContainerResource();
|
||||
newContainer.setContainerId(containerIdTextField.getValue());
|
||||
newContainer.setReleaseId(new ReleaseId());
|
||||
newContainer.getReleaseId().setArtifactId(projectArtifactIDTextField.getValue());
|
||||
newContainer.getReleaseId().setGroupId(projectGroupIDTextField.getValue());
|
||||
newContainer.getReleaseId().setVersion(projectVersionTextField.getValue());
|
||||
KieContainerInfo createdContainer = kieServerRepositoryService.createContainer(config.getKieserverUrl(), config.getKieserverUserName(), config.getKieserverPassword(), projectArtifactIDTextField.getValue(), newContainer, this);
|
||||
containerIdTextField.setValue(createdContainer.getContainerId());
|
||||
refreshList();
|
||||
|
||||
|
||||
Grid.Column<ProjectPersist> groupIdCo=projectPersistGrid.addColumn(projectPersist -> projectPersist.getGroupID());
|
||||
groupeId=new TextField(strGroupeId);
|
||||
groupeId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
groupeId.addValueChangeListener(e -> {
|
||||
refreshtGrid(groupeId.getValue(), strGroupeId);
|
||||
});
|
||||
buttonDeployProject.setEnabled(false);
|
||||
gridLogging.setSizeFull();
|
||||
groupIdCo.setHeader(groupeId);
|
||||
|
||||
gridLogging.setColumnReorderingAllowed(false);
|
||||
Grid.Column<ProjectPersist> artifactIDCO=projectPersistGrid.addColumn(projectPersist -> projectPersist.getArtifactID());
|
||||
artifactId=new TextField(strArtefactID);
|
||||
artifactId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
artifactId.addValueChangeListener(e -> {
|
||||
refreshtGrid(artifactId.getValue(), strArtefactID);
|
||||
});
|
||||
artifactIDCO.setHeader(artifactId);
|
||||
|
||||
Grid.Column<ProjectPersist> processIDco=projectPersistGrid.addColumn(projectPersist -> projectPersist.getProcessID());
|
||||
processId=new TextField(strProcessID);
|
||||
processId.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
processId.addValueChangeListener(e -> {
|
||||
refreshtGrid(processId.getValue(), strProcessID);
|
||||
});
|
||||
processIDco.setHeader(processId);
|
||||
|
||||
|
||||
// gridLogging.addColumn("Message", new com.vaadin.ui.renderers.TextRenderer()).setCaption("Message");
|
||||
Grid.Column<ProjectPersist> serverNameCo=projectPersistGrid.addColumn(projectPersist -> projectPersist.getServerName());
|
||||
serverName=new TextField(strServerName);
|
||||
serverName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
serverName.addValueChangeListener(e -> {
|
||||
refreshtGrid(serverName.getValue(), strServerName);
|
||||
});
|
||||
serverNameCo.setHeader(serverName);
|
||||
|
||||
|
||||
verticalLayout.add(gridLogging);
|
||||
getInfoPage().add(verticalLayout);
|
||||
projectPersistGrid.addColumn(projectPersist -> projectPersist.getProjectVersion()).setHeader("Version")
|
||||
.setComparator((projectPersist,t1) -> projectPersist.getProjectVersion().compareTo(t1.getProjectVersion()));
|
||||
|
||||
|
||||
Grid.Column<ProjectPersist> statusCo=projectPersistGrid.addColumn(projectPersist -> projectPersist.getStatus());
|
||||
status=new ComboBox(strProcessID);
|
||||
status.setClassName("deployment-combobox");
|
||||
|
||||
ArrayList<String> tmp=new ArrayList<>();
|
||||
tmp.add(ProjectPersist.DEFINI);
|
||||
tmp.add(ProjectPersist.Deployable);
|
||||
tmp.add(ProjectPersist.ADEFINIR);
|
||||
tmp.add(" ");
|
||||
status.setItems(tmp);
|
||||
status.addValueChangeListener(e -> {
|
||||
refreshtGrid(status.getValue()!=null?status.getValue().toString():" ", strStatus);
|
||||
});
|
||||
statusCo.setHeader(status);
|
||||
|
||||
add(projectPersistGrid);
|
||||
|
||||
setDataProvider();
|
||||
|
||||
projectPersistGrid.addSelectionListener(selectionEvent -> {
|
||||
|
||||
if(selectionEvent.getFirstSelectedItem()!=null&&selectionEvent.getFirstSelectedItem().isPresent()) {
|
||||
majAction(selectionEvent.getFirstSelectedItem().get());
|
||||
}else {
|
||||
getDeploymentAction().getAssociateKieServer().setEnabled(false);
|
||||
getDeploymentAction().getDefinirProject().setEnabled(false);
|
||||
getDeploymentAction().getDeployer().setEnabled(false);
|
||||
}
|
||||
});
|
||||
//add(new ConsoleDeploy());
|
||||
}
|
||||
|
||||
public void refreshCombo() {
|
||||
spaceSelection.setItems(userConnected.getProjectResponses());
|
||||
private void refreshtGrid(String value,String type){
|
||||
|
||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(),type));
|
||||
projectPersistGrid.getDataProvider().refreshAll();
|
||||
}
|
||||
private SerializablePredicate<ProjectPersist> filterGrid(String value, String type){
|
||||
SerializablePredicate<ProjectPersist> columnPredicate = null;
|
||||
|
||||
if(value.equals("")||value.equals(" ")||type.equals(" ")){
|
||||
columnPredicate = asset -> (true);
|
||||
}else {
|
||||
if (type.equals(strArtefactID)) {
|
||||
columnPredicate = asset -> (
|
||||
asset.getArtifactID()!=null&&asset.getArtifactID().toUpperCase().contains(value.toUpperCase()));
|
||||
}else if(type.equals(strGroupeId)){
|
||||
columnPredicate = asset -> (asset.getGroupID()!=null&&asset.getGroupID().toUpperCase().contains(value.toUpperCase()));
|
||||
}
|
||||
else if(type.equals(strNameDeploy)){
|
||||
columnPredicate = asset -> (asset.getDeploymentName()!=null&&asset.getDeploymentName().toUpperCase().contains(value.toUpperCase()));
|
||||
} else if(type.equals(strNameProject)){
|
||||
columnPredicate = asset -> (asset.getProjectName()!=null&&asset.getProjectName().toUpperCase().contains(value.toUpperCase()));
|
||||
}else if(type.equals(strProcessID)){
|
||||
columnPredicate = asset -> (asset.getProcessID()!=null&&asset.getProcessID().toUpperCase().contains(value.toUpperCase()));
|
||||
}else if(type.equals(strStatus)){
|
||||
columnPredicate = asset -> (asset.getStatus()!=null&&asset.getStatus().toUpperCase().equals(value.toUpperCase()));
|
||||
}else if(type.equals(strServerName)){
|
||||
columnPredicate = asset -> (asset.getServerName()!=null&&asset.getServerName().toUpperCase().equals(value.toUpperCase()));
|
||||
}
|
||||
}
|
||||
return columnPredicate;
|
||||
}
|
||||
public void setDataProvider(){
|
||||
|
||||
Set<ProjectPersist> projectPersists = projectPersistService.getProjectsSession();
|
||||
if(projectPersists!=null) {
|
||||
dataProvider = new ListDataProvider<>(projectPersists);
|
||||
|
||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
|
||||
|
||||
projectPersistGrid.setDataProvider(filterDataProvider);
|
||||
|
||||
reinitFilter();
|
||||
|
||||
}
|
||||
}
|
||||
public void reinitFilter(){
|
||||
|
||||
private void refreshList() {
|
||||
buttonDeployProject.setEnabled(true);
|
||||
KieConfigurationData config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
List<KieContainerInfo> listcontainers = kieServerRepositoryService.getContainerList(config.getKieserverUrl(), config.getKieserverUserName(), config.getKieserverPassword());
|
||||
containerIdTextField.setValue("");
|
||||
for (KieContainerInfo kieContainerInfo : listcontainers) {
|
||||
if (kieContainerInfo.getArtifactId() != null
|
||||
&& kieContainerInfo.getArtifactId().equals(projectArtifactIDTextField.getValue())
|
||||
&& kieContainerInfo.getArtifactId().equals(projectArtifactIDTextField.getValue())
|
||||
&& kieContainerInfo.getArtifactId().equals(projectArtifactIDTextField.getValue())) {
|
||||
containerIdTextField.setValue(kieContainerInfo.getContainerId());
|
||||
artifactId.setValue("");
|
||||
groupeId.setValue("");
|
||||
processId.setValue("");
|
||||
nameProject.setValue("");
|
||||
nameDeploy.setValue("");
|
||||
}
|
||||
public void majAction(ProjectPersist projectPersist){
|
||||
if(projectPersist.getStatus().equals(ProjectPersist.DEFINI)){
|
||||
|
||||
getDeploymentAction().getAssociateKieServer().setEnabled(true);
|
||||
getDeploymentAction().getDefinirProject().setEnabled(false);
|
||||
getDeploymentAction().getDeployer().setEnabled(false);
|
||||
|
||||
}else if(projectPersist.getStatus().equals(ProjectPersist.ADEFINIR)){
|
||||
|
||||
getDeploymentAction().getAssociateKieServer().setEnabled(false);
|
||||
getDeploymentAction().getDefinirProject().setEnabled(true);
|
||||
getDeploymentAction().getDeployer().setEnabled(false);
|
||||
}else if(projectPersist.getStatus().equals(ProjectPersist.Deployable)){
|
||||
|
||||
getDeploymentAction().getAssociateKieServer().setEnabled(false);
|
||||
getDeploymentAction().getDefinirProject().setEnabled(false);
|
||||
getDeploymentAction().getDeployer().setEnabled(true);
|
||||
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void addRow(String textToAdd,UI ui) {
|
||||
|
||||
getUI().get().access(()->{
|
||||
|
||||
HorizontalLayout horizontalLayout=new HorizontalLayout();
|
||||
horizontalLayout.setClassName("console-row");
|
||||
Label date=new Label(new Date()+" : ");
|
||||
date.setClassName("console-date");
|
||||
horizontalLayout.add(date);
|
||||
horizontalLayout.add(new Label(textToAdd));
|
||||
squeletteComposant.getConsoleDeploy().getLogContent().add(horizontalLayout);
|
||||
//getUI().get().push();
|
||||
});
|
||||
ui.getSession().lock();
|
||||
try {
|
||||
ui.push();
|
||||
}finally {
|
||||
ui.getSession().unlock();
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println("coucou");
|
||||
public Grid<ProjectPersist> getProjectPersistGrid() {
|
||||
return projectPersistGrid;
|
||||
}
|
||||
|
||||
public void addRow(String textToAdd) {
|
||||
logs.add(textToAdd);
|
||||
gridLogging.setItems(logs);
|
||||
|
||||
public void setProjectPersistGrid(Grid<ProjectPersist> projectPersistGrid) {
|
||||
this.projectPersistGrid = projectPersistGrid;
|
||||
}
|
||||
|
||||
public DeploymentAction getDeploymentAction() {
|
||||
return deploymentAction;
|
||||
}
|
||||
|
||||
public void setDeploymentAction(DeploymentAction deploymentAction) {
|
||||
this.deploymentAction = deploymentAction;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,123 +0,0 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.combobox.ComboBox;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.router.Route;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.KieServerRepositoryService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
||||
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
|
||||
@Route("AssetUpdate")
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class TableLikeArtefactView extends SqueletteComposant {
|
||||
|
||||
private KieConfigurationData config;
|
||||
|
||||
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
private KieServerRepositoryService kieServerRepositoryService;
|
||||
|
||||
private UserConnected userConnected;
|
||||
|
||||
|
||||
private Grid<Map<String, String>> assetListGrid;
|
||||
|
||||
private ComboBox<PlatformProjectResponse> spaceSelection;
|
||||
private Button deleteRow;
|
||||
|
||||
private Button editRow;
|
||||
|
||||
private Button duplicateRow;
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
public TableLikeArtefactView() {
|
||||
|
||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
this.kieServerRepositoryService = AppContext.getApplicationContext().getBean(KieServerRepositoryService.class);
|
||||
|
||||
this.userConnected = userConnectedService.getUserConnected();
|
||||
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
VerticalLayout verticalLayout = new VerticalLayout();
|
||||
Button button = new Button("Refresh");
|
||||
button.addClickListener(event -> {
|
||||
this.refreshList();
|
||||
});
|
||||
verticalLayout.add(button);
|
||||
spaceSelection = new ComboBox("Project", userConnected.getProjectResponses());
|
||||
spaceSelection.setItemLabelGenerator(PlatformProjectResponse::getName);
|
||||
spaceSelection.addValueChangeListener(valueChangeEvent -> {
|
||||
PlatformProjectResponse response = (PlatformProjectResponse) spaceSelection.getValue();
|
||||
//spaceSelection.setSelectedItem(response);
|
||||
assetListGrid.addColumn(hashmap -> hashmap.get("title"));
|
||||
List<Asset> assets = kieRepositoryService.getListAssets(config.getKiewbUrl(), userConnected.getUserName(), userConnected.getUserPassword(), response.getSpaceName(), response.getName());
|
||||
List<Map<String, String>> rows = new ArrayList<>();
|
||||
for (Asset asset : assets) {
|
||||
if (asset.getTitle().endsWith(".template")
|
||||
|| asset.getTitle().endsWith(".gdst")) {
|
||||
Map<String, String> line = new HashMap<>();
|
||||
line.put("title", asset.getTitle());
|
||||
rows.add(line);
|
||||
}
|
||||
}
|
||||
assetListGrid.setItems(rows);
|
||||
|
||||
|
||||
});
|
||||
verticalLayout.add(spaceSelection);
|
||||
HorizontalLayout actionButtons = new HorizontalLayout();
|
||||
verticalLayout.add(actionButtons);
|
||||
duplicateRow = new Button("Duplicate");
|
||||
actionButtons.add(duplicateRow);
|
||||
editRow = new Button("Edit");
|
||||
actionButtons.add(editRow);
|
||||
deleteRow = new Button("Delete");
|
||||
|
||||
|
||||
assetListGrid = new Grid();
|
||||
assetListGrid.setClassName("grid-perso");
|
||||
assetListGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||
assetListGrid.setSizeFull();
|
||||
|
||||
verticalLayout.add(assetListGrid);
|
||||
editRow.addClickListener(clickEvent -> {
|
||||
Set<Map<String, String>> selectedElements = assetListGrid.getSelectedItems();
|
||||
if (selectedElements.toArray().length > 0) {
|
||||
String assetName = ((Map<String, String>) selectedElements.toArray()[0]).get("title");
|
||||
if (assetName != null) {
|
||||
PlatformProjectResponse response = spaceSelection.getValue();
|
||||
userConnectedService.addAssetToSession(assetName);
|
||||
userConnectedService.addProjectToSession(response.getName());
|
||||
userConnectedService.addSpaceToSession(response.getSpaceName());
|
||||
getUI().get().navigate("AssetDetail");
|
||||
// AssetEditView assetEditView = new AssetEditView(userConnected, response.getSpaceName(), response.getName(), assetName);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
getInfoPage().add(verticalLayout);
|
||||
}
|
||||
|
||||
|
||||
public void refreshList() {
|
||||
spaceSelection.setItems(userConnected.getProjectResponses());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
import com.vaadin.flow.component.combobox.ComboBox;
|
||||
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.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
import com.vaadin.flow.data.provider.ConfigurableFilterDataProvider;
|
||||
import com.vaadin.flow.data.provider.ListDataProvider;
|
||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||
import com.vaadin.flow.function.SerializablePredicate;
|
||||
import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.AppContext;
|
||||
import org.chtijbug.drools.console.vaadinComponent.componentView.AssetEdit;
|
||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.TemplatesAction;
|
||||
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class TemplateView extends VerticalLayout {
|
||||
|
||||
public static final String pageName="Templates";
|
||||
|
||||
private KieConfigurationData config;
|
||||
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
|
||||
private UserConnected userConnected;
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
|
||||
private ListDataProvider<Asset> dataProvider;
|
||||
|
||||
private ComboBox<PlatformProjectResponse> spaceSelection;
|
||||
|
||||
private Grid<Asset> assetListGrid;
|
||||
|
||||
private TextField searchTemplate;
|
||||
|
||||
private ConfigurableFilterDataProvider<Asset,Void,SerializablePredicate<Asset>> filterDataProvider;
|
||||
|
||||
private TemplatesAction templatesAction;
|
||||
|
||||
public TemplateView() {
|
||||
|
||||
setClassName("template-content");
|
||||
|
||||
dataProvider=new ListDataProvider<>(new ArrayList<>());
|
||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
|
||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
this.userConnectedService = AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
||||
this.userConnected = userConnectedService.getUserConnected();
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
|
||||
spaceSelection = new ComboBox("Project", userConnected.getProjectResponses());
|
||||
spaceSelection.setItemLabelGenerator(PlatformProjectResponse::getName);
|
||||
spaceSelection.addValueChangeListener(valueChangeEvent -> {
|
||||
setDataProvider();
|
||||
});
|
||||
|
||||
add(spaceSelection);
|
||||
|
||||
assetListGrid = new Grid();
|
||||
assetListGrid.setClassName("templates-grid-perso");
|
||||
assetListGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||
|
||||
Grid.Column<Asset> assetColumn=assetListGrid.addColumn(asset -> asset.getTitle());
|
||||
searchTemplate=new TextField("title");
|
||||
searchTemplate.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
searchTemplate.addValueChangeListener(e -> {
|
||||
refreshtGrid(searchTemplate.getValue(), "title");
|
||||
});
|
||||
assetColumn.setHeader(searchTemplate);
|
||||
add(assetListGrid);
|
||||
|
||||
assetListGrid.addSelectionListener(selectionEvent -> {
|
||||
if(assetListGrid.getSelectedItems()==null){
|
||||
templatesAction.getEdit().setEnabled(false);
|
||||
}else {
|
||||
templatesAction.getEdit().setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setDataProvider(){
|
||||
PlatformProjectResponse response = (PlatformProjectResponse) spaceSelection.getValue();
|
||||
List<Asset> tmp = kieRepositoryService.getListAssets(config.getKiewbUrl(), userConnected.getUserName(), userConnected.getUserPassword(), response.getSpaceName(), response.getName());
|
||||
List<Asset> result = new ArrayList<>();
|
||||
for (Asset asset : tmp) {
|
||||
if (asset.getTitle().endsWith(".template")
|
||||
|| asset.getTitle().endsWith(".gdst")) {
|
||||
result.add(asset);
|
||||
}
|
||||
}
|
||||
dataProvider=new ListDataProvider<>(result);
|
||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
assetListGrid.setDataProvider(filterDataProvider);
|
||||
reinitFilter();
|
||||
}
|
||||
|
||||
public void refreshList() {
|
||||
spaceSelection.setItems(userConnected.getProjectResponses());
|
||||
}
|
||||
public void edit(){
|
||||
Set<Asset> selectedElements = assetListGrid.getSelectedItems();
|
||||
if (selectedElements.toArray().length > 0) {
|
||||
String assetName = selectedElements.stream().findFirst().get().getTitle();
|
||||
if (assetName != null) {
|
||||
PlatformProjectResponse response = spaceSelection.getValue();
|
||||
userConnectedService.addAssetToSession(assetName);
|
||||
userConnectedService.addProjectToSession(response.getName());
|
||||
userConnectedService.addSpaceToSession(response.getSpaceName());
|
||||
Dialog dialog=new Dialog();
|
||||
|
||||
dialog.add(new AssetEdit());
|
||||
dialog.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void refreshtGrid(String value,String type){
|
||||
|
||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(),type));
|
||||
assetListGrid.getDataProvider().refreshAll();
|
||||
}
|
||||
private SerializablePredicate<Asset> filterGrid(String value, String type){
|
||||
SerializablePredicate<Asset> columnPredicate = null;
|
||||
if(value.equals(" ")||type.equals(" ")){
|
||||
columnPredicate = asset -> (true);
|
||||
}else {
|
||||
if (type.equals("Asset Title")) {
|
||||
columnPredicate = asset -> (asset.getTitle().contains(value));
|
||||
}
|
||||
}
|
||||
return columnPredicate;
|
||||
}
|
||||
public void duplicate(){}
|
||||
|
||||
public void reinitFilter(){
|
||||
searchTemplate.setValue("");
|
||||
}
|
||||
|
||||
public TemplatesAction getTemplatesAction() {
|
||||
return templatesAction;
|
||||
}
|
||||
|
||||
public void setTemplatesAction(TemplatesAction templatesAction) {
|
||||
this.templatesAction = templatesAction;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
@import "menu/menuGlobal.css";
|
||||
@import "leftMenu/leftMenuGlobal.css";
|
||||
@import "view/global.css";
|
||||
@import "composantperso/console.css";
|
||||
|
||||
.separator{
|
||||
height: 2px;
|
||||
|
|
@ -17,10 +18,16 @@
|
|||
|
||||
.squelette-component-content{
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
/*margin: 0px;*/
|
||||
margin-left: auto;
|
||||
background-color: whitesmoke;
|
||||
}
|
||||
.squelette-menu-secondaire{
|
||||
width: 100%;
|
||||
height: 4vw;
|
||||
padding: 0;
|
||||
|
||||
}
|
||||
.squelette-component-horizontal{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
@ -30,12 +37,16 @@
|
|||
.squelette-component-infoPage{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0px;
|
||||
/*margin-top: 3vw;*/
|
||||
position: relative;
|
||||
}
|
||||
.footer-button{
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
font-size: 0.8vw;
|
||||
}
|
||||
body{
|
||||
overflow: hidden!important;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
.console-content-all{
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
margin-left: 4px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
background: white;
|
||||
/* box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); */
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
|
||||
border-top-color: #c5c5c5;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
border-left-color: rgb(197, 197, 197);
|
||||
border-left-style: solid;
|
||||
border-left-width: 1px;
|
||||
box-shadow: 1px 1px 10px #A0A0A0A0;
|
||||
height: 2vw;
|
||||
left: 15.8%;
|
||||
right: 0;
|
||||
}
|
||||
.split-console{}
|
||||
.console-content-all.active{
|
||||
height: 30vw;
|
||||
|
||||
}
|
||||
|
||||
.console-outilsBar-content{
|
||||
width: 4vw!important;
|
||||
/* margin: 0px; */
|
||||
padding: 0px;
|
||||
padding-top: 0px;
|
||||
background: whitesmoke;
|
||||
border-right-color: rgb(0, 0, 0,0.2);
|
||||
border-right-style: solid;
|
||||
border-right-width: 1px;}
|
||||
|
||||
.console-content{
|
||||
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.console-button{
|
||||
background: transparent;
|
||||
color: gray;
|
||||
/* margin: 0; */
|
||||
/* padding: 0px; */
|
||||
cursor: pointer;
|
||||
font-size: 1vw;
|
||||
}
|
||||
|
||||
.console-content-title{
|
||||
width: 100%;
|
||||
margin-left: 0px;
|
||||
background: whitesmoke;
|
||||
padding: 0.5vw;
|
||||
border-bottom-color: rgb(0, 0, 0,0.2);
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
height: 2.5vw;
|
||||
}
|
||||
|
||||
.console-title{
|
||||
font-size: 0.8vw;
|
||||
}
|
||||
|
||||
.console-log-content{
|
||||
margin: 0px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.console-date{
|
||||
margin-right: 0px;
|
||||
padding: 0px;
|
||||
font-size: 0.9vw;
|
||||
font-weight: bold;
|
||||
}
|
||||
.console-row{
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
width: 37px !important;
|
||||
}
|
||||
.horizontal-content{
|
||||
width: 90%;
|
||||
width: 100%;
|
||||
}
|
||||
.vaadin-text-field-container.style-scope.vaadin-password-field {
|
||||
width: 100%;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@
|
|||
border-left-width: 0.2vw;
|
||||
background-color: whitesmoke;
|
||||
}
|
||||
.leftMenu-global-button[disabled][disabled] {
|
||||
pointer-events: none;
|
||||
color: var(--lumo-disabled-text-color);
|
||||
}
|
||||
|
||||
|
||||
.leftMenu-global-action{
|
||||
|
|
@ -70,4 +74,11 @@
|
|||
font-size: 0.9vw;
|
||||
}
|
||||
|
||||
.leftMenu-content-action{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.leftMenu-global-inforStructure-content-label{}
|
||||
|
|
@ -28,6 +28,22 @@
|
|||
|
||||
}
|
||||
|
||||
.login-application-connexion-error {
|
||||
font-family: var(--lumo-font-family);
|
||||
font-size: var(--lumo-font-size-m);
|
||||
font-weight: 500;
|
||||
color: white;
|
||||
background-color:red ;
|
||||
border-radius: var(--lumo-border-radius);
|
||||
width: 100%;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
margin-top: 10%;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.login-application-layout{
|
||||
display: inline-block;
|
||||
box-shadow: 5px 4px 10px #A0A0A0A0;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
width: 100%;
|
||||
background-color: #32cbcb;
|
||||
box-shadow: 5px 4px 10px #A0A0A0A0;
|
||||
height: 7%;
|
||||
padding: 0;
|
||||
height: 3vw;
|
||||
}
|
||||
.menu-secondaire-button{
|
||||
background-color: transparent;
|
||||
|
|
@ -11,4 +10,18 @@
|
|||
color: white;
|
||||
cursor: pointer;
|
||||
font-size: 1vw;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.menu-secondaire-button.active :after{
|
||||
border-top: 20px solid #32cbcb;
|
||||
content: "";
|
||||
position:absolute;
|
||||
border-left: 20px solid transparent;
|
||||
border-right: 20px solid transparent;
|
||||
width: 0px;
|
||||
margin-bottom: -15px;
|
||||
bottom: 0;
|
||||
display: block;
|
||||
margin-top:-4px;
|
||||
}
|
||||
|
|
@ -6,4 +6,11 @@
|
|||
margin-right: auto;
|
||||
}
|
||||
|
||||
.creation-runtime-title2{
|
||||
color: #32CBBB;
|
||||
font-size: 1.2vw;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.creation-runtime-content{}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.assetEdit-content{
|
||||
width: 77vw!important;
|
||||
height: 34vw;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
.deployment-content{
|
||||
height: 100%;
|
||||
width: 100%!important;
|
||||
margin: auto;
|
||||
}
|
||||
.deployment-combobox{
|
||||
width: 8vw!important;
|
||||
}
|
||||
|
|
@ -1 +1,4 @@
|
|||
@import "addRuntime.css";
|
||||
@import "template.css";
|
||||
@import "assedit.css";
|
||||
@import "deployment.css";
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.templates-grid-perso{}
|
||||
|
||||
.template-content{
|
||||
height: 86%;
|
||||
width: 84%!important;
|
||||
}
|
||||
|
|
@ -22,3 +22,6 @@ jenkins.nexusUrl=https://nexus.pymma-software.com/nexus/
|
|||
jenkins.nexusName=pymma-snapshot
|
||||
jenkins.jdkVersion=jdk18
|
||||
jenkins.group=EPO
|
||||
|
||||
spring.data.mongodb.database=businessProxyDB
|
||||
spring.data.mongodb.host=localhost:27017
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.chtijbug.drools.proxy.camel;
|
|||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.apache.camel.model.rest.RestBindingMode;
|
||||
import org.apache.camel.model.rest.RestParamType;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.chtijbug.drools.proxy.service.KieServiceCommon;
|
||||
import org.kie.server.api.model.KieContainerResource;
|
||||
import org.kie.server.api.model.KieContainerResourceList;
|
||||
|
|
@ -69,6 +70,7 @@ public class AdminRouter extends RouteBuilder {
|
|||
.param().name("body").type(body).description("KIE Container resource to be deployed as KieContainerResourcee").endParam()
|
||||
.responseMessage().code(200).message("Container successfully created").endResponseMessage()
|
||||
.to("bean:kieService?method=createContainer(${header.id},${body})");
|
||||
|
||||
rest("/server/containers").description(" Disposes (undeploys) container with given id")
|
||||
.consumes("application/json")
|
||||
.produces("application/json")
|
||||
|
|
@ -89,7 +91,6 @@ public class AdminRouter extends RouteBuilder {
|
|||
.param().name("body").type(body).description("KIE Container resource to be deployed as KieContainerResourcee").endParam()
|
||||
.responseMessage().code(200).message("Container successfully created").endResponseMessage()
|
||||
.to("bean:kieService?method=createContainerWithRestBusinessService(${header.id},${body},${header.className},${header.processID})");
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.chtijbug.drools.proxy.service;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.camel.CamelContext;
|
||||
import org.chtijbug.drools.proxy.camel.DroolsRouter;
|
||||
import org.chtijbug.drools.proxy.persistence.ContainerRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ContainerRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugKieServerExtension;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import org.apache.commons.io.FileUtils;
|
|||
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
||||
import org.chtijbug.drools.logging.SessionExecution;
|
||||
import org.chtijbug.drools.proxy.persistence.ContainerRepository;
|
||||
import org.chtijbug.kieserver.services.drools.ChtijbugObjectRequest;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugKieServerExtension;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
|
||||
|
|
@ -18,7 +17,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,164 @@
|
|||
package org.chtijbug.drools.proxy.persistence.model;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Document
|
||||
public class ProjectPersist implements Serializable {
|
||||
|
||||
public static final String ADEFINIR="A définir";
|
||||
|
||||
public static final String DEFINI="Défini";
|
||||
|
||||
public static final String Deployable="Déployable";
|
||||
|
||||
@Id
|
||||
private String id=new ObjectId().toString();
|
||||
|
||||
@Indexed
|
||||
private String deploymentName;
|
||||
|
||||
@Indexed
|
||||
private String projectName;
|
||||
|
||||
private String spaceName;
|
||||
|
||||
private String oldName;
|
||||
|
||||
private String mainClass;
|
||||
|
||||
private String groupID;
|
||||
|
||||
private String artifactID;
|
||||
|
||||
private String processID;
|
||||
|
||||
private String projectVersion;
|
||||
|
||||
private String containerID;
|
||||
|
||||
private String serverName;
|
||||
|
||||
private String status;
|
||||
|
||||
private List<String> classNameList;
|
||||
|
||||
public ProjectPersist(){}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDeploymentName() {
|
||||
return deploymentName;
|
||||
}
|
||||
|
||||
public void setDeploymentName(String deploymentName) {
|
||||
this.deploymentName = deploymentName;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getMainClass() {
|
||||
return mainClass;
|
||||
}
|
||||
|
||||
public void setMainClass(String mainClass) {
|
||||
this.mainClass = mainClass;
|
||||
}
|
||||
|
||||
public String getGroupID() {
|
||||
return groupID;
|
||||
}
|
||||
|
||||
public void setGroupID(String groupID) {
|
||||
this.groupID = groupID;
|
||||
}
|
||||
|
||||
public String getArtifactID() {
|
||||
return artifactID;
|
||||
}
|
||||
|
||||
public void setArtifactID(String artifactID) {
|
||||
this.artifactID = artifactID;
|
||||
}
|
||||
|
||||
public String getProcessID() {
|
||||
return processID;
|
||||
}
|
||||
|
||||
public String getSpaceName() {
|
||||
return spaceName;
|
||||
}
|
||||
|
||||
public void setSpaceName(String spaceName) {
|
||||
this.spaceName = spaceName;
|
||||
}
|
||||
|
||||
public String getOldName() {
|
||||
return oldName;
|
||||
}
|
||||
|
||||
public String getContainerID() {
|
||||
return containerID;
|
||||
}
|
||||
|
||||
public void setContainerID(String containerID) {
|
||||
this.containerID = containerID;
|
||||
}
|
||||
|
||||
public void setOldName(String oldName) {
|
||||
this.oldName = oldName;
|
||||
}
|
||||
|
||||
public void setProcessID(String processID) {
|
||||
this.processID = processID;
|
||||
}
|
||||
|
||||
public String getProjectVersion() {
|
||||
return projectVersion;
|
||||
}
|
||||
|
||||
public void setProjectVersion(String projectVersion) {
|
||||
this.projectVersion = projectVersion;
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
public void setServerName(String serverName) {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public List<String> getClassNameList() {
|
||||
return classNameList;
|
||||
}
|
||||
|
||||
public void setClassNameList(List<String> classNameList) {
|
||||
this.classNameList = classNameList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package org.chtijbug.drools.proxy.persistence.model;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.index.Indexed;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
@Document
|
||||
public class RuntimePersist {
|
||||
|
||||
@Id
|
||||
private String id=new ObjectId().toString();
|
||||
|
||||
@Indexed
|
||||
private String serverName;
|
||||
|
||||
private String version;
|
||||
|
||||
private String hostname;
|
||||
|
||||
public RuntimePersist(String serverName, String version, String hostname) {
|
||||
this.serverName = serverName;
|
||||
this.version = version;
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
public void setServerName(String serverName) {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public void setHostname(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.chtijbug.drools.proxy.persistence;
|
||||
package org.chtijbug.drools.proxy.persistence.repository;
|
||||
|
||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package org.chtijbug.drools.proxy.persistence.repository;
|
||||
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ProjectRepository extends MongoRepository<ProjectPersist, String> {
|
||||
|
||||
public ProjectPersist findByProjectName(String projectName);
|
||||
public ProjectPersist findByDeploymentName(String deploymentName);
|
||||
public List<ProjectPersist> findByServerName(String serverName);
|
||||
public List<ProjectPersist> findByServerNameAndDeploymentName(String serverName,String deploymentName);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package org.chtijbug.drools.proxy.persistence.repository;
|
||||
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface RuntimeRepository extends MongoRepository<RuntimePersist, String> {
|
||||
|
||||
public List<RuntimePersist> findByServerName(String serverName);
|
||||
}
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue