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 {
.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) {
String key = String.format("%s-%s-%s", tenant, model.getCalendarID().trim(), model.getId());
if (futureMap.containsKey(key)){
......@@ -268,8 +280,8 @@ public class ScheduleService implements SchedulingConfigurer {
String keyDataSens = "";
for (DeleteDataSensBean data : deleteDataSensBeans) {
Agent agent = agentRepository.findById(data.getAgenId()).get();
Trigger trigger = new CronTrigger(cronExpression, timeZone);
keyDataSens = String.format("deleteSensible-%s-%s", tenantIdentifier, data.getValue());
Trigger trigger = new CronTrigger("0 0/1 * * * *", timeZone);
keyDataSens = String.format("deleteSensible-%s-%s", tenantIdentifier, data.getAgenId());
if (!futureMap.containsKey(keyDataSens)) {
keys.add(keyDataSens);
futureMap.put(keyDataSens, taskRegistrar.getScheduler()
......
......@@ -21,6 +21,9 @@ public class StatusConverter implements AttributeConverter<StatusEnum, String> {
@Override
public String convertToDatabaseColumn(StatusEnum value) {
if (value == null) {
return null;
}
return value.getName();
}
......
package com.bytesw.bytebot.service;
import com.bytesw.bytebot.bean.*;
import com.bytesw.bytebot.etl.batch.service.ScheduleService;
import com.bytesw.bytebot.model.*;
import com.bytesw.bytebot.jdbc.AgentJDBCRepository;
import com.bytesw.bytebot.model.enums.*;
......@@ -60,6 +61,9 @@ public class AgentService extends CustomPaginationService<Agent> {
@Autowired
private ProducerTemplate producerTemplate;
@Autowired
private ScheduleService scheduleService;
public List<DeploymentChannelParamValueBean> GetKeysFromAgents(AgentStatusEnum status){
List<DeploymentChannelParamValueBean> values = agentJDBCRepository.getCredentialsFromAgentStatus(status.getName());
......@@ -147,7 +151,6 @@ public class AgentService extends CustomPaginationService<Agent> {
if (agent.getCountryId() != null) {
Optional<Country> countryFound = countryRepository.findById(agent.getCountryId());
if (countryFound.isPresent()) {
agentBD.setCountry(countryFound.get());
}
......@@ -435,7 +438,7 @@ public class AgentService extends CustomPaginationService<Agent> {
if (agentFound.isPresent()) {
Agent agent = agentFound.get();
agent.setStatus(AgentStatusEnum.DELETED);
scheduleService.cancelTaskDelete(id);
agentRepository.save(agent);
}
}
......
......@@ -5,8 +5,7 @@ server:
port: ${APPLICATION_PORT:9077}
web:
#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/
#NOTA debe terminar con /
static-content-location: file:/home/mgutierrez/Descargas/dist/bytebot-html/
security:
......@@ -28,7 +27,7 @@ application:
byte-bot:
batch:
chunk: 10
cron: 0/50 * * * * *
cron: 0 0/1 * * * *
show-side-bar: false
test: ENC(OEchnTXpIZnCVdPNthgCZBfQjMt1AUS1)
name: xdf-example
......@@ -98,8 +97,8 @@ application:
zone: TimeZone
default: America/Mexico_City
bucket:
deployment: Despliegue
parameter: Bucket
deployment: DeployMode
parameter: KnowledgeBaseBucket
tenant: T186A1
region: us-east-1
fileBucket: KB_Files
......@@ -118,7 +117,7 @@ spring:
datasource:
database-type: postgres
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'
username: postgres
password: postgres
......@@ -146,7 +145,7 @@ spring:
datasource:
database-type: postgres
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'
username: 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