@Test public void testSkip() throws Exception { init(Policy.SKIP); stage.process(doc); Assert.assertEquals("value", doc.getContentField("empty")); Assert.assertEquals("string", doc.getContentField("string")); Assert.assertTrue(((List<?>) doc.getContentField("list")).contains("x")); Assert.assertTrue(((List<?>) doc.getContentField("list")).contains(1)); }
@Override public void process(LocalDocument doc) throws FieldAlreadyExistsException { for (Map.Entry<String, Object> entry : fieldValueMap.entrySet()) { final String key = entry.getKey(); if (!hasContent(doc, key) || overwritePolicy == Policy.OVERWRITE) { doc.putContentField(key, entry.getValue()); } else if (overwritePolicy == Policy.ADD) { addValueToField(doc, key, entry.getValue()); } else if (overwritePolicy == Policy.THROW) { throw new FieldAlreadyExistsException("Field " + key + " already has a value!"); } } }
SetStaticFieldStage extends AbstractProcessStage { @Override public void process(LocalDocument doc) throws FieldAlreadyExistsException { for (Map.Entry<String, Object> entry : fieldValueMap.entrySet()) { final String key = entry.getKey(); if (!hasContent(doc, key) || overwritePolicy == Policy.OVERWRITE) { doc.putContentField(key, entry.getValue()); } else if (overwritePolicy == Policy.ADD) { addValueToField(doc, key, entry.getValue()); } else if (overwritePolicy == Policy.THROW) { throw new FieldAlreadyExistsException("Field " + key + " already has a value!"); } } } }
SetStaticFieldStage extends AbstractProcessStage { @Override public void process(LocalDocument doc) throws FieldAlreadyExistsException { for (Map.Entry<String, Object> entry : fieldValueMap.entrySet()) { final String key = entry.getKey(); if (!hasContent(doc, key) || overwritePolicy == Policy.OVERWRITE) { doc.putContentField(key, entry.getValue()); } else if (overwritePolicy == Policy.ADD) { addValueToField(doc, key, entry.getValue()); } else if (overwritePolicy == Policy.THROW) { throw new FieldAlreadyExistsException("Field " + key + " already has a value!"); } } }  }
SetStaticFieldStage extends AbstractProcessStage { @Override public void process(LocalDocument doc) throws FieldAlreadyExistsException { for (Map.Entry<String, Object> entry : fieldValueMap.entrySet()) { final String key = entry.getKey(); if (!hasContent(doc, key) || overwritePolicy == Policy.OVERWRITE) { doc.putContentField(key, entry.getValue()); } else if (overwritePolicy == Policy.ADD) { addValueToField(doc, key, entry.getValue()); } else if (overwritePolicy == Policy.THROW) { throw new FieldAlreadyExistsException("Field " + key + " already has a value!"); } } }  @Override void process(LocalDocument doc); void setFieldValueMap(Map<String, Object> fieldValueMap); void setOverwritePolicy(Policy overwritePolicy); }
SetStaticFieldStage extends AbstractProcessStage { @Override public void process(LocalDocument doc) throws FieldAlreadyExistsException { for (Map.Entry<String, Object> entry : fieldValueMap.entrySet()) { final String key = entry.getKey(); if (!hasContent(doc, key) || overwritePolicy == Policy.OVERWRITE) { doc.putContentField(key, entry.getValue()); } else if (overwritePolicy == Policy.ADD) { addValueToField(doc, key, entry.getValue()); } else if (overwritePolicy == Policy.THROW) { throw new FieldAlreadyExistsException("Field " + key + " already has a value!"); } } }  @Override void process(LocalDocument doc); void setFieldValueMap(Map<String, Object> fieldValueMap); void setOverwritePolicy(Policy overwritePolicy);  }