@Test public void testAddSafeCollectionOutput() { List<DataOutputAssociation> associations = new ArrayList<>(); DataOutputAssociation outputAssociation = mock(DataOutputAssociation.class); associations.add(outputAssociation); DataOutputAssociation outputAssociation2 = mock(DataOutputAssociation.class); when(outputAssociation.getSourceRef()).thenReturn(null); writer.addSafe(associations, outputAssociation2); associations.clear(); associations.add(outputAssociation); when(outputAssociation.getSourceRef()).thenReturn(new ArrayList<>()); writer.addSafe(associations, outputAssociation2); associations.clear(); associations.add(outputAssociation); List<ItemAwareElement> list = new ArrayList<>(); ItemAwareElementImpl element = mock(ItemAwareElementImpl.class); when(element.getId()).thenReturn("elementId"); list.add(element); when(outputAssociation.getSourceRef()).thenReturn(list); when(outputAssociation2.getSourceRef()).thenReturn(list); writer.addSafe(associations, outputAssociation2); associations.clear(); associations.add(outputAssociation); list = new ArrayList<>(); element = mock(ItemAwareElementImpl.class); when(element.getId()).thenReturn("elementId"); list.add(element); List<ItemAwareElement> list2 = new ArrayList<>(); ItemAwareElementImpl element2 = mock(ItemAwareElementImpl.class); when(element2.getId()).thenReturn("elementId"); list2.add(element2); when(element.getId()).thenReturn("elementId2"); list.add(element); when(outputAssociation.getSourceRef()).thenReturn(list); when(outputAssociation2.getSourceRef()).thenReturn(list2); writer.addSafe(associations, outputAssociation2); assertTrue(associations.contains(outputAssociation2)); }
protected static void addSafe(List<DataInput> inputs, DataInput dataInput) { inputs.removeIf(existingDataInput -> dataInput.getId().equals(existingDataInput.getId())); inputs.add(dataInput); }
MultipleInstanceActivityPropertyWriter extends ActivityPropertyWriter { protected static void addSafe(List<DataInput> inputs, DataInput dataInput) { inputs.removeIf(existingDataInput -> dataInput.getId().equals(existingDataInput.getId())); inputs.add(dataInput); } }
MultipleInstanceActivityPropertyWriter extends ActivityPropertyWriter { protected static void addSafe(List<DataInput> inputs, DataInput dataInput) { inputs.removeIf(existingDataInput -> dataInput.getId().equals(existingDataInput.getId())); inputs.add(dataInput); } MultipleInstanceActivityPropertyWriter(Activity activity,
                                                  VariableScope variableScope,
                                                  Set<DataObject> dataObjects); }
MultipleInstanceActivityPropertyWriter extends ActivityPropertyWriter { protected static void addSafe(List<DataInput> inputs, DataInput dataInput) { inputs.removeIf(existingDataInput -> dataInput.getId().equals(existingDataInput.getId())); inputs.add(dataInput); } MultipleInstanceActivityPropertyWriter(Activity activity,
                                                  VariableScope variableScope,
                                                  Set<DataObject> dataObjects); void setCollectionInput(String collectionInput); void setCollectionOutput(String collectionOutput); void setInput(String name); void setOutput(String name); void setOutput(String name, boolean addDataOutputAssociation); void setCompletionCondition(String expression); void setIsSequential(boolean sequential); }
MultipleInstanceActivityPropertyWriter extends ActivityPropertyWriter { protected static void addSafe(List<DataInput> inputs, DataInput dataInput) { inputs.removeIf(existingDataInput -> dataInput.getId().equals(existingDataInput.getId())); inputs.add(dataInput); } MultipleInstanceActivityPropertyWriter(Activity activity,
                                                  VariableScope variableScope,
                                                  Set<DataObject> dataObjects); void setCollectionInput(String collectionInput); void setCollectionOutput(String collectionOutput); void setInput(String name); void setOutput(String name); void setOutput(String name, boolean addDataOutputAssociation); void setCompletionCondition(String expression); void setIsSequential(boolean sequential);  }