@Override
public SourceValidity getValidity() {
if (this.validity == null) {
try {
DSpaceValidity validity = new DSpaceValidity();
DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
if (dso != null) {
// Add the actual collection;
validity.add(dso);
}
// add reciently submitted items, serialize solr query contents.
QueryResponse response = getQueryResponse(dso);
validity.add("numFound:" + response.getResults().getNumFound());
// for (SolrDocument doc : response.getResults()) {
// validity.add(doc.toString());
// }
for (SolrDocument doc : response.getResults()) {
validity.add(doc.toString());
}
for (FacetField field : response.getFacetFields()) {
validity.add(field.getName());
for (FacetField.Count count : field.getValues()) {
validity.add(count.getName() + "#" + count.getCount());
}
}
this.validity = validity.complete();
} catch (Exception e) {
// Just ignore all errors and return an invalid cache.
}
//TODO: dependent on tags as well :)