Codota Logo
EDIConfigDigester
Code IndexAdd Codota to your IDE (free)

How to use
EDIConfigDigester
in
org.milyn.edisax.model

Best Java code snippets using org.milyn.edisax.model.EDIConfigDigester (Showing top 20 results out of 315)

  • Common ways to obtain EDIConfigDigester
private void myMethod () {
EDIConfigDigester e =
  • Codota IconURI uRI;URI resourceURI;new EDIConfigDigester(uRI, URIResourceLocator.extractBaseURI(resourceURI))
  • Codota IconURI modelURI;URI importBaseURI;new EDIConfigDigester(modelURI, importBaseURI)
  • Smart code suggestions by Codota
}
origin: smooks/smooks

/**
 * Digest the XML edi-message-mapping configuration stream.
 * @param stream the edi-message-mapping stream.
 * @return the {@link org.milyn.edisax.model.internal.Edimap}.
 * @throws IOException Error parsing the XML stream.
 * @throws SAXException Error parsing the XML stream.
 * @throws EDIConfigurationException Multiple or no namespaces in edi-message-mapping.
 */
public static Edimap digestConfig(InputStream stream) throws IOException, SAXException, EDIConfigurationException {
  return new EDIConfigDigester().digestEDIConfig(stream);
}
 
origin: org.milyn/milyn-smooks-all

/**
 * Digest child elements of edimap.
 * @param configDoc the Edimap element.
 * @param edimap the {@link org.milyn.edisax.model.internal.Edimap} to populate.
 * @param schemaName the schema uri.
 * @throws org.milyn.edisax.EDIConfigurationException is thrown when unable to retrieve namespace in configuration.
 */
private void digestXSDValidatedConfig(Document configDoc, Edimap edimap, String schemaName) throws EDIConfigurationException {
  // Check the namespace attribute
  Element documentElement = configDoc.getDocumentElement();
  //Retrieve the namespace for the schema.
  String namespacePrefix = retrieveNamespace(documentElement, schemaName);
  NodeList nodes = documentElement.getChildNodes();
  for (int i = 0; i < nodes.getLength(); i++) {
    Node node = nodes.item(i);
    if (node.getNodeName().equalsIgnoreCase(namespacePrefix + "import")) {
      digestImport(node, edimap);
    } else if (node.getNodeName().equalsIgnoreCase(namespacePrefix + "description")) {
      digestDescription(node, edimap);
    } else if (node.getNodeName().equalsIgnoreCase(namespacePrefix + "delimiters")) {
      digestDelimiters(node, edimap);
    } else if (node.getNodeName().equalsIgnoreCase(namespacePrefix + "segments")) {
      digestSegments(node, edimap, namespacePrefix);
    }
  }
}
origin: smooks/smooks

/**
 * Set values in {@link org.milyn.edisax.model.internal.ValueNode}.
 * @param node the {@link org.milyn.edisax.model.internal.ValueNode} to populate.
 * @param valueNode the ValueNode element.
 * @throws org.milyn.edisax.EDIConfigurationException is thrown when values are badly formatted.
 */
private void setValuesForValueNode(Node node, ValueNode valueNode, String namespacePrefix, MappingNode parent) throws EDIConfigurationException {
  setValuesForMappingNode(node, valueNode, namespacePrefix, parent);
  String type = getAttributeValue(node, "dataType");
  if(type != null) {
    valueNode.setDataType(type);
  } else {
    valueNode.setDataType(getAttributeValue(node, "type"));
  }
  valueNode.setMinLength(getNodeValueAsInteger(node, "minLength"));
  valueNode.setMaxLength(getNodeValueAsInteger(node, "maxLength"));
  String dataTypeParams = getAttributeValue(node, "dataTypeParameters");
  if(dataTypeParams != null) {
    digestParameters(valueNode, dataTypeParams);
  } else {
    digestParameters(valueNode, getAttributeValue(node, "typeParameters"));
  }
}
origin: smooks/smooks

