Exemplo n.º 1
0
  private void emitReferencedValue(AttributeList attrs) throws SAXException {
    if (expectingTarget) {
      String previousElement = "";
      if (!elementStack.empty()) {
        previousElement = (String) elementStack.peek();
      }

      int prevSrxId = XmiMapping.getSrxId(previousElement);
      // enabledOutput = toProcess(prevSrxId);
      if (!enabledOutput) {
        return;
      }

      if (attrs != null) {
        for (int i = 0; i < attrs.getLength(); i++) {
          String attr = attrs.getName(i);
          if (attr.equals(kTarget)) {
            String key = attrs.getValue(i);
            String name = (String) idTable.get(key);
            if (name != null) {
              emit(name + eol);
            }
            expectingTarget = false;
          }
        } // end for
      } // end if
    } // end if
  } // end emitReferencedValue()
Exemplo n.º 2
0
  private void emitNewOccurrence(int srxId, AttributeList attrs) throws SAXException {

    enabledOutput = toProcess(srxId);
    if (!enabledOutput) {
      return;
    }

    currentSrxId = srxId;
    String mappedName = XmiMapping.getMappingName(srxId);
    emit(eol + kOccurrenceType + " " + mappedName + eol);

    // if it's a component, write its composite
    String composite = XmiMapping.getComposite(srxId);
    if (composite != null) {
      if (!occurrenceNameStack.empty()) {
        String compositeName = (String) occurrenceNameStack.peek();
        if (compositeName != null) {
          emit(composite + " " + compositeName + eol);
        }
      } // end if
    } // end if

    // Keep its XMI.id
    if (attrs != null) {
      for (int i = 0; i < attrs.getLength(); i++) {
        String attr = attrs.getName(i);
        if (attr.equals(kXmiId)) {
          currentXmiId = attrs.getValue(i);
        } // end if
      } // end for
    } // end if

    // Keep its current XMI name & SRX name
    currentXmiName = XmiMapping.getXmiName(srxId);
    currentSrxName = XmiMapping.getSrxName(srxId);
  }