Commit 723df8b5 authored by Roberto Loayza's avatar Roberto Loayza

Bcd Artefacts

parent 2ad3fa3d
package com.bytesw.bytebot.bean;
import com.google.gson.annotations.Expose;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter @Setter
public class BcdControlBean implements Serializable {
@Expose private Long id;
@Expose private Long agentId;
@Expose private String status;
}
package com.bytesw.bytebot.controller;
import com.bytesw.bytebot.bean.BcdControlBean;
import com.bytesw.bytebot.service.BcdControlService;
import com.bytesw.xdf.annotation.ProgramSecurity;
import com.bytesw.xdf.controller.XDFController;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController()
@RequestMapping("/service/settings/bcdControl")
@ProgramSecurity("BCDCONTROL")
@Log4j2
public class BcdControlController extends XDFController<BcdControlBean, Long> {
public BcdControlController(BcdControlService service) {
super(service);
}
}
package com.bytesw.bytebot.etl.dao; package com.bytesw.bytebot.etl.dao;
import com.bytesw.bytebot.etl.model.Action; import com.bytesw.bytebot.etl.model.Action;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import java.util.Optional; import java.util.Optional;
public interface ActionRepository extends CrudRepository<Action, Long> { public interface ActionRepository extends CrudRepository<Action, Long>, JpaSpecificationExecutor<Action> {
Optional<Action> findByIdentifier(String identifier); Optional<Action> findByIdentifier(String identifier);
} }
package com.bytesw.bytebot.model;
import lombok.*;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Getter
@Setter
@ToString
@Table(name = "avb_bcd_control")
@NamedQuery(name = "BcdControl.findByPK", query = "Select u from BcdControl u where u.id = ?1")
public class BcdControl implements Serializable {
@Id
@Column(name = "bcd_id")
@SequenceGenerator(name = "AVB_BCD_CONTROL_GENERATOR", sequenceName = "AVB_BCD_CONTROL_SEQ", initialValue = 1, allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AVB_BCD_CONTROL_GENERATOR")
private Long id;
@Column(name = "agen_id")
private Long agentId;
@Column(name = "bcd_status")
private String status;
}
package com.bytesw.bytebot.model.enums;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@Getter
public enum StatusBcdEnum {
CARGANDO("CG"),
CARGADO("CGD"),
INDEXANDO("IDX"),
INDEXADO("IDXD");
private static final Map<String, StatusBcdEnum> map = new HashMap<>();
private String name;
StatusBcdEnum(String name) {
this.name = name;
}
static {
for (StatusBcdEnum type : StatusBcdEnum.values()) {
map.put(type.name, type);
}
}
public static StatusBcdEnum fromString(String name) {
return map.get(name);
}
}
package com.bytesw.bytebot.repository;
import com.bytesw.bytebot.model.BcdControl;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;
public interface BcdControlRepository extends CrudRepository<BcdControl, Long>, JpaSpecificationExecutor<BcdControl> {
}
package com.bytesw.bytebot.service;
import com.bytesw.bytebot.bean.BcdControlBean;
import com.bytesw.bytebot.model.BcdControl;
import com.bytesw.bytebot.repository.BcdControlRepository;
import com.bytesw.xdf.service.XDFService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
@Log4j2
public class BcdControlService extends XDFService<BcdControl, BcdControlBean, Long> {
protected BcdControlService(BcdControlRepository repository) {
super(repository);
}
@Override
protected BcdControl toModel(BcdControl model, BcdControlBean bean) {
if (model == null) {
model = new BcdControl();
}
BeanUtils.copyProperties(bean, model);
return model;
}
@Override
protected BcdControlBean toBean(BcdControl model) {
BcdControlBean bean = new BcdControlBean();
BeanUtils.copyProperties(model, bean);
return bean;
}
}
...@@ -43,8 +43,8 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -43,8 +43,8 @@ import org.springframework.web.multipart.MultipartFile;
@Log4j2 @Log4j2
public class FileManagementService { public class FileManagementService {
String[] validExtensions = new String[]{"xls", "xlsx"}; String[] validExtensions = new String[]{"xls", "xlsx", "csv"};
String[] fileHeaders = new String[]{"TOPICO", "SUBTOPICO", "PREGUNTA", "RESPUESTA"}; String[] fileHeaders = new String[]{"Class", "Question", "Answer"};
@Autowired @Autowired
private QuestionFileRepository questionFileRepository; private QuestionFileRepository questionFileRepository;
...@@ -61,7 +61,7 @@ public class FileManagementService { ...@@ -61,7 +61,7 @@ public class FileManagementService {
for (String validExension : validExtensions) { for (String validExension : validExtensions) {
if (validExension.equalsIgnoreCase(fileExtension.trim())) { if (validExension.equalsIgnoreCase(fileExtension.trim())) {
acceptedExtension = true; acceptedExtension = true;
continue; continue;//Break?
} }
} }
......
package com.bytesw.bytebot.service;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
@Log4j2
public class OrquestadorService {
}
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