@Test public void testMessageStructureRef() { MessageRef messageRef = new MessageRef("someVar", ""); List<ItemDefinition> itemDefinitions = new ArrayList<>(); ItemDefinition itemDefinition = mock(ItemDefinition.class); itemDefinitions.add(itemDefinition); when(itemDefinition.getStructureRef()).thenReturn(SAMPLE_STRUCTURE_REF); when(propertyWriter.getItemDefinitions()).thenReturn(itemDefinitions); propertyWriter.addMessage(messageRef); assertEquals(messageRef.getStructure(), SAMPLE_STRUCTURE_REF); when(itemDefinition.getStructureRef()).thenReturn(SAMPLE_STRUCTURE_REF); messageRef.setStructure("nonEmpty"); propertyWriter.addMessage(messageRef); assertEquals(messageRef.getStructure(), "nonEmpty"); itemDefinitions.clear(); messageRef.setStructure(""); propertyWriter.addMessage(messageRef); assertEquals(messageRef.getStructure(), ""); messageRef.setStructure("nonEmpty"); propertyWriter.addMessage(messageRef); assertEquals(messageRef.getStructure(), "nonEmpty"); }
public void addMessage(MessageRef messageRef) { if (messageRef.getStructure().isEmpty() && this.getItemDefinitions().size() == 1) { messageRef.setStructure(this.getItemDefinitions().get(0).getStructureRef()); } MessageEventDefinition messageEventDefinition = bpmn2.createMessageEventDefinition(); addEventDefinition(messageEventDefinition); String name = messageRef.getValue(); if (name == null || name.isEmpty()) { return; } ItemDefinition itemDefinition = bpmn2.createItemDefinition(); itemDefinition.setId(Ids.messageItem(name)); itemDefinition.setStructureRef(messageRef.getStructure()); Message message = bpmn2.createMessage(); message.setName(name); message.setItemRef(itemDefinition); messageEventDefinition.setMessageRef(message); CustomAttribute.msgref.of(messageEventDefinition).set(name); addItemDefinition(itemDefinition); addRootElement(message); }
EventPropertyWriter extends PropertyWriter { public void addMessage(MessageRef messageRef) { if (messageRef.getStructure().isEmpty() && this.getItemDefinitions().size() == 1) { messageRef.setStructure(this.getItemDefinitions().get(0).getStructureRef()); } MessageEventDefinition messageEventDefinition = bpmn2.createMessageEventDefinition(); addEventDefinition(messageEventDefinition); String name = messageRef.getValue(); if (name == null || name.isEmpty()) { return; } ItemDefinition itemDefinition = bpmn2.createItemDefinition(); itemDefinition.setId(Ids.messageItem(name)); itemDefinition.setStructureRef(messageRef.getStructure()); Message message = bpmn2.createMessage(); message.setName(name); message.setItemRef(itemDefinition); messageEventDefinition.setMessageRef(message); CustomAttribute.msgref.of(messageEventDefinition).set(name); addItemDefinition(itemDefinition); addRootElement(message); } }
EventPropertyWriter extends PropertyWriter { public void addMessage(MessageRef messageRef) { if (messageRef.getStructure().isEmpty() && this.getItemDefinitions().size() == 1) { messageRef.setStructure(this.getItemDefinitions().get(0).getStructureRef()); } MessageEventDefinition messageEventDefinition = bpmn2.createMessageEventDefinition(); addEventDefinition(messageEventDefinition); String name = messageRef.getValue(); if (name == null || name.isEmpty()) { return; } ItemDefinition itemDefinition = bpmn2.createItemDefinition(); itemDefinition.setId(Ids.messageItem(name)); itemDefinition.setStructureRef(messageRef.getStructure()); Message message = bpmn2.createMessage(); message.setName(name); message.setItemRef(itemDefinition); messageEventDefinition.setMessageRef(message); CustomAttribute.msgref.of(messageEventDefinition).set(name); addItemDefinition(itemDefinition); addRootElement(message); } EventPropertyWriter(Event event, VariableScope variableScope); }
EventPropertyWriter extends PropertyWriter { public void addMessage(MessageRef messageRef) { if (messageRef.getStructure().isEmpty() && this.getItemDefinitions().size() == 1) { messageRef.setStructure(this.getItemDefinitions().get(0).getStructureRef()); } MessageEventDefinition messageEventDefinition = bpmn2.createMessageEventDefinition(); addEventDefinition(messageEventDefinition); String name = messageRef.getValue(); if (name == null || name.isEmpty()) { return; } ItemDefinition itemDefinition = bpmn2.createItemDefinition(); itemDefinition.setId(Ids.messageItem(name)); itemDefinition.setStructureRef(messageRef.getStructure()); Message message = bpmn2.createMessage(); message.setName(name); message.setItemRef(itemDefinition); messageEventDefinition.setMessageRef(message); CustomAttribute.msgref.of(messageEventDefinition).set(name); addItemDefinition(itemDefinition); addRootElement(message); } EventPropertyWriter(Event event, VariableScope variableScope); abstract void setAssignmentsInfo(AssignmentsInfo assignmentsInfo); void addMessage(MessageRef messageRef); void addLink(LinkRef linkRef); void addSignal(SignalRef signalRef); void addSignalScope(SignalScope signalScope); void addError(ErrorRef errorRef); void addTerminate(); void addTimer(TimerSettings timerSettings); void addCondition(ConditionExpression condition); void addEscalation(EscalationRef escalationRef); void addCompensation(); void addSlaDueDate(SLADueDate slaDueDate); }
EventPropertyWriter extends PropertyWriter { public void addMessage(MessageRef messageRef) { if (messageRef.getStructure().isEmpty() && this.getItemDefinitions().size() == 1) { messageRef.setStructure(this.getItemDefinitions().get(0).getStructureRef()); } MessageEventDefinition messageEventDefinition = bpmn2.createMessageEventDefinition(); addEventDefinition(messageEventDefinition); String name = messageRef.getValue(); if (name == null || name.isEmpty()) { return; } ItemDefinition itemDefinition = bpmn2.createItemDefinition(); itemDefinition.setId(Ids.messageItem(name)); itemDefinition.setStructureRef(messageRef.getStructure()); Message message = bpmn2.createMessage(); message.setName(name); message.setItemRef(itemDefinition); messageEventDefinition.setMessageRef(message); CustomAttribute.msgref.of(messageEventDefinition).set(name); addItemDefinition(itemDefinition); addRootElement(message); } EventPropertyWriter(Event event, VariableScope variableScope); abstract void setAssignmentsInfo(AssignmentsInfo assignmentsInfo); void addMessage(MessageRef messageRef); void addLink(LinkRef linkRef); void addSignal(SignalRef signalRef); void addSignalScope(SignalScope signalScope); void addError(ErrorRef errorRef); void addTerminate(); void addTimer(TimerSettings timerSettings); void addCondition(ConditionExpression condition); void addEscalation(EscalationRef escalationRef); void addCompensation(); void addSlaDueDate(SLADueDate slaDueDate);  }