public OMElement serialize(OMFactory fac) {

    if (log.isDebugEnabled() || log.isTraceEnabled()) {
      log.debug("Serialize command");
    }

    /*
     * org.apache.axiom.om.OMNamespace nullNS = fac.createOMNamespace(
     * XMLConfigConstants.NULL_NAMESPACE, "");
     */
    ValueSerializer valueSerializer = new ValueSerializer();

    OMElement root = AuditMediatorUtils.createTag(fac, this.type);

    for (Iterator iterator = params.iterator(); iterator.hasNext(); ) {
      Param param = (Param) iterator.next();

      OMElement paramTag = AuditMediatorUtils.createTag(fac, AuditMediatorUtils.PARAM_TAG_NAME);

      root.addChild(paramTag);

      paramTag.addAttribute(
          fac.createOMAttribute(
              AuditMediatorUtils.NAME_ATT_NAME, AuditMediatorUtils.nullNS, param.getName()));

      valueSerializer.serializeValue(param.getValue(), AuditMediatorUtils.VALUE_ATT_NAME, paramTag);
    }

    return root;
  }
  public void parse(OMElement paramsTag) {

    if (log.isDebugEnabled() || log.isTraceEnabled()) {
      log.debug("Parse params");
    }

    ValueFactory valueFactory = new ValueFactory();

    this.type = paramsTag.getLocalName();

    for (Iterator iterator = paramsTag.getChildElements(); iterator.hasNext(); ) {
      OMElement param = (OMElement) iterator.next();

      if (AuditMediatorUtils.isTag(param, AuditMediatorUtils.PARAM_TAG_NAME)) {

        String name = param.getAttributeValue(AuditMediatorUtils.NAME_ATT_QNAME);

        Value value = valueFactory.createValue(AuditMediatorUtils.VALUE_ATT_NAME, param);

        if (StringUtils.isBlank(name) || value == null) {
          log.error("Error, attributes name and value required");
          break;
        }

        params.add(new Param(name, value));

      } else {
        log.error(
            "Unable to create the Audit mediator. "
                + "Unexpected element: "
                + param
                + " inside the Params TAG of Audit mediator configuration");
      }
    }
  }