Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. @Configuration
  2. public class BPMConfiguration {
  3.  
  4. private static final Logger LOGGER = LogManager.getLogger(BPMConfiguration.class);
  5.  
  6. @Autowired
  7. private JPDLService jpdlService;
  8.  
  9. @PostConstruct
  10. public void deployJPDL() {
  11. BpmService bpmService = new BpmService();
  12.  
  13. try {
  14. bpmService.init();
  15. List<JPDL> jpdls = jpdlService.findJPDLDesplegar();
  16. LOGGER.info("[BPMConfiguration.deployJPDL()] -> Número de jpdls a desplegar: " + jpdls.size() + ".");
  17. for (JPDL jpdl : jpdls) {
  18. String basePath = BaseUtils.Configuration.getResourcesPath() + "jpdl/";
  19. String jpdlPath = basePath.concat(jpdl.getNombre().name()).concat(".xml");
  20. LOGGER.info("[BPMConfiguration.deployJPDL()] -> Desplegando el jpdl: " + jpdl.toString() + ", con basepath: " + basePath + " y jpdlPath: " + jpdlPath + ".");
  21. Path path = Paths.get(jpdlPath);
  22. byte[] file = Files.readAllBytes(path);
  23. String jpdlXml = new String(file, StandardCharsets.UTF_8);
  24. bpmService.despliegaProceso(jpdlXml);
  25. jpdl.setDesplegar(false);
  26. jpdlService.update(jpdl);
  27. }
  28. } catch (IOException e) {
  29. LOGGER.error("Error al desplegar JPDL", e);
  30. } catch (BpmException e) {
  31. LOGGER.error("Error al desplegar JPDL", e);
  32. } finally {
  33. bpmService.destroy();
  34. }
  35.  
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement