Package org.milyn.edisax.model

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


    boolean status(final List<String> toks) {
        if (standaloneNodes.size() > 0) {
            out.println("Standalone Nodes:");
            for (String nodeName : standaloneNodes.keySet()) {
                Node node = standaloneNodes.get(nodeName);
                for (String curi : node.getInstalledContributions()) {
                    for (String dc : node.getDeployedComposites(curi)) {
                        out.println("   " + nodeName + " " + dc);
                    }
                }
            }
            out.println();
        }
        if (nodes.size() > 0) {
            for (Node node : nodes.values()) {
                out.println("Domain: " + node.getDomainName());
                List<String> ics;
                if (toks.size() > 1) {
                    ics = new ArrayList<String>();
                    ics.add(toks.get(1));
                } else {
                    ics = node.getInstalledContributions();
                }

                for (String curi : ics) {
                    Contribution c = node.getInstalledContribution(curi);
                    List<String> dcs = node.getDeployedComposites(curi);
                    if (toks.size() > 2) {
                        dcs = new ArrayList<String>();
                        dcs.add(toks.get(2));
                    } else {
                        dcs = node.getDeployedComposites(curi);
                    }
                    for (String compositeUri : dcs) {
                        for (Artifact a : c.getArtifacts()) {
                            if (compositeUri.equals(a.getURI())) {
                                out.println("   " + curi
View Full Code Here


*/
public class FieldRepeatTest 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

        lookupNameBuilder.append(':');
      }
      lookupNameBuilder.append(nameComponents[i]);
    }
    String lookupName = lookupNameBuilder.toString().trim();
    EdifactModel result = content.get(lookupName);
    if (result == null) {
            synchronized (content) {
                result = content.get(lookupName);
            if (result == null) {
              content.putAll(demandLoading(nameComponents));
View Full Code Here

        }
    }

    private static boolean loadXMLMappingModel(String mappingModelFile, Map<String, EdifactModel> mappingModels, URI baseURI) throws EDIConfigurationException {
    try {
      EdifactModel model = EDIParser.parseMappingModel(mappingModelFile, baseURI);
      mappingModels.put(toLookupName(model.getEdimap().getDescription()), model);
      return true;
    } catch (IOException e) {
      return false;
    } catch (SAXException e) {
      logger.debug("Configured mapping model file '" + mappingModelFile + "' is not a valid Mapping Model xml file.");
View Full Code Here

  }

    public static void loadMappingModels(Map<String, EdifactModel> mappingModels, URI baseURI, List<String> rootMappingModels) throws IOException, SAXException, EDIConfigurationException {
        for (String rootMappingModel : rootMappingModels) {
            try {
                EdifactModel mappingModel = EDIParser.parseMappingModel(rootMappingModel, baseURI);

                mappingModel.setAssociateModels(mappingModels.values());
                mappingModels.put(toLookupName(mappingModel.getDescription()), mappingModel);
            } catch(Exception e) {
                throw new EDIConfigurationException("Error parsing EDI Mapping Model '" + rootMappingModel + "'.", e);
            }
        }
    }
View Full Code Here

    // Check make sure the parsed and validated model was cached...
    Hashtable mappingTable = EDIReader.getMappingTable(smooks.getApplicationContext());
    assertNotNull("No mapping table in context!", mappingTable);

        EdifactModel mappingModel_request1 = (EdifactModel) mappingTable.get(config);
        assertNotNull("No mapping model in mapping table!", mappingModel_request1);

    // Create 2nd parser using the same config, and run a parse through it...
    parser = new DOMParser(smooks.createExecutionContext(), config);
    parser.parse(new StreamSource(new ByteArrayInputStream(input)));
View Full Code Here

     * @throws EDIConfigurationException When edi-mapping-configuration is badly formatted.
     * @throws IOException When unable to read edi-mapping-configuration.
     * @throws SAXException When edi-mapping-configuration is badly formatted.
     */
    private Edimap readEDIConfig(InputStream inputStream) throws EDIConfigurationException, IOException, SAXException {
        EdifactModel edifactModel = new EdifactModel(inputStream);
        return edifactModel.getEdimap();
    }
View Full Code Here

        Properties interchangeProperties = EDIUtils.getInterchangeProperties(ediMappingModel);

        Map<String, EdifactModel> mappingModels = new LinkedHashMap<String, EdifactModel>();
        EDIUtils.loadMappingModels(ediMappingModel, mappingModels, URIResourceLocator.DEFAULT_BASE_URI);

        EdifactModel definitionsModel = mappingModels.get(EDIUtils.MODEL_SET_DEFINITIONS_DESCRIPTION_LOOKUP_NAME);
        String commonsPackageName = packageName + ".common";
        ClassModel definitionsClassModel = null;

        if(definitionsModel != null) {
            EJC ejc = new EJC();
            definitionsClassModel = ejc.compile(definitionsModel.getEdimap(), commonsPackageName, destDir.getAbsolutePath());

            // Get rid of the binding and edi mapping model configs for the commons...
            deleteFile(commonsPackageName, EJC.BINDINGCONFIG_XML);
            deleteFile(commonsPackageName, EJC.EDIMAPPINGCONFIG_XML);
        }
View Full Code Here

        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

  private static final String NS = "http://smooks.org/edi/un/test.xsd";

  public void test() throws IOException, SAXException,
      EDIConfigurationException {
    EdifactModel msg1 = EDIParser.parseMappingModel(getClass()
        .getResourceAsStream("edi-to-xml-mapping.xml"));
    assertNotNull(msg1);
    Edimap edimap = msg1.getEdimap();
    assertEquals(NS,edimap.getDescription().getNamespace());
    SegmentGroup group = edimap.getSegments();
    assertEquals(NS,group.getNamespace());
    List<SegmentGroup> segments = group.getSegments();
    for (SegmentGroup segment : segments) {
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.