Commit 4e812b11 authored by Roberto Loayza's avatar Roberto Loayza

Update parameter and channel agent

parent f9d7499a
...@@ -220,6 +220,18 @@ public class ScheduleService implements SchedulingConfigurer { ...@@ -220,6 +220,18 @@ public class ScheduleService implements SchedulingConfigurer {
.schedule(() -> processDeleteData(tenant, taskRegister, model.getCalendarID().trim()), trigger)); .schedule(() -> processDeleteData(tenant, taskRegister, model.getCalendarID().trim()), trigger));
} }
public void cancelTaskDelete(Long id) {
String keyDataSens = String.format("deleteSensible-%s-%s", tenant, id);
if (futureMap.containsKey(keyDataSens)) {
ScheduledFuture future = futureMap.get(keyDataSens);
future.cancel(true);
futureMap.remove(keyDataSens);
if (keys.contains(keyDataSens)) {
keys.remove(keyDataSens);
}
}
}
public void cancelTask(SchedulerTask model) { public void cancelTask(SchedulerTask model) {
String key = String.format("%s-%s-%s", tenant, model.getCalendarID().trim(), model.getId()); String key = String.format("%s-%s-%s", tenant, model.getCalendarID().trim(), model.getId());
if (futureMap.containsKey(key)){ if (futureMap.containsKey(key)){
...@@ -268,8 +280,8 @@ public class ScheduleService implements SchedulingConfigurer { ...@@ -268,8 +280,8 @@ public class ScheduleService implements SchedulingConfigurer {
String keyDataSens = ""; String keyDataSens = "";
for (DeleteDataSensBean data : deleteDataSensBeans) { for (DeleteDataSensBean data : deleteDataSensBeans) {
Agent agent = agentRepository.findById(data.getAgenId()).get(); Agent agent = agentRepository.findById(data.getAgenId()).get();
Trigger trigger = new CronTrigger(cronExpression, timeZone); Trigger trigger = new CronTrigger("0 0/1 * * * *", timeZone);
keyDataSens = String.format("deleteSensible-%s-%s", tenantIdentifier, data.getValue()); keyDataSens = String.format("deleteSensible-%s-%s", tenantIdentifier, data.getAgenId());
if (!futureMap.containsKey(keyDataSens)) { if (!futureMap.containsKey(keyDataSens)) {
keys.add(keyDataSens); keys.add(keyDataSens);
futureMap.put(keyDataSens, taskRegistrar.getScheduler() futureMap.put(keyDataSens, taskRegistrar.getScheduler()
......
...@@ -21,6 +21,9 @@ public class StatusConverter implements AttributeConverter<StatusEnum, String> { ...@@ -21,6 +21,9 @@ public class StatusConverter implements AttributeConverter<StatusEnum, String> {
@Override @Override
public String convertToDatabaseColumn(StatusEnum value) { public String convertToDatabaseColumn(StatusEnum value) {
if (value == null) {
return null;
}
return value.getName(); return value.getName();
} }
......
package com.bytesw.bytebot.service; package com.bytesw.bytebot.service;
import com.bytesw.bytebot.bean.*; import com.bytesw.bytebot.bean.*;
import com.bytesw.bytebot.etl.batch.service.ScheduleService;
import com.bytesw.bytebot.model.*; import com.bytesw.bytebot.model.*;
import com.bytesw.bytebot.jdbc.AgentJDBCRepository; import com.bytesw.bytebot.jdbc.AgentJDBCRepository;
import com.bytesw.bytebot.model.enums.*; import com.bytesw.bytebot.model.enums.*;
...@@ -60,6 +61,9 @@ public class AgentService extends CustomPaginationService<Agent> { ...@@ -60,6 +61,9 @@ public class AgentService extends CustomPaginationService<Agent> {
@Autowired @Autowired
private ProducerTemplate producerTemplate; private ProducerTemplate producerTemplate;
@Autowired
private ScheduleService scheduleService;
public List<DeploymentChannelParamValueBean> GetKeysFromAgents(AgentStatusEnum status){ public List<DeploymentChannelParamValueBean> GetKeysFromAgents(AgentStatusEnum status){
List<DeploymentChannelParamValueBean> values = agentJDBCRepository.getCredentialsFromAgentStatus(status.getName()); List<DeploymentChannelParamValueBean> values = agentJDBCRepository.getCredentialsFromAgentStatus(status.getName());
...@@ -147,7 +151,6 @@ public class AgentService extends CustomPaginationService<Agent> { ...@@ -147,7 +151,6 @@ public class AgentService extends CustomPaginationService<Agent> {
if (agent.getCountryId() != null) { if (agent.getCountryId() != null) {
Optional<Country> countryFound = countryRepository.findById(agent.getCountryId()); Optional<Country> countryFound = countryRepository.findById(agent.getCountryId());
if (countryFound.isPresent()) { if (countryFound.isPresent()) {
agentBD.setCountry(countryFound.get()); agentBD.setCountry(countryFound.get());
} }
...@@ -435,7 +438,7 @@ public class AgentService extends CustomPaginationService<Agent> { ...@@ -435,7 +438,7 @@ public class AgentService extends CustomPaginationService<Agent> {
if (agentFound.isPresent()) { if (agentFound.isPresent()) {
Agent agent = agentFound.get(); Agent agent = agentFound.get();
agent.setStatus(AgentStatusEnum.DELETED); agent.setStatus(AgentStatusEnum.DELETED);
scheduleService.cancelTaskDelete(id);
agentRepository.save(agent); agentRepository.save(agent);
} }
} }
......
...@@ -5,8 +5,7 @@ server: ...@@ -5,8 +5,7 @@ server:
port: ${APPLICATION_PORT:9077} port: ${APPLICATION_PORT:9077}
web: web:
#static-content-location: file:/home/mgutierrez/Documentos/Bytesw/bytebot-workspace/dist/bytebot-html/ #static-content-location: file:/home/mgutierrez/Documentos/Bytesw/bytebot-workspace/dist/bytebot-html/
static-content-location: file:/home/mgutierrez/Descargas/dist-20/dist/bytebot-html/ static-content-location: file:/home/mgutierrez/Descargas/dist/bytebot-html/
#NOTA debe terminar con /
security: security:
...@@ -28,7 +27,7 @@ application: ...@@ -28,7 +27,7 @@ application:
byte-bot: byte-bot:
batch: batch:
chunk: 10 chunk: 10
cron: 0/50 * * * * * cron: 0 0/1 * * * *
show-side-bar: false show-side-bar: false
test: ENC(OEchnTXpIZnCVdPNthgCZBfQjMt1AUS1) test: ENC(OEchnTXpIZnCVdPNthgCZBfQjMt1AUS1)
name: xdf-example name: xdf-example
...@@ -98,8 +97,8 @@ application: ...@@ -98,8 +97,8 @@ application:
zone: TimeZone zone: TimeZone
default: America/Mexico_City default: America/Mexico_City
bucket: bucket:
deployment: Despliegue deployment: DeployMode
parameter: Bucket parameter: KnowledgeBaseBucket
tenant: T186A1 tenant: T186A1
region: us-east-1 region: us-east-1
fileBucket: KB_Files fileBucket: KB_Files
...@@ -118,7 +117,7 @@ spring: ...@@ -118,7 +117,7 @@ spring:
datasource: datasource:
database-type: postgres database-type: postgres
schemaName: avb schemaName: avb
url: jdbc:postgresql://192.168.0.119:5432/bytebot?useSSL=false&currentSchema=avb url: jdbc:postgresql://192.168.0.119:5432/bytebot?useSSL=false&currentSchema=avb_hdi
driverClassName: 'org.postgresql.Driver' driverClassName: 'org.postgresql.Driver'
username: postgres username: postgres
password: postgres password: postgres
...@@ -146,7 +145,7 @@ spring: ...@@ -146,7 +145,7 @@ spring:
datasource: datasource:
database-type: postgres database-type: postgres
schemaName: avb schemaName: avb
url: jdbc:postgresql://192.168.0.119:5432/bytebot?useSSL=false&currentSchema=avb url: jdbc:postgresql://192.168.0.119:5432/bytebot?useSSL=false&currentSchema=avb_hdi
driverClassName: 'org.postgresql.Driver' driverClassName: 'org.postgresql.Driver'
username: postgres username: postgres
password: postgres password: postgres
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment