コード例 #1
0
  @Override
  protected SemanticElementRelationship buildMessageModelObject(ClassDef classDef, RawRoot root) {

    SemanticElementRelationship msgElemRel = new SemanticElementRelationship();
    msgElemRel.setName(BuilderUtil.getNameAttribVal(classDef));
    msgElemRel.setDescription(BuilderUtil.getDescriptionAttribVal(classDef));
    msgElemRel.setRule(BuilderUtil.getRuleAttribVal(classDef));
    msgElemRel.setRuleExpressionLanguage(BuilderUtil.getRuleExprAttribVal(classDef));
    msgElemRel.setSourceIsInstance(BuilderUtil.getBooleanAttribVal(classDef, s_srcIsAttrib));
    msgElemRel.setTargetIsInstance(BuilderUtil.getBooleanAttribVal(classDef, s_targetIsAttrib));

    try {
      msgElemRel.setMinOccurs(BuilderUtil.getIntegerAttribVal(classDef, s_minAttrib));
    } catch (NumberFormatException ex) {
      String value = BuilderUtil.getAttribVal(classDef, s_minAttrib);
      Mdmi.INSTANCE
          .logger()
          .loge(
              ex,
              SemanticElementRelationshipBuilder.class.getName()
                  + ": Unable to parse '"
                  + s_minAttrib
                  + "' '"
                  + value
                  + "' as integer.");
    }

    try {
      msgElemRel.setMaxOccurs(BuilderUtil.getIntegerAttribVal(classDef, s_maxAttrib));
    } catch (NumberFormatException ex) {
      String value = BuilderUtil.getAttribVal(classDef, s_maxAttrib);
      Mdmi.INSTANCE
          .logger()
          .loge(
              ex,
              SemanticElementRelationshipBuilder.class.getName()
                  + ": Unable to parse '"
                  + s_maxAttrib
                  + "' '"
                  + value
                  + "' as integer.");
    }

    return msgElemRel;
  }
コード例 #2
0
  @Override
  protected boolean processAssociation(
      SemanticElementRelationship modelObject,
      Object assocObject,
      String stereotypeName,
      Attribute attrib) {

    boolean rv = true;
    if (stereotypeName.equals(StereotypeNames.SEMANTIC_ELEMENT)) {
      SemanticElement msgElem = (SemanticElement) assocObject;

      if (s_relElemName.equals(attrib.getName())) {

        modelObject.setRelatedSemanticElement(msgElem);
      }
    } else {
      rv = false;
    }

    return rv;
  }