@Test public void testGetTypeDescriptorForInputPort() throws Exception { String xml = "<s:extensions xmlns:s=\"http: Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement(); JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element); XMLInputSplitterActivity a = new XMLInputSplitterActivity(); a.configure(bean); XMLInputSplitterActivityFactory af = new XMLInputSplitterActivityFactory(); af.setEdits(new EditsImpl()); boolean exists = false; for (ActivityInputPort p : af.getInputPorts(bean)) { if (p.getName().equals("person")) { exists=true; break; } } assertTrue("The input port named person should have been found",exists); assertNotNull("There should be a type descriptor for person",a.getTypeDescriptorForInputPort("person")); assertTrue("The descriptor should be complex",a.getTypeDescriptorForInputPort("person") instanceof ComplexTypeDescriptor); }
@Override public TypeDescriptor getTypeDescriptorForInputPort(String portName) { TypeDescriptor result = null; if (typeDescriptor instanceof ComplexTypeDescriptor) { for (TypeDescriptor desc : ((ComplexTypeDescriptor)typeDescriptor).getElements()) { if (desc.getName().equals(portName)) { result = desc; break; } } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType(); if (typeDescriptor.getName().equals(portName)) { result = desc; } } return result; }
XMLInputSplitterActivity extends AbstractAsynchronousActivity<JsonNode> implements InputPortTypeDescriptorActivity { @Override public TypeDescriptor getTypeDescriptorForInputPort(String portName) { TypeDescriptor result = null; if (typeDescriptor instanceof ComplexTypeDescriptor) { for (TypeDescriptor desc : ((ComplexTypeDescriptor)typeDescriptor).getElements()) { if (desc.getName().equals(portName)) { result = desc; break; } } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType(); if (typeDescriptor.getName().equals(portName)) { result = desc; } } return result; } }
XMLInputSplitterActivity extends AbstractAsynchronousActivity<JsonNode> implements InputPortTypeDescriptorActivity { @Override public TypeDescriptor getTypeDescriptorForInputPort(String portName) { TypeDescriptor result = null; if (typeDescriptor instanceof ComplexTypeDescriptor) { for (TypeDescriptor desc : ((ComplexTypeDescriptor)typeDescriptor).getElements()) { if (desc.getName().equals(portName)) { result = desc; break; } } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType(); if (typeDescriptor.getName().equals(portName)) { result = desc; } } return result; }  }
XMLInputSplitterActivity extends AbstractAsynchronousActivity<JsonNode> implements InputPortTypeDescriptorActivity { @Override public TypeDescriptor getTypeDescriptorForInputPort(String portName) { TypeDescriptor result = null; if (typeDescriptor instanceof ComplexTypeDescriptor) { for (TypeDescriptor desc : ((ComplexTypeDescriptor)typeDescriptor).getElements()) { if (desc.getName().equals(portName)) { result = desc; break; } } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType(); if (typeDescriptor.getName().equals(portName)) { result = desc; } } return result; }  @Override void configure(JsonNode configBean); @Override JsonNode getConfiguration(); @Override void executeAsynch(final Map<String, T2Reference> data,
			final AsynchronousActivityCallback callback); @Override TypeDescriptor getTypeDescriptorForInputPort(String portName); Map<String, TypeDescriptor> getTypeDescriptorsForInputPorts(); }
XMLInputSplitterActivity extends AbstractAsynchronousActivity<JsonNode> implements InputPortTypeDescriptorActivity { @Override public TypeDescriptor getTypeDescriptorForInputPort(String portName) { TypeDescriptor result = null; if (typeDescriptor instanceof ComplexTypeDescriptor) { for (TypeDescriptor desc : ((ComplexTypeDescriptor)typeDescriptor).getElements()) { if (desc.getName().equals(portName)) { result = desc; break; } } } else if (typeDescriptor instanceof ArrayTypeDescriptor) { TypeDescriptor desc = ((ArrayTypeDescriptor)typeDescriptor).getElementType(); if (typeDescriptor.getName().equals(portName)) { result = desc; } } return result; }  @Override void configure(JsonNode configBean); @Override JsonNode getConfiguration(); @Override void executeAsynch(final Map<String, T2Reference> data,
			final AsynchronousActivityCallback callback); @Override TypeDescriptor getTypeDescriptorForInputPort(String portName); Map<String, TypeDescriptor> getTypeDescriptorsForInputPorts(); static final String URI; }