setValuesForSegment(segment, node, namespacePrefix, parent);
    Field field = new Field();
    segment.getFields().add(field);
    digestField(currentNode, field, namespacePrefix, segment);
  } else {
    digestSegmentGroup(currentNode, segment.getSegments(), namespacePrefix, segment);
segmentGroup.setMaxOccurs(getNodeValueAsInteger(node, "maxOccurs"));
segmentGroup.setMinOccurs(getNodeValueAsInteger(node, "minOccurs"));
setValuesForMappingNode(node, segmentGroup, namespacePrefix, parent);
  Node currentNode = nodes.item(i);
  digestSegmentGroup(currentNode, segmentGroup.getSegments(), namespacePrefix, segmentGroup);
origin: smooks/smooks

private boolean digestSegmentGroup(Node currentNode, List<SegmentGroup> segmentGroupList, String namespacePrefix, MappingNode parent) throws EDIConfigurationException {
  if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "segmentGroup")) {
    SegmentGroup segment = new SegmentGroup();
    segment.setDocumentation(getNodeValue(currentNode, namespacePrefix + "documentation"));
    segmentGroupList.add(segment);
    digestSegment(currentNode, segment, namespacePrefix, parent);
    return true;
  } else if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "segment")) {
    Segment segment = new Segment();
    segmentGroupList.add(segment);
    digestSegment(currentNode, segment, namespacePrefix, parent);
    return true;
  }
  return false;
}
origin: org.milyn/milyn-smooks-all

private Edimap digestEDIConfig(Document configDoc) throws SAXException, EDIConfigurationException, IOException {
  XsdDOMValidator validator = new XsdDOMValidator(configDoc);
  if (validator.getNamespaces().size() == 0) {
    throw new EDIConfigurationException("The edi-message-mapping configuration must contain a namespace.");
  }
  if (validator.getNamespaces().size() > 1) {
    throw new EDIConfigurationException("Unsupported use of multiple configuration namespaces from inside the edi-message-mapping configuration.");
  }
  String ediNS = validator.getNamespaces().get(0).toString();
  validator.validate();
  Edimap edimap = new Edimap(modelURI);
  if(assertValidXSD(ediNS)) {
    digestXSDValidatedConfig(configDoc,  edimap, ediNS);
  } else {
    throw new SAXException("Cannot parse edi-message-mapping configuration.  Unsupported default Namespace '" + ediNS + "'.");
  }
  return edimap;
}
origin: org.milyn/milyn-smooks-all

/**
 * 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);
    }
  }
}
origin: org.milyn/milyn-smooks-all

/**
 * Digest the XML edi-message-mapping configuration stream.
 * @param stream the edi-message-mapping stream.
 * @return the {@link org.milyn.edisax.model.internal.Edimap}.
 * @throws IOException Error parsing the XML stream.
 * @throws SAXException Error parsing the XML stream.
 * @throws EDIConfigurationException Multiple or no namespaces in edi-message-mapping.
 */
public Edimap digestEDIConfig(Reader stream) throws IOException, SAXException, EDIConfigurationException {
  Document configDoc;
  try {
    configDoc = XmlUtil.parseStream(stream);
  } catch (ParserConfigurationException ee) {
    throw new SAXException("Unable to parse Smooks configuration.", ee);
  }
  return digestEDIConfig(configDoc);
}
origin: org.milyn/milyn-edisax-parser

setValuesForSegment(segment, node, namespacePrefix, parent);
    Field field = new Field();
    segment.getFields().add(field);
    digestField(currentNode, field, namespacePrefix, segment);
  } else {
    digestSegmentGroup(currentNode, segment.getSegments(), namespacePrefix, segment);
segmentGroup.setMaxOccurs(getNodeValueAsInteger(node, "maxOccurs"));
segmentGroup.setMinOccurs(getNodeValueAsInteger(node, "minOccurs"));
setValuesForMappingNode(node, segmentGroup, namespacePrefix, parent);
  Node currentNode = nodes.item(i);
  digestSegmentGroup(currentNode, segmentGroup.getSegments(), namespacePrefix, segmentGroup);
origin: org.milyn/milyn-smooks-all

private boolean digestSegmentGroup(Node currentNode, List<SegmentGroup> segmentGroupList, String namespacePrefix, MappingNode parent) throws EDIConfigurationException {
  if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "segmentGroup")) {
    SegmentGroup segment = new SegmentGroup();
    segment.setDocumentation(getNodeValue(currentNode, namespacePrefix + "documentation"));
    segmentGroupList.add(segment);
    digestSegment(currentNode, segment, namespacePrefix, parent);
    return true;
  } else if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "segment")) {
    Segment segment = new Segment();
    segmentGroupList.add(segment);
    digestSegment(currentNode, segment, namespacePrefix, parent);
    return true;
  }
  return false;
}
origin: org.milyn/milyn-edisax-parser

