public IndexedRepresentation(String uuid, String id, String aipId, boolean original, String type, String title, long sizeInBytes, long totalNumberOfFiles, long totalNumberOfFolders, long numberOfDocumentationFiles, long numberOfSchemaFiles, List<String> ancestors) { super(id, aipId, original, type); this.uuid = uuid; this.setTitle(title); this.sizeInBytes = sizeInBytes; this.numberOfDataFiles = totalNumberOfFiles; this.setNumberOfDataFolders(totalNumberOfFolders); this.numberOfDocumentationFiles = numberOfDocumentationFiles; this.numberOfSchemaFiles = numberOfSchemaFiles; this.ancestors = ancestors; }
private static List<Representation> getRepresentationFromList(ModelService model, List<IndexedRepresentation> retrieve) throws RequestNotValidException, GenericException, NotFoundException, AuthorizationDeniedException { List<Representation> representationsToReturn = new ArrayList<>(); for (IndexedRepresentation indexedRepresentation : retrieve) { representationsToReturn .add(model.retrieveRepresentation(indexedRepresentation.getAipId(), indexedRepresentation.getId())); } return representationsToReturn; }
@Override public IndexedRepresentation fromSolrDocument(SolrDocument doc, List<String> fieldsToReturn) throws GenericException { final IndexedRepresentation ret = super.fromSolrDocument(doc, fieldsToReturn); ret.setAipId(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_AIP_ID), null)); ret.setOriginal( Boolean.TRUE.equals(SolrUtils.objectToBoolean(doc.get(RodaConstants.REPRESENTATION_ORIGINAL), Boolean.FALSE))); ret.setType(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_TYPE), null)); ret.setTitle(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_TITLE), null)); ret.setSizeInBytes(SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_SIZE_IN_BYTES), 0L)); ret.setNumberOfDataFiles(SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_NUMBER_OF_DATA_FILES), 0L)); ret .setNumberOfDataFolders(SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_NUMBER_OF_DATA_FOLDERS), 0L)); ret.setNumberOfDocumentationFiles( SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_NUMBER_OF_DOCUMENTATION_FILES), 0L)); ret .setNumberOfSchemaFiles(SolrUtils.objectToLong(doc.get(RodaConstants.REPRESENTATION_NUMBER_OF_SCHEMA_FILES), 0L)); ret.setAncestors(SolrUtils.objectToListString(doc.get(RodaConstants.AIP_ANCESTORS))); ret.setCreatedOn(SolrUtils.objectToDate(doc.get(RodaConstants.REPRESENTATION_CREATED_ON))); ret.setCreatedBy(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_CREATED_BY), "")); ret.setUpdatedOn(SolrUtils.objectToDate(doc.get(RodaConstants.REPRESENTATION_UPDATED_ON))); ret.setUpdatedBy(SolrUtils.objectToString(doc.get(RodaConstants.REPRESENTATION_UPDATED_BY), "")); ret.setRepresentationStates(SolrUtils.objectToListString(doc.get(RodaConstants.REPRESENTATION_STATES))); Map<String, Object> indexedFields = new HashMap<>(); for (String field : fieldsToReturn) { indexedFields.put(field, doc.get(field)); } ret.setFields(indexedFields); return ret; }
public static void checkRepresentationPermissions(User user, SelectedItems<IndexedRepresentation> selected, PermissionType permission) throws AuthorizationDeniedException, GenericException, RequestNotValidException { checkObjectPermissions(user, selected, rep -> rep.getAipId(), permission, RodaConstants.REPRESENTATION_FIELDS_TO_RETURN); }
public static void checkRepresentationPermissions(User user, IndexedRepresentation rep, PermissionType permissionType) throws AuthorizationDeniedException { checkAIPObjectPermissions(user, rep, r -> r.getAipId(), permissionType); }