Exemple #1
0
 @Override
 protected void readAttributes(XMLStreamReader reader, MdmiBusinessElementRule object) {
   object.setName(reader.getAttributeValue(null, BusinessElemRuleValidate.s_nameField));
   object.setDescription(reader.getAttributeValue(null, BusinessElemRuleValidate.s_descName));
   object.setRuleExpressionLanguage(
       reader.getAttributeValue(null, BusinessElemRuleValidate.s_ruleLangName));
 }
Exemple #2
0
 @Override
 protected void readAttributes(XMLStreamReader reader, MessageGroup object) {
   object.setName(reader.getAttributeValue(null, MessageGroupValidate.s_nameField));
   object.setDescription(reader.getAttributeValue(null, MessageGroupValidate.s_descField));
   object.setDefaultConstraintExprLang(
       reader.getAttributeValue(null, MessageGroupValidate.s_defConstrField));
   object.setDefaultLocationExprLang(
       reader.getAttributeValue(null, MessageGroupValidate.s_defLocField));
   object.setDefaultRuleExprLang(
       reader.getAttributeValue(null, MessageGroupValidate.s_defRuleField));
 }
  /** Deserializes the object from XML */
  public DataField parseField(XMLStreamReader in) throws IOException, XMLStreamException {
    String label = in.getAttributeValue(null, "label");
    String type = in.getAttributeValue(null, "type");
    String var = in.getAttributeValue(null, "var");

    DataField field = new DataField(type, var, label);

    ArrayList<DataValue> valueList = new ArrayList<DataValue>();
    ArrayList<DataOption> optionList = new ArrayList<DataOption>();

    int tag = in.nextTag();
    while (tag > 0) {
      if (_isFinest) debug(in);

      if (XMLStreamReader.END_ELEMENT == tag) {
        field.setValueList(valueList);
        field.setOptionList(optionList);

        return field;
      }

      if (XMLStreamReader.START_ELEMENT == tag && "desc".equals(in.getLocalName())) {
        String desc = in.getElementText();

        field.setDesc(desc);

        skipToEnd(in, "desc");
      } else if (XMLStreamReader.START_ELEMENT == tag && "option".equals(in.getLocalName())) {
        optionList.add(parseOption(in));
      } else if (XMLStreamReader.START_ELEMENT == tag && "required".equals(in.getLocalName())) {
        field.setRequired(true);

        skipToEnd(in, "required");
      } else if (XMLStreamReader.START_ELEMENT == tag && "value".equals(in.getLocalName())) {
        String value = in.getElementText();

        valueList.add(new DataValue(value));

        skipToEnd(in, "value");
      } else if (XMLStreamReader.START_ELEMENT == tag) {
        log.finer(this + " <" + in.getLocalName() + "> is an unknown tag");

        skipToEnd(in, in.getLocalName());
      }

      tag = in.nextTag();
    }

    skipToEnd(in, "field");

    return field;
  }
  /** Deserializes the object from XML */
  public DataOption parseOption(XMLStreamReader in) throws IOException, XMLStreamException {
    String label = in.getAttributeValue(null, "label");

    DataOption option = new DataOption(label);

    ArrayList<DataValue> valueList = new ArrayList<DataValue>();

    int tag = in.nextTag();
    while (tag > 0) {
      if (_isFinest) debug(in);

      if (XMLStreamReader.END_ELEMENT == tag) {
        option.setValueList(valueList);

        return option;
      }

      if (XMLStreamReader.START_ELEMENT == tag && "value".equals(in.getLocalName())) {
        String value = in.getElementText();

        valueList.add(new DataValue(value));

        skipToEnd(in, "value");
      } else if (XMLStreamReader.START_ELEMENT == tag) {
        log.finer(this + " <" + in.getLocalName() + "> is an unknown tag");

        skipToEnd(in, in.getLocalName());
      }

      tag = in.nextTag();
    }

    skipToEnd(in, "option");

    return option;
  }