-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlowStencilSetResource.java
48 lines (42 loc) · 2 KB
/
FlowStencilSetResource.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.flowable.controller;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.flowable.ui.common.service.exception.InternalServerErrorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* FlowStencilSetResource
* @author jinlei
* @date 2019/3/13 15:34
*/
@RestController
@RequestMapping("/app")
public class FlowStencilSetResource {
private static final Logger LOGGER = LoggerFactory.getLogger(org.flowable.ui.modeler.rest.app.StencilSetResource.class);
@Autowired
protected ObjectMapper objectMapper;
@RequestMapping(value = "/rest/stencil-sets/editor", method = RequestMethod.GET, produces = "application/json")
public JsonNode getStencilSetForEditor() {
try {
JsonNode stencilNode = objectMapper.readTree(this.getClass().getClassLoader().getResourceAsStream("stencilset/stencilset_bpmn.json"));
return stencilNode;
} catch (Exception e) {
LOGGER.error("Error reading bpmn stencil set json", e);
throw new InternalServerErrorException("Error reading bpmn stencil set json");
}
}
@RequestMapping(value = "/rest/stencil-sets/cmmneditor", method = RequestMethod.GET, produces = "application/json")
public JsonNode getCmmnStencilSetForEditor() {
try {
JsonNode stencilNode = objectMapper.readTree(this.getClass().getClassLoader().getResourceAsStream("stencilset/stencilset_cmmn.json"));
return stencilNode;
} catch (Exception e) {
LOGGER.error("Error reading bpmn stencil set json", e);
throw new InternalServerErrorException("Error reading bpmn stencil set json");
}
}
}