private Edimap digestEDIConfig(Document configDoc) throws SAXException, EDIConfigurationException, IOException {
  XsdDOMValidator validator = new XsdDOMValidator(configDoc);
  if (validator.getNamespaces().size() == 0) {
    throw new EDIConfigurationException("The edi-message-mapping configuration must contain a namespace.");
  }
  if (validator.getNamespaces().size() > 1) {
    throw new EDIConfigurationException("Unsupported use of multiple configuration namespaces from inside the edi-message-mapping configuration.");
  }
  String ediNS = validator.getNamespaces().get(0).toString();
  validator.validate();
  Edimap edimap = new Edimap(modelURI);
  if(assertValidXSD(ediNS)) {
    digestXSDValidatedConfig(configDoc,  edimap, ediNS);
  } else {
    throw new SAXException("Cannot parse edi-message-mapping configuration.  Unsupported default Namespace '" + ediNS + "'.");
  }
  return edimap;
}
origin: org.milyn/milyn-edisax-parser

/**
 * 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);
    }
  }
}
origin: org.virtuslab/milyn-edisax-parser

/**
 * Digest the XML edi-message-mapping configuration stream.
 * @param stream the edi-message-mapping stream.
 * @return the {@link org.milyn.edisax.model.internal.Edimap}.
 * @throws IOException Error parsing the XML stream.
 * @throws SAXException Error parsing the XML stream.
 * @throws EDIConfigurationException Multiple or no namespaces in edi-message-mapping.
 */
public Edimap digestEDIConfig(InputStream stream) throws IOException, SAXException, EDIConfigurationException {
  Document configDoc;
  try {
    configDoc = XmlUtil.parseStream(stream);
  } catch (ParserConfigurationException ee) {
    throw new SAXException("Unable to parse Smooks configuration.", ee);
  }
  return digestEDIConfig(configDoc);
}
origin: smooks/smooks

/**
 * Digest child elements of edimap.
 * @param configDoc the Edimap element.
 * @param edimap the {@link org.milyn.edisax.model.internal.Edimap} to populate.
 * @param schemaName the schema uri.
 * @throws org.milyn.edisax.EDIConfigurationException is thrown when unable to retrieve namespace in configuration.
 */
private void digestXSDValidatedConfig(Document configDoc, Edimap edimap, String schemaName) throws EDIConfigurationException {
  // Check the namespace attribute
  Element documentElement = configDoc.getDocumentElement();
  //Retrieve the namespace for the schema.
  String namespacePrefix = retrieveNamespace(documentElement, schemaName);
  NodeList nodes = documentElement.getChildNodes();
  for (int i = 0; i < nodes.getLength(); i++) {
    Node node = nodes.item(i);
    if (node.getNodeName().equalsIgnoreCase(namespacePrefix + "import")) {
      digestImport(node, edimap);
    } else if (node.getNodeName().equalsIgnoreCase(namespacePrefix + "description")) {
      digestDescription(node, edimap);
    } else if (node.getNodeName().equalsIgnoreCase(namespacePrefix + "delimiters")) {
      digestDelimiters(node, edimap);
    } else if (node.getNodeName().equalsIgnoreCase(namespacePrefix + "segments")) {
      digestSegments(node, edimap, namespacePrefix);
    }
  }
}
origin: org.virtuslab/milyn-edisax-parser

