コード例 #1
0
ファイル: MessageGroupReader.java プロジェクト: GOancea/MDMI
  @Override
  protected void readSingleChildElement(
      XMLStreamReader reader,
      ParsingInfo parsingInfo,
      RawRoot root,
      Map<String, Object> objectMap,
      MessageGroup object)
      throws XMLStreamException {

    if (s_dictRefReader.canRead(reader)) {
      MdmiDomainDictionaryReference ref =
          s_dictRefReader.readAndBuild(reader, parsingInfo, root, objectMap);
      ref.setMessageGroup(object);
      object.setDomainDictionary(ref);
    } else if (s_modelReader.canRead(reader)) {
      MessageModel model = s_modelReader.readAndBuild(reader, parsingInfo, root, objectMap);
      model.setGroup(object);
      object.addModel(model);
    } else if (s_dataRuleReader.canRead(reader)) {
      DataRule rule = s_dataRuleReader.readAndBuild(reader, parsingInfo, root, objectMap);
      rule.setScope(object);
      object.addDataRule(rule);
    } else if (s_extTypeReader.canRead(reader)) {
      DTExternal type = s_extTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_choiceTypeReader.canRead(reader)) {
      DTCChoice type = s_choiceTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_structTypeReader.canRead(reader)) {
      DTCStructured type = s_structTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_enumTypeReader.canRead(reader)) {
      DTSEnumerated type = s_enumTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_derivedTypeReader.canRead(reader)) {
      DTSDerived type = s_derivedTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
      type.setOwner(object);
    } else if (s_primTypeReader.canRead(reader)) {
      DTSPrimitive type = s_primTypeReader.readAndBuild(reader, parsingInfo, root, objectMap);
      object.addDatatype(type);
    }
  }
コード例 #2
0
ファイル: XSDtoXMI.java プロジェクト: GOancea/MDMI
  /**
   * toXMI - takes a root MDMI node object and writes it out into a blank MDMI map.
   *
   * @param path The path of the output MDMI map.
   * @param root The root MDMI node object that will be attached to the resulting Message Model.
   */
  public static void toXMI(String path, Node root) {
    List<MessageGroup> messageGroups = new ArrayList<MessageGroup>();
    MessageGroup messageGroup = new MessageGroup();
    MessageModel messageModel = new MessageModel();
    MessageSyntaxModel syntaxModel = new MessageSyntaxModel();

    syntaxModel.setRoot(root);
    messageModel.setSyntaxModel(syntaxModel);
    messageGroup.addModel(messageModel);
    messageGroups.add(messageGroup);

    try {
      XMIWriterDirect.write(path, messageGroups);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
コード例 #3
0
  protected void loadChildren(MessageModel model) {

    // Semantic Element Set
    SemanticElementSet elemSet = model.getElementSet();
    if (elemSet == null) {
      elemSet = new SemanticElementSet();
      model.setElementSet(elemSet);
    }
    EditableObjectNode elemSetNode = new SemanticElementSetNode(elemSet);
    add(elemSetNode);

    // Message Syntax Model
    MessageSyntaxModel syntaxModel = model.getSyntaxModel();
    if (syntaxModel == null) {
      syntaxModel = new MessageSyntaxModel();
      model.setSyntaxModel(syntaxModel);
    }
    EditableObjectNode syntaxNode = new MessageSyntaxModelNode(syntaxModel);
    add(syntaxNode);
  }