FieldUpdate readAdd(DocumentUpdate update) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { if ("field".equals(reader.getAttributeName(i).toString())) { Field f = update.getDocumentType().getField(reader.getAttributeValue(i)); FieldValue value = f.getDataType().createFieldValue(); value.deserialize(f, this); if (value instanceof Array) { List<FieldValue> l = ((Array)value).getValues(); return FieldUpdate.createAddAll(f, l); } else if (value instanceof WeightedSet) { return FieldUpdate.createAddAll(f, ((WeightedSet) value)); } else { throw newDeserializeException("Add operation only applicable to multivalue lists"); } } } throw newDeserializeException("Add update without field attribute"); }
singleUpdate = FieldUpdate.createRemoveAll(field, weightedSet); } else { singleUpdate = FieldUpdate.createAddAll(field, weightedSet); singleUpdate = FieldUpdate.createRemoveAll(field, arrayContents); } else { singleUpdate = FieldUpdate.createAddAll(field, arrayContents);