@Test public void testCreateParameters() throws Exception { ObjectMetadataParameter p = new ObjectMetadataParameter(".*"); AdaptrisMessage msg = createMessage(); Map map = p.createParameters(msg, null); assertNotNull(map); assertTrue(map.containsKey(KEY_OBJECT_METADATA)); assertTrue(map.get(KEY_OBJECT_METADATA) instanceof Document); Map existing = new HashMap(); existing.put("key", "value"); map = p.createParameters(msg, existing); assertNotNull(map); assertTrue(map.containsKey(KEY_OBJECT_METADATA)); assertTrue(map.get(KEY_OBJECT_METADATA) instanceof Document); assertTrue(map.containsKey("key")); }
@Override public Map createParameters(AdaptrisMessage msg, Map existingParams) throws ServiceException { if (isEmpty(getObjectMetadataKeyRegexp())) { throw new ServiceException("Object Metadata Key regexp is empty"); } Pattern pattern = Pattern.compile(getObjectMetadataKeyRegexp()); Map params = existingParams == null ? new HashMap() : new HashMap(existingParams); Map objMetadata = msg.getObjectHeaders(); for (Object key : objMetadata.keySet()) { if (pattern.matcher(key.toString()).matches()) { params.put(key.toString(), objMetadata.get(key)); log.trace("Adding object metadata against [{}]", key.toString()); } } return params; }
ObjectMetadataParameter implements XmlTransformParameter { @Override public Map createParameters(AdaptrisMessage msg, Map existingParams) throws ServiceException { if (isEmpty(getObjectMetadataKeyRegexp())) { throw new ServiceException("Object Metadata Key regexp is empty"); } Pattern pattern = Pattern.compile(getObjectMetadataKeyRegexp()); Map params = existingParams == null ? new HashMap() : new HashMap(existingParams); Map objMetadata = msg.getObjectHeaders(); for (Object key : objMetadata.keySet()) { if (pattern.matcher(key.toString()).matches()) { params.put(key.toString(), objMetadata.get(key)); log.trace("Adding object metadata against [{}]", key.toString()); } } return params; } }
ObjectMetadataParameter implements XmlTransformParameter { @Override public Map createParameters(AdaptrisMessage msg, Map existingParams) throws ServiceException { if (isEmpty(getObjectMetadataKeyRegexp())) { throw new ServiceException("Object Metadata Key regexp is empty"); } Pattern pattern = Pattern.compile(getObjectMetadataKeyRegexp()); Map params = existingParams == null ? new HashMap() : new HashMap(existingParams); Map objMetadata = msg.getObjectHeaders(); for (Object key : objMetadata.keySet()) { if (pattern.matcher(key.toString()).matches()) { params.put(key.toString(), objMetadata.get(key)); log.trace("Adding object metadata against [{}]", key.toString()); } } return params; } ObjectMetadataParameter();  ObjectMetadataParameter(String regexp); }
ObjectMetadataParameter implements XmlTransformParameter { @Override public Map createParameters(AdaptrisMessage msg, Map existingParams) throws ServiceException { if (isEmpty(getObjectMetadataKeyRegexp())) { throw new ServiceException("Object Metadata Key regexp is empty"); } Pattern pattern = Pattern.compile(getObjectMetadataKeyRegexp()); Map params = existingParams == null ? new HashMap() : new HashMap(existingParams); Map objMetadata = msg.getObjectHeaders(); for (Object key : objMetadata.keySet()) { if (pattern.matcher(key.toString()).matches()) { params.put(key.toString(), objMetadata.get(key)); log.trace("Adding object metadata against [{}]", key.toString()); } } return params; } ObjectMetadataParameter();  ObjectMetadataParameter(String regexp); @Override Map createParameters(AdaptrisMessage msg, Map existingParams); String getObjectMetadataKeyRegexp(); void setObjectMetadataKeyRegexp(String s); }
ObjectMetadataParameter implements XmlTransformParameter { @Override public Map createParameters(AdaptrisMessage msg, Map existingParams) throws ServiceException { if (isEmpty(getObjectMetadataKeyRegexp())) { throw new ServiceException("Object Metadata Key regexp is empty"); } Pattern pattern = Pattern.compile(getObjectMetadataKeyRegexp()); Map params = existingParams == null ? new HashMap() : new HashMap(existingParams); Map objMetadata = msg.getObjectHeaders(); for (Object key : objMetadata.keySet()) { if (pattern.matcher(key.toString()).matches()) { params.put(key.toString(), objMetadata.get(key)); log.trace("Adding object metadata against [{}]", key.toString()); } } return params; } ObjectMetadataParameter();  ObjectMetadataParameter(String regexp); @Override Map createParameters(AdaptrisMessage msg, Map existingParams); String getObjectMetadataKeyRegexp(); void setObjectMetadataKeyRegexp(String s);  }