Package org.milyn.edisax.model.internal

Examples of org.milyn.edisax.model.internal.Segment


            } else if (line.matches(SEGMENT_GROUP_END)) {
                Matcher matcher = Pattern.compile(SEGMENT_GROUP_END).matcher(line);
                matcher.matches();
                String id = getLineId(lineNo, matcher.group(1));
                Segment segment = createSegment(id, matcher.group(2), matcher.group(3), matcher.group(4), matcher.group(5), definitions, isSplitIntoImport, useShortName, segmentDefinitions);
                parentGroup.getSegments().add(segment);
                return extractPlusCharacter(matcher.group(6)).length() - 1;
            } else if (line.matches(SEGMENT_REGULAR)) {
                Matcher matcher = Pattern.compile(SEGMENT_REGULAR).matcher(line);
                matcher.matches();
                String id = getLineId(lineNo, matcher.group(1));
                if (!ignoreSegments.contains(matcher.group(2))) {
                    Segment segment = createSegment(id, matcher.group(2), matcher.group(3), matcher.group(4), matcher.group(5), definitions, isSplitIntoImport, useShortName, segmentDefinitions);
                    parentGroup.getSegments().add(segment);
                }
            } else if (!line.trim().equals("") && line.matches(SEGMENT_REGULAR_START)) {
                Matcher matcher = Pattern.compile(SEGMENT_REGULAR_START).matcher(line);
                matcher.matches();
                String id = getLineId(lineNo, matcher.group(1));
                String segcode = matcher.group(2);
                String description = matcher.group(3);
                line = reader.readLine();
                matcher = Pattern.compile(SEGMENT_REGULAR_END).matcher(line);
                matcher.matches();
                description += " " + matcher.group(1);
                if (!ignoreSegments.contains(matcher.group(2))) {
                    Segment segment = createSegment(id, segcode, description, matcher.group(2), matcher.group(3), definitions, isSplitIntoImport, useShortName, segmentDefinitions);
                    parentGroup.getSegments().add(segment);
                }
            } else if (line.matches(ANNEX)) {
                return 0;
            }
View Full Code Here


        group.setMaxOccurs(Integer.valueOf(maxOccurance));
        return group;
    }

    private Segment createSegment(String id, String segcode, String name, String mandatory, String maxOccurance, Map<String, String> definitions, boolean isSplitIntoImport, boolean useShortName, Map<String, Segment> segmentDefinitions) {
        Segment segment = new Segment();

        name = name.trim();

        segment.setName(name);
        segment.setSegcode(segcode);
        segment.setNodeTypeRef(agency + ":" + segcode);

        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) {
                segment.getSegments().addAll(importedSegment.getSegments());
            }
        }

        if (useShortName) {
            segment.setXmltag(segcode);
View Full Code Here

TOP

Related Classes of org.milyn.edisax.model.internal.Segment

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.