/** * Just cut out a local part from the fully qualified name * * @param segment * @return */ private String getLocalPart(Segment segment) { // TODO Fix this hack String ref = segment.getNodeTypeRef(); return ref.substring(ref.indexOf(":") + 1); } }
/** * Inserts data from imported segment into the importing segment. Continues * through all the child segments of the importing segment. * * @param segment the importing segment. * @param imp import information like url and namespace. * @param importedSegments the imported segment. * @throws EDIParseException Thrown when a segref attribute in importing * segment contains a value not located in the imported segment but with the * namespace referencing the imported file. */ private void applyImportOnSegment(Segment segment, Import imp, Map<String, Segment> importedSegments) throws EDIParseException { if (segment.getNodeTypeRef() != null && segment.getNodeTypeRef().startsWith(imp.getNamespace() + ":")) { String key = segment.getNodeTypeRef().substring(segment.getNodeTypeRef().indexOf(':') + 1); Segment importedSegment = importedSegments.get(key); if (importedSegment == null) { throw new EDIParseException(edimap, "Referenced segment [" + key + "] does not exist in imported edi-message-mapping [" + imp.getResource() + "]"); } insertImportedSegmentInfo(segment, importedSegment, imp.isTruncatableSegments(), imp.isTruncatableFields(), imp.isTruncatableComponents()); } }
Segment segment = (Segment) arg0; EClass clazz = null; if (segment.getNodeTypeRef() == null) {
/** * Set values in {@link org.dhatim.edisax.model.internal.Segment}. * @param segment the {@link org.dhatim.edisax.model.internal.Segment} to populate. * @param node the Segment element. */ private void setValuesForSegment(Segment segment, Node node, String namespacePrefix, MappingNode parent) { segment.setMaxOccurs(getNodeValueAsInteger(node, "maxOccurs")); segment.setMinOccurs(getNodeValueAsInteger(node, "minOccurs")); segment.setSegcode(getAttributeValue(node, "segcode")); segment.setTruncatable(getNodeValueAsBoolean(node, "truncatable")); segment.setIgnoreUnmappedFields(getNodeValueAsBoolean(node, "ignoreUnmappedFields")); segment.setDescription(getAttributeValue(node, "description")); setValuesForMappingNode(node, segment, namespacePrefix, parent); if(segment.getNodeTypeRef() == null) { // Backward compatibility support. Schema pre v 1.4 supported a segref // on <segment>, which we thn generalised as nodeTypeRef for all node types. segment.setNodeTypeRef(getAttributeValue(node, "segref")); } }