Package org.milyn.edisax.model

Examples of org.milyn.edisax.model.EdifactModel$Node


        assertTrue("The truncatable attribute should have value [true] in Segment.", ((Segment)ediModel.getEdimap().getSegments().getSegments().get(0).getSegments().get(0)).isTruncatable());
    }

    public void testImport_truncatableSegmentsNotExists() throws IOException, EDIConfigurationException, SAXException {
        InputStream input = new ByteArrayInputStream(StreamUtils.readStream(getClass().getResourceAsStream("edi-config-truncatableSegmentsNotExists.xml")));
        EdifactModel ediModel = new EdifactModel(input);

        assertTrue("The truncatable attribute should have value [true] in Segment.", !((Segment)ediModel.getEdimap().getSegments().getSegments().get(0).getSegments().get(0)).isTruncatable());
    }       
View Full Code Here


*/
public class IgnoreUnmappedFieldsTest extends TestCase {

  public void test() throws IOException, SAXException, EDIConfigurationException {
    MockContentHandler handler;
    EdifactModel msg1 = EDIParser.parseMappingModel(getClass().getResourceAsStream("edi-to-xml-mapping.xml"));
   
    EDIParser parser = new EDIParser();
    parser.setMappingModel(msg1);

    handler = new MockContentHandler();
View Full Code Here

    segmentReader.moveToNextSegment(false);

    // Select the mapping model to use for this message...
    String[] fields = segmentReader.getCurrentSegmentFields();
    String messageName = fields[2];
    EdifactModel mappingModel = registry.getMappingModel(messageName, segmentReader.getDelimiters());
        Edimap ediMap = mappingModel.getEdimap();

        Description description = ediMap.getDescription();
        AttributesImpl attrs = new AttributesImpl();
        String namespace = description.getNamespace();
        String commonNS = null;
View Full Code Here

   * Parse the EDI message.
   * <p/>
   * Overridden so as to set the EDI to XML mapping model on the parser.
   */
  public void parse(InputSource ediSource) throws IOException, SAXException {
    EdifactModel edi2xmlMappingModel = getMappingModel();
   
    setMappingModel(edi2xmlMappingModel);
       
    // Set features...
    setFeature(FEATURE_VALIDATE, validate);       
View Full Code Here

   * @return The Mapping Model.
   * @throws IOException Error reading resource configuration data (the mapping model).
   * @throws SAXException Error parsing mapping model.
   */
  private EdifactModel getMappingModel() throws IOException, SAXException {
        EdifactModel edifactModel;
        Hashtable mappings = getMappingTable(applicationContext);

    synchronized (configuration) {
            edifactModel = (EdifactModel) mappings.get(configuration);
            if(edifactModel == null) {
        try {
                ContainerResourceLocator resourceLocator = applicationContext.getResourceLocator();

                    if(modelConfigData.startsWith("urn:") || modelConfigData.endsWith(".jar") || modelConfigData.endsWith(".zip")) {
                        throw new IOException("Unsupported mapping model config URI for basic EDI Parser '" + modelConfigData + "'.  Check that you are using the correct EDI parser.  You may need to configure an Interchange Parser, such as the UN/EDIFACT parser.");
                    }

                if(resourceLocator instanceof URIResourceLocator) {
                  // This will resolve config paths relative to the containing smooks config file....
                  edifactModel = EDIParser.parseMappingModel(modelConfigData, (resourceLocator).getBaseURI());
                } else {
                  edifactModel = EDIParser.parseMappingModel(modelConfigData, URIResourceLocator.getSystemBaseURI());
                }
            if(edifactModel == null) {
              logger.error("Invalid " + MODEL_CONFIG_KEY + " config value '" + modelConfigData + "'. Failed to locate EDI Mapping Model resource!");
            }
        } catch (IOException e) {
                    IOException newE = new IOException("Error parsing EDI mapping model [" + configuration.getStringParameter(MODEL_CONFIG_KEY) + "].  Target Profile(s) " + getTargetProfiles() + ".");
          newE.initCause(e);
          throw newE;
        } catch (SAXException e) {
          throw new SAXException("Error parsing EDI mapping model [" + configuration.getStringParameter(MODEL_CONFIG_KEY) + "].  Target Profile(s) " + getTargetProfiles() + ".", e);
        } catch (EDIConfigurationException e) {
                    throw new SAXException("Error parsing EDI mapping model [" + configuration.getStringParameter(MODEL_CONFIG_KEY) + "].  Target Profile(s) " + getTargetProfiles() + ".", e);
                }
                mappings.put(configuration, edifactModel);
        logger.debug("Parsed, validated and cached EDI mapping model [" + edifactModel.getEdimap().getDescription().getName() + ", Version " + edifactModel.getEdimap().getDescription().getVersion() + "].  Target Profile(s) " + getTargetProfiles() + ".");
      } else if(logger.isInfoEnabled()) {
        logger.debug("Found EDI mapping model [" + edifactModel.getEdimap().getDescription().getName() + ", Version " + edifactModel.getEdimap().getDescription().getVersion() + "] in the model cache.  Target Profile(s) " + getTargetProfiles() + ".");
      }
    }
   
    return edifactModel;
  }
View Full Code Here

    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OSMNode> wayNodes = new ArrayList<OSMNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        if (origNode != null) {
          wayNodes.add(nodeMap.get(origNode));
        }
      }
     
View Full Code Here

    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OwnNode> wayNodes = new ArrayList<OwnNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        wayNodes.add(nodeMap.get(origNode));
      }
     
      OwnWay ownWay = new OwnWay(tagGroupForEntity(way), wayNodes);
     
View Full Code Here

        CommonEntityData entityData = new CommonEntityData(id, version, timestamp, osmuser,
                changeset, tags);
        if (type.equals(OSMUtils.nodeType())) {
            Point pt = (Point) feature.getDefaultGeometryProperty().getValue();
            entity = new Node(entityData, pt.getY(), pt.getX());

        } else {
            List<WayNode> nodes = Lists.newArrayList();
            String nodesString = (String) feature.getAttribute("nodes");
            for (String s : nodesString.split(";")) {
View Full Code Here

  /* save */

  @Test
  public void saveNode() {
    // Setup
    Node node = OsmDataBuilder.buildSampleNode();

    // Action
    entityDao.save(node);
    refresh(INDEX_NAME);

View Full Code Here

  }

  @Test
  public void saveAll() throws InterruptedException {
    // Setup
    Node node1 = OsmDataBuilder.buildSampleNode(1);
    Node node2 = OsmDataBuilder.buildSampleNode(2);

    // Action
    entityDao.saveAll(Arrays.asList(new Entity[] { node1, node2 }));
    refresh(INDEX_NAME);
View Full Code Here

TOP

Related Classes of org.milyn.edisax.model.EdifactModel$Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.