private static Map<String, Component> readComponents(Reader reader, boolean useShortName) throws IOException, EdiParseException { Map<String, Component> datas = new HashMap<String, Component>(); BufferedReader _reader = new BufferedReader(reader); moveToNextPart(_reader); Component component = new Component(); String id = populateComponent(_reader, component, useShortName); while (id != null) { datas.put(id, component); moveToNextPart(_reader); component = new Component(); id = populateComponent(_reader, component, useShortName); } return datas; }
/** * Digests attributes and child elements of Field element. * @param node the Field element. * @param field the {@link org.milyn.edisax.model.internal.Field} to populate * @param namespacePrefix the prefix used to name elements in xml. * @throws org.milyn.edisax.EDIConfigurationException is thrown when values are badly formatted. */ private void digestField(Node node, Field field, String namespacePrefix, MappingNode parent) throws EDIConfigurationException { setValuesForField(field, node, namespacePrefix, parent); NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node currentNode = nodes.item(i); if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "component")) { Component component = new Component(); field.getComponents().add(component); digestComponent(currentNode, component, namespacePrefix, field); } } }
/** * Digests attributes and child elements of Field element. * @param node the Field element. * @param field the {@link org.milyn.edisax.model.internal.Field} to populate * @param namespacePrefix the prefix used to name elements in xml. * @throws org.milyn.edisax.EDIConfigurationException is thrown when values are badly formatted. */ private void digestField(Node node, Field field, String namespacePrefix, MappingNode parent) throws EDIConfigurationException { setValuesForField(field, node, namespacePrefix, parent); NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node currentNode = nodes.item(i); if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "component")) { Component component = new Component(); field.getComponents().add(component); digestComponent(currentNode, component, namespacePrefix, field); } } }
/** * Digests attributes and child elements of Field element. * @param node the Field element. * @param field the {@link org.milyn.edisax.model.internal.Field} to populate * @param namespacePrefix the prefix used to name elements in xml. * @throws org.milyn.edisax.EDIConfigurationException is thrown when values are badly formatted. */ private void digestField(Node node, Field field, String namespacePrefix, MappingNode parent) throws EDIConfigurationException { setValuesForField(field, node, namespacePrefix, parent); NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node currentNode = nodes.item(i); if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "component")) { Component component = new Component(); field.getComponents().add(component); digestComponent(currentNode, component, namespacePrefix, field); } } }
/** * Digests attributes and child elements of Field element. * @param node the Field element. * @param field the {@link org.milyn.edisax.model.internal.Field} to populate * @param namespacePrefix the prefix used to name elements in xml. * @throws org.milyn.edisax.EDIConfigurationException is thrown when values are badly formatted. */ private void digestField(Node node, Field field, String namespacePrefix, MappingNode parent) throws EDIConfigurationException { setValuesForField(field, node, namespacePrefix, parent); NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node currentNode = nodes.item(i); if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "component")) { Component component = new Component(); field.getComponents().add(component); digestComponent(currentNode, component, namespacePrefix, field); } } }
linePart = getLinePart(reader, line); if (linePart != null) { Component component = new Component(); component.setRequired(linePart.isMandatory()); populateComponent(component, components.get(linePart.getId()));