/** * Returns the Edimap for a given edi-mapping inputstream. * @param inputStream the edi-mapping. * @return the Edimap. * @throws EDIConfigurationException When edi-mapping-configuration is badly formatted. * @throws IOException When unable to read edi-mapping-configuration. */ private Edimap readEDIConfig(InputStream inputStream) throws EDIConfigurationException, IOException { EdifactModel edifactModel = new EdifactModel(inputStream); return edifactModel.getEdimap(); }
/** * Parse the supplied mapping model config stream and return the generated EdiMap. * <p/> * Can be used to set the mapping model to be used during the parsing operation. * See {@link #setMappingModel(org.milyn.edisax.model.EdifactModel)}. * @param mappingConfigStream Config stream. Must conform with the * <a href="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd">edi-message-mapping-1.0.xsd</a> * schema. * @param mappingDescription Mapping Model Description. * @param resourceURI The resource URI. * @param importBaseURI The base URI for loading imports. * @return The EdifactModel for the mapping model. * @throws IOException Error reading the model stream. * @throws SAXException Invalid model. * @throws EDIConfigurationException when edi-mapping-configuration is incorrect. */ public static EdifactModel parseMappingModel(Reader mappingConfigStream, Description mappingDescription, URI resourceURI, URI importBaseURI) throws IOException, SAXException, EDIConfigurationException { AssertArgument.isNotNull(mappingConfigStream, "mappingConfigStream"); AssertArgument.isNotNull(importBaseURI, "importBaseURI"); // The resourceURI can be null e.g. when the mapping model was inlined in the Smooks config. EdifactModel edifactModel; edifactModel = new EdifactModel(resourceURI, importBaseURI, mappingConfigStream); edifactModel.setDescription(mappingDescription); return edifactModel; }
/** * Parse the supplied mapping model config stream and return the generated EdiMap. * <p/> * Can be used to set the mapping model to be used during the parsing operation. * See {@link #setMappingModel(org.milyn.edisax.model.EdifactModel)}. * @param mappingConfigStream Config stream. Must conform with the * <a href="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd">edi-message-mapping-1.0.xsd</a> * schema. * @param mappingDescription Mapping Model Description. * @param resourceURI The resource URI. * @param importBaseURI The base URI for loading imports. * @return The EdifactModel for the mapping model. * @throws IOException Error reading the model stream. * @throws SAXException Invalid model. * @throws EDIConfigurationException when edi-mapping-configuration is incorrect. */ public static EdifactModel parseMappingModel(Reader mappingConfigStream, Description mappingDescription, URI resourceURI, URI importBaseURI) throws IOException, SAXException, EDIConfigurationException { AssertArgument.isNotNull(mappingConfigStream, "mappingConfigStream"); AssertArgument.isNotNull(importBaseURI, "importBaseURI"); // The resourceURI can be null e.g. when the mapping model was inlined in the Smooks config. EdifactModel edifactModel; edifactModel = new EdifactModel(resourceURI, importBaseURI, mappingConfigStream); edifactModel.setDescription(mappingDescription); return edifactModel; }
/** * Parse the supplied mapping model config stream and return the generated EdiMap. * * Can be used to set the mapping model to be used during the parsing operation. * See {@link #setMappingModel(org.milyn.edisax.model.EdifactModel)}. * @param mappingConfigStream Config stream. Must conform with the * <a href="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd">edi-message-mapping-1.0.xsd</a> * schema. * @param mappingDescription Mapping Model Description. * @param resourceURI The resource URI. * @param importBaseURI The base URI for loading imports. * @return The EdifactModel for the mapping model. * @throws IOException Error reading the model stream. * @throws SAXException Invalid model. * @throws EDIConfigurationException when edi-mapping-configuration is incorrect. */ public static EdifactModel parseMappingModel(Reader mappingConfigStream, Description mappingDescription, URI resourceURI, URI importBaseURI) throws IOException, SAXException, EDIConfigurationException { AssertArgument.isNotNull(mappingConfigStream, "mappingConfigStream"); AssertArgument.isNotNull(importBaseURI, "importBaseURI"); // The resourceURI can be null e.g. when the mapping model was inlined in the Smooks config. EdifactModel edifactModel; edifactModel = new EdifactModel(resourceURI, importBaseURI, mappingConfigStream); edifactModel.setDescription(mappingDescription); return edifactModel; }
/** * Parse the supplied mapping model config stream and return the generated EdiMap. * <p/> * Can be used to set the mapping model to be used during the parsing operation. * See {@link #setMappingModel(org.milyn.edisax.model.EdifactModel)}. * @param mappingConfigStream Config stream. Must conform with the * <a href="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd">edi-message-mapping-1.0.xsd</a> * schema. * @param mappingDescription Mapping Model Description. * @param resourceURI The resource URI. * @param importBaseURI The base URI for loading imports. * @return The EdifactModel for the mapping model. * @throws IOException Error reading the model stream. * @throws SAXException Invalid model. * @throws EDIConfigurationException when edi-mapping-configuration is incorrect. */ public static EdifactModel parseMappingModel(Reader mappingConfigStream, Description mappingDescription, URI resourceURI, URI importBaseURI) throws IOException, SAXException, EDIConfigurationException { AssertArgument.isNotNull(mappingConfigStream, "mappingConfigStream"); AssertArgument.isNotNull(importBaseURI, "importBaseURI"); // The resourceURI can be null e.g. when the mapping model was inlined in the Smooks config. EdifactModel edifactModel; edifactModel = new EdifactModel(resourceURI, importBaseURI, mappingConfigStream); edifactModel.setDescription(mappingDescription); return edifactModel; }
public UnEdifactSpecificationReader(ZipInputStream specificationInStream, boolean useImport, boolean useShortName) throws IOException { this.useImport = useImport; this.useShortName = useShortName; definitionFiles = new HashMap<String, byte[]>(); 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); } }
EdifactModel controlModel = new EdifactModel(controlMap);
EdifactModel controlModel = new EdifactModel(controlMap);
EdifactModel controlModel = new EdifactModel(controlMap);
EdifactModel controlModel = new EdifactModel(controlMap);