Package org.milyn.ect

Examples of org.milyn.ect.EdiParseException


        messageFiles = new HashMap<String, byte[]>();
        readDefinitionEntries(specificationInStream, new ZipDirectoryEntry("eded.", definitionFiles), new ZipDirectoryEntry("edcd.", definitionFiles), new ZipDirectoryEntry("edsd.", definitionFiles), new ZipDirectoryEntry("edmd.", "*", messageFiles));
       
        if (versions.size() != 1) {
            if (versions.size() == 0) {
                throw new EdiParseException("Seems that we have a directory containing 0 parseable version inside: " + versions + ".\n All messages:\n\t" + messages);
            }
            throw new EdiParseException("Seems that we have a directory containing more than one parseable version inside: " + versions + ".\n All messages:\n\t" + messages);
        }
        String version = versions.iterator().next();
        // Read Definition Configuration
        definitionModel = parseEDIDefinitionFiles();

        addMissingDefinitions(definitionModel);
        definitionModel.getDescription().setNamespace(ControlBlockHandlerFactory.NAMESPACE_ROOT + ":un:" + version + ":common");

        //Interchange envelope is inserted into the definitions. Handcoded at the moment.
        try {
            String interchangeSegmentDefinitions = INTERCHANGE_DEFINITION_SHORTNAME;
            if (!useShortName) {
                interchangeSegmentDefinitions = INTERCHANGE_DEFINITION;
            }
            EdifactModel interchangeEnvelope = new EdifactModel(ClassUtil.getResourceAsStream(interchangeSegmentDefinitions, this.getClass()));
            definitionModel.getSegments().getSegments().addAll(interchangeEnvelope.getEdimap().getSegments().getSegments());
        } catch (Exception e) {
            throw new EdiParseException(e.getMessage(), e);
        }

    }
View Full Code Here


        Matcher headerMatcher = SEGMENT_HEADER.matcher(line);
        if (headerMatcher.matches()) {
            segcode = headerMatcher.group(1);
            name = headerMatcher.group(2);
        } else {
            throw new EdiParseException("Unable to extract segment code and name for Segment from line [" + line + "].");
        }

        String description = getValue(reader, "Function:");

        Segment segment = new Segment();
View Full Code Here

        Matcher headerMatcher = COMPOSITE_HEADER.matcher(line);
        if (headerMatcher.matches()) {
            id = headerMatcher.group(1);
            name = headerMatcher.group(2);
        } else {
            throw new EdiParseException("Unable to extract id and name for Composite element from line [" + line + "].");
        }

        String description = getValue(reader, "Desc:");

        field.setName(name);
View Full Code Here

      Matcher headerMatcherOld = ELEMENT_HEADER_OLD.matcher(line);
      if (headerMatcherOld.matches()) {
    id = headerMatcherOld.group(1);
    name = headerMatcherOld.group(2);
      } else {
    throw new EdiParseException("Unable to extract id and name for Data element from line [" + line + "].");
      }
        }

        String description = getValue(reader, "Desc:");
View Full Code Here

            line = reader.readLine();
            while (line != null && !line.matches(LEGAL_MESSAGE)) {
                line = reader.readLine();
            }
        } catch (IOException e) {
            throw new EdiParseException("Error reading first line of UN/EDIFACT message.", e);
        }

        if(line == null) {
            throw new EdiParseException("Not a valid UN/EDIFACT message definition. First line doe not match pattern '" + LEGAL_MESSAGE + "'.");
        }
    }
View Full Code Here

        if (!isSplitIntoImport) {
            Segment importedSegment = segmentDefinitions.get(segcode);

            if(importedSegment == null) {
                throw new EdiParseException("Unknown segment code '" + segcode + "'.");
            }

            segment.getFields().addAll(importedSegment.getFields());

            if (importedSegment.getSegments().size() > 0) {
View Full Code Here

TOP

Related Classes of org.milyn.ect.EdiParseException

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.