use of com.fasterxml.jackson.databind.node.ArrayNode in project Activiti by Activiti.
the class BpmnJsonConverterUtil method convertSignalDefinitionsToJson.
public static void convertSignalDefinitionsToJson(BpmnModel bpmnModel, ObjectNode propertiesNode) {
if (bpmnModel.getSignals() != null) {
ArrayNode signalDefinitions = objectMapper.createArrayNode();
for (Signal signal : bpmnModel.getSignals()) {
ObjectNode signalNode = signalDefinitions.addObject();
signalNode.put(PROPERTY_SIGNAL_DEFINITION_ID, signal.getId());
signalNode.put(PROPERTY_SIGNAL_DEFINITION_NAME, signal.getName());
signalNode.put(PROPERTY_SIGNAL_DEFINITION_SCOPE, signal.getScope());
}
propertiesNode.put(PROPERTY_SIGNAL_DEFINITIONS, signalDefinitions);
}
}
use of com.fasterxml.jackson.databind.node.ArrayNode in project Activiti by Activiti.
the class BpmnJsonConverterUtil method convertMessagesToJson.
public static void convertMessagesToJson(Collection<Message> messages, ObjectNode propertiesNode) {
String propertyName = "messages";
ArrayNode messagesNode = objectMapper.createArrayNode();
for (Message message : messages) {
ObjectNode propertyItemNode = objectMapper.createObjectNode();
propertyItemNode.put(PROPERTY_MESSAGE_ID, message.getId());
propertyItemNode.put(PROPERTY_MESSAGE_NAME, message.getName());
propertyItemNode.put(PROPERTY_MESSAGE_ITEM_REF, message.getItemRef());
messagesNode.add(propertyItemNode);
}
propertiesNode.put(propertyName, messagesNode);
}
use of com.fasterxml.jackson.databind.node.ArrayNode in project Activiti by Activiti.
the class BaseBpmnJsonConverter method createDataAssociation.
protected void createDataAssociation(DataAssociation dataAssociation, boolean incoming, Activity activity) {
String sourceRef = null;
String targetRef = null;
if (incoming) {
sourceRef = dataAssociation.getSourceRef();
targetRef = activity.getId();
} else {
sourceRef = activity.getId();
targetRef = dataAssociation.getTargetRef();
}
ObjectNode flowNode = BpmnJsonConverterUtil.createChildShape(dataAssociation.getId(), STENCIL_DATA_ASSOCIATION, 172, 212, 128, 212);
ArrayNode dockersArrayNode = objectMapper.createArrayNode();
ObjectNode dockNode = objectMapper.createObjectNode();
dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(sourceRef).getWidth() / 2.0);
dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(sourceRef).getHeight() / 2.0);
dockersArrayNode.add(dockNode);
if (model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() > 2) {
for (int i = 1; i < model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() - 1; i++) {
GraphicInfo graphicInfo = model.getFlowLocationGraphicInfo(dataAssociation.getId()).get(i);
dockNode = objectMapper.createObjectNode();
dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX());
dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY());
dockersArrayNode.add(dockNode);
}
}
dockNode = objectMapper.createObjectNode();
dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(targetRef).getWidth() / 2.0);
dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(targetRef).getHeight() / 2.0);
dockersArrayNode.add(dockNode);
flowNode.put("dockers", dockersArrayNode);
ArrayNode outgoingArrayNode = objectMapper.createArrayNode();
outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(targetRef));
flowNode.put("outgoing", outgoingArrayNode);
flowNode.put("target", BpmnJsonConverterUtil.createResourceNode(targetRef));
ObjectNode propertiesNode = objectMapper.createObjectNode();
propertiesNode.put(PROPERTY_OVERRIDE_ID, dataAssociation.getId());
flowNode.put(EDITOR_SHAPE_PROPERTIES, propertiesNode);
shapesArrayNode.add(flowNode);
}
use of com.fasterxml.jackson.databind.node.ArrayNode in project Activiti by Activiti.
the class BoundaryEventJsonConverter method convertElementToJson.
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {
BoundaryEvent boundaryEvent = (BoundaryEvent) baseElement;
ArrayNode dockersArrayNode = objectMapper.createArrayNode();
ObjectNode dockNode = objectMapper.createObjectNode();
GraphicInfo graphicInfo = model.getGraphicInfo(boundaryEvent.getId());
GraphicInfo parentGraphicInfo = model.getGraphicInfo(boundaryEvent.getAttachedToRef().getId());
dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX() - parentGraphicInfo.getX());
dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY() - parentGraphicInfo.getY());
dockersArrayNode.add(dockNode);
flowElementNode.put("dockers", dockersArrayNode);
propertiesNode.put(PROPERTY_CANCEL_ACTIVITY, boundaryEvent.isCancelActivity());
addEventProperties(boundaryEvent, propertiesNode);
}
use of com.fasterxml.jackson.databind.node.ArrayNode in project Activiti by Activiti.
the class UserTaskJsonConverter method convertElementToJson.
@Override
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {
UserTask userTask = (UserTask) baseElement;
String assignee = userTask.getAssignee();
String owner = userTask.getOwner();
if (StringUtils.isNotEmpty(assignee) || StringUtils.isNotEmpty(owner) || CollectionUtils.isNotEmpty(userTask.getCandidateUsers()) || CollectionUtils.isNotEmpty(userTask.getCandidateGroups())) {
ObjectNode assignmentNode = objectMapper.createObjectNode();
ObjectNode assignmentValuesNode = objectMapper.createObjectNode();
if (StringUtils.isNotEmpty(assignee)) {
assignmentValuesNode.put(PROPERTY_USERTASK_ASSIGNEE, assignee);
}
if (StringUtils.isNotEmpty(owner)) {
assignmentValuesNode.put(PROPERTY_USERTASK_OWNER, owner);
}
if (CollectionUtils.isNotEmpty(userTask.getCandidateUsers())) {
ArrayNode candidateArrayNode = objectMapper.createArrayNode();
for (String candidateUser : userTask.getCandidateUsers()) {
ObjectNode candidateNode = objectMapper.createObjectNode();
candidateNode.put("value", candidateUser);
candidateArrayNode.add(candidateNode);
}
assignmentValuesNode.put(PROPERTY_USERTASK_CANDIDATE_USERS, candidateArrayNode);
}
if (CollectionUtils.isNotEmpty(userTask.getCandidateGroups())) {
ArrayNode candidateArrayNode = objectMapper.createArrayNode();
for (String candidateGroup : userTask.getCandidateGroups()) {
ObjectNode candidateNode = objectMapper.createObjectNode();
candidateNode.put("value", candidateGroup);
candidateArrayNode.add(candidateNode);
}
assignmentValuesNode.put(PROPERTY_USERTASK_CANDIDATE_GROUPS, candidateArrayNode);
}
assignmentNode.put("assignment", assignmentValuesNode);
propertiesNode.put(PROPERTY_USERTASK_ASSIGNMENT, assignmentNode);
}
if (userTask.getPriority() != null) {
setPropertyValue(PROPERTY_USERTASK_PRIORITY, userTask.getPriority().toString(), propertiesNode);
}
if (StringUtils.isNotEmpty(userTask.getFormKey())) {
setPropertyValue(PROPERTY_FORMKEY, userTask.getFormKey(), propertiesNode);
}
setPropertyValue(PROPERTY_USERTASK_DUEDATE, userTask.getDueDate(), propertiesNode);
setPropertyValue(PROPERTY_USERTASK_CATEGORY, userTask.getCategory(), propertiesNode);
addFormProperties(userTask.getFormProperties(), propertiesNode);
}
Aggregations