Removed usage of kafka when deploying (polling mongodb instead)
This commit is contained in:
parent
b9f11ad846
commit
69c5ef7d43
56 changed files with 396 additions and 542 deletions
|
|
@ -9,7 +9,6 @@ import org.apache.kafka.clients.producer.ProducerConfig;
|
||||||
import org.apache.kafka.common.serialization.StringDeserializer;
|
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||||
import org.apache.kafka.common.serialization.StringSerializer;
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
import org.chtijbug.drools.KieContainerResponse;
|
import org.chtijbug.drools.KieContainerResponse;
|
||||||
import org.chtijbug.drools.KieContainerUpdate;
|
|
||||||
import org.chtijbug.drools.ReverseProxyUpdate;
|
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.chtijbug.drools.console.middle.DababaseContentInit;
|
import org.chtijbug.drools.console.middle.DababaseContentInit;
|
||||||
|
|
@ -129,30 +128,14 @@ public class DroolsSpringBootConsoleApplication extends SpringBootServletInitial
|
||||||
JsonSerializer.class);
|
JsonSerializer.class);
|
||||||
return new DefaultKafkaProducerFactory<>(configProps);
|
return new DefaultKafkaProducerFactory<>(configProps);
|
||||||
}
|
}
|
||||||
@Bean
|
|
||||||
public ProducerFactory<String, KieContainerUpdate> producerKieContainerUpdateFactory() {
|
|
||||||
Map<String, Object> configProps = new HashMap<>();
|
|
||||||
configProps.put(
|
|
||||||
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
|
|
||||||
bootstrapAddress);
|
|
||||||
configProps.put(
|
|
||||||
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
|
|
||||||
StringSerializer.class);
|
|
||||||
configProps.put(
|
|
||||||
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
|
|
||||||
JsonSerializer.class);
|
|
||||||
return new DefaultKafkaProducerFactory<>(configProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplate() {
|
public KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplate() {
|
||||||
return new KafkaTemplate<>(producerFactory());
|
return new KafkaTemplate<>(producerFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public KafkaTemplate<String, KieContainerUpdate> kafkaKieContainerUpdateTemplate() {
|
|
||||||
return new KafkaTemplate<>(producerKieContainerUpdateFactory());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ConsumerFactory<String, KieContainerResponse> greetingConsumerFactory() {
|
public ConsumerFactory<String, KieContainerResponse> greetingConsumerFactory() {
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,13 @@ import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.ColumnDefinition;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.ColumnDefinition;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.DecisionTable;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.DecisionTable;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.GuidedException;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.GuidedException;
|
||||||
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
|
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
|
||||||
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
import org.springframework.context.annotation.DependsOn;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -22,6 +24,8 @@ import java.util.List;
|
||||||
@DependsOn("applicationContext")
|
@DependsOn("applicationContext")
|
||||||
public class DecisionTableExcelService {
|
public class DecisionTableExcelService {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(DecisionTableExcelService.class);
|
||||||
|
|
||||||
@Value("${adminConsole.tmpdir}")
|
@Value("${adminConsole.tmpdir}")
|
||||||
public String tmpDir;
|
public String tmpDir;
|
||||||
|
|
||||||
|
|
@ -75,6 +79,7 @@ public class DecisionTableExcelService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
logger.error("IOException","ImportExcell",e);
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
if (workbook != null) {
|
if (workbook != null) {
|
||||||
|
|
@ -84,7 +89,7 @@ public class DecisionTableExcelService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteArrayInputStream exportExcel(String nameTemplate) {
|
public ByteArrayInputStream exportExcel(String nameTemplate) {
|
||||||
|
|
||||||
//Récupération des objets JAVA
|
//Récupération des objets JAVA
|
||||||
|
|
||||||
|
|
@ -99,7 +104,7 @@ public class DecisionTableExcelService {
|
||||||
try {
|
try {
|
||||||
workbook = new XSSFWorkbook();
|
workbook = new XSSFWorkbook();
|
||||||
DecisionTable decisionTable = new DecisionTable(model);
|
DecisionTable decisionTable = new DecisionTable(model);
|
||||||
CreationHelper createHelper = workbook.getCreationHelper();
|
workbook.getCreationHelper();
|
||||||
Sheet sheet = workbook.createSheet(nameTemplate);
|
Sheet sheet = workbook.createSheet(nameTemplate);
|
||||||
|
|
||||||
Font headerFont = workbook.createFont();
|
Font headerFont = workbook.createFont();
|
||||||
|
|
@ -111,27 +116,26 @@ public class DecisionTableExcelService {
|
||||||
|
|
||||||
Row headerRow = sheet.createRow(0);
|
Row headerRow = sheet.createRow(0);
|
||||||
|
|
||||||
if (decisionTable.getRows() != null && decisionTable.getRows().size() != 0) {
|
if (decisionTable.getRows() != null && !decisionTable.getRows().isEmpty()) {
|
||||||
int columnIndex = 0;
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
||||||
if (columnDefinition.isHideColumn() == false) {
|
if (!columnDefinition.isHideColumn()) {
|
||||||
Cell cell = headerRow.createCell(j);
|
Cell cell = headerRow.createCell(j);
|
||||||
cell.setCellValue(columnDefinition.getHeader());
|
cell.setCellValue(columnDefinition.getHeader());
|
||||||
cell.setCellStyle(headerCellStyle);
|
cell.setCellStyle(headerCellStyle);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
columnIndex++;
|
|
||||||
}
|
}
|
||||||
int rowIndex = 1;
|
int rowIndex = 1;
|
||||||
|
|
||||||
for (int i = 0; i < decisionTable.getRows().size(); i++) {
|
for (int i = 0; i < decisionTable.getRows().size(); i++) {
|
||||||
org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.Row row = decisionTable.getRows().get(i);
|
org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.Row row = decisionTable.getRows().get(i);
|
||||||
int k = 0;
|
int k = 0;
|
||||||
int jj = 0;
|
int jj = 0;
|
||||||
Row r = sheet.createRow(rowIndex);
|
Row r = sheet.createRow(rowIndex);
|
||||||
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
||||||
if (columnDefinition.isHideColumn() == false) {
|
if (!columnDefinition.isHideColumn()) {
|
||||||
Cell cell = r.createCell(k);
|
Cell cell = r.createCell(k);
|
||||||
cell.setCellValue(row.getRowElements().get(jj).getValue());
|
cell.setCellValue(row.getRowElements().get(jj).getValue());
|
||||||
cell.setCellStyle(headerCellStyle);
|
cell.setCellStyle(headerCellStyle);
|
||||||
|
|
@ -144,32 +148,16 @@ public class DecisionTableExcelService {
|
||||||
|
|
||||||
}
|
}
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
try {
|
ByteArrayInputStream is = null;
|
||||||
FileOutputStream fileOutputStream = new FileOutputStream(tmpDir + "/" + nameTemplate + ".xlsx");
|
FileOutputStream fileOutputStream = new FileOutputStream(tmpDir + "/" + nameTemplate + ".xlsx");
|
||||||
workbook.write(fileOutputStream);
|
workbook.write(fileOutputStream);
|
||||||
} catch (FileNotFoundException e) {
|
workbook.write(bos);
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
workbook.write(bos);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
byte[] barray = bos.toByteArray();
|
byte[] barray = bos.toByteArray();
|
||||||
ByteArrayInputStream is = new ByteArrayInputStream(barray);
|
is = new ByteArrayInputStream(barray);
|
||||||
|
workbook.close();
|
||||||
try {
|
|
||||||
workbook.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
|
} catch (GuidedException | IOException e) {
|
||||||
} catch (GuidedException e) {
|
logger.error("new FileOutputStream", e);
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
} finally {
|
||||||
if (workbook != null) {
|
if (workbook != null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ public class GitLabRepositoryService {
|
||||||
public List<GroupElementResponse> getListGitRepostitories(String url, String token, String groupName) {
|
public List<GroupElementResponse> getListGitRepostitories(String url, String token, String groupName) {
|
||||||
|
|
||||||
String completeurl = url + "/groups/" + groupName + "/projects";
|
String completeurl = url + "/groups/" + groupName + "/projects";
|
||||||
logger.info("url gitlab : " + completeurl);
|
logger.info("url gitlab : {}" , completeurl);
|
||||||
ResponseEntity<List<GroupElementResponse>> response = restTemplateKiewb
|
ResponseEntity<List<GroupElementResponse>> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, token), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.GET, requestCallback(null, token), clientHttpResponse -> {
|
||||||
List<GroupElementResponse> extractedResponse = null;
|
List<GroupElementResponse> extractedResponse = null;
|
||||||
|
|
@ -43,8 +43,7 @@ public class GitLabRepositoryService {
|
||||||
GroupElementResponse[] values = mapper.readValue(result, GroupElementResponse[].class);
|
GroupElementResponse[] values = mapper.readValue(result, GroupElementResponse[].class);
|
||||||
extractedResponse = Arrays.asList(values);
|
extractedResponse = Arrays.asList(values);
|
||||||
}
|
}
|
||||||
ResponseEntity<List<GroupElementResponse>> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
return extractedValue;
|
|
||||||
});
|
});
|
||||||
List<GroupElementResponse> reponseMoteur;
|
List<GroupElementResponse> reponseMoteur;
|
||||||
|
|
||||||
|
|
@ -55,7 +54,7 @@ public class GitLabRepositoryService {
|
||||||
public GroupElementResponse createProjectForUser(String url, String token, String projectName) {
|
public GroupElementResponse createProjectForUser(String url, String token, String projectName) {
|
||||||
|
|
||||||
String completeurl = url + "/projects?name=" + projectName;
|
String completeurl = url + "/projects?name=" + projectName;
|
||||||
logger.info("url moteur reco : " + completeurl);
|
logger.info("url moteur reco : {}", completeurl);
|
||||||
ResponseEntity<GroupElementResponse> response = restTemplateKiewb
|
ResponseEntity<GroupElementResponse> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
||||||
GroupElementResponse extractedResponse = null;
|
GroupElementResponse extractedResponse = null;
|
||||||
|
|
@ -64,8 +63,7 @@ public class GitLabRepositoryService {
|
||||||
String result = s.hasNext() ? s.next() : "";
|
String result = s.hasNext() ? s.next() : "";
|
||||||
extractedResponse = mapper.readValue(result, GroupElementResponse.class);
|
extractedResponse = mapper.readValue(result, GroupElementResponse.class);
|
||||||
}
|
}
|
||||||
ResponseEntity<GroupElementResponse> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
return extractedValue;
|
|
||||||
});
|
});
|
||||||
GroupElementResponse reponseMoteur;
|
GroupElementResponse reponseMoteur;
|
||||||
|
|
||||||
|
|
@ -76,7 +74,7 @@ public class GitLabRepositoryService {
|
||||||
public ProjectMoveResponse moveProjectTpGroup(String url, String token, String projectid, String groupName) {
|
public ProjectMoveResponse moveProjectTpGroup(String url, String token, String projectid, String groupName) {
|
||||||
|
|
||||||
String completeurl = url + "/groups/" + groupName + "/projects/" + projectid;
|
String completeurl = url + "/groups/" + groupName + "/projects/" + projectid;
|
||||||
logger.info("url moteur reco : " + completeurl);
|
logger.info("url moteur reco : {}" , completeurl);
|
||||||
ResponseEntity<ProjectMoveResponse> response = restTemplateKiewb
|
ResponseEntity<ProjectMoveResponse> response = restTemplateKiewb
|
||||||
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
.execute(completeurl, HttpMethod.POST, requestCallback(null, token), clientHttpResponse -> {
|
||||||
ProjectMoveResponse extractedResponse = null;
|
ProjectMoveResponse extractedResponse = null;
|
||||||
|
|
@ -85,8 +83,7 @@ public class GitLabRepositoryService {
|
||||||
String result = s.hasNext() ? s.next() : "";
|
String result = s.hasNext() ? s.next() : "";
|
||||||
extractedResponse = mapper.readValue(result, ProjectMoveResponse.class);
|
extractedResponse = mapper.readValue(result, ProjectMoveResponse.class);
|
||||||
}
|
}
|
||||||
ResponseEntity<ProjectMoveResponse> extractedValue = new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
return new ResponseEntity<>(extractedResponse, clientHttpResponse.getHeaders(), clientHttpResponse.getStatusCode());
|
||||||
return extractedValue;
|
|
||||||
});
|
});
|
||||||
ProjectMoveResponse reponseMoteur;
|
ProjectMoveResponse reponseMoteur;
|
||||||
|
|
||||||
|
|
@ -105,7 +102,7 @@ public class GitLabRepositoryService {
|
||||||
clientHttpRequest.getHeaders().add(
|
clientHttpRequest.getHeaders().add(
|
||||||
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
|
||||||
String authHeader = new String(token);
|
String authHeader = token;
|
||||||
clientHttpRequest.getHeaders().add(
|
clientHttpRequest.getHeaders().add(
|
||||||
"Private-Token", authHeader);
|
"Private-Token", authHeader);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package org.chtijbug.drools.console.service;
|
||||||
|
|
||||||
import com.vaadin.flow.component.UI;
|
import com.vaadin.flow.component.UI;
|
||||||
import com.vaadin.flow.server.VaadinSession;
|
import com.vaadin.flow.server.VaadinSession;
|
||||||
import org.chtijbug.drools.KieContainerUpdate;
|
|
||||||
import org.chtijbug.drools.ReverseProxyUpdate;
|
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.chtijbug.drools.console.AddLog;
|
import org.chtijbug.drools.console.AddLog;
|
||||||
|
|
@ -61,8 +60,7 @@ public class ProjectPersistService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplateProxyUpdate;
|
private KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplateProxyUpdate;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private KafkaTemplate<String, KieContainerUpdate> kafkaKieContainerUpdateTemplate;
|
|
||||||
|
|
||||||
public ProjectPersistService() {
|
public ProjectPersistService() {
|
||||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||||
|
|
@ -215,18 +213,7 @@ public class ProjectPersistService {
|
||||||
runtimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name());
|
runtimePojoPersist.setStatus(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name());
|
||||||
containerRuntimeRepository.save(runtimePojoPersist);
|
containerRuntimeRepository.save(runtimePojoPersist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
KieContainerUpdate kieContainerUpdate = new KieContainerUpdate();
|
|
||||||
kieContainerUpdate.setMainClass(projectPersist.getMainClass());
|
|
||||||
kieContainerUpdate.setArtifactID(projectPersist.getArtifactID());
|
|
||||||
kieContainerUpdate.setGroupID(projectPersist.getGroupID());
|
|
||||||
kieContainerUpdate.setProjectVersion(projectPersist.getProjectVersion());
|
|
||||||
kieContainerUpdate.setContainerID(projectPersist.getContainerID());
|
|
||||||
kieContainerUpdate.setAction(KieContainerUpdate.STATUS.TODEPLOY);
|
|
||||||
kafkaKieContainerUpdateTemplate.send(serverName,kieContainerUpdate);
|
|
||||||
workOnGoingView.addRow("Deploy Request="+kieContainerUpdate,ui);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ package org.chtijbug.drools.console.util;
|
||||||
|
|
||||||
import com.vaadin.flow.data.validator.RegexpValidator;
|
import com.vaadin.flow.data.validator.RegexpValidator;
|
||||||
|
|
||||||
public class hostnameValidator extends RegexpValidator {
|
public class HostnameValidator extends RegexpValidator {
|
||||||
|
|
||||||
private static final String PATTERN ="(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$)";
|
private static final String PATTERN ="(^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$)";
|
||||||
|
|
||||||
public hostnameValidator(String errorMessage) {
|
public HostnameValidator(String errorMessage) {
|
||||||
super(errorMessage, PATTERN, true);
|
super(errorMessage, PATTERN, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,6 +7,6 @@ public class PasswordValidator extends RegexpValidator {
|
||||||
private static final String PATTERN = "[a-zA-Z0-9_@./*#&+-]{4,30}";
|
private static final String PATTERN = "[a-zA-Z0-9_@./*#&+-]{4,30}";
|
||||||
|
|
||||||
public PasswordValidator(String errorMessage) {
|
public PasswordValidator(String errorMessage) {
|
||||||
super(errorMessage, "[a-zA-Z0-9_@./#*&+-]{4,30}", true);
|
super(errorMessage, PATTERN, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.Squelette;
|
package org.chtijbug.drools.console.vaadincomponent.Squelette;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.component.splitlayout.SplitLayout;
|
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.ConsoleDeploy;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.ConsoleDeploy;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.LeftMenuGlobal;
|
import org.chtijbug.drools.console.vaadincomponent.leftMenu.LeftMenuGlobal;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.menu.*;
|
import org.chtijbug.drools.console.vaadincomponent.menu.*;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||||
|
|
||||||
|
|
||||||
import com.vaadin.flow.component.combobox.ComboBox;
|
import com.vaadin.flow.component.combobox.ComboBox;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||||
|
|
||||||
import com.vaadin.flow.component.datepicker.DatePicker;
|
import com.vaadin.flow.component.datepicker.DatePicker;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.Icon;
|
import com.vaadin.flow.component.icon.Icon;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.ComponentPerso;
|
package org.chtijbug.drools.console.vaadincomponent.componentperso;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.Icon;
|
import com.vaadin.flow.component.icon.Icon;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.grid.Grid;
|
import com.vaadin.flow.component.grid.Grid;
|
||||||
|
|
@ -7,8 +7,8 @@ import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.GuidedDecisionTableModelTransformer;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.GuidedDecisionTableModelTransformer;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.GuidedRuleTemplateModelTransformer;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.GuidedRuleTemplateModelTransformer;
|
||||||
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
|
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
|
||||||
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
||||||
import org.drools.workbench.models.guided.template.backend.RuleTemplateModelXMLPersistenceImpl;
|
import org.drools.workbench.models.guided.template.backend.RuleTemplateModelXMLPersistenceImpl;
|
||||||
|
|
@ -21,10 +21,11 @@ import java.util.Map;
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class AssetEdit extends Grid<HashMap<String, Object>> {
|
public class AssetEdit extends Grid<HashMap<String, Object>> {
|
||||||
|
|
||||||
private KieRepositoryService kieRepositoryService;
|
private transient KieRepositoryService kieRepositoryService;
|
||||||
private KieConfigurationData config;
|
|
||||||
|
|
||||||
private UserConnectedService userConnectedService;
|
private transient KieConfigurationData config;
|
||||||
|
|
||||||
|
private transient UserConnectedService userConnectedService;
|
||||||
|
|
||||||
public AssetEdit() {
|
public AssetEdit() {
|
||||||
|
|
||||||
|
|
@ -43,7 +44,7 @@ public class AssetEdit extends Grid<HashMap<String, Object>> {
|
||||||
Binder<HashMap<String, Object>> binder = new Binder<>();
|
Binder<HashMap<String, Object>> binder = new Binder<>();
|
||||||
getEditor().setBinder(binder);
|
getEditor().setBinder(binder);
|
||||||
setClassName("grid-perso");
|
setClassName("grid-perso");
|
||||||
if (assetContent.startsWith("<decision-table52")==true){
|
if (assetContent.startsWith("<decision-table52")){
|
||||||
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal(assetContent);
|
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal(assetContent);
|
||||||
GuidedDecisionTableModelTransformer transform = new GuidedDecisionTableModelTransformer(model, binder, this);
|
GuidedDecisionTableModelTransformer transform = new GuidedDecisionTableModelTransformer(model, binder, this);
|
||||||
transform.run();
|
transform.run();
|
||||||
|
|
@ -68,7 +69,7 @@ public class AssetEdit extends Grid<HashMap<String, Object>> {
|
||||||
Binder<HashMap<String, Object>> binder = new Binder<>();
|
Binder<HashMap<String, Object>> binder = new Binder<>();
|
||||||
getEditor().setBinder(binder);
|
getEditor().setBinder(binder);
|
||||||
|
|
||||||
if(objects.size()>0){
|
if(!objects.isEmpty()){
|
||||||
for(Map.Entry<String,Object> t:objects.get(0).entrySet()){
|
for(Map.Entry<String,Object> t:objects.get(0).entrySet()){
|
||||||
addColumn(hashmap -> hashmap.get(t.getKey())).setHeader(t.getKey());
|
addColumn(hashmap -> hashmap.get(t.getKey())).setHeader(t.getKey());
|
||||||
|
|
||||||
|
|
@ -78,10 +79,5 @@ public class AssetEdit extends Grid<HashMap<String, Object>> {
|
||||||
setItems(objects);
|
setItems(objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void maj(List<HashMap<String, Object>> objects){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dialog.Dialog;
|
import com.vaadin.flow.component.dialog.Dialog;
|
||||||
|
|
@ -24,7 +24,7 @@ public class AssociateProjectKie extends VerticalLayout {
|
||||||
|
|
||||||
private Button associer;
|
private Button associer;
|
||||||
|
|
||||||
private ProjectPersistService projectPersistService;
|
private transient ProjectPersistService projectPersistService;
|
||||||
|
|
||||||
public AssociateProjectKie(DeploymentView deploymentView, Dialog dialog, ProjectPersist projectPersist) {
|
public AssociateProjectKie(DeploymentView deploymentView, Dialog dialog, ProjectPersist projectPersist) {
|
||||||
|
|
||||||
|
|
@ -52,11 +52,11 @@ public class AssociateProjectKie extends VerticalLayout {
|
||||||
for (RuntimePersist runtimePersist : gridRuntime.getSelectedItems()) {
|
for (RuntimePersist runtimePersist : gridRuntime.getSelectedItems()) {
|
||||||
lstToSave.add(runtimePersist);
|
lstToSave.add(runtimePersist);
|
||||||
}
|
}
|
||||||
if (lstToSave.size()>0) {
|
if (!lstToSave.isEmpty()) {
|
||||||
|
|
||||||
boolean tmp = projectPersistService.associate(projectPersist,lstToSave);
|
boolean tmp = projectPersistService.associate(projectPersist, lstToSave);
|
||||||
|
|
||||||
if (tmp == true) {
|
if (tmp) {
|
||||||
deploymentView.setDataProvider();
|
deploymentView.setDataProvider();
|
||||||
dialog.close();
|
dialog.close();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -67,12 +67,7 @@ public class AssociateProjectKie extends VerticalLayout {
|
||||||
});
|
});
|
||||||
|
|
||||||
gridRuntime.addSelectionListener(selectionEvent -> {
|
gridRuntime.addSelectionListener(selectionEvent -> {
|
||||||
if ( selectionEvent.getFirstSelectedItem().isPresent()) {
|
associer.setEnabled(selectionEvent.getFirstSelectedItem().isPresent());
|
||||||
|
|
||||||
associer.setEnabled(true);
|
|
||||||
} else {
|
|
||||||
associer.setEnabled(false);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,96 +1,96 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
|
import com.vaadin.flow.component.html.Label;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.component.html.Label;
|
|
||||||
import com.vaadin.flow.component.page.Push;
|
|
||||||
import org.chtijbug.drools.console.AddLog;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class ConsoleDeploy extends HorizontalLayout {
|
public class ConsoleDeploy extends HorizontalLayout {
|
||||||
|
|
||||||
public VerticalLayout outilsBar;
|
private static String activeClass = "active";
|
||||||
|
|
||||||
public VerticalLayout content;
|
private transient VerticalLayout outilsBar;
|
||||||
|
|
||||||
public HorizontalLayout titleContent;
|
private transient VerticalLayout content;
|
||||||
|
|
||||||
public VerticalLayout logContent;
|
private transient HorizontalLayout titleContent;
|
||||||
|
|
||||||
public Button menu;
|
private transient VerticalLayout logContent;
|
||||||
|
|
||||||
public Button clear;
|
private transient Button menu;
|
||||||
|
|
||||||
private Label title;
|
private transient Button clear;
|
||||||
|
|
||||||
public ConsoleDeploy(){
|
private transient Label title;
|
||||||
|
|
||||||
|
public ConsoleDeploy() {
|
||||||
|
|
||||||
setClassName("console-content-all");
|
setClassName("console-content-all");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|
||||||
outilsBar=new VerticalLayout();
|
outilsBar = new VerticalLayout();
|
||||||
outilsBar.setClassName("console-outilsBar-content");
|
outilsBar.setClassName("console-outilsBar-content");
|
||||||
add(outilsBar);
|
add(outilsBar);
|
||||||
|
|
||||||
menu=new Button("",VaadinIcon.MENU.create());
|
menu = new Button("", VaadinIcon.MENU.create());
|
||||||
menu.setClassName("console-button");
|
menu.setClassName("console-button");
|
||||||
menu.addClickListener(buttonClickEvent -> {
|
menu.addClickListener(buttonClickEvent -> {
|
||||||
if(isActive()){
|
if (isActive()) {
|
||||||
removeActive();
|
removeActive();
|
||||||
content.setVisible(false);
|
content.setVisible(false);
|
||||||
}else {
|
} else {
|
||||||
active();
|
active();
|
||||||
content.setVisible(true);
|
content.setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
outilsBar.add(menu);
|
outilsBar.add(menu);
|
||||||
|
|
||||||
clear=new Button("", VaadinIcon.PANEL.create());
|
clear = new Button("", VaadinIcon.PANEL.create());
|
||||||
clear.setClassName("console-button");
|
clear.setClassName("console-button");
|
||||||
clear.addClickListener(buttonClickEvent -> {
|
clear.addClickListener(buttonClickEvent ->
|
||||||
logContent.removeAll();
|
logContent.removeAll()
|
||||||
});
|
);
|
||||||
outilsBar.add(clear);
|
outilsBar.add(clear);
|
||||||
|
|
||||||
content=new VerticalLayout();
|
content = new VerticalLayout();
|
||||||
content.setClassName("console-content");
|
content.setClassName("console-content");
|
||||||
add(content);
|
add(content);
|
||||||
content.setVisible(false);
|
content.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
titleContent=new HorizontalLayout();
|
titleContent = new HorizontalLayout();
|
||||||
titleContent.setClassName("console-content-title");
|
titleContent.setClassName("console-content-title");
|
||||||
content.add(titleContent);
|
content.add(titleContent);
|
||||||
|
|
||||||
title=new Label("Console : ");
|
title = new Label("Console : ");
|
||||||
title.setClassName("console-title");
|
title.setClassName("console-title");
|
||||||
titleContent.add(title);
|
titleContent.add(title);
|
||||||
|
|
||||||
logContent=new VerticalLayout();
|
logContent = new VerticalLayout();
|
||||||
logContent.setClassName("console-log-content");
|
logContent.setClassName("console-log-content");
|
||||||
content.add(logContent);
|
content.add(logContent);
|
||||||
}
|
}
|
||||||
private boolean isActive(){
|
|
||||||
return getClassNames().contains("active");
|
private boolean isActive() {
|
||||||
|
return getClassNames().contains(activeClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeActive() {
|
private void removeActive() {
|
||||||
|
|
||||||
if(getClassNames().contains("active")){
|
if (getClassNames().contains(activeClass)) {
|
||||||
getClassNames().remove("active");
|
getClassNames().remove(activeClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void active(){
|
|
||||||
|
private void active() {
|
||||||
removeActive();
|
removeActive();
|
||||||
|
|
||||||
getClassNames().add("active");
|
getClassNames().add(activeClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTtile(String nameProject){
|
public void setTtile(String nameProject) {
|
||||||
title.setText("Console : "+nameProject);
|
title.setText("Console : " + nameProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VerticalLayout getLogContent() {
|
public VerticalLayout getLogContent() {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dialog.Dialog;
|
import com.vaadin.flow.component.dialog.Dialog;
|
||||||
|
|
@ -8,10 +8,9 @@ import com.vaadin.flow.component.notification.Notification;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.ComboBoxPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.ComboBoxPerso;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.TextFieldPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.TextFieldPerso;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
|
|
||||||
|
|
@ -31,16 +30,12 @@ public class DefineProject extends VerticalLayout {
|
||||||
|
|
||||||
private Button valider;
|
private Button valider;
|
||||||
|
|
||||||
//METIER
|
private transient ProjectPersistService projectPersistService;
|
||||||
|
|
||||||
private UserConnectedService userConnectedService;
|
|
||||||
|
|
||||||
private ProjectPersistService projectPersistService;
|
|
||||||
private boolean createMode;
|
private boolean createMode;
|
||||||
|
|
||||||
public DefineProject(DeploymentView deploymentView,Dialog dialog, ProjectPersist projectPersist){
|
public DefineProject(DeploymentView deploymentView,Dialog dialog, ProjectPersist projectPersist){
|
||||||
|
|
||||||
userConnectedService= AppContext.getApplicationContext().getBean(UserConnectedService.class);
|
|
||||||
projectPersistService=AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
projectPersistService=AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||||
|
|
||||||
setClassName("creation-runtime-content");
|
setClassName("creation-runtime-content");
|
||||||
|
|
@ -76,7 +71,7 @@ public class DefineProject extends VerticalLayout {
|
||||||
mainClass.getComboBox().setRequired(true);
|
mainClass.getComboBox().setRequired(true);
|
||||||
if (projectPersist.getMainClass()!= null
|
if (projectPersist.getMainClass()!= null
|
||||||
&& projectPersist.getMainClass().length()>0){
|
&& projectPersist.getMainClass().length()>0){
|
||||||
mainClass.getComboBox().setValue("class="+(String)projectPersist.getMainClass());
|
mainClass.getComboBox().setValue("class="+projectPersist.getMainClass());
|
||||||
}
|
}
|
||||||
mainClass.getComboBox().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
mainClass.getComboBox().addValueChangeListener(textFieldStringComponentValueChangeEvent -> {
|
||||||
verify();
|
verify();
|
||||||
|
|
@ -114,7 +109,7 @@ public class DefineProject extends VerticalLayout {
|
||||||
}
|
}
|
||||||
valider.setClassName("login-application-connexion");
|
valider.setClassName("login-application-connexion");
|
||||||
valider.addClickListener(buttonClickEvent -> {
|
valider.addClickListener(buttonClickEvent -> {
|
||||||
if (createMode==true) {
|
if (createMode) {
|
||||||
projectPersist.setStatus(ProjectPersist.DEFINI);
|
projectPersist.setStatus(ProjectPersist.DEFINI);
|
||||||
}
|
}
|
||||||
projectPersistService.addProjectToSession(projectPersist,true);
|
projectPersistService.addProjectToSession(projectPersist,true);
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
@ -16,7 +16,7 @@ import com.vaadin.flow.data.value.ValueChangeMode;
|
||||||
import com.vaadin.flow.function.SerializablePredicate;
|
import com.vaadin.flow.function.SerializablePredicate;
|
||||||
import org.chtijbug.drools.console.service.IndexerService;
|
import org.chtijbug.drools.console.service.IndexerService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||||
import org.chtijbug.drools.logging.Fact;
|
import org.chtijbug.drools.logging.Fact;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
|
@ -52,18 +52,18 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
private ListDataProvider<BusinessTransactionAction> dataProvider;
|
private ListDataProvider<BusinessTransactionAction> dataProvider;
|
||||||
private ConfigurableFilterDataProvider<BusinessTransactionAction, Void, SerializablePredicate<BusinessTransactionAction>> filterDataProvider;
|
private ConfigurableFilterDataProvider<BusinessTransactionAction, Void, SerializablePredicate<BusinessTransactionAction>> filterDataProvider;
|
||||||
|
|
||||||
private IndexerService indexerService;
|
private transient IndexerService indexerService;
|
||||||
|
|
||||||
public GridActionLogging(String idRequest) {
|
public GridActionLogging(String idRequest) {
|
||||||
|
|
||||||
mapper.setDateFormat( new SimpleDateFormat("dd-MM-yyyy hh:mm"));
|
mapper.setDateFormat(new SimpleDateFormat("dd-MM-yyyy hh:mm"));
|
||||||
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
|
indexerService = AppContext.getApplicationContext().getBean(IndexerService.class);
|
||||||
|
|
||||||
setClassName("action-log-grid-perso");
|
setClassName("action-log-grid-perso");
|
||||||
setSelectionMode(Grid.SelectionMode.SINGLE);
|
setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||||
setVerticalScrollingEnabled(true);
|
setVerticalScrollingEnabled(true);
|
||||||
|
|
||||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
|
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
Label label = new Label();
|
Label label = new Label();
|
||||||
|
|
@ -87,43 +87,43 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
Grid.Column<BusinessTransactionAction> enventTypeC = addColumn(runtimePersist -> runtimePersist.getEventType());
|
Grid.Column<BusinessTransactionAction> enventTypeC = addColumn(runtimePersist -> runtimePersist.getEventType());
|
||||||
this.eventType = new TextField(strEventType);
|
this.eventType = new TextField(strEventType);
|
||||||
this.eventType.setValueChangeMode(ValueChangeMode.EAGER);
|
this.eventType.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
this.eventType.addValueChangeListener(e -> {
|
this.eventType.addValueChangeListener(e ->
|
||||||
refreshtGrid(this.eventType.getValue(), strEventType);
|
refreshtGrid(this.eventType.getValue(), strEventType)
|
||||||
});
|
);
|
||||||
enventTypeC.setHeader(this.eventType).setResizable(true);
|
enventTypeC.setHeader(this.eventType).setResizable(true);
|
||||||
|
|
||||||
Grid.Column<BusinessTransactionAction> positionC = addColumn(runtimePersist -> runtimePersist.getEventNumber());
|
Grid.Column<BusinessTransactionAction> positionC = addColumn(runtimePersist -> runtimePersist.getEventNumber());
|
||||||
|
|
||||||
positionExecution = new TextField(strPositionExecution);
|
positionExecution = new TextField(strPositionExecution);
|
||||||
positionExecution.setValueChangeMode(ValueChangeMode.EAGER);
|
positionExecution.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
positionExecution.addValueChangeListener(e -> {
|
positionExecution.addValueChangeListener(e ->
|
||||||
refreshtGrid(positionExecution.getValue(), strPositionExecution);
|
refreshtGrid(positionExecution.getValue(), strPositionExecution)
|
||||||
});
|
);
|
||||||
positionC.setHeader(positionExecution).setResizable(true);
|
positionC.setHeader(positionExecution).setResizable(true);
|
||||||
positionC.setWidth("3%");
|
positionC.setWidth("3%");
|
||||||
|
|
||||||
Grid.Column<BusinessTransactionAction> ruleNameC = addColumn(runtimePersist -> runtimePersist.getRuleExecution() != null ? runtimePersist.getRuleExecution().getRuleName() : "");
|
Grid.Column<BusinessTransactionAction> ruleNameC = addColumn(runtimePersist -> runtimePersist.getRuleExecution() != null ? runtimePersist.getRuleExecution().getRuleName() : "");
|
||||||
ruleName = new TextField(strRuleName);
|
ruleName = new TextField(strRuleName);
|
||||||
ruleName.setValueChangeMode(ValueChangeMode.EAGER);
|
ruleName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
ruleName.addValueChangeListener(e -> {
|
ruleName.addValueChangeListener(e ->
|
||||||
refreshtGrid(ruleName.getValue(), strRuleName);
|
refreshtGrid(ruleName.getValue(), strRuleName)
|
||||||
});
|
);
|
||||||
ruleNameC.setHeader(ruleName).setResizable(true);
|
ruleNameC.setHeader(ruleName).setResizable(true);
|
||||||
|
|
||||||
Grid.Column<BusinessTransactionAction> versionC = addColumn(runtimePersist -> runtimePersist.getRuleExecution() != null ? runtimePersist.getRuleExecution().getPackageName() : "");
|
Grid.Column<BusinessTransactionAction> versionC = addColumn(runtimePersist -> runtimePersist.getRuleExecution() != null ? runtimePersist.getRuleExecution().getPackageName() : "");
|
||||||
packageName = new TextField(strPackageName);
|
packageName = new TextField(strPackageName);
|
||||||
packageName.setValueChangeMode(ValueChangeMode.EAGER);
|
packageName.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
packageName.addValueChangeListener(e -> {
|
packageName.addValueChangeListener(e ->
|
||||||
refreshtGrid(packageName.getValue(), strPackageName);
|
refreshtGrid(packageName.getValue(), strPackageName)
|
||||||
});
|
);
|
||||||
versionC.setHeader(packageName).setResizable(true);
|
versionC.setHeader(packageName).setResizable(true);
|
||||||
|
|
||||||
Grid.Column<BusinessTransactionAction> ruleflowC = addColumn(runtimePersist -> runtimePersist.getRuleflowGroupName() != null ? runtimePersist.getRuleflowGroupName() : "");
|
Grid.Column<BusinessTransactionAction> ruleflowC = addColumn(runtimePersist -> runtimePersist.getRuleflowGroupName() != null ? runtimePersist.getRuleflowGroupName() : "");
|
||||||
ruleFlowGroup = new TextField(strRuleFlowGroup);
|
ruleFlowGroup = new TextField(strRuleFlowGroup);
|
||||||
ruleFlowGroup.setValueChangeMode(ValueChangeMode.EAGER);
|
ruleFlowGroup.setValueChangeMode(ValueChangeMode.EAGER);
|
||||||
ruleFlowGroup.addValueChangeListener(e -> {
|
ruleFlowGroup.addValueChangeListener(e ->
|
||||||
refreshtGrid(ruleFlowGroup.getValue(), strRuleFlowGroup);
|
refreshtGrid(ruleFlowGroup.getValue(), strRuleFlowGroup)
|
||||||
});
|
);
|
||||||
ruleflowC.setHeader(ruleFlowGroup).setResizable(true);
|
ruleflowC.setHeader(ruleFlowGroup).setResizable(true);
|
||||||
|
|
||||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
|
|
@ -140,21 +140,21 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
if (b != null && b.getInputData() != null && b.getInputData().getRealFact() != null) {
|
if (b != null && b.getInputData() != null && b.getInputData().getRealFact() != null) {
|
||||||
|
|
||||||
VerticalLayout verticalLayout = new VerticalLayout();
|
VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
Label label = new Label(b.getEventType().name() );
|
Label label = new Label(b.getEventType().name());
|
||||||
label.setClassName("creation-runtime-title");
|
label.setClassName("creation-runtime-title");
|
||||||
verticalLayout.add(label);
|
verticalLayout.add(label);
|
||||||
verticalLayout.setClassName("content-action-logging");
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
|
||||||
TextArea textArea = new TextArea(b.getInputData().getFactType().name()+"-"+b.getInputData().getFullClassName());
|
TextArea textArea = new TextArea(b.getInputData().getFactType().name() + "-" + b.getInputData().getFullClassName());
|
||||||
textArea.setReadOnly(true);
|
textArea.setReadOnly(true);
|
||||||
textArea.setClassName("content-log");
|
textArea.setClassName("content-log");
|
||||||
try {
|
try {
|
||||||
mapper.setDateFormat( new SimpleDateFormat("dd-MM-yyyy hh:mm"));
|
mapper.setDateFormat(new SimpleDateFormat("dd-MM-yyyy hh:mm"));
|
||||||
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getInputData().getRealFact());
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getInputData().getRealFact());
|
||||||
textArea.setValue(text);
|
textArea.setValue(text);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
textArea.setValue(
|
textArea.setValue(
|
||||||
b.getInputData().getRealFact().toString().replaceAll(",", ",\n")
|
b.getInputData().getRealFact().toString().replace(",", ",\n")
|
||||||
.replaceAll("\\{", "\\{\n")
|
.replaceAll("\\{", "\\{\n")
|
||||||
.replaceAll("\\}", "\n\\}")
|
.replaceAll("\\}", "\n\\}")
|
||||||
.replaceAll("\\[", "\n\\[")
|
.replaceAll("\\[", "\n\\[")
|
||||||
|
|
@ -186,7 +186,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
verticalLayout.add(label);
|
verticalLayout.add(label);
|
||||||
verticalLayout.setClassName("content-action-logging");
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
|
||||||
TextArea textArea = new TextArea(b.getFact().getFactType().name()+"-"+b.getFact().getFullClassName());
|
TextArea textArea = new TextArea(b.getFact().getFactType().name() + "-" + b.getFact().getFullClassName());
|
||||||
textArea.setReadOnly(true);
|
textArea.setReadOnly(true);
|
||||||
textArea.setClassName("content-log");
|
textArea.setClassName("content-log");
|
||||||
try {
|
try {
|
||||||
|
|
@ -194,10 +194,10 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
textArea.setValue(text);
|
textArea.setValue(text);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
textArea.setValue(
|
textArea.setValue(
|
||||||
b.getFact().getRealFact().toString().replaceAll(",", ",\n")
|
b.getFact().getRealFact().toString().replace(",", ",\n")
|
||||||
.replaceAll("\\{", "\\{\n")
|
.replace("\\{", "\\{\n")
|
||||||
.replaceAll("\\}", "\n\\}")
|
.replace("\\}", "\n\\}")
|
||||||
.replaceAll("\\[", "\n\\[")
|
.replace("\\[", "\n\\[")
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -209,7 +209,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
});
|
});
|
||||||
horizontalLayout.add(realFact);
|
horizontalLayout.add(realFact);
|
||||||
}
|
}
|
||||||
if (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getThenFacts() != null && runtimePersist.getRuleExecution().getThenFacts().size() > 0) {
|
if (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getThenFacts() != null && !runtimePersist.getRuleExecution().getThenFacts().isEmpty()) {
|
||||||
Button whenFact = new Button("When Data");
|
Button whenFact = new Button("When Data");
|
||||||
whenFact.setClassName("menu-button");
|
whenFact.setClassName("menu-button");
|
||||||
whenFact.setEnabled(true);
|
whenFact.setEnabled(true);
|
||||||
|
|
@ -228,7 +228,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
for (Fact fact : b.getRuleExecution().getWhenFacts()) {
|
for (Fact fact : b.getRuleExecution().getWhenFacts()) {
|
||||||
if (fact != null && fact.getRealFact() != null) {
|
if (fact != null && fact.getRealFact() != null) {
|
||||||
|
|
||||||
TextArea textArea = new TextArea(fact.getFactType().name()+"-"+fact.getFullClassName());
|
TextArea textArea = new TextArea(fact.getFactType().name() + "-" + fact.getFullClassName());
|
||||||
textArea.setReadOnly(true);
|
textArea.setReadOnly(true);
|
||||||
textArea.setClassName("content-log");
|
textArea.setClassName("content-log");
|
||||||
try {
|
try {
|
||||||
|
|
@ -236,10 +236,10 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
textArea.setValue(text);
|
textArea.setValue(text);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
textArea.setValue(
|
textArea.setValue(
|
||||||
fact.getRealFact().toString().replaceAll(",", ",\n")
|
fact.getRealFact().toString().replace(",", ",\n")
|
||||||
.replaceAll("\\{", "\\{\n")
|
.replace("\\{", "\\{\n")
|
||||||
.replaceAll("\\}", "\n\\}")
|
.replace("\\}", "\n\\}")
|
||||||
.replaceAll("\\[", "\n\\[")
|
.replace("\\[", "\n\\[")
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,8 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
});
|
});
|
||||||
horizontalLayout.add(whenFact);
|
horizontalLayout.add(whenFact);
|
||||||
}
|
}
|
||||||
if (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getThenFacts() != null && runtimePersist.getRuleExecution().getThenFacts().size() > 0) {
|
if (runtimePersist.getRuleExecution() != null && runtimePersist.getRuleExecution().getThenFacts() != null
|
||||||
|
&& !runtimePersist.getRuleExecution().getThenFacts().isEmpty()) {
|
||||||
|
|
||||||
Button thenFact = new Button("Then data");
|
Button thenFact = new Button("Then data");
|
||||||
thenFact.setClassName("menu-button");
|
thenFact.setClassName("menu-button");
|
||||||
|
|
@ -263,7 +264,8 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
|
|
||||||
BusinessTransactionAction b = runtimePersist;
|
BusinessTransactionAction b = runtimePersist;
|
||||||
|
|
||||||
if (b != null && b.getRuleExecution() != null && b.getRuleExecution().getThenFacts() != null) {
|
if (b != null && b.getRuleExecution() != null
|
||||||
|
&& b.getRuleExecution().getThenFacts() != null) {
|
||||||
|
|
||||||
VerticalLayout verticalLayout = new VerticalLayout();
|
VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
Label label = new Label(b.getEventType().name() + " - " + (b.getRuleExecution() != null && b.getRuleExecution().getRuleName() != null ? b.getRuleExecution().getRuleName() : ""));
|
Label label = new Label(b.getEventType().name() + " - " + (b.getRuleExecution() != null && b.getRuleExecution().getRuleName() != null ? b.getRuleExecution().getRuleName() : ""));
|
||||||
|
|
@ -273,7 +275,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
for (Fact fact : b.getRuleExecution().getThenFacts()) {
|
for (Fact fact : b.getRuleExecution().getThenFacts()) {
|
||||||
if (fact != null && fact.getRealFact() != null) {
|
if (fact != null && fact.getRealFact() != null) {
|
||||||
|
|
||||||
TextArea textArea = new TextArea(fact.getFactType().name()+"-"+fact.getFullClassName());
|
TextArea textArea = new TextArea(fact.getFactType().name() + "-" + fact.getFullClassName());
|
||||||
textArea.setReadOnly(true);
|
textArea.setReadOnly(true);
|
||||||
textArea.setClassName("content-log");
|
textArea.setClassName("content-log");
|
||||||
try {
|
try {
|
||||||
|
|
@ -281,10 +283,10 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
textArea.setValue(text);
|
textArea.setValue(text);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
textArea.setValue(
|
textArea.setValue(
|
||||||
fact.getRealFact().toString().replaceAll(",", ",\n")
|
fact.getRealFact().toString().replace(",", ",\n")
|
||||||
.replaceAll("\\{", "\\{\n")
|
.replace("\\{", "\\{\n")
|
||||||
.replaceAll("\\}", "\n\\}")
|
.replace("\\}", "\n\\}")
|
||||||
.replaceAll("\\[", "\n\\[")
|
.replace("\\[", "\n\\[")
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -309,12 +311,12 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
if (b != null && b.getOutputData() != null && b.getOutputData().getRealFact() != null) {
|
if (b != null && b.getOutputData() != null && b.getOutputData().getRealFact() != null) {
|
||||||
|
|
||||||
VerticalLayout verticalLayout = new VerticalLayout();
|
VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
Label label = new Label(b.getEventType().name() );
|
Label label = new Label(b.getEventType().name());
|
||||||
label.setClassName("creation-runtime-title");
|
label.setClassName("creation-runtime-title");
|
||||||
verticalLayout.add(label);
|
verticalLayout.add(label);
|
||||||
verticalLayout.setClassName("content-action-logging");
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
|
||||||
TextArea textArea = new TextArea(b.getOutputData().getFactType().name()+"-"+b.getOutputData().getFullClassName());
|
TextArea textArea = new TextArea(b.getOutputData().getFactType().name() + "-" + b.getOutputData().getFullClassName());
|
||||||
textArea.setReadOnly(true);
|
textArea.setReadOnly(true);
|
||||||
textArea.setClassName("content-log");
|
textArea.setClassName("content-log");
|
||||||
try {
|
try {
|
||||||
|
|
@ -322,10 +324,10 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||||
textArea.setValue(text);
|
textArea.setValue(text);
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
textArea.setValue(
|
textArea.setValue(
|
||||||
b.getOutputData().getRealFact().toString().replaceAll(",", ",\n")
|
b.getOutputData().getRealFact().toString().replace(",", ",\n")
|
||||||
.replaceAll("\\{", "\\{\n")
|
.replace("\\{", "\\{\n")
|
||||||
.replaceAll("\\}", "\n\\}")
|
.replace("\\}", "\n\\}")
|
||||||
.replaceAll("\\[", "\n\\[")
|
.replace("\\[", "\n\\[")
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||||
|
|
||||||
import com.vaadin.flow.component.grid.Grid;
|
import com.vaadin.flow.component.grid.Grid;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
|
|
@ -43,7 +43,7 @@ public class GridLogging extends Grid<BusinessTransactionPersistence> {
|
||||||
private ListDataProvider<BusinessTransactionPersistence> dataProvider;
|
private ListDataProvider<BusinessTransactionPersistence> dataProvider;
|
||||||
private ConfigurableFilterDataProvider<BusinessTransactionPersistence,Void,SerializablePredicate<BusinessTransactionPersistence>> filterDataProvider;
|
private ConfigurableFilterDataProvider<BusinessTransactionPersistence,Void,SerializablePredicate<BusinessTransactionPersistence>> filterDataProvider;
|
||||||
|
|
||||||
private IndexerService indexerService;
|
private transient IndexerService indexerService;
|
||||||
|
|
||||||
public GridLogging(){
|
public GridLogging(){
|
||||||
|
|
||||||
|
|
@ -54,10 +54,7 @@ public class GridLogging extends Grid<BusinessTransactionPersistence> {
|
||||||
|
|
||||||
|
|
||||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||||
|
return new Label(runtimePersist.getHour()+":"+runtimePersist.getMinute()+":"+runtimePersist.getMillis()+" ->"+runtimePersist.getDay()+"/"+runtimePersist.getMonth()+"/"+runtimePersist.getYear());
|
||||||
Label label=new Label(runtimePersist.getHour()+":"+runtimePersist.getMinute()+":"+runtimePersist.getMillis()+" ->"+runtimePersist.getDay()+"/"+runtimePersist.getMonth()+"/"+runtimePersist.getYear());
|
|
||||||
|
|
||||||
return label;
|
|
||||||
})).setHeader("Date");
|
})).setHeader("Date");
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
package org.chtijbug.drools.console.vaadincomponent.componentview;
|
||||||
|
|
||||||
import com.vaadin.flow.component.grid.Grid;
|
import com.vaadin.flow.component.grid.Grid;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
|
|
@ -41,8 +41,8 @@ public class GridRuntime extends Grid<RuntimePersist> {
|
||||||
|
|
||||||
private String strStatus = "State";
|
private String strStatus = "State";
|
||||||
|
|
||||||
private ProjectPersistService projectPersistService;
|
private transient ProjectPersistService projectPersistService;
|
||||||
private RuntimeService runtimeService;
|
private transient RuntimeService runtimeService;
|
||||||
|
|
||||||
private ListDataProvider<RuntimePersist> dataProvider;
|
private ListDataProvider<RuntimePersist> dataProvider;
|
||||||
private ConfigurableFilterDataProvider<RuntimePersist, Void, SerializablePredicate<RuntimePersist>> filterDataProvider;
|
private ConfigurableFilterDataProvider<RuntimePersist, Void, SerializablePredicate<RuntimePersist>> filterDataProvider;
|
||||||
|
|
@ -1,19 +1,16 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView.service;
|
package org.chtijbug.drools.console.vaadincomponent.componentview.service;
|
||||||
|
|
||||||
import com.vaadin.flow.data.binder.Binder;
|
import com.vaadin.flow.data.binder.Binder;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.AssetEdit;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.AssetEdit;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.ColumnDefinition;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.ColumnDefinition;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.DecisionTable;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.DecisionTable;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.GuidedException;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.GuidedException;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.Row;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.Row;
|
||||||
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class GuidedDecisionTableModelTransformer {
|
public class GuidedDecisionTableModelTransformer {
|
||||||
|
|
||||||
|
|
@ -33,7 +30,7 @@ public class GuidedDecisionTableModelTransformer {
|
||||||
try {
|
try {
|
||||||
DecisionTable decisionTable = new DecisionTable(model);
|
DecisionTable decisionTable = new DecisionTable(model);
|
||||||
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
for (ColumnDefinition columnDefinition : decisionTable.getColumnDefinitionList()) {
|
||||||
if (columnDefinition.isHideColumn()==false) {
|
if (!columnDefinition.isHideColumn()) {
|
||||||
assetEdit.addColumn(hashmap -> hashmap.get(columnDefinition.getHeader())).setHeader(columnDefinition.getHeader());
|
assetEdit.addColumn(hashmap -> hashmap.get(columnDefinition.getHeader())).setHeader(columnDefinition.getHeader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -45,9 +42,6 @@ public class GuidedDecisionTableModelTransformer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillTable(DecisionTable decisionTable) {
|
private void fillTable(DecisionTable decisionTable) {
|
||||||
List<ColumnDefinition> columnDefinitions = decisionTable.getColumnDefinitionList();
|
|
||||||
|
|
||||||
DateFormat format = new SimpleDateFormat("dd-MMM-yyyy", Locale.FRANCE);
|
|
||||||
List<HashMap<String, Object>> rows = new ArrayList<>();
|
List<HashMap<String, Object>> rows = new ArrayList<>();
|
||||||
for (int i = 0; i < decisionTable.getRows().size(); i++) {
|
for (int i = 0; i < decisionTable.getRows().size(); i++) {
|
||||||
Row row = decisionTable.getRows().get(i);
|
Row row = decisionTable.getRows().get(i);
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView.service;
|
package org.chtijbug.drools.console.vaadincomponent.componentview.service;
|
||||||
|
|
||||||
import com.vaadin.flow.data.binder.Binder;
|
import com.vaadin.flow.data.binder.Binder;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.AssetEdit;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.AssetEdit;
|
||||||
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
||||||
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
import org.drools.workbench.models.guided.template.shared.TemplateModel;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class GuidedRuleTemplateModelTransformer {
|
public class GuidedRuleTemplateModelTransformer {
|
||||||
|
|
||||||
|
|
@ -34,7 +31,6 @@ public class GuidedRuleTemplateModelTransformer {
|
||||||
}
|
}
|
||||||
private void fillTable(TemplateModel model) {
|
private void fillTable(TemplateModel model) {
|
||||||
InterpolationVariable[] variablesList = model.getInterpolationVariablesList();
|
InterpolationVariable[] variablesList = model.getInterpolationVariablesList();
|
||||||
DateFormat format = new SimpleDateFormat("dd-MMM-yyyy", Locale.FRANCE);
|
|
||||||
String[][] contenuTable = model.getTableAsArray();
|
String[][] contenuTable = model.getTableAsArray();
|
||||||
List<HashMap<String, Object>> rows = new ArrayList<>();
|
List<HashMap<String, Object>> rows = new ArrayList<>();
|
||||||
for (int i = 0; i < model.getRowsCount(); i++) {
|
for (int i = 0; i < model.getRowsCount(); i++) {
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel;
|
package org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||||
|
|
||||||
|
|
||||||
import org.drools.workbench.models.guided.dtable.shared.model.*;
|
import org.drools.workbench.models.guided.dtable.shared.model.*;
|
||||||
|
|
@ -43,25 +43,25 @@ public class ColumnDefinition {
|
||||||
|
|
||||||
public ColumnDefinition(int columnNumber, RowNumberCol52 rowNumberCol52) {
|
public ColumnDefinition(int columnNumber, RowNumberCol52 rowNumberCol52) {
|
||||||
this.columnNumber = columnNumber;
|
this.columnNumber = columnNumber;
|
||||||
this.columnType = ColumnType.rowNumber;
|
this.columnType = ColumnType.ROW_NUMBER;
|
||||||
this.fieldType = DataType.TYPE_NUMERIC_INTEGER.toString();
|
this.fieldType = DataType.TYPE_NUMERIC_INTEGER;
|
||||||
this.rowNumberCol52 = rowNumberCol52;
|
this.rowNumberCol52 = rowNumberCol52;
|
||||||
this.header = rowNumberCol52.getHeader();
|
this.header = rowNumberCol52.getHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColumnDefinition(int columnNumber, DescriptionCol52 descriptionCol52) {
|
public ColumnDefinition(int columnNumber, DescriptionCol52 descriptionCol52) {
|
||||||
this.columnNumber = columnNumber;
|
this.columnNumber = columnNumber;
|
||||||
this.columnType = ColumnType.description;
|
this.columnType = ColumnType.DESCRIPTION;
|
||||||
this.header = descriptionCol52.getHeader();
|
this.header = descriptionCol52.getHeader();
|
||||||
this.fieldType = DataType.TYPE_STRING.toString();
|
this.fieldType = DataType.TYPE_STRING;
|
||||||
this.descriptionCol52 = descriptionCol52;
|
this.descriptionCol52 = descriptionCol52;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColumnDefinition(int columnNumber, AttributeCol52 attributeCol52) {
|
public ColumnDefinition(int columnNumber, AttributeCol52 attributeCol52) {
|
||||||
this.attributeCol52 = attributeCol52;
|
this.attributeCol52 = attributeCol52;
|
||||||
this.columnNumber = columnNumber;
|
this.columnNumber = columnNumber;
|
||||||
this.columnType = ColumnType.attribute;
|
this.columnType = ColumnType.ATTRIBUTE;
|
||||||
this.fieldType = DataType.TYPE_STRING.toString();
|
this.fieldType = DataType.TYPE_STRING;
|
||||||
if (attributeCol52.getDefaultValue() != null) {
|
if (attributeCol52.getDefaultValue() != null) {
|
||||||
this.hasDefaultValue = true;
|
this.hasDefaultValue = true;
|
||||||
this.defaultValueCell = attributeCol52.getDefaultValue();
|
this.defaultValueCell = attributeCol52.getDefaultValue();
|
||||||
|
|
@ -74,7 +74,7 @@ public class ColumnDefinition {
|
||||||
public ColumnDefinition(int columnNumber, ConditionCol52 conditionCol52) {
|
public ColumnDefinition(int columnNumber, ConditionCol52 conditionCol52) {
|
||||||
this.conditionCol52 = conditionCol52;
|
this.conditionCol52 = conditionCol52;
|
||||||
this.columnNumber = columnNumber;
|
this.columnNumber = columnNumber;
|
||||||
this.columnType = ColumnType.condition;
|
this.columnType = ColumnType.CONDITION;
|
||||||
this.fieldType = conditionCol52.getFieldType();
|
this.fieldType = conditionCol52.getFieldType();
|
||||||
if (conditionCol52.getDefaultValue() != null) {
|
if (conditionCol52.getDefaultValue() != null) {
|
||||||
this.hasDefaultValue = true;
|
this.hasDefaultValue = true;
|
||||||
|
|
@ -83,34 +83,34 @@ public class ColumnDefinition {
|
||||||
this.hideColumn = conditionCol52.isHideColumn();
|
this.hideColumn = conditionCol52.isHideColumn();
|
||||||
this.header = conditionCol52.getHeader();
|
this.header = conditionCol52.getHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColumnDefinition(int columnNumber, ActionSetFieldCol52 actionSetFieldCol52) {
|
public ColumnDefinition(int columnNumber, ActionSetFieldCol52 actionSetFieldCol52) {
|
||||||
this.actionSetFieldCol52 = actionSetFieldCol52;
|
this.actionSetFieldCol52 = actionSetFieldCol52;
|
||||||
this.columnNumber = columnNumber;
|
this.columnNumber = columnNumber;
|
||||||
this.columnType = ColumnType.action;
|
this.columnType = ColumnType.ACTION;
|
||||||
this.fieldType = actionSetFieldCol52.getType();
|
this.fieldType = actionSetFieldCol52.getType();
|
||||||
this.header = actionSetFieldCol52.getHeader();
|
this.header = actionSetFieldCol52.getHeader();
|
||||||
if (actionSetFieldCol52.getDefaultValue() != null) {
|
if (actionSetFieldCol52.getDefaultValue() != null
|
||||||
DTCellValue52 defaultValue = actionSetFieldCol52.getDefaultValue();
|
&& !(DataType.DataTypes.STRING.equals(actionSetFieldCol52.getDefaultValue().getDataType()) && actionSetFieldCol52.getDefaultValue().getStringValue().isEmpty())) {
|
||||||
if (!(DataType.DataTypes.STRING.equals(defaultValue.getDataType()) && defaultValue.getStringValue().isEmpty())) {
|
this.hasDefaultValue = true;
|
||||||
this.hasDefaultValue = true;
|
this.defaultValue = getValue(actionSetFieldCol52.getDefaultValue());
|
||||||
this.defaultValue = getValue(actionSetFieldCol52.getDefaultValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.hideColumn = actionSetFieldCol52.isHideColumn();
|
this.hideColumn = actionSetFieldCol52.isHideColumn();
|
||||||
this.header = actionSetFieldCol52.getHeader();
|
this.header = actionSetFieldCol52.getHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColumnDefinition(int columnNumber, ActionInsertFactCol52 actionInsertFact52) {
|
public ColumnDefinition(int columnNumber, ActionInsertFactCol52 actionInsertFact52) {
|
||||||
this.actionInsertFact52 = actionInsertFact52;
|
this.actionInsertFact52 = actionInsertFact52;
|
||||||
this.columnNumber = columnNumber;
|
this.columnNumber = columnNumber;
|
||||||
this.columnType = ColumnType.action;
|
this.columnType = ColumnType.ACTION;
|
||||||
this.fieldType = actionInsertFact52.getType();
|
this.fieldType = actionInsertFact52.getType();
|
||||||
this.header = actionInsertFact52.getHeader();
|
this.header = actionInsertFact52.getHeader();
|
||||||
if (actionInsertFact52.getDefaultValue() != null) {
|
if (actionInsertFact52.getDefaultValue() != null
|
||||||
DTCellValue52 defaultValue = actionInsertFact52.getDefaultValue();
|
&& !(DataType.DataTypes.STRING.equals(actionInsertFact52.getDefaultValue().getDataType()) && actionInsertFact52.getDefaultValue().getStringValue().isEmpty())) {
|
||||||
if (!(DataType.DataTypes.STRING.equals(defaultValue.getDataType()) && defaultValue.getStringValue().isEmpty())) {
|
this.hasDefaultValue = true;
|
||||||
this.hasDefaultValue = true;
|
this.defaultValue = getValue(actionInsertFact52.getDefaultValue());
|
||||||
this.defaultValue = getValue(actionInsertFact52.getDefaultValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.hideColumn = actionInsertFact52.isHideColumn();
|
this.hideColumn = actionInsertFact52.isHideColumn();
|
||||||
this.header = actionInsertFact52.getHeader();
|
this.header = actionInsertFact52.getHeader();
|
||||||
|
|
@ -123,43 +123,45 @@ public class ColumnDefinition {
|
||||||
value = Boolean.toString(cell.getBooleanValue());
|
value = Boolean.toString(cell.getBooleanValue());
|
||||||
break;
|
break;
|
||||||
case NUMERIC_BIGDECIMAL:
|
case NUMERIC_BIGDECIMAL:
|
||||||
if (cell.getNumericValue()!= null) {
|
if (cell.getNumericValue() != null) {
|
||||||
value = cell.getNumericValue().toString();
|
value = cell.getNumericValue().toString();
|
||||||
}else{
|
} else {
|
||||||
value="";
|
value = "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NUMERIC:
|
case NUMERIC:
|
||||||
if (cell.getNumericValue()!= null) {
|
if (cell.getNumericValue() != null) {
|
||||||
value = cell.getNumericValue().toString();
|
value = cell.getNumericValue().toString();
|
||||||
}else{
|
} else {
|
||||||
value="";
|
value = "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NUMERIC_INTEGER:
|
case NUMERIC_INTEGER:
|
||||||
if (cell.getNumericValue()!= null) {
|
if (cell.getNumericValue() != null) {
|
||||||
value = cell.getNumericValue().toString();
|
value = cell.getNumericValue().toString();
|
||||||
}else{
|
} else {
|
||||||
value="";
|
value = "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NUMERIC_DOUBLE:
|
case NUMERIC_DOUBLE:
|
||||||
if (cell.getNumericValue()!= null) {
|
if (cell.getNumericValue() != null) {
|
||||||
value = cell.getNumericValue().toString();
|
value = cell.getNumericValue().toString();
|
||||||
}else{
|
} else {
|
||||||
value="";
|
value = "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case STRING:
|
||||||
value = cell.getStringValue();
|
value = cell.getStringValue();
|
||||||
break;
|
break;
|
||||||
case DATE:
|
case DATE:
|
||||||
if (cell.getDateValue()!= null) {
|
if (cell.getDateValue() != null) {
|
||||||
value = cell.getDateValue().toString();
|
value = cell.getDateValue().toString();
|
||||||
}else{
|
} else {
|
||||||
value="";
|
value = "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* STRING,
|
* STRING,
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel;
|
package org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
|
|
@ -22,5 +22,5 @@ package org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmode
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
public enum ColumnType {
|
public enum ColumnType {
|
||||||
rowNumber, description, attribute, condition, action
|
ROW_NUMBER, DESCRIPTION, ATTRIBUTE, CONDITION, ACTION
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel;
|
package org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||||
|
|
||||||
|
|
||||||
import org.drools.workbench.models.guided.dtable.shared.model.*;
|
import org.drools.workbench.models.guided.dtable.shared.model.*;
|
||||||
|
|
@ -24,8 +24,8 @@ import java.util.List;
|
||||||
public class DecisionTable {
|
public class DecisionTable {
|
||||||
private String name;
|
private String name;
|
||||||
private GuidedDecisionTable52 guidedDecisionTable52;
|
private GuidedDecisionTable52 guidedDecisionTable52;
|
||||||
private List<ColumnDefinition> columnDefinitionList = new ArrayList<ColumnDefinition>();
|
private List<ColumnDefinition> columnDefinitionList = new ArrayList<>();
|
||||||
private List<Row> rows = new ArrayList<Row>();
|
private List<Row> rows = new ArrayList<>();
|
||||||
|
|
||||||
public DecisionTable(GuidedDecisionTable52 guidedDecisionTable52) throws GuidedException {
|
public DecisionTable(GuidedDecisionTable52 guidedDecisionTable52) throws GuidedException {
|
||||||
this.guidedDecisionTable52 = guidedDecisionTable52;
|
this.guidedDecisionTable52 = guidedDecisionTable52;
|
||||||
|
|
@ -67,7 +67,6 @@ public class DecisionTable {
|
||||||
for (List<DTCellValue52> line : this.guidedDecisionTable52.getData()) {
|
for (List<DTCellValue52> line : this.guidedDecisionTable52.getData()) {
|
||||||
try {
|
try {
|
||||||
Row newRow = new Row(line, this);
|
Row newRow = new Row(line, this);
|
||||||
//Row newRow = fillRow(line);
|
|
||||||
rows.add(newRow);
|
rows.add(newRow);
|
||||||
} catch (GuidedException e) {
|
} catch (GuidedException e) {
|
||||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel;
|
package org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||||
|
|
||||||
public class GuidedException extends Exception {
|
public class GuidedException extends Exception {
|
||||||
private String className;
|
private String className;
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel;
|
package org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||||
|
|
||||||
import org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52;
|
import org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52;
|
||||||
|
|
||||||
|
|
@ -22,13 +22,13 @@ import java.util.List;
|
||||||
|
|
||||||
public class Row {
|
public class Row {
|
||||||
private DecisionTable decisionTable;
|
private DecisionTable decisionTable;
|
||||||
private List<RowElement> rowElements = new ArrayList<RowElement>();
|
private List<RowElement> rowElements = new ArrayList<>();
|
||||||
private List<DTCellValue52> cellValue52List;
|
private List<DTCellValue52> cellValue52List;
|
||||||
|
|
||||||
|
|
||||||
protected Row(DecisionTable decisionTable, int rowNumber) throws GuidedException {
|
protected Row(DecisionTable decisionTable, int rowNumber) throws GuidedException {
|
||||||
this.decisionTable = decisionTable;
|
this.decisionTable = decisionTable;
|
||||||
this.cellValue52List = new ArrayList<DTCellValue52>();
|
this.cellValue52List = new ArrayList<>();
|
||||||
for (ColumnDefinition col : this.decisionTable.getColumnDefinitionList()) {
|
for (ColumnDefinition col : this.decisionTable.getColumnDefinitionList()) {
|
||||||
RowElement newRowElement = new RowElement(col);
|
RowElement newRowElement = new RowElement(col);
|
||||||
this.cellValue52List.add(newRowElement.getDtCellValue52());
|
this.cellValue52List.add(newRowElement.getDtCellValue52());
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel;
|
package org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel;
|
||||||
|
|
||||||
|
|
||||||
import org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52;
|
import org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52;
|
||||||
|
|
@ -31,10 +31,14 @@ import java.util.Date;
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
public class RowElement {
|
public class RowElement {
|
||||||
|
private static String rowEelement ="RowElement";
|
||||||
|
|
||||||
private ColumnDefinition columnDefinition;
|
private ColumnDefinition columnDefinition;
|
||||||
private String value = "";
|
private String value = "";
|
||||||
private DTCellValue52 dtCellValue52;
|
private DTCellValue52 dtCellValue52;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public RowElement(ColumnDefinition columnDefinition, DTCellValue52 dtCellValue52) throws GuidedException {
|
public RowElement(ColumnDefinition columnDefinition, DTCellValue52 dtCellValue52) throws GuidedException {
|
||||||
this.columnDefinition = columnDefinition;
|
this.columnDefinition = columnDefinition;
|
||||||
this.dtCellValue52 = dtCellValue52;
|
this.dtCellValue52 = dtCellValue52;
|
||||||
|
|
@ -47,40 +51,40 @@ public class RowElement {
|
||||||
|
|
||||||
if (this.columnDefinition.isHasDefaultValue()) {
|
if (this.columnDefinition.isHasDefaultValue()) {
|
||||||
this.value = this.columnDefinition.getDefaultValue();
|
this.value = this.columnDefinition.getDefaultValue();
|
||||||
if (this.columnDefinition.getColumnDefinition() == ColumnType.rowNumber) {
|
if (this.columnDefinition.getColumnDefinition() == ColumnType.ROW_NUMBER) {
|
||||||
int rowNumber = new Integer(value).intValue();
|
int rowNumber = Integer.parseInt(value);
|
||||||
this.dtCellValue52.setNumericValue(rowNumber + 1);
|
this.dtCellValue52.setNumericValue(rowNumber + 1);
|
||||||
this.value = value;
|
this.value = value;
|
||||||
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.description) {
|
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.DESCRIPTION) {
|
||||||
this.dtCellValue52.setStringValue(value);
|
this.dtCellValue52.setStringValue(value);
|
||||||
|
|
||||||
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.attribute) {
|
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.ATTRIBUTE) {
|
||||||
this.dtCellValue52.setStringValue(value);
|
this.dtCellValue52.setStringValue(value);
|
||||||
try {
|
try {
|
||||||
setValuedtCell(this.value);
|
setValuedtCell(this.value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||||
chtijbugDroolsRestException.setClassName("RowElement");
|
chtijbugDroolsRestException.setClassName(rowEelement);
|
||||||
chtijbugDroolsRestException.setAttribute(this.columnDefinition.toString());
|
chtijbugDroolsRestException.setAttribute(this.columnDefinition.toString());
|
||||||
chtijbugDroolsRestException.setValue(this.value);
|
chtijbugDroolsRestException.setValue(this.value);
|
||||||
throw chtijbugDroolsRestException;
|
throw chtijbugDroolsRestException;
|
||||||
}
|
}
|
||||||
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.condition) {
|
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.CONDITION) {
|
||||||
try {
|
try {
|
||||||
setValuedtCell(this.value);
|
setValuedtCell(this.value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||||
chtijbugDroolsRestException.setClassName("RowElement");
|
chtijbugDroolsRestException.setClassName(rowEelement);
|
||||||
chtijbugDroolsRestException.setAttribute(this.columnDefinition.toString());
|
chtijbugDroolsRestException.setAttribute(this.columnDefinition.toString());
|
||||||
chtijbugDroolsRestException.setValue(this.value);
|
chtijbugDroolsRestException.setValue(this.value);
|
||||||
throw chtijbugDroolsRestException;
|
throw chtijbugDroolsRestException;
|
||||||
}
|
}
|
||||||
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.action) {
|
} else if (this.columnDefinition.getColumnDefinition() == ColumnType.ACTION) {
|
||||||
try {
|
try {
|
||||||
setValuedtCell(this.value);
|
setValuedtCell(this.value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
GuidedException chtijbugDroolsRestException = new GuidedException(e);
|
||||||
chtijbugDroolsRestException.setClassName("RowElement");
|
chtijbugDroolsRestException.setClassName(rowEelement);
|
||||||
chtijbugDroolsRestException.setAttribute(this.columnDefinition.toString());
|
chtijbugDroolsRestException.setAttribute(this.columnDefinition.toString());
|
||||||
chtijbugDroolsRestException.setValue(this.value);
|
chtijbugDroolsRestException.setValue(this.value);
|
||||||
throw chtijbugDroolsRestException;
|
throw chtijbugDroolsRestException;
|
||||||
|
|
@ -108,35 +112,35 @@ public class RowElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setValuedtCell(String aValue) throws Exception {
|
private void setValuedtCell(String aValue) throws Exception {
|
||||||
if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_STRING.toString())) {
|
if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_STRING)) {
|
||||||
this.dtCellValue52.setStringValue(aValue);
|
this.dtCellValue52.setStringValue(aValue);
|
||||||
|
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_NUMERIC_BIGDECIMAL.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_BIGDECIMAL)) {
|
||||||
this.dtCellValue52.setNumericValue(new BigDecimal(aValue));
|
this.dtCellValue52.setNumericValue(new BigDecimal(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_NUMERIC_BIGINTEGER.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_BIGINTEGER)) {
|
||||||
this.dtCellValue52.setNumericValue(new BigInteger(aValue));
|
this.dtCellValue52.setNumericValue(new BigInteger(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_NUMERIC_BYTE.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_BYTE)) {
|
||||||
this.dtCellValue52.setNumericValue(new Byte(aValue));
|
this.dtCellValue52.setNumericValue(Byte.parseByte(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_NUMERIC_DOUBLE.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_DOUBLE)) {
|
||||||
this.dtCellValue52.setNumericValue(new Double(aValue));
|
this.dtCellValue52.setNumericValue( Double.parseDouble(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals("DOUBLE")) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase("DOUBLE")) {
|
||||||
this.dtCellValue52.setNumericValue(new Double(aValue));
|
this.dtCellValue52.setNumericValue(Double.parseDouble(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_NUMERIC_FLOAT.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_FLOAT)) {
|
||||||
this.dtCellValue52.setNumericValue(new Float(aValue));
|
this.dtCellValue52.setNumericValue(Float.parseFloat(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_NUMERIC_INTEGER.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_INTEGER)) {
|
||||||
this.dtCellValue52.setNumericValue(new Integer(aValue));
|
this.dtCellValue52.setNumericValue(Integer.parseInt(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_NUMERIC_LONG.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_LONG)) {
|
||||||
this.dtCellValue52.setNumericValue(new Long(aValue));
|
this.dtCellValue52.setNumericValue( Long.parseLong(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_NUMERIC_SHORT.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC_SHORT)) {
|
||||||
this.dtCellValue52.setNumericValue(new Short(aValue));
|
this.dtCellValue52.setNumericValue(Short.parseShort(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_DATE.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_DATE)) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat();
|
SimpleDateFormat sdf = new SimpleDateFormat();
|
||||||
Date newDate = sdf.parse(aValue);
|
Date newDate = sdf.parse(aValue);
|
||||||
this.dtCellValue52.setDateValue(newDate);
|
this.dtCellValue52.setDateValue(newDate);
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_BOOLEAN.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_BOOLEAN)) {
|
||||||
this.dtCellValue52.setBooleanValue(new Boolean(aValue));
|
this.dtCellValue52.setBooleanValue( Boolean.parseBoolean(aValue));
|
||||||
} else if (this.columnDefinition.getFieldType().toUpperCase().equals(DataType.TYPE_NUMERIC.toString())) {
|
} else if (this.columnDefinition.getFieldType().equalsIgnoreCase(DataType.TYPE_NUMERIC)) {
|
||||||
this.dtCellValue52.setNumericValue(new Double(aValue));
|
this.dtCellValue52.setNumericValue( Double.parseDouble(aValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
|
|
@ -7,8 +7,8 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.data.value.ValueChangeMode;
|
import com.vaadin.flow.data.value.ValueChangeMode;
|
||||||
import org.chtijbug.drools.console.service.IndexerService;
|
import org.chtijbug.drools.console.service.IndexerService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.TextFieldPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.TextFieldPerso;
|
||||||
import org.chtijbug.drools.console.view.ActionLoggingView;
|
import org.chtijbug.drools.console.view.ActionLoggingView;
|
||||||
import org.chtijbug.drools.console.view.LoggingView;
|
import org.chtijbug.drools.console.view.LoggingView;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
||||||
|
|
@ -1,19 +1,16 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.KieContainerResponse;
|
|
||||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
|
||||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.AssociateProjectKie;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.AssociateProjectKie;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.DefineProject;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.DefineProject;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
import org.springframework.kafka.annotation.KafkaListener;
|
|
||||||
|
|
||||||
public class DeploymentAction extends VerticalLayout {
|
public class DeploymentAction extends VerticalLayout {
|
||||||
|
|
||||||
|
|
@ -80,14 +77,7 @@ public class DeploymentAction extends VerticalLayout {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@KafkaListener(
|
|
||||||
topics = KafkaTopicConstants.RESPONSE_DEPLOY_TOPIC,groupId = "Console",
|
|
||||||
containerFactory = "ruleKafkaListenerKieContainerUpdateFactory")
|
|
||||||
public void updateKieServerLogInfo(KieContainerResponse kieContainerResponse){
|
|
||||||
if (getUI().isPresent()) {
|
|
||||||
deploymentView.addRow("Deploy Response=" + kieContainerResponse.toString(), getUI().get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isActive(Button button){
|
private boolean isActive(Button button){
|
||||||
return button.getClassNames().contains("active");
|
return button.getClassNames().contains("active");
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||||
|
|
||||||
public class RuntimesAction extends VerticalLayout {
|
public class RuntimesAction extends VerticalLayout {
|
||||||
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.leftMenu.Action;
|
package org.chtijbug.drools.console.vaadincomponent.leftMenu.Action;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.combobox.ComboBox;
|
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.ComboBoxPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.ComboBoxPerso;
|
||||||
import org.chtijbug.drools.console.view.TemplateView;
|
import org.chtijbug.drools.console.view.TemplateView;
|
||||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.leftMenu;
|
package org.chtijbug.drools.console.vaadincomponent.leftMenu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Image;
|
import com.vaadin.flow.component.html.Image;
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.leftMenu;
|
package org.chtijbug.drools.console.vaadincomponent.leftMenu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Anchor;
|
import com.vaadin.flow.component.html.Anchor;
|
||||||
import com.vaadin.flow.component.icon.Icon;
|
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.login;
|
package org.chtijbug.drools.console.vaadincomponent.login;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -14,8 +14,8 @@ import org.chtijbug.drools.console.service.model.UserConnected;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.util.PasswordValidator;
|
import org.chtijbug.drools.console.util.PasswordValidator;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.PasswordFieldPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.PasswordFieldPerso;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.TextFieldPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.TextFieldPerso;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class FormulaireComposant extends VerticalLayout {
|
public class FormulaireComposant extends VerticalLayout {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.login;
|
package org.chtijbug.drools.console.vaadincomponent.login;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.login;
|
package org.chtijbug.drools.console.vaadincomponent.login;
|
||||||
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class LoginComponent extends HorizontalLayout {
|
public class LoginComponent extends HorizontalLayout {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.login;
|
package org.chtijbug.drools.console.vaadincomponent.login;
|
||||||
|
|
||||||
import com.vaadin.flow.component.checkbox.Checkbox;
|
import com.vaadin.flow.component.checkbox.Checkbox;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.menu;
|
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -10,7 +10,7 @@ import com.vaadin.flow.server.InputStreamFactory;
|
||||||
import com.vaadin.flow.server.StreamResource;
|
import com.vaadin.flow.server.StreamResource;
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.menu;
|
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.DeploymentAction;
|
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.DeploymentAction;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.menu;
|
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.TemplatesAction;
|
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.TemplatesAction;
|
||||||
import org.chtijbug.drools.console.view.TemplateView;
|
import org.chtijbug.drools.console.view.TemplateView;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.menu;
|
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.menu;
|
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.ActionLogging;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.ActionLogging;
|
|
||||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.RuntimesAction;
|
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
|
||||||
import org.chtijbug.drools.console.view.LoggingView;
|
import org.chtijbug.drools.console.view.LoggingView;
|
||||||
import org.chtijbug.drools.console.view.RuntimesView;
|
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class MenuSecondaireLogging extends HorizontalLayout {
|
public class MenuSecondaireLogging extends HorizontalLayout {
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package org.chtijbug.drools.console.vaadinComponent.menu;
|
package org.chtijbug.drools.console.vaadincomponent.menu;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.RuntimesAction;
|
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.RuntimesAction;
|
||||||
import org.chtijbug.drools.console.view.DeploymentView;
|
import org.chtijbug.drools.console.view.DeploymentView;
|
||||||
import org.chtijbug.drools.console.view.RuntimesView;
|
import org.chtijbug.drools.console.view.RuntimesView;
|
||||||
|
|
||||||
|
|
@ -8,7 +8,7 @@ import com.vaadin.flow.router.BeforeEnterEvent;
|
||||||
import com.vaadin.flow.router.BeforeEnterObserver;
|
import com.vaadin.flow.router.BeforeEnterObserver;
|
||||||
import com.vaadin.flow.router.Route;
|
import com.vaadin.flow.router.Route;
|
||||||
import com.vaadin.flow.shared.communication.PushMode;
|
import com.vaadin.flow.shared.communication.PushMode;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import com.vaadin.flow.server.StreamResource;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.chtijbug.drools.console.service.IndexerService;
|
import org.chtijbug.drools.console.service.IndexerService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.GridActionLogging;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.GridActionLogging;
|
||||||
import org.chtijbug.drools.logging.Fact;
|
import org.chtijbug.drools.logging.Fact;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ import com.vaadin.flow.shared.communication.PushMode;
|
||||||
import org.chtijbug.drools.console.AddLog;
|
import org.chtijbug.drools.console.AddLog;
|
||||||
import org.chtijbug.drools.console.service.ProjectPersistService;
|
import org.chtijbug.drools.console.service.ProjectPersistService;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
import org.chtijbug.drools.console.vaadincomponent.Squelette.SqueletteComposant;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.DeploymentAction;
|
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.DeploymentAction;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,12 @@ import org.chtijbug.drools.console.service.KieRepositoryService;
|
||||||
import org.chtijbug.drools.console.service.UserConnectedService;
|
import org.chtijbug.drools.console.service.UserConnectedService;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.AssetEdit;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.AssetEdit;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.ColumnDefinition;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.ColumnDefinition;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.DecisionTable;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.DecisionTable;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.GuidedException;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.GuidedException;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.Row;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.Row;
|
||||||
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
import org.drools.workbench.models.datamodel.rule.InterpolationVariable;
|
||||||
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
|
import org.drools.workbench.models.guided.dtable.backend.GuidedDTXMLPersistence;
|
||||||
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
import org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52;
|
||||||
|
|
@ -156,7 +156,7 @@ public class EditTemplateView extends VerticalLayout {
|
||||||
add(assetEdit);
|
add(assetEdit);
|
||||||
String assetSource=this.getAssetContent();
|
String assetSource=this.getAssetContent();
|
||||||
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal(assetSource);
|
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal(assetSource);
|
||||||
org.chtijbug.drools.console.vaadinComponent.componentView.service.dtmodel.DecisionTable decisionTable = new DecisionTable(model);
|
org.chtijbug.drools.console.vaadincomponent.componentview.service.dtmodel.DecisionTable decisionTable = new DecisionTable(model);
|
||||||
decisionTable.getRows().clear();
|
decisionTable.getRows().clear();
|
||||||
List<ColumnDefinition> columnDefinitions = decisionTable.getColumnDefinitionList();
|
List<ColumnDefinition> columnDefinitions = decisionTable.getColumnDefinitionList();
|
||||||
int k=0;
|
int k=0;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ package org.chtijbug.drools.console.view;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.GridLogging;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.GridLogging;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.ActionLogging;
|
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.ActionLogging;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class LoggingView extends VerticalLayout {
|
public class LoggingView extends VerticalLayout {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package org.chtijbug.drools.console.view;
|
package org.chtijbug.drools.console.view;
|
||||||
|
|
||||||
import com.vaadin.flow.component.button.Button;
|
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Anchor;
|
import com.vaadin.flow.component.html.Anchor;
|
||||||
import com.vaadin.flow.component.html.Image;
|
import com.vaadin.flow.component.html.Image;
|
||||||
|
|
@ -9,8 +8,8 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import com.vaadin.flow.router.Route;
|
import com.vaadin.flow.router.Route;
|
||||||
import com.vaadin.flow.server.InputStreamFactory;
|
import com.vaadin.flow.server.InputStreamFactory;
|
||||||
import com.vaadin.flow.server.StreamResource;
|
import com.vaadin.flow.server.StreamResource;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.login.LoginComponent;
|
import org.chtijbug.drools.console.vaadincomponent.login.LoginComponent;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.login.TextInfoComponent;
|
import org.chtijbug.drools.console.vaadincomponent.login.TextInfoComponent;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package org.chtijbug.drools.console.view;
|
||||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.componentView.GridRuntime;
|
import org.chtijbug.drools.console.vaadincomponent.componentview.GridRuntime;
|
||||||
|
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
public class RuntimesView extends VerticalLayout {
|
public class RuntimesView extends VerticalLayout {
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ import org.chtijbug.drools.console.service.UserConnectedService;
|
||||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||||
import org.chtijbug.drools.console.service.util.AppContext;
|
import org.chtijbug.drools.console.service.util.AppContext;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
import org.chtijbug.drools.console.vaadincomponent.componentperso.DialogPerso;
|
||||||
import org.chtijbug.drools.console.vaadinComponent.leftMenu.Action.TemplatesAction;
|
import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.TemplatesAction;
|
||||||
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
|
||||||
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectResponse;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package org.chtijbug.drools.common;
|
||||||
|
|
||||||
public class KafkaTopicConstants {
|
public class KafkaTopicConstants {
|
||||||
public final static String LOGING_TOPIC ="logging";
|
public final static String LOGING_TOPIC ="logging";
|
||||||
public final static String RESPONSE_TOPIC ="Response";
|
|
||||||
public final static String RESPONSE_DEPLOY_TOPIC ="ResponseDeploy";
|
public final static String RESPONSE_DEPLOY_TOPIC ="ResponseDeploy";
|
||||||
public final static String REVERSE_PROXY="proxy";
|
public final static String REVERSE_PROXY="proxy";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,14 @@ public class AssetService {
|
||||||
private List<PlatformProjectResponse> getSpace(OrganizationalUnit ou) {
|
private List<PlatformProjectResponse> getSpace(OrganizationalUnit ou) {
|
||||||
|
|
||||||
final List<PlatformProjectResponse> repoNames = new ArrayList<>();
|
final List<PlatformProjectResponse> repoNames = new ArrayList<>();
|
||||||
for (WorkspaceProject workspaceProject : workspaceProjectService.getAllWorkspaceProjects(ou)) {
|
try {
|
||||||
for (Branch branch : workspaceProject.getRepository().getBranches()) {
|
for (WorkspaceProject workspaceProject : workspaceProjectService.getAllWorkspaceProjects(ou)) {
|
||||||
repoNames.add(getProjectResponse(workspaceProject, branch));
|
for (Branch branch : workspaceProject.getRepository().getBranches()) {
|
||||||
|
repoNames.add(getProjectResponse(workspaceProject, branch));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info("getSpace error "+ou.getName(),e);
|
||||||
}
|
}
|
||||||
return repoNames;
|
return repoNames;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistenc
|
||||||
import org.chtijbug.drools.proxy.persistence.model.EventType;
|
import org.chtijbug.drools.proxy.persistence.model.EventType;
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionActionRepository;
|
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionActionRepository;
|
||||||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionPersistenceRepository;
|
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionPersistenceRepository;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.kafka.annotation.KafkaListener;
|
import org.springframework.kafka.annotation.KafkaListener;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -18,6 +20,8 @@ import java.util.*;
|
||||||
@Service("storeService")
|
@Service("storeService")
|
||||||
public class StoreLoggingService {
|
public class StoreLoggingService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(StoreLoggingService.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BusinessTransactionPersistenceRepository transactionRepository;
|
private BusinessTransactionPersistenceRepository transactionRepository;
|
||||||
|
|
||||||
|
|
@ -26,7 +30,7 @@ public class StoreLoggingService {
|
||||||
|
|
||||||
|
|
||||||
@KafkaListener(
|
@KafkaListener(
|
||||||
topics = KafkaTopicConstants.LOGING_TOPIC,groupId = "${kafka.index.groupid}",
|
topics = KafkaTopicConstants.LOGING_TOPIC, groupId = "${kafka.index.groupid}",
|
||||||
containerFactory = "ruleKafkaListenerContainerFactory")
|
containerFactory = "ruleKafkaListenerContainerFactory")
|
||||||
public void store(ChtijbugObjectRequest result) {
|
public void store(ChtijbugObjectRequest result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|
@ -150,22 +154,15 @@ public class StoreLoggingService {
|
||||||
businessTransactionoutput.setEventNumber(ii++);
|
businessTransactionoutput.setEventNumber(ii++);
|
||||||
actions.put(businessTransactionoutput.getEventNumber(), businessTransactionoutput);
|
actions.put(businessTransactionoutput.getEventNumber(), businessTransactionoutput);
|
||||||
}
|
}
|
||||||
List<Long> keys = new ArrayList<Long>(actions.keySet());
|
List<Long> keys = new ArrayList<>(actions.keySet());
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
List<BusinessTransactionAction> sortedList = new LinkedList<>();
|
List<BusinessTransactionAction> sortedList = new LinkedList<>();
|
||||||
for (Long i : keys) {
|
for (Long i : keys) {
|
||||||
sortedList.add(actions.get(i));
|
sortedList.add(actions.get(i));
|
||||||
}
|
}
|
||||||
transactionRepository.save(item);
|
transactionRepository.save(item);
|
||||||
Iterable<BusinessTransactionAction> toto = actionRepository.saveAll(sortedList);
|
actionRepository.saveAll(sortedList);
|
||||||
System.out.println("");
|
logger.info("Logging transaction {}", result.getTransactionID());
|
||||||
|
|
||||||
|
|
||||||
//item.setContent(fileContent);
|
|
||||||
|
|
||||||
// repository.save(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("coucou");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,10 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import org.apache.kafka.clients.admin.AdminClientConfig;
|
import org.apache.kafka.clients.admin.AdminClientConfig;
|
||||||
import org.apache.kafka.clients.admin.NewTopic;
|
import org.apache.kafka.clients.admin.NewTopic;
|
||||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
|
||||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||||
import org.apache.kafka.common.serialization.StringDeserializer;
|
|
||||||
import org.apache.kafka.common.serialization.StringSerializer;
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
import org.chtijbug.drools.ChtijbugObjectRequest;
|
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||||
import org.chtijbug.drools.KieContainerResponse;
|
import org.chtijbug.drools.KieContainerResponse;
|
||||||
import org.chtijbug.drools.KieContainerUpdate;
|
|
||||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
|
@ -35,11 +32,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.kafka.annotation.EnableKafka;
|
import org.springframework.kafka.annotation.EnableKafka;
|
||||||
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
|
||||||
import org.springframework.kafka.core.*;
|
import org.springframework.kafka.core.KafkaAdmin;
|
||||||
import org.springframework.kafka.support.serializer.JsonDeserializer;
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
|
import org.springframework.kafka.core.ProducerFactory;
|
||||||
import org.springframework.kafka.support.serializer.JsonSerializer;
|
import org.springframework.kafka.support.serializer.JsonSerializer;
|
||||||
import org.springframework.kafka.transaction.KafkaTransactionManager;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
@ -50,6 +48,7 @@ import java.util.Map;
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableKafka
|
@EnableKafka
|
||||||
|
@EnableScheduling
|
||||||
public class DroolsBusinessProxyServer {
|
public class DroolsBusinessProxyServer {
|
||||||
|
|
||||||
@Value(value = "${org.kie.server.id}")
|
@Value(value = "${org.kie.server.id}")
|
||||||
|
|
@ -70,10 +69,7 @@ public class DroolsBusinessProxyServer {
|
||||||
return new NewTopic(KafkaTopicConstants.LOGING_TOPIC, 1, (short) 1);
|
return new NewTopic(KafkaTopicConstants.LOGING_TOPIC, 1, (short) 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public NewTopic actionResponseTopic() {
|
|
||||||
return new NewTopic(KafkaTopicConstants.RESPONSE_TOPIC, 1, (short) 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ProducerFactory<String, ChtijbugObjectRequest> producerFactory() {
|
public ProducerFactory<String, ChtijbugObjectRequest> producerFactory() {
|
||||||
|
|
@ -90,7 +86,7 @@ public class DroolsBusinessProxyServer {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
objectMapper.registerModule(new JavaTimeModule());
|
objectMapper.registerModule(new JavaTimeModule());
|
||||||
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
new DefaultKafkaProducerFactory<>(configProps, new StringSerializer(), new JsonSerializer<ChtijbugObjectRequest>(objectMapper));
|
new DefaultKafkaProducerFactory<>(configProps, new StringSerializer(), new JsonSerializer<>(objectMapper));
|
||||||
return new DefaultKafkaProducerFactory<>(configProps);
|
return new DefaultKafkaProducerFactory<>(configProps);
|
||||||
}
|
}
|
||||||
@Bean
|
@Bean
|
||||||
|
|
@ -110,46 +106,19 @@ public class DroolsBusinessProxyServer {
|
||||||
producer.setTransactionIdPrefix("trans");
|
producer.setTransactionIdPrefix("trans");
|
||||||
return producer;
|
return producer;
|
||||||
}
|
}
|
||||||
@Bean
|
|
||||||
public KafkaTransactionManager transactionManager(ProducerFactory producerFactory) {
|
|
||||||
KafkaTransactionManager manager = new KafkaTransactionManager(producerKieContainerResponseactory());
|
|
||||||
return manager;
|
|
||||||
}
|
|
||||||
@Bean
|
|
||||||
public KafkaTemplate<String, KieContainerResponse> kafkaKieContainerUpdateResponsableTemplate() {
|
|
||||||
return new KafkaTemplate<>(producerKieContainerResponseactory());
|
|
||||||
}
|
|
||||||
@Bean(name="deployFinish")
|
@Bean(name="deployFinish")
|
||||||
public NewTopic actionDeployResponseTopic() {
|
public NewTopic actionDeployResponseTopic() {
|
||||||
return new NewTopic(KafkaTopicConstants.RESPONSE_DEPLOY_TOPIC, 1, (short) 1);
|
return new NewTopic(KafkaTopicConstants.RESPONSE_DEPLOY_TOPIC, 1, (short) 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ConsumerFactory<String, KieContainerUpdate> greetingConsumerFactory() {
|
|
||||||
Map<String, Object> props = new HashMap<>();
|
|
||||||
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
|
||||||
props.put(ConsumerConfig.GROUP_ID_CONFIG, groupID);
|
|
||||||
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KieContainerUpdate.class));
|
|
||||||
}
|
|
||||||
@Bean
|
|
||||||
public ConcurrentKafkaListenerContainerFactory<String, KieContainerUpdate>
|
|
||||||
ruleKafkaListenerKieContainerUpdateFactory() {
|
|
||||||
|
|
||||||
ConcurrentKafkaListenerContainerFactory<String, KieContainerUpdate> factory =
|
|
||||||
new ConcurrentKafkaListenerContainerFactory<>();
|
|
||||||
factory.setConsumerFactory(greetingConsumerFactory());
|
|
||||||
return factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public KafkaTemplate<String, ChtijbugObjectRequest> kafkaTemplate() {
|
public KafkaTemplate<String, ChtijbugObjectRequest> kafkaTemplate() {
|
||||||
return new KafkaTemplate<>(producerFactory());
|
return new KafkaTemplate<>(producerFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main method to start the application.
|
* Main method to start the application.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,9 @@
|
||||||
|
|
||||||
package org.chtijbug.drools.proxy.service;
|
package org.chtijbug.drools.proxy.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import org.apache.camel.CamelContext;
|
import org.apache.camel.CamelContext;
|
||||||
import org.apache.camel.Route;
|
import org.apache.camel.Route;
|
||||||
import org.apache.kafka.clients.admin.NewTopic;
|
import org.apache.kafka.clients.admin.NewTopic;
|
||||||
import org.chtijbug.drools.KieContainerResponse;
|
|
||||||
import org.chtijbug.drools.KieContainerUpdate;
|
|
||||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
|
||||||
import org.chtijbug.drools.proxy.PlatfomKieServerStateRepository;
|
import org.chtijbug.drools.proxy.PlatfomKieServerStateRepository;
|
||||||
import org.chtijbug.drools.proxy.camel.DroolsRouter;
|
import org.chtijbug.drools.proxy.camel.DroolsRouter;
|
||||||
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
import org.chtijbug.drools.proxy.persistence.model.ContainerPojoPersist;
|
||||||
|
|
@ -37,15 +33,13 @@ import org.kie.server.services.api.KieServerExtension;
|
||||||
import org.kie.server.services.api.KieServerRegistry;
|
import org.kie.server.services.api.KieServerRegistry;
|
||||||
import org.kie.server.services.impl.KieContainerInstanceImpl;
|
import org.kie.server.services.impl.KieContainerInstanceImpl;
|
||||||
import org.kie.server.services.impl.KieServerImpl;
|
import org.kie.server.services.impl.KieServerImpl;
|
||||||
import org.kie.server.services.impl.marshal.MarshallerHelper;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.kafka.annotation.KafkaListener;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.kafka.core.KafkaTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
@ -61,13 +55,16 @@ public class KieServiceCommon {
|
||||||
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(KieServiceCommon.class);
|
private static final Logger logger = LoggerFactory.getLogger(KieServiceCommon.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CamelContext camelContext;
|
CamelContext camelContext;
|
||||||
|
|
||||||
private KieServerImpl server;
|
private KieServerImpl server;
|
||||||
private MarshallerHelper marshallerHelper;
|
|
||||||
private KieServerRegistry registry;
|
private KieServerRegistry registry;
|
||||||
private ObjectMapper mapper = new ObjectMapper();
|
|
||||||
private DroolsChtijbugRulesExecutionService droolsChtijbugRulesExecutionService = null;
|
private DroolsChtijbugRulesExecutionService droolsChtijbugRulesExecutionService = null;
|
||||||
|
|
||||||
private DroolsChtijbugKieServerExtension droolsChtijbugKieServerExtension;
|
private DroolsChtijbugKieServerExtension droolsChtijbugKieServerExtension;
|
||||||
@Inject
|
@Inject
|
||||||
private ContainerRepository containerRepository;
|
private ContainerRepository containerRepository;
|
||||||
|
|
@ -87,19 +84,19 @@ public class KieServiceCommon {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext appContext;
|
private ApplicationContext appContext;
|
||||||
|
|
||||||
private String hostName = "localhost";
|
private String hostName = "localhost";
|
||||||
private Map<String, DroolsRouter> routes = new HashMap<>();
|
private Map<String, DroolsRouter> routes = new HashMap<>();
|
||||||
|
|
||||||
@Autowired
|
|
||||||
KafkaTemplate<String, KieContainerResponse> kafkaKieContainerUpdateResponseTemplate;
|
|
||||||
|
|
||||||
@Qualifier("deployFinish")
|
@Qualifier("deployFinish")
|
||||||
@Autowired
|
@Autowired
|
||||||
NewTopic responseTopic;
|
NewTopic responseTopic;
|
||||||
|
|
||||||
public KieServiceCommon() {
|
public KieServiceCommon() {
|
||||||
// for now, if no server impl is passed as parameter, create one
|
//Needed
|
||||||
// this.server = KieServerLocator.getInstance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getKieServerID() {
|
public static String getKieServerID() {
|
||||||
|
|
@ -127,8 +124,6 @@ public class KieServiceCommon {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.marshallerHelper = new MarshallerHelper(this.server.getServerRegistry());
|
|
||||||
|
|
||||||
String serverName = KieServiceCommon.getKieServerID();
|
String serverName = KieServiceCommon.getKieServerID();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -144,11 +139,11 @@ public class KieServiceCommon {
|
||||||
}else{
|
}else{
|
||||||
itIsMes = runtimeRepository.findByServerName(serverName);
|
itIsMes = runtimeRepository.findByServerName(serverName);
|
||||||
}
|
}
|
||||||
|
RuntimePersist runtimePersist;
|
||||||
ServiceResponse<KieServerInfo> result = server.getInfo();
|
ServiceResponse<KieServerInfo> result = server.getInfo();
|
||||||
String version = result.getResult().getVersion();
|
String version = result.getResult().getVersion();
|
||||||
if (itIsMes.isEmpty()) {
|
if (itIsMes.isEmpty()) {
|
||||||
RuntimePersist runtimePersist = new RuntimePersist(serverName, version, hostName,
|
runtimePersist = new RuntimePersist(serverName, version, hostName,
|
||||||
String.valueOf(serverPort), null,
|
String.valueOf(serverPort), null,
|
||||||
hostName, RuntimePersist.STATUS.UP.toString());
|
hostName, RuntimePersist.STATUS.UP.toString());
|
||||||
if (runtimePort!=-1){
|
if (runtimePort!=-1){
|
||||||
|
|
@ -156,24 +151,26 @@ public class KieServiceCommon {
|
||||||
runtimePersist.setServerPort(String.valueOf(runtimePort));
|
runtimePersist.setServerPort(String.valueOf(runtimePort));
|
||||||
}
|
}
|
||||||
String isSwarm = System.getProperty("org.kie.server.swarm");
|
String isSwarm = System.getProperty("org.kie.server.swarm");
|
||||||
|
String swarmPort=System.getProperty("org.kie.server.swarm.port");
|
||||||
|
String baseurl="http://";
|
||||||
if ("1".equals(isSwarm)) {
|
if ("1".equals(isSwarm)) {
|
||||||
if (System.getProperty("org.kie.server.swarm.port")!= null &&
|
if (swarmPort!= null &&
|
||||||
System.getProperty("org.kie.server.swarm.port").length()>0){
|
swarmPort.length()>0){
|
||||||
runtimePersist.setServerUrl("http://" + serverName + ":" + System.getProperty("org.kie.server.swarm.port"));
|
runtimePersist.setServerUrl(baseurl + serverName + ":" + swarmPort);
|
||||||
}else{
|
}else{
|
||||||
runtimePersist.setServerUrl("http://" + serverName + ":" + serverPort);
|
runtimePersist.setServerUrl(baseurl + serverName + ":" + serverPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (runtimePort==-1) {
|
if (runtimePort==-1) {
|
||||||
runtimePersist.setServerUrl("http://" + hostName + ":" + serverPort);
|
runtimePersist.setServerUrl(baseurl + hostName + ":" + serverPort);
|
||||||
}else{
|
}else{
|
||||||
runtimePersist.setServerUrl("http://" + runtimeServer + ":" + runtimePort);
|
runtimePersist.setServerUrl(baseurl + runtimeServer + ":" + runtimePort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
runtimeRepository.save(runtimePersist);
|
runtimeRepository.save(runtimePersist);
|
||||||
} else {
|
} else {
|
||||||
RuntimePersist runtimePersist = itIsMes.get(0);
|
runtimePersist = itIsMes.get(0);
|
||||||
runtimePersist.setStatus(RuntimePersist.STATUS.UP.toString());
|
runtimePersist.setStatus(RuntimePersist.STATUS.UP.toString());
|
||||||
runtimeRepository.save(runtimePersist);
|
runtimeRepository.save(runtimePersist);
|
||||||
}
|
}
|
||||||
|
|
@ -254,7 +251,7 @@ public class KieServiceCommon {
|
||||||
try {
|
try {
|
||||||
Set<Class<?>> classes = kieContainerInstance.getExtraClasses();
|
Set<Class<?>> classes = kieContainerInstance.getExtraClasses();
|
||||||
String className = container.getClassName();
|
String className = container.getClassName();
|
||||||
Class foundClass = this.getClassFromName(classes, className);
|
Class<Object> foundClass = this.getClassFromName(classes, className);
|
||||||
if (foundClass != null) {
|
if (foundClass != null) {
|
||||||
ClassLoader classLoader = foundClass.getClassLoader();
|
ClassLoader classLoader = foundClass.getClassLoader();
|
||||||
Class<?> theClass = classLoader.loadClass(className);
|
Class<?> theClass = classLoader.loadClass(className);
|
||||||
|
|
@ -310,57 +307,6 @@ public class KieServiceCommon {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@KafkaListener(
|
|
||||||
topics = "${org.kie.server.id}", groupId = "${org.kie.server.id}",
|
|
||||||
containerFactory = "ruleKafkaListenerKieContainerUpdateFactory")
|
|
||||||
public void updateConfig(KieContainerUpdate update) {
|
|
||||||
try {
|
|
||||||
String serverName = KieServiceCommon.getKieServerID();
|
|
||||||
if (update.getAction().equals(KieContainerUpdate.STATUS.TODEPLOY)) {
|
|
||||||
this.disposeContainer(update.getContainerID());
|
|
||||||
KieContainerResource newContainer = new KieContainerResource();
|
|
||||||
newContainer.setContainerId(update.getContainerID());
|
|
||||||
newContainer.setReleaseId(new ReleaseId());
|
|
||||||
newContainer.getReleaseId().setArtifactId(update.getArtifactID());
|
|
||||||
newContainer.getReleaseId().setGroupId(update.getGroupID());
|
|
||||||
newContainer.getReleaseId().setVersion(update.getProjectVersion());
|
|
||||||
this.createContainer(update.getContainerID(), newContainer);
|
|
||||||
ContainerPojoPersist containerIds = containerRepository.findByServerNameAndContainerId(serverName, update.getContainerID());
|
|
||||||
this.initCamelBusinessRoute(containerIds);
|
|
||||||
List<ContainerRuntimePojoPersist> containers = containerRuntimeRepository.findByServerNameAndContainerId(serverName, update.getContainerID());
|
|
||||||
for (ContainerRuntimePojoPersist element : containers) {
|
|
||||||
element.setStatus(ContainerRuntimePojoPersist.STATUS.UP.toString());
|
|
||||||
containerRuntimeRepository.save(element);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.disposeContainer(update.getContainerID());
|
|
||||||
this.deleteCamelBusinessRoute(update.getContainerID());
|
|
||||||
ContainerPojoPersist containerIds = containerRepository.findByServerNameAndContainerId(serverName, update.getContainerID());
|
|
||||||
List<ContainerRuntimePojoPersist> containers = containerRuntimeRepository.findByServerNameAndContainerId(serverName, update.getContainerID());
|
|
||||||
for (ContainerRuntimePojoPersist element : containers) {
|
|
||||||
element.setStatus(ContainerRuntimePojoPersist.STATUS.UP.toString());
|
|
||||||
containerRuntimeRepository.save(element);
|
|
||||||
}
|
|
||||||
containerRepository.delete(containerIds);
|
|
||||||
}
|
|
||||||
KieContainerResponse kieContainerResponse = new KieContainerResponse();
|
|
||||||
kieContainerResponse.setStatus(KieContainerResponse.STATUS.SUCCESS);
|
|
||||||
kafkaKieContainerUpdateResponseTemplate.executeInTransaction(kt ->
|
|
||||||
kt.send(KafkaTopicConstants.RESPONSE_DEPLOY_TOPIC,kieContainerResponse));
|
|
||||||
|
|
||||||
}catch (Exception e){
|
|
||||||
KieContainerResponse kieContainerResponse = new KieContainerResponse();
|
|
||||||
kieContainerResponse.setStatus(KieContainerResponse.STATUS.ERROR);
|
|
||||||
kieContainerResponse.setKieContainerUpdate(update);
|
|
||||||
kieContainerResponse.setMessageError(e.getMessage());
|
|
||||||
for (StackTraceElement stackTraceElement : e.getStackTrace()){
|
|
||||||
kieContainerResponse.getErrorMessages().add(stackTraceElement.toString());
|
|
||||||
}
|
|
||||||
kafkaKieContainerUpdateResponseTemplate.executeInTransaction(kt ->
|
|
||||||
kt.send(KafkaTopicConstants.RESPONSE_DEPLOY_TOPIC,kieContainerResponse));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public KieContainerResource createContainerWithRestBusinessService(String id, KieContainerResource container, String className, String processID) {
|
public KieContainerResource createContainerWithRestBusinessService(String id, KieContainerResource container, String className, String processID) {
|
||||||
|
|
@ -401,8 +347,6 @@ public class KieServiceCommon {
|
||||||
this.initCamelBusinessRoute(containerPojoPersist);
|
this.initCamelBusinessRoute(containerPojoPersist);
|
||||||
containerRepository.save(containerPojoPersist);
|
containerRepository.save(containerPojoPersist);
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
logger.error("createContainerWithRestBusinessService", e);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("createContainerWithRestBusinessService", e);
|
logger.error("createContainerWithRestBusinessService", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -437,20 +381,16 @@ public class KieServiceCommon {
|
||||||
|
|
||||||
|
|
||||||
public ServiceResponse<KieContainerResource> activateContainer(String id) {
|
public ServiceResponse<KieContainerResource> activateContainer(String id) {
|
||||||
ServiceResponse<KieContainerResource> response = server.activateContainer(id);
|
return server.activateContainer(id);
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ServiceResponse<KieContainerResource> deactivateContainer(String id) {
|
public ServiceResponse<KieContainerResource> deactivateContainer(String id) {
|
||||||
ServiceResponse<KieContainerResource> response = server.deactivateContainer(id);
|
return server.deactivateContainer(id);
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceResponse<KieContainerResource> getContainerInfo(String id) {
|
public ServiceResponse<KieContainerResource> getContainerInfo(String id) {
|
||||||
ServiceResponse<KieContainerResource> result = server.getContainerInfo(id);
|
return server.getContainerInfo(id);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceResponse<Void> disposeContainer(String id) {
|
public ServiceResponse<Void> disposeContainer(String id) {
|
||||||
|
|
@ -465,25 +405,20 @@ public class KieServiceCommon {
|
||||||
|
|
||||||
|
|
||||||
public ServiceResponse<KieServerStateInfo> getServerState(@Context HttpHeaders headers) {
|
public ServiceResponse<KieServerStateInfo> getServerState(@Context HttpHeaders headers) {
|
||||||
ServiceResponse<KieServerStateInfo> result = server.getServerState();
|
return server.getServerState();
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean readycheck() {
|
public boolean readycheck() {
|
||||||
boolean result = server.isKieServerReady();
|
return server.isKieServerReady();
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Message> healthcheck(boolean report) {
|
public List<Message> healthcheck(boolean report) {
|
||||||
List<Message> healthMessages = server.healthCheck(report);
|
return server.healthCheck(report);
|
||||||
|
|
||||||
|
|
||||||
return healthMessages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Class getClassFromName(Set<Class<?>> classes, String name) {
|
private Class<Object> getClassFromName(Set<Class<?>> classes, String name) {
|
||||||
Class result = null;
|
Class<Object> result = null;
|
||||||
for (Class c : classes) {
|
for (Class c : classes) {
|
||||||
if (c.getCanonicalName() != null
|
if (c.getCanonicalName() != null
|
||||||
&& c.getCanonicalName().equals(name)) {
|
&& c.getCanonicalName().equals(name)) {
|
||||||
|
|
@ -493,4 +428,41 @@ public class KieServiceCommon {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@Scheduled(fixedDelay = 5000)
|
||||||
|
public void updateConfig(){
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String serverName = KieServiceCommon.getKieServerID();
|
||||||
|
List<ContainerRuntimePojoPersist> containerRuntimePojoPersists = containerRuntimeRepository.findByServerNameAndHostname(serverName, hostName);
|
||||||
|
for (ContainerRuntimePojoPersist element : containerRuntimePojoPersists) {
|
||||||
|
ContainerPojoPersist containerPojoPersist = containerRepository.findByServerNameAndContainerId(serverName, element.getContainerId());
|
||||||
|
if (element.getStatus().equals(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name())) {
|
||||||
|
this.disposeContainer(element.getContainerId());
|
||||||
|
KieContainerResource newContainer = new KieContainerResource();
|
||||||
|
newContainer.setContainerId(element.getContainerId());
|
||||||
|
newContainer.setReleaseId(new ReleaseId());
|
||||||
|
newContainer.getReleaseId().setArtifactId(containerPojoPersist.getArtifactId());
|
||||||
|
newContainer.getReleaseId().setGroupId(containerPojoPersist.getGroupId());
|
||||||
|
newContainer.getReleaseId().setVersion(containerPojoPersist.getVersion());
|
||||||
|
this.createContainer(element.getContainerId(), newContainer);
|
||||||
|
this.initCamelBusinessRoute(containerPojoPersist);
|
||||||
|
element.setStatus(ContainerRuntimePojoPersist.STATUS.UP.toString());
|
||||||
|
containerRuntimeRepository.save(element);
|
||||||
|
|
||||||
|
} else if (element.getStatus().equals(ContainerRuntimePojoPersist.STATUS.TODELETE.name())) {
|
||||||
|
this.disposeContainer(element.getContainerId());
|
||||||
|
this.deleteCamelBusinessRoute(element.getContainerId());
|
||||||
|
element.setStatus(ContainerRuntimePojoPersist.STATUS.DOWN.toString());
|
||||||
|
containerRuntimeRepository.save(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("KieServerCommon",e);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue