Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Configuration
- public class BPMConfiguration {
- private static final Logger LOGGER = LogManager.getLogger(BPMConfiguration.class);
- @Autowired
- private JPDLService jpdlService;
- @PostConstruct
- public void deployJPDL() {
- BpmService bpmService = new BpmService();
- try {
- bpmService.init();
- List<JPDL> jpdls = jpdlService.findJPDLDesplegar();
- LOGGER.info("[BPMConfiguration.deployJPDL()] -> Número de jpdls a desplegar: " + jpdls.size() + ".");
- for (JPDL jpdl : jpdls) {
- String basePath = BaseUtils.Configuration.getResourcesPath() + "jpdl/";
- String jpdlPath = basePath.concat(jpdl.getNombre().name()).concat(".xml");
- LOGGER.info("[BPMConfiguration.deployJPDL()] -> Desplegando el jpdl: " + jpdl.toString() + ", con basepath: " + basePath + " y jpdlPath: " + jpdlPath + ".");
- Path path = Paths.get(jpdlPath);
- byte[] file = Files.readAllBytes(path);
- String jpdlXml = new String(file, StandardCharsets.UTF_8);
- bpmService.despliegaProceso(jpdlXml);
- jpdl.setDesplegar(false);
- jpdlService.update(jpdl);
- }
- } catch (IOException e) {
- LOGGER.error("Error al desplegar JPDL", e);
- } catch (BpmException e) {
- LOGGER.error("Error al desplegar JPDL", e);
- } finally {
- bpmService.destroy();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement