public static OutputMapping fromOM(OMElement mappingElement)
      throws EventFormatterValidationException, EventFormatterConfigurationException {

    MapOutputMapping mapOutputMapping = new MapOutputMapping();

    String customMappingEnabled =
        mappingElement.getAttributeValue(new QName(EventFormatterConstants.EF_ATTR_CUSTOM_MAPPING));
    if (customMappingEnabled == null
        || (customMappingEnabled.equals(EventFormatterConstants.TM_VALUE_ENABLE))) {
      mapOutputMapping.setCustomMappingEnabled(true);
      if (!validateMapEventMapping(mappingElement)) {
        throw new EventFormatterConfigurationException(
            "Map Mapping is not valid, check the output mapping");
      }

      if (mappingElement != null) {
        Iterator propertyIterator =
            mappingElement.getChildrenWithName(
                new QName(
                    EventFormatterConstants.EF_CONF_NS, EventFormatterConstants.EF_ELE_PROPERTY));
        while (propertyIterator.hasNext()) {
          OMElement propertyOMElement = (OMElement) propertyIterator.next();
          EventOutputProperty eventOutputProperty = getOutputPropertyFromOM(propertyOMElement);
          mapOutputMapping.addOutputPropertyConfiguration(eventOutputProperty);
        }
      }
    } else {
      mapOutputMapping.setCustomMappingEnabled(false);
    }

    return mapOutputMapping;
  }