}
@Override
@SuppressWarnings("unchecked")
public void setAsText(String text) throws IllegalArgumentException {
MultiDocument docs = (MultiDocument) getValue();
if (docs == null) docs = new MultiDocument();
for (String doc : text.split("##")) {
if (StringUtils.hasText(doc)) {
if (doc.startsWith("-")) {
Iterator<Document> it = docs.getDocuments().iterator();
while (it.hasNext()) {
Document d = it.next();
if (doc.substring(1).equals(d.getUri())) it.remove();
}
} else {
Document document = getDocument(doc);
if (document != null) docs.addDocument(document);
}
}
}
setValue(docs);
}