public void changeRepresentationStates(String aipId, String representationId, List<String> newStates, String updatedBy) throws RequestNotValidException, NotFoundException, GenericException, AuthorizationDeniedException { RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType); AIP aip = retrieveAIP(aipId); Iterator<Representation> it = aip.getRepresentations().iterator(); Optional<Representation> representation = Optional.empty(); while (it.hasNext()) { Representation next = it.next(); if (next.getId().equals(representationId)) { representation = Optional.of(next); break; } } if (representation.isPresent()) { representation.get().setRepresentationStates(newStates); representation.get().setUpdatedOn(new Date()); representation.get().setUpdatedBy(updatedBy); updateAIPMetadata(aip); notifyRepresentationUpdated(representation.get()).failOnError(); } }
public void changeRepresentationType(String aipId, String representationId, String type, String updatedBy) throws RequestNotValidException, NotFoundException, GenericException, AuthorizationDeniedException { RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType); AIP aip = retrieveAIP(aipId); Iterator<Representation> it = aip.getRepresentations().iterator(); while (it.hasNext()) { Representation representation = it.next(); if (representation.getId().equals(representationId)) { representation.setType(type); representation.setUpdatedOn(new Date()); representation.setUpdatedBy(updatedBy); notifyRepresentationUpdated(representation).failOnError(); break; } } updateAIPMetadata(aip); }
representation.setUpdatedOn(updateDate); representation.setUpdatedBy(aip.getUpdatedBy());