public static OutputMapping fromOM(OMElement mappingElement) throws EventPublisherConfigurationException { JSONOutputMapping jsonOutputMapping = new JSONOutputMapping(); String customMappingEnabled = mappingElement.getAttributeValue(new QName(EventPublisherConstants.EF_ATTR_CUSTOM_MAPPING)); if (customMappingEnabled == null || (customMappingEnabled.equals(EventPublisherConstants.ENABLE_CONST))) { jsonOutputMapping.setCustomMappingEnabled(true); if (!validateJsonEventMapping(mappingElement)) { throw new EventPublisherConfigurationException( "JSON Mapping is not valid, check the output mapping"); } OMElement innerMappingElement = mappingElement.getFirstChildWithName( new QName( EventPublisherConstants.EF_CONF_NS, EventPublisherConstants.EF_ELE_MAPPING_INLINE)); if (innerMappingElement != null) { jsonOutputMapping.setRegistryResource(false); } else { innerMappingElement = mappingElement.getFirstChildWithName( new QName( EventPublisherConstants.EF_CONF_NS, EventPublisherConstants.EF_ELE_MAPPING_REGISTRY)); if (innerMappingElement != null) { jsonOutputMapping.setRegistryResource(true); } else { throw new EventPublisherConfigurationException( "XML Mapping is not valid, Mapping should be inline or from registry"); } } if (innerMappingElement.getText() == null || innerMappingElement.getText().trim().isEmpty()) { throw new EventPublisherConfigurationException("There is no any mapping content available"); } else { jsonOutputMapping.setMappingText(innerMappingElement.getText()); } } else { jsonOutputMapping.setCustomMappingEnabled(false); } return jsonOutputMapping; }