@Test public void updateStorageLocationUnknownObject() throws Exception { objectReferentialRepository.updateStorageLocation( "container", "objectName1", "ANOTHER_STORAGE_ID", new TapeLibraryTarObjectStorageLocation( Arrays.asList( new TarEntryDescription("tarId1", "entry1", 1000L, 3L, "digest1-1"), new TarEntryDescription("tarId2", "entry2", 2000L, 7L, "digest1-2") ) ) ); }
public void updateStorageLocation(String containerName, String objectName, String storageId, TapeLibraryTarObjectStorageLocation tapeLibraryTarStorageLocation) throws ObjectReferentialException { try { collection.updateOne( Filters.and( Filters.eq(TapeObjectReferentialEntity.ID, toBson(new TapeLibraryObjectReferentialId(containerName, objectName))), Filters.eq(TapeObjectReferentialEntity.STORAGE_ID, storageId) ), Updates.combine( Updates.set(TapeObjectReferentialEntity.LOCATION, toBson(tapeLibraryTarStorageLocation)), Updates.set(TapeObjectReferentialEntity.LAST_UPDATE_DATE, LocalDateUtil.now().toString()) ), new UpdateOptions().upsert(false) ); } catch (MongoException ex) { throw new ObjectReferentialException("Could not update storage location for " + containerName + "/" + objectName, ex); } }
ObjectReferentialRepository { public void updateStorageLocation(String containerName, String objectName, String storageId, TapeLibraryTarObjectStorageLocation tapeLibraryTarStorageLocation) throws ObjectReferentialException { try { collection.updateOne( Filters.and( Filters.eq(TapeObjectReferentialEntity.ID, toBson(new TapeLibraryObjectReferentialId(containerName, objectName))), Filters.eq(TapeObjectReferentialEntity.STORAGE_ID, storageId) ), Updates.combine( Updates.set(TapeObjectReferentialEntity.LOCATION, toBson(tapeLibraryTarStorageLocation)), Updates.set(TapeObjectReferentialEntity.LAST_UPDATE_DATE, LocalDateUtil.now().toString()) ), new UpdateOptions().upsert(false) ); } catch (MongoException ex) { throw new ObjectReferentialException("Could not update storage location for " + containerName + "/" + objectName, ex); } } }
ObjectReferentialRepository { public void updateStorageLocation(String containerName, String objectName, String storageId, TapeLibraryTarObjectStorageLocation tapeLibraryTarStorageLocation) throws ObjectReferentialException { try { collection.updateOne( Filters.and( Filters.eq(TapeObjectReferentialEntity.ID, toBson(new TapeLibraryObjectReferentialId(containerName, objectName))), Filters.eq(TapeObjectReferentialEntity.STORAGE_ID, storageId) ), Updates.combine( Updates.set(TapeObjectReferentialEntity.LOCATION, toBson(tapeLibraryTarStorageLocation)), Updates.set(TapeObjectReferentialEntity.LAST_UPDATE_DATE, LocalDateUtil.now().toString()) ), new UpdateOptions().upsert(false) ); } catch (MongoException ex) { throw new ObjectReferentialException("Could not update storage location for " + containerName + "/" + objectName, ex); } } ObjectReferentialRepository(MongoCollection<Document> collection); }
ObjectReferentialRepository { public void updateStorageLocation(String containerName, String objectName, String storageId, TapeLibraryTarObjectStorageLocation tapeLibraryTarStorageLocation) throws ObjectReferentialException { try { collection.updateOne( Filters.and( Filters.eq(TapeObjectReferentialEntity.ID, toBson(new TapeLibraryObjectReferentialId(containerName, objectName))), Filters.eq(TapeObjectReferentialEntity.STORAGE_ID, storageId) ), Updates.combine( Updates.set(TapeObjectReferentialEntity.LOCATION, toBson(tapeLibraryTarStorageLocation)), Updates.set(TapeObjectReferentialEntity.LAST_UPDATE_DATE, LocalDateUtil.now().toString()) ), new UpdateOptions().upsert(false) ); } catch (MongoException ex) { throw new ObjectReferentialException("Could not update storage location for " + containerName + "/" + objectName, ex); } } ObjectReferentialRepository(MongoCollection<Document> collection); void insertOrUpdate(TapeObjectReferentialEntity tapeObjectReferentialEntity); Optional<TapeObjectReferentialEntity> find(String containerName, String objectName); List<TapeObjectReferentialEntity> bulkFind(String containerName, Set<String> objectNames); void updateStorageLocation(String containerName, String objectName, String storageId,
        TapeLibraryTarObjectStorageLocation tapeLibraryTarStorageLocation); boolean delete(TapeLibraryObjectReferentialId tapeLibraryObjectReferentialId); }
ObjectReferentialRepository { public void updateStorageLocation(String containerName, String objectName, String storageId, TapeLibraryTarObjectStorageLocation tapeLibraryTarStorageLocation) throws ObjectReferentialException { try { collection.updateOne( Filters.and( Filters.eq(TapeObjectReferentialEntity.ID, toBson(new TapeLibraryObjectReferentialId(containerName, objectName))), Filters.eq(TapeObjectReferentialEntity.STORAGE_ID, storageId) ), Updates.combine( Updates.set(TapeObjectReferentialEntity.LOCATION, toBson(tapeLibraryTarStorageLocation)), Updates.set(TapeObjectReferentialEntity.LAST_UPDATE_DATE, LocalDateUtil.now().toString()) ), new UpdateOptions().upsert(false) ); } catch (MongoException ex) { throw new ObjectReferentialException("Could not update storage location for " + containerName + "/" + objectName, ex); } } ObjectReferentialRepository(MongoCollection<Document> collection); void insertOrUpdate(TapeObjectReferentialEntity tapeObjectReferentialEntity); Optional<TapeObjectReferentialEntity> find(String containerName, String objectName); List<TapeObjectReferentialEntity> bulkFind(String containerName, Set<String> objectNames); void updateStorageLocation(String containerName, String objectName, String storageId,
        TapeLibraryTarObjectStorageLocation tapeLibraryTarStorageLocation); boolean delete(TapeLibraryObjectReferentialId tapeLibraryObjectReferentialId);  }