public List<IndexedAIP> retrieveAncestors(IndexedAIP aip, User user, List<String> fieldsToReturn) throws GenericException { List<IndexedAIP> ancestors = new ArrayList<>(); IndexedAIP parent; IndexedAIP actual = aip; while (actual != null && actual.getParentID() != null) { try { parent = getParent(actual, user, fieldsToReturn); } catch (NotFoundException | AuthorizationDeniedException e) { parent = null; LOGGER.warn("Ancestor not found: {}", actual.getParentID()); } if (parent != null && ancestors.contains(parent)) { LOGGER.warn("Found a cyclic ancestor relationship: {} and {}", aip.getId(), parent.getId()); break; } ancestors.add(parent); actual = parent; } return ancestors; }
public IndexedAIP getParent(IndexedAIP aip, User user, List<String> fieldsToReturn) throws NotFoundException, GenericException, AuthorizationDeniedException { return SolrUtils.retrieve(getSolrClient(), IndexedAIP.class, aip.getParentID(), user, fieldsToReturn); }
node = node.put("id", indexedAIP.getId()); if (indexedAIP.getParentID() != null) { node = node.put("parentId", indexedAIP.getParentID());
try { LOGGER.debug("Reindexing aip {} descendant {}", aip.getId(), item.getId()); List<String> ancestors = SolrUtils.getAncestors(item.getParentID(), model); SolrUtils.update(index, IndexedAIP.class, aip.getId(), Collections.singletonMap(RodaConstants.AIP_ANCESTORS, ancestors), (ModelObserver) this).addTo(ret);
/** * Constructs a new {@link IndexedAIP} cloning the one given by argument. * * @param other * the {@link IndexedAIP} to be cloned. */ public IndexedAIP(IndexedAIP other) { this(other.getId(), other.getState(), other.getType(), other.getLevel(), other.getTitle(), other.getDateInitial(), other.getDateFinal(), other.getDescription(), other.getParentID(), other.getAncestors(), other.getPermissions(), other.getNumberOfSubmissionFiles(), other.getNumberOfDocumentationFiles(), other.getNumberOfSchemaFiles(), other.getHasRepresentations(), other.getGhost()); }