/** Adds a new {@link ReferenceBook} to the network's {@link ReferenceLibrary} */ @POST public Response addReferenceBook(ReferenceBookBean referenceBookBean) { _logger.infof("WMS2: addReferenceBook '%s'\n", _network); if (referenceBookBean.name == null) { throw new BadRequestException("ReferenceBook must have a name"); } try { ReferenceLibrary library = Main.getWorkMgr().getReferenceLibrary(_network); if (library.getReferenceBook(referenceBookBean.name).isPresent()) { throw new BadRequestException("Duplicate bookname: " + referenceBookBean.name); } ReferenceLibrary.mergeReferenceBooks( Main.getWorkMgr().getReferenceLibraryPath(_network), ImmutableSortedSet.of(referenceBookBean.toAddressBook())); return Response.ok().build(); } catch (IOException e) { throw new InternalServerErrorException("ReferenceLibrary resource is corrupted"); } }
ReferenceLibrary testrigData = ReferenceLibrary.read(subFile); Path path = networkDir.resolve(BfConsts.RELPATH_REFERENCE_LIBRARY_PATH); ReferenceLibrary.mergeReferenceBooks(path, testrigData.getReferenceBooks()); } catch (IOException e) {
ReferenceBook.builder("book3").build()); ReferenceLibrary.mergeReferenceBooks(tempPath, newBooks);