setValuesForSegment(segment, node, namespacePrefix, parent);
    Field field = new Field();
    segment.getFields().add(field);
    digestField(currentNode, field, namespacePrefix, segment);
  } else {
    digestSegmentGroup(currentNode, segment.getSegments(), namespacePrefix, segment);
segmentGroup.setMaxOccurs(getNodeValueAsInteger(node, "maxOccurs"));
segmentGroup.setMinOccurs(getNodeValueAsInteger(node, "minOccurs"));
setValuesForMappingNode(node, segmentGroup, namespacePrefix, parent);
  Node currentNode = nodes.item(i);
  digestSegmentGroup(currentNode, segmentGroup.getSegments(), namespacePrefix, segmentGroup);
origin: org.milyn/milyn-edisax-parser

/**
 * Set values in {@link org.milyn.edisax.model.internal.ValueNode}.
 * @param node the {@link org.milyn.edisax.model.internal.ValueNode} to populate.
 * @param valueNode the ValueNode element.
 * @throws org.milyn.edisax.EDIConfigurationException is thrown when values are badly formatted.
 */
private void setValuesForValueNode(Node node, ValueNode valueNode, String namespacePrefix, MappingNode parent) throws EDIConfigurationException {
  setValuesForMappingNode(node, valueNode, namespacePrefix, parent);
  String type = getAttributeValue(node, "dataType");
  if(type != null) {
    valueNode.setDataType(type);
  } else {
    valueNode.setDataType(getAttributeValue(node, "type"));
  }
  valueNode.setMinLength(getNodeValueAsInteger(node, "minLength"));
  valueNode.setMaxLength(getNodeValueAsInteger(node, "maxLength"));
  String dataTypeParams = getAttributeValue(node, "dataTypeParameters");
  if(dataTypeParams != null) {
    digestParameters(valueNode, dataTypeParams);
  } else {
    digestParameters(valueNode, getAttributeValue(node, "typeParameters"));
  }
}
origin: org.milyn/milyn-smooks-all

/**
 * Digest the XML edi-message-mapping configuration stream.
 * @param stream the edi-message-mapping stream.
 * @return the {@link org.milyn.edisax.model.internal.Edimap}.
 * @throws IOException Error parsing the XML stream.
 * @throws SAXException Error parsing the XML stream.
 * @throws EDIConfigurationException Multiple or no namespaces in edi-message-mapping.
 */
public static Edimap digestConfig(InputStream stream) throws IOException, SAXException, EDIConfigurationException {
  return new EDIConfigDigester().digestEDIConfig(stream);
}
 
origin: org.milyn/milyn-edisax-parser

private boolean digestSegmentGroup(Node currentNode, List<SegmentGroup> segmentGroupList, String namespacePrefix, MappingNode parent) throws EDIConfigurationException {
  if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "segmentGroup")) {
    SegmentGroup segment = new SegmentGroup();
    segment.setDocumentation(getNodeValue(currentNode, namespacePrefix + "documentation"));
    segmentGroupList.add(segment);
    digestSegment(currentNode, segment, namespacePrefix, parent);
    return true;
  } else if (currentNode.getNodeName().equalsIgnoreCase(namespacePrefix + "segment")) {
    Segment segment = new Segment();
    segmentGroupList.add(segment);
    digestSegment(currentNode, segment, namespacePrefix, parent);
    return true;
  }
  return false;
}
origin: smooks/smooks

private Edimap digestEDIConfig(Document configDoc) throws SAXException, EDIConfigurationException, IOException {
  XsdDOMValidator validator = new XsdDOMValidator(configDoc);
  if (validator.getNamespaces().size() == 0) {
    throw new EDIConfigurationException("The edi-message-mapping configuration must contain a namespace.");
  }
  if (validator.getNamespaces().size() > 1) {
    throw new EDIConfigurationException("Unsupported use of multiple configuration namespaces from inside the edi-message-mapping configuration.");
  }
  String ediNS = validator.getNamespaces().get(0).toString();
  validator.validate();
  Edimap edimap = new Edimap(modelURI);
  if(assertValidXSD(ediNS)) {
    digestXSDValidatedConfig(configDoc,  edimap, ediNS);
  } else {
    throw new SAXException("Cannot parse edi-message-mapping configuration.  Unsupported default Namespace '" + ediNS + "'.");
  }
  return edimap;
}
origin: org.virtuslab/milyn-edisax-parser

/**
 * 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);
    }
  }
}
org.milyn.edisax.modelEDIConfigDigester

Javadoc

Digests an edi-message-mapping and populates a org.milyn.edisax.model.internal.Edimap.

Most used methods

  • <init>
    Public constructor.
  • assertValidXSD
    Assert that schema used for validation are valid, i.e. the schema is either edi-message-mapping-1.0
  • digestComponent
    Digests attributes and child elements of Component element.
  • digestDelimiters
    Digest attributes of Delimiter element and populate Delimiter.
  • digestDescription
    Digest attributes of Description element and populate Description.
  • digestEDIConfig
  • digestField
    Digests attributes and child elements of Field element.
  • digestImport
    Digest attributes of Import element and populate Import.
  • digestParameters
    Digests parameters from parameters attribute and insertsthe parameters into the valueNode. If first
  • digestSegment
    Digests attributes and child elements of Segment element.
  • digestSegmentGroup
  • digestSegments
    Digest attributes and child elements of Segments element. Populates Segments.
  • digestSegmentGroup,
  • digestSegments,
  • digestXSDValidatedConfig,
  • getAttributeValue,
  • getNodeValue,
  • getNodeValueAsBoolean,
  • getNodeValueAsInteger,
  • retrieveNamespace,
  • setValuesForComponent,
  • setValuesForField

Popular in Java

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • onCreateOptionsMenu (Activity)
  • getSystemService (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now