target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void validateEmailAddress_shouldNotMatchInvalidAddresses() throws Exception { Assert.assertFalse(EmailValidator.validateEmailAddress("blup")); } | public static boolean validateEmailAddress(String email) { if (email == null) { return false; } Matcher m = PATTERN.matcher(email.toLowerCase()); return m.find(); } | EmailValidator implements Validator<String> { public static boolean validateEmailAddress(String email) { if (email == null) { return false; } Matcher m = PATTERN.matcher(email.toLowerCase()); return m.find(); } } | EmailValidator implements Validator<String> { public static boolean validateEmailAddress(String email) { if (email == null) { return false; } Matcher m = PATTERN.matcher(email.toLowerCase()); return m.find(); } } | EmailValidator implements Validator<String> { public static boolean validateEmailAddress(String email) { if (email == null) { return false; } Matcher m = PATTERN.matcher(email.toLowerCase()); return m.find(); } @Override void validate(FacesContext context, UIComponent component, String value); static boolean validateE... | EmailValidator implements Validator<String> { public static boolean validateEmailAddress(String email) { if (email == null) { return false; } Matcher m = PATTERN.matcher(email.toLowerCase()); return m.find(); } @Override void validate(FacesContext context, UIComponent component, String value); static boolean validateE... |
@Test public void testBuild() { List<ImageGalleryTile> items = new ArrayList<>(); CMSMediaItem item1 = new CMSMediaItem(); item1.setId(1l); item1.addCategory(getCategory("tag1")); item1.setPriority(Priority.IMPORTANT); item1.setFileName("file1"); items.add(item1); CMSMediaItem item2 = new CMSMediaItem(); item2.setId(2l... | public TileGrid build(List<ImageGalleryTile> items) { if (!tags.isEmpty()) { items = filter(items, tags); } items = items.stream() .filter(item -> tags.isEmpty() || countTags(item, tags) > 0) .sorted(new SemiRandomOrderComparator<ImageGalleryTile>(tile -> tile.getDisplayOrder())) .collect(Collectors.toList()); List<Ima... | TileGridBuilder { public TileGrid build(List<ImageGalleryTile> items) { if (!tags.isEmpty()) { items = filter(items, tags); } items = items.stream() .filter(item -> tags.isEmpty() || countTags(item, tags) > 0) .sorted(new SemiRandomOrderComparator<ImageGalleryTile>(tile -> tile.getDisplayOrder())) .collect(Collectors.t... | TileGridBuilder { public TileGrid build(List<ImageGalleryTile> items) { if (!tags.isEmpty()) { items = filter(items, tags); } items = items.stream() .filter(item -> tags.isEmpty() || countTags(item, tags) > 0) .sorted(new SemiRandomOrderComparator<ImageGalleryTile>(tile -> tile.getDisplayOrder())) .collect(Collectors.t... | TileGridBuilder { public TileGrid build(List<ImageGalleryTile> items) { if (!tags.isEmpty()) { items = filter(items, tags); } items = items.stream() .filter(item -> tags.isEmpty() || countTags(item, tags) > 0) .sorted(new SemiRandomOrderComparator<ImageGalleryTile>(tile -> tile.getDisplayOrder())) .collect(Collectors.t... | TileGridBuilder { public TileGrid build(List<ImageGalleryTile> items) { if (!tags.isEmpty()) { items = filter(items, tags); } items = items.stream() .filter(item -> tags.isEmpty() || countTags(item, tags) > 0) .sorted(new SemiRandomOrderComparator<ImageGalleryTile>(tile -> tile.getDisplayOrder())) .collect(Collectors.t... |
@Test public void replaceApiPathParams_shouldRemoveTrailingSlashIfFileNameContainsPeriod() throws Exception { Assert.assertEquals("http: AbstractApiUrlManager.replaceApiPathParams("http: } | static String replaceApiPathParams(String urlString, Object[] pathParams) { return ApiPathParams.replacePathParams(urlString, pathParams); } | AbstractApiUrlManager { static String replaceApiPathParams(String urlString, Object[] pathParams) { return ApiPathParams.replacePathParams(urlString, pathParams); } } | AbstractApiUrlManager { static String replaceApiPathParams(String urlString, Object[] pathParams) { return ApiPathParams.replacePathParams(urlString, pathParams); } } | AbstractApiUrlManager { static String replaceApiPathParams(String urlString, Object[] pathParams) { return ApiPathParams.replacePathParams(urlString, pathParams); } abstract String getApiUrl(); abstract String getApplicationUrl(); static String subPath(String url, String within); String parseParameter(String template,... | AbstractApiUrlManager { static String replaceApiPathParams(String urlString, Object[] pathParams) { return ApiPathParams.replacePathParams(urlString, pathParams); } abstract String getApiUrl(); abstract String getApplicationUrl(); static String subPath(String url, String within); String parseParameter(String template,... |
@Test public void getNumAllowedPages_shouldReturn0IfPercentage0() throws Exception { Assert.assertEquals(0, PdfRequestFilter.getNumAllowedPages(0, 10)); } | static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be less than 0"); } if (numTotalRecordPages == 0 || per... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... |
@Test public void getNumAllowedPages_shouldReturn0IfNumberOfPages0() throws Exception { Assert.assertEquals(0, PdfRequestFilter.getNumAllowedPages(50, 0)); } | static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be less than 0"); } if (numTotalRecordPages == 0 || per... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... |
@Test public void getNumAllowedPages_shouldReturnNumberOfPagesIfPercentage100() throws Exception { Assert.assertEquals(10, PdfRequestFilter.getNumAllowedPages(100, 10)); } | static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be less than 0"); } if (numTotalRecordPages == 0 || per... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... |
@Test public void getNumAllowedPages_shouldCalculateNumberCorrectly() throws Exception { Assert.assertEquals(35, PdfRequestFilter.getNumAllowedPages(35, 100)); Assert.assertEquals(3, PdfRequestFilter.getNumAllowedPages(35, 10)); Assert.assertEquals(1, PdfRequestFilter.getNumAllowedPages(19, 10)); Assert.assertEquals(0,... | static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be less than 0"); } if (numTotalRecordPages == 0 || per... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... | PdfRequestFilter implements ContainerRequestFilter { static int getNumAllowedPages(int percentage, int numTotalRecordPages) { if (percentage < 0) { throw new IllegalArgumentException("percentage may not be less than 0"); } if (numTotalRecordPages < 0) { throw new IllegalArgumentException("numTotalRecordPages may not be... |
@Test public void testGetAlto() throws JDOMException, IOException { String url = urls.path(RECORDS_FILES, RECORDS_FILES_ALTO).params(PI, FILENAME + ".xml").build(); try (Response response = target(url) .request() .accept(MediaType.TEXT_XML) .get()) { assertEquals("Should return status 200", 200, response.getStatus()); ... | @GET @javax.ws.rs.Path(RECORDS_FILES_ALTO) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get Alto fulltext for a single page") public String getAlto( @Parameter(description = "Filename of the alto document") @PathParam("filename") String filename) throws PresentationException, IndexUnrea... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_ALTO) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get Alto fulltext for a single page") public String getAlto( @Parameter(description = "Filename of the alto document") @PathParam("filename") String filename) throws Presentation... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_ALTO) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get Alto fulltext for a single page") public String getAlto( @Parameter(description = "Filename of the alto document") @PathParam("filename") String filename) throws Presentation... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_ALTO) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get Alto fulltext for a single page") public String getAlto( @Parameter(description = "Filename of the alto document") @PathParam("filename") String filename) throws Presentation... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_ALTO) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get Alto fulltext for a single page") public String getAlto( @Parameter(description = "Filename of the alto document") @PathParam("filename") String filename) throws Presentation... |
@Test public void testGetPlaintext() throws JDOMException, IOException { String url = urls.path(RECORDS_FILES, RECORDS_FILES_PLAINTEXT).params(PI, FILENAME + ".txt").build(); try (Response response = target(url) .request() .accept(MediaType.TEXT_PLAIN) .get()) { assertEquals(response.getStatusInfo().getReasonPhrase(), ... | @GET @javax.ws.rs.Path(RECORDS_FILES_PLAINTEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get plaintext for a single page") public String getPlaintext( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws ContentNotFoundException, ... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_PLAINTEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get plaintext for a single page") public String getPlaintext( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws Conte... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_PLAINTEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get plaintext for a single page") public String getPlaintext( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws Conte... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_PLAINTEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get plaintext for a single page") public String getPlaintext( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws Conte... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_PLAINTEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get plaintext for a single page") public String getPlaintext( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws Conte... |
@Test public void testGetTEI() throws JDOMException, IOException { String url = urls.path(RECORDS_FILES, RECORDS_FILES_TEI).params(PI, FILENAME + ".xml").build(); try (Response response = target(url) .request() .accept(MediaType.TEXT_XML) .get()) { assertEquals(response.getStatusInfo().getReasonPhrase(), 200, response.... | @GET @javax.ws.rs.Path(RECORDS_FILES_TEI) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get fulltext for a single page in TEI format") public String getTEI( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws PresentationException, Inde... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_TEI) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get fulltext for a single page in TEI format") public String getTEI( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws Presen... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_TEI) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get fulltext for a single page in TEI format") public String getTEI( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws Presen... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_TEI) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get fulltext for a single page in TEI format") public String getTEI( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws Presen... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_TEI) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get fulltext for a single page in TEI format") public String getTEI( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws Presen... |
@Test public void testGetPdf() { String url = urls.path(RECORDS_FILES, RECORDS_FILES_PDF).params(PI, FILENAME).build(); try (Response response = target(url) .request() .accept("application/pdf") .get()) { assertEquals(response.getStatusInfo().getReasonPhrase(), 200, response.getStatus()); assertNotNull("Should return u... | @GET @javax.ws.rs.Path(RECORDS_FILES_PDF) @Produces({ "application/pdf" }) @Operation(tags = { "records" }, summary = "Non-canonical URL to PDF file") public Response getPDF( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws ContentLibException { logger.trace("getPD... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_PDF) @Produces({ "application/pdf" }) @Operation(tags = { "records" }, summary = "Non-canonical URL to PDF file") public Response getPDF( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws ContentLibException ... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_PDF) @Produces({ "application/pdf" }) @Operation(tags = { "records" }, summary = "Non-canonical URL to PDF file") public Response getPDF( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws ContentLibException ... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_PDF) @Produces({ "application/pdf" }) @Operation(tags = { "records" }, summary = "Non-canonical URL to PDF file") public Response getPDF( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws ContentLibException ... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_PDF) @Produces({ "application/pdf" }) @Operation(tags = { "records" }, summary = "Non-canonical URL to PDF file") public Response getPDF( @Parameter(description = "Filename containing the text") @PathParam("filename") String filename) throws ContentLibException ... |
@Test public void testGetSourceFile() { String url = urls.path(RECORDS_FILES, RECORDS_FILES_SOURCE).params(PI, "text.txt").build(); try (Response response = target(url) .request() .get()) { assertEquals(response.getStatusInfo().getReasonPhrase(), 200, response.getStatus()); String contentType = response.getHeaderString... | @GET @javax.ws.rs.Path(RECORDS_FILES_SOURCE) @Operation(tags = { "records" }, summary = "Get source files of record") @Produces(MediaType.APPLICATION_OCTET_STREAM) public StreamingOutput getSourceFile( @Parameter(description = "Source file name") @PathParam("filename") String filename) throws ContentLibException, Prese... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_SOURCE) @Operation(tags = { "records" }, summary = "Get source files of record") @Produces(MediaType.APPLICATION_OCTET_STREAM) public StreamingOutput getSourceFile( @Parameter(description = "Source file name") @PathParam("filename") String filename) throws Conte... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_SOURCE) @Operation(tags = { "records" }, summary = "Get source files of record") @Produces(MediaType.APPLICATION_OCTET_STREAM) public StreamingOutput getSourceFile( @Parameter(description = "Source file name") @PathParam("filename") String filename) throws Conte... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_SOURCE) @Operation(tags = { "records" }, summary = "Get source files of record") @Produces(MediaType.APPLICATION_OCTET_STREAM) public StreamingOutput getSourceFile( @Parameter(description = "Source file name") @PathParam("filename") String filename) throws Conte... | RecordFileResource { @GET @javax.ws.rs.Path(RECORDS_FILES_SOURCE) @Operation(tags = { "records" }, summary = "Get source files of record") @Produces(MediaType.APPLICATION_OCTET_STREAM) public StreamingOutput getSourceFile( @Parameter(description = "Source file name") @PathParam("filename") String filename) throws Conte... |
@Test public void testComparatorContract() { Random picker = new Random(System.nanoTime()); for (int i = 0; i < testRuns; i++) { SortTestObject o1 = testArray[picker.nextInt(testArray.length)]; SortTestObject o2 = testArray[picker.nextInt(testArray.length)]; SemiRandomOrderComparator<SortTestObject> comparator = new Se... | @Override public int compare(T a, T b) { Integer nA = comparisonOperator.apply(a); Integer nB = comparisonOperator.apply(b); if (nA.equals(0)) { nA = Integer.MAX_VALUE; } if (nB.equals(0)) { nB = Integer.MAX_VALUE; } if (nA.equals(nB)) { return Integer.compare(valueFor(a), valueFor(b)); } else { int res = nA.compareTo(... | SemiRandomOrderComparator implements Comparator<T> { @Override public int compare(T a, T b) { Integer nA = comparisonOperator.apply(a); Integer nB = comparisonOperator.apply(b); if (nA.equals(0)) { nA = Integer.MAX_VALUE; } if (nB.equals(0)) { nB = Integer.MAX_VALUE; } if (nA.equals(nB)) { return Integer.compare(valueF... | SemiRandomOrderComparator implements Comparator<T> { @Override public int compare(T a, T b) { Integer nA = comparisonOperator.apply(a); Integer nB = comparisonOperator.apply(b); if (nA.equals(0)) { nA = Integer.MAX_VALUE; } if (nB.equals(0)) { nB = Integer.MAX_VALUE; } if (nA.equals(nB)) { return Integer.compare(valueF... | SemiRandomOrderComparator implements Comparator<T> { @Override public int compare(T a, T b) { Integer nA = comparisonOperator.apply(a); Integer nB = comparisonOperator.apply(b); if (nA.equals(0)) { nA = Integer.MAX_VALUE; } if (nB.equals(0)) { nB = Integer.MAX_VALUE; } if (nA.equals(nB)) { return Integer.compare(valueF... | SemiRandomOrderComparator implements Comparator<T> { @Override public int compare(T a, T b) { Integer nA = comparisonOperator.apply(a); Integer nB = comparisonOperator.apply(b); if (nA.equals(0)) { nA = Integer.MAX_VALUE; } if (nB.equals(0)) { nB = Integer.MAX_VALUE; } if (nA.equals(nB)) { return Integer.compare(valueF... |
@Test public void testGetRISAsFile() { try(Response response = target(urls.path(RECORDS_SECTIONS, RECORDS_SECTIONS_RIS_FILE).params(PI, DIVID).build()) .request() .get()) { assertEquals("Should return status 200", 200, response.getStatus()); assertNotNull("Should return user object as json", response.getEntity()); Stri... | @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = getStructElement(pi, divId)... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = get... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = get... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = get... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = get... |
@Test public void testGetRISAsText() { try(Response response = target(urls.path(RECORDS_SECTIONS, RECORDS_SECTIONS_RIS_TEXT).params(PI, DIVID).build()) .request() .accept(MediaType.TEXT_PLAIN) .get()) { assertEquals("Should return status 200", 200, response.getStatus()); assertNotNull("Should return user object as json... | @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { StructElement se = getStructElement(pi, divId)... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { StructElement se = get... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { StructElement se = get... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { StructElement se = get... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records"}, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { StructElement se = get... |
@Test public void testGetRange() throws JsonMappingException, JsonProcessingException { String url = urls.path(RECORDS_SECTIONS, RECORDS_SECTIONS_RANGE).params(PI, DIVID).build(); try(Response response = target(url) .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200, r... | @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RANGE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = {"records", "iiif"}, summary = "Get IIIF range for section") @IIIFPresentationBinding public IPresentationModelElement getRange() throws ContentNotFoundException, PresentationException, IndexUnreachableException, ... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RANGE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = {"records", "iiif"}, summary = "Get IIIF range for section") @IIIFPresentationBinding public IPresentationModelElement getRange() throws ContentNotFoundException, PresentationException, Ind... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RANGE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = {"records", "iiif"}, summary = "Get IIIF range for section") @IIIFPresentationBinding public IPresentationModelElement getRange() throws ContentNotFoundException, PresentationException, Ind... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RANGE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = {"records", "iiif"}, summary = "Get IIIF range for section") @IIIFPresentationBinding public IPresentationModelElement getRange() throws ContentNotFoundException, PresentationException, Ind... | RecordSectionResource { @GET @javax.ws.rs.Path(RECORDS_SECTIONS_RANGE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = {"records", "iiif"}, summary = "Get IIIF range for section") @IIIFPresentationBinding public IPresentationModelElement getRange() throws ContentNotFoundException, PresentationException, Ind... |
@Test public void testGetPdf() { String url = urls.path(RECORDS_RECORD, RECORDS_PDF).params(PI).build(); try (Response response = target(url) .request() .header("x-forwarded-for", "1.2.3.4") .accept("application/pdf") .get()) { assertEquals("Should return status 200", 200, response.getStatus()); assertNotNull("Should r... | @Override @GET @Path(ApiUrls.RECORDS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records" }, summary = "Get PDF for entire record") public StreamingOutput getPdf() throws ContentLibException { logger.trace("getPdf: {}", filename); response.addHeader("Content-Disposition", "attachment... | ViewerRecordPDFResource extends MetsPdfResource { @Override @GET @Path(ApiUrls.RECORDS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records" }, summary = "Get PDF for entire record") public StreamingOutput getPdf() throws ContentLibException { logger.trace("getPdf: {}", filename); res... | ViewerRecordPDFResource extends MetsPdfResource { @Override @GET @Path(ApiUrls.RECORDS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records" }, summary = "Get PDF for entire record") public StreamingOutput getPdf() throws ContentLibException { logger.trace("getPdf: {}", filename); res... | ViewerRecordPDFResource extends MetsPdfResource { @Override @GET @Path(ApiUrls.RECORDS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records" }, summary = "Get PDF for entire record") public StreamingOutput getPdf() throws ContentLibException { logger.trace("getPdf: {}", filename); res... | ViewerRecordPDFResource extends MetsPdfResource { @Override @GET @Path(ApiUrls.RECORDS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records" }, summary = "Get PDF for entire record") public StreamingOutput getPdf() throws ContentLibException { logger.trace("getPdf: {}", filename); res... |
@Test public void testGetPdf() { String url = urls.path(RECORDS_SECTIONS, RECORDS_SECTIONS_PDF).params(PI, LOGID).build(); try (Response response = target(url) .request() .header("x-forwarded-for", "1.2.3.4") .accept("application/pdf") .get()) { assertEquals(response.getStatusInfo().getReasonPhrase(), 200, response.get... | @GET @Path(ApiUrls.RECORDS_SECTIONS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records"}, summary = "Get PDF for section of record") public StreamingOutput getPdf() throws ContentLibException { response.addHeader("Content-Disposition", "attachment; filename=\"" + filename + "\""); r... | ViewerSectionPDFResource extends MetsPdfResource { @GET @Path(ApiUrls.RECORDS_SECTIONS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records"}, summary = "Get PDF for section of record") public StreamingOutput getPdf() throws ContentLibException { response.addHeader("Content-Dispositio... | ViewerSectionPDFResource extends MetsPdfResource { @GET @Path(ApiUrls.RECORDS_SECTIONS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records"}, summary = "Get PDF for section of record") public StreamingOutput getPdf() throws ContentLibException { response.addHeader("Content-Dispositio... | ViewerSectionPDFResource extends MetsPdfResource { @GET @Path(ApiUrls.RECORDS_SECTIONS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records"}, summary = "Get PDF for section of record") public StreamingOutput getPdf() throws ContentLibException { response.addHeader("Content-Dispositio... | ViewerSectionPDFResource extends MetsPdfResource { @GET @Path(ApiUrls.RECORDS_SECTIONS_PDF) @Produces("application/pdf") @ContentServerPdfBinding @Operation(tags = { "records"}, summary = "Get PDF for section of record") public StreamingOutput getPdf() throws ContentLibException { response.addHeader("Content-Dispositio... |
@Test public void testGetSequence() throws JsonMappingException, JsonProcessingException { String url = urls.path(RECORDS_PAGES, RECORDS_PAGES_SEQUENCE).params(PI).build(); try(Response response = target(url) .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200, response... | @GET @javax.ws.rs.Path(RECORDS_PAGES_SEQUENCE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF base sequence") @IIIFPresentationBinding public IPresentationModelElement getSequence() throws ContentNotFoundException, PresentationException, IndexUnreachableException,... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_SEQUENCE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF base sequence") @IIIFPresentationBinding public IPresentationModelElement getSequence() throws ContentNotFoundException, PresentationException, Index... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_SEQUENCE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF base sequence") @IIIFPresentationBinding public IPresentationModelElement getSequence() throws ContentNotFoundException, PresentationException, Index... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_SEQUENCE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF base sequence") @IIIFPresentationBinding public IPresentationModelElement getSequence() throws ContentNotFoundException, PresentationException, Index... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_SEQUENCE) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF base sequence") @IIIFPresentationBinding public IPresentationModelElement getSequence() throws ContentNotFoundException, PresentationException, Index... |
@Test public void testGetCanvas() throws JsonMappingException, JsonProcessingException { String url = urls.path(RECORDS_PAGES, RECORDS_PAGES_CANVAS).params(PI, PAGENO).build(); try(Response response = target(url) .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200, resp... | @GET @javax.ws.rs.Path(RECORDS_PAGES_CANVAS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF canvas for a page") @IIIFPresentationBinding public IPresentationModelElement getCanvas( @Parameter(description = "Page numer (1-based") @PathParam("pageNo") Integer pageNo... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_CANVAS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF canvas for a page") @IIIFPresentationBinding public IPresentationModelElement getCanvas( @Parameter(description = "Page numer (1-based") @PathParam("pa... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_CANVAS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF canvas for a page") @IIIFPresentationBinding public IPresentationModelElement getCanvas( @Parameter(description = "Page numer (1-based") @PathParam("pa... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_CANVAS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF canvas for a page") @IIIFPresentationBinding public IPresentationModelElement getCanvas( @Parameter(description = "Page numer (1-based") @PathParam("pa... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_CANVAS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF canvas for a page") @IIIFPresentationBinding public IPresentationModelElement getCanvas( @Parameter(description = "Page numer (1-based") @PathParam("pa... |
@Test public void testGetCommentsForPage() throws JsonMappingException, JsonProcessingException { try(Response response = target(urls.path(RECORDS_PAGES, RECORDS_PAGES_COMMENTS).params(PI_ANNOTATIONS, PAGENO_ANNOTATIONS).build()) .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return statu... | @GET @javax.ws.rs.Path(RECORDS_PAGES_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations"}, summary = "List comments for a page") public IAnnotationCollection getCommentsForPage( @Parameter(description = "Page numer (1-based") @PathParam("pageNo") Integer pageNo, @Parameter( ... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations"}, summary = "List comments for a page") public IAnnotationCollection getCommentsForPage( @Parameter(description = "Page numer (1-based") @PathParam("pageNo") Integer... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations"}, summary = "List comments for a page") public IAnnotationCollection getCommentsForPage( @Parameter(description = "Page numer (1-based") @PathParam("pageNo") Integer... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations"}, summary = "List comments for a page") public IAnnotationCollection getCommentsForPage( @Parameter(description = "Page numer (1-based") @PathParam("pageNo") Integer... | RecordPageResource { @GET @javax.ws.rs.Path(RECORDS_PAGES_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations"}, summary = "List comments for a page") public IAnnotationCollection getCommentsForPage( @Parameter(description = "Page numer (1-based") @PathParam("pageNo") Integer... |
@Test public void testGetRISAsFile() { try(Response response = target(urls.path(RECORDS_RECORD, RECORDS_RIS_FILE).params(PI).build()) .request() .get()) { assertEquals("Should return status 200", 200, response.getStatus()); assertNotNull("Should return user object as json", response.getEntity()); String entity = respon... | @GET @javax.ws.rs.Path(RECORDS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = getStructElement(pi); String fileNa... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = getStructElement(p... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = getStructElement(p... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = getStructElement(p... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_RIS_FILE) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Download ris as file") public String getRISAsFile() throws PresentationException, IndexUnreachableException, DAOException, ContentLibException { StructElement se = getStructElement(p... |
@Test public void testGetRISAsText() { try(Response response = target(urls.path(RECORDS_RECORD, RECORDS_RIS_TEXT).params(PI).build()) .request() .accept(MediaType.TEXT_PLAIN) .get()) { assertEquals("Should return status 200", 200, response.getStatus()); assertNotNull("Should return user object as json", response.getEnt... | @GET @javax.ws.rs.Path(RECORDS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { if (servletResponse != null) { servletResponse.setChar... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { if (servletResponse != null) { servle... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { if (servletResponse != null) { servle... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { if (servletResponse != null) { servle... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_RIS_TEXT) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get ris as text") public String getRISAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException { if (servletResponse != null) { servle... |
@Test public void testClone() { CMSMediaItem item1 = new CMSMediaItem(); CMSContentItem original = new CMSContentItem(CMSContentItemType.HTML); original.setBaseCollection("base-collection"); original.setCategories(new ArrayList(Collections.singleton(new CMSCategory("category")))); original.setCollectionBaseLevels(2); o... | @Override public CMSContentItem clone() { CMSContentItem clone = new CMSContentItem(this, null); return clone; } | CMSContentItem implements Comparable<CMSContentItem>, CMSMediaHolder { @Override public CMSContentItem clone() { CMSContentItem clone = new CMSContentItem(this, null); return clone; } } | CMSContentItem implements Comparable<CMSContentItem>, CMSMediaHolder { @Override public CMSContentItem clone() { CMSContentItem clone = new CMSContentItem(this, null); return clone; } CMSContentItem(); CMSContentItem(CMSContentItem blueprint, CMSPageLanguageVersion owner); CMSContentItem(CMSContentItemType type); } | CMSContentItem implements Comparable<CMSContentItem>, CMSMediaHolder { @Override public CMSContentItem clone() { CMSContentItem clone = new CMSContentItem(this, null); return clone; } CMSContentItem(); CMSContentItem(CMSContentItem blueprint, CMSPageLanguageVersion owner); CMSContentItem(CMSContentItemType type); Fun... | CMSContentItem implements Comparable<CMSContentItem>, CMSMediaHolder { @Override public CMSContentItem clone() { CMSContentItem clone = new CMSContentItem(this, null); return clone; } CMSContentItem(); CMSContentItem(CMSContentItem blueprint, CMSPageLanguageVersion owner); CMSContentItem(CMSContentItemType type); Fun... |
@Test public void testGetTOCAsText() { try(Response response = target(urls.path(RECORDS_RECORD, RECORDS_TOC).params(PI).build()) .request() .accept(MediaType.TEXT_PLAIN) .get()) { assertEquals("Should return status 200", 200, response.getStatus()); assertNotNull("Should return user object as json", response.getEntity()... | @GET @javax.ws.rs.Path(RECORDS_TOC) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get table of contents of records") public String getTOCAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException, ViewerConfigurationException { if (servletR... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_TOC) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get table of contents of records") public String getTOCAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException, ViewerConfigurationExcepti... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_TOC) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get table of contents of records") public String getTOCAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException, ViewerConfigurationExcepti... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_TOC) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get table of contents of records") public String getTOCAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException, ViewerConfigurationExcepti... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_TOC) @Produces({ MediaType.TEXT_PLAIN }) @Operation(tags = { "records" }, summary = "Get table of contents of records") public String getTOCAsText() throws PresentationException, IndexUnreachableException, ContentNotFoundException, DAOException, ViewerConfigurationExcepti... |
@Test public void testGetAnnotationsForRecord() throws JsonMappingException, JsonProcessingException { try(Response response = target(urls.path(RECORDS_RECORD, RECORDS_ANNOTATIONS).params(PI_ANNOTATIONS).build()) .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200, resp... | @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List annotations for a record") public IAnnotationCollection getAnnotationsForRecord( @Parameter( description = "annotation format of the response. If it is 'oa' the comments ... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List annotations for a record") public IAnnotationCollection getAnnotationsForRecord( @Parameter( description = "annotation format of the response. If it is '... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List annotations for a record") public IAnnotationCollection getAnnotationsForRecord( @Parameter( description = "annotation format of the response. If it is '... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List annotations for a record") public IAnnotationCollection getAnnotationsForRecord( @Parameter( description = "annotation format of the response. If it is '... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List annotations for a record") public IAnnotationCollection getAnnotationsForRecord( @Parameter( description = "annotation format of the response. If it is '... |
@Test public void testGetAnnotationPageForRecord() throws JsonMappingException, JsonProcessingException { try(Response response = target(urls.path(RECORDS_RECORD, RECORDS_ANNOTATIONS).params(PI_ANNOTATIONS).build() + "1/") .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200",... | @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getAnnotationPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequestException { URI u... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getAnnotationPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequest... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getAnnotationPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequest... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getAnnotationPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequest... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_ANNOTATIONS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getAnnotationPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequest... |
@Test public void testGetCommentsForRecord() throws JsonMappingException, JsonProcessingException { try(Response response = target(urls.path(RECORDS_RECORD, RECORDS_COMMENTS).params(PI_ANNOTATIONS).build()) .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200, response.g... | @GET @javax.ws.rs.Path(RECORDS_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List comments for a record") public IAnnotationCollection getCommentsForRecord( @Parameter( description = "annotation format of the response. If it is 'oa' the comments will be d... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List comments for a record") public IAnnotationCollection getCommentsForRecord( @Parameter( description = "annotation format of the response. If it is 'oa' the c... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List comments for a record") public IAnnotationCollection getCommentsForRecord( @Parameter( description = "annotation format of the response. If it is 'oa' the c... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List comments for a record") public IAnnotationCollection getCommentsForRecord( @Parameter( description = "annotation format of the response. If it is 'oa' the c... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_COMMENTS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "annotations" }, summary = "List comments for a record") public IAnnotationCollection getCommentsForRecord( @Parameter( description = "annotation format of the response. If it is 'oa' the c... |
@Test public void testGetCommentPageForRecord() throws JsonMappingException, JsonProcessingException { try(Response response = target(urls.path(RECORDS_RECORD, RECORDS_COMMENTS).params(PI_ANNOTATIONS).build() + "1/") .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200, ... | @GET @javax.ws.rs.Path(RECORDS_COMMENTS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getCommentPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequestException { URI uri = U... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_COMMENTS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getCommentPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequestExcept... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_COMMENTS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getCommentPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequestExcept... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_COMMENTS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getCommentPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequestExcept... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_COMMENTS + "/{page}") @Produces({ MediaType.APPLICATION_JSON }) @ApiResponse(responseCode = "400", description = "If the page number is out of bounds") public AnnotationPage getCommentPageForRecord(@PathParam("page") Integer page) throws DAOException, IllegalRequestExcept... |
@Test public void testGetSource() { try(Response response = target(urls.path(RECORDS_RECORD, RECORDS_METADATA_SOURCE).params(PI).build()) .request() .accept(MediaType.TEXT_XML) .get()) { assertEquals("Should return status 404", 404, response.getStatus()); assertNotNull("Should return user object as json", response.getE... | @GET @javax.ws.rs.Path(RECORDS_METADATA_SOURCE) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get record metadata source file") public StreamingOutput getSource() throws ContentNotFoundException, PresentationException, IndexUnreachableException { StructElement se = getStructElement(pi); ... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_METADATA_SOURCE) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get record metadata source file") public StreamingOutput getSource() throws ContentNotFoundException, PresentationException, IndexUnreachableException { StructElement se = getSt... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_METADATA_SOURCE) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get record metadata source file") public StreamingOutput getSource() throws ContentNotFoundException, PresentationException, IndexUnreachableException { StructElement se = getSt... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_METADATA_SOURCE) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get record metadata source file") public StreamingOutput getSource() throws ContentNotFoundException, PresentationException, IndexUnreachableException { StructElement se = getSt... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_METADATA_SOURCE) @Produces({ MediaType.TEXT_XML }) @Operation(tags = { "records" }, summary = "Get record metadata source file") public StreamingOutput getSource() throws ContentNotFoundException, PresentationException, IndexUnreachableException { StructElement se = getSt... |
@Test public void testGetManifest() throws JsonMappingException, JsonProcessingException { String url = urls.path(RECORDS_RECORD, RECORDS_MANIFEST).params(PI).build(); try(Response response = target(url) .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200, response.getS... | @GET @javax.ws.rs.Path(RECORDS_MANIFEST) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF manifest for record") @IIIFPresentationBinding public IPresentationModelElement getManifest( @Parameter( description = "Build mode for manifest to select type of resources to i... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_MANIFEST) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF manifest for record") @IIIFPresentationBinding public IPresentationModelElement getManifest( @Parameter( description = "Build mode for manifest to select type ... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_MANIFEST) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF manifest for record") @IIIFPresentationBinding public IPresentationModelElement getManifest( @Parameter( description = "Build mode for manifest to select type ... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_MANIFEST) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF manifest for record") @IIIFPresentationBinding public IPresentationModelElement getManifest( @Parameter( description = "Build mode for manifest to select type ... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_MANIFEST) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get IIIF manifest for record") @IIIFPresentationBinding public IPresentationModelElement getManifest( @Parameter( description = "Build mode for manifest to select type ... |
@Test public void testGetLayer() throws JsonMappingException, JsonProcessingException { String url = urls.path(RECORDS_RECORD, RECORDS_LAYER).params(PI, "ALTO").build(); try(Response response = target(url) .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200, response.ge... | @GET @javax.ws.rs.Path(RECORDS_LAYER) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get a layer within a IIIF manifest") @IIIFPresentationBinding public IPresentationModelElement getLayer( @Parameter(description = "Name of the manifest layer") @PathParam("name") String la... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_LAYER) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get a layer within a IIIF manifest") @IIIFPresentationBinding public IPresentationModelElement getLayer( @Parameter(description = "Name of the manifest layer") @PathParam(... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_LAYER) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get a layer within a IIIF manifest") @IIIFPresentationBinding public IPresentationModelElement getLayer( @Parameter(description = "Name of the manifest layer") @PathParam(... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_LAYER) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get a layer within a IIIF manifest") @IIIFPresentationBinding public IPresentationModelElement getLayer( @Parameter(description = "Name of the manifest layer") @PathParam(... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_LAYER) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records", "iiif" }, summary = "Get a layer within a IIIF manifest") @IIIFPresentationBinding public IPresentationModelElement getLayer( @Parameter(description = "Name of the manifest layer") @PathParam(... |
@Test public void testGetNERTags() throws JsonMappingException, JsonProcessingException { String url = urls.path(RECORDS_RECORD, RECORDS_NER_TAGS).params(PI_NER).build(); try(Response response = target(url) .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200, response.g... | @GET @javax.ws.rs.Path(RECORDS_NER_TAGS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records" }, summary = "Get NER tags for a record") public DocumentReference getNERTags( @Parameter(description = "First page to get tags for") @QueryParam("start") Integer start, @Parameter(description = "Last page t... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_NER_TAGS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records" }, summary = "Get NER tags for a record") public DocumentReference getNERTags( @Parameter(description = "First page to get tags for") @QueryParam("start") Integer start, @Parameter(descripti... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_NER_TAGS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records" }, summary = "Get NER tags for a record") public DocumentReference getNERTags( @Parameter(description = "First page to get tags for") @QueryParam("start") Integer start, @Parameter(descripti... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_NER_TAGS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records" }, summary = "Get NER tags for a record") public DocumentReference getNERTags( @Parameter(description = "First page to get tags for") @QueryParam("start") Integer start, @Parameter(descripti... | RecordResource { @GET @javax.ws.rs.Path(RECORDS_NER_TAGS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "records" }, summary = "Get NER tags for a record") public DocumentReference getNERTags( @Parameter(description = "First page to get tags for") @QueryParam("start") Integer start, @Parameter(descripti... |
@Test public void testGetAllCollections() throws JsonMappingException, JsonProcessingException { String url = urls.path(COLLECTIONS).params(SOLR_FIELD).build(); try(Response response = target(url) .request() .accept(MediaType.APPLICATION_JSON) .get()) { String entity = response.readEntity(String.class); assertEquals("S... | @GET @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get all collections as IIIF presentation collection") @ApiResponse(responseCode="400", description="No collections available for field") public Collection getAllCollections( @Parameter(description ="Add values of this field to respo... | CollectionsResource { @GET @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get all collections as IIIF presentation collection") @ApiResponse(responseCode="400", description="No collections available for field") public Collection getAllCollections( @Parameter(description ="Add values ... | CollectionsResource { @GET @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get all collections as IIIF presentation collection") @ApiResponse(responseCode="400", description="No collections available for field") public Collection getAllCollections( @Parameter(description ="Add values ... | CollectionsResource { @GET @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get all collections as IIIF presentation collection") @ApiResponse(responseCode="400", description="No collections available for field") public Collection getAllCollections( @Parameter(description ="Add values ... | CollectionsResource { @GET @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get all collections as IIIF presentation collection") @ApiResponse(responseCode="400", description="No collections available for field") public Collection getAllCollections( @Parameter(description ="Add values ... |
@Test public void testGetTileGridUrl() { String allowedTags = "a$b$cde"; List<CMSCategory> categories = new ArrayList<>(); for (String catName : allowedTags.split("\\$")) { categories.add(new CMSCategory(catName)); } boolean preferImportant = true; int numTiles = 12; CMSPage page = new CMSPage(); CMSPageLanguageVersion... | public String getTileGridUrl(String itemId) throws IllegalRequestException { CMSContentItem item; try { item = getContentItem(itemId); } catch (CmsElementNotFoundException e) { item = null; } if (item != null && item.getType().equals(CMSContentItemType.TILEGRID)) { StringBuilder sb = new StringBuilder(BeanUtils.getServ... | CMSPage implements Comparable<CMSPage>, Harvestable { public String getTileGridUrl(String itemId) throws IllegalRequestException { CMSContentItem item; try { item = getContentItem(itemId); } catch (CmsElementNotFoundException e) { item = null; } if (item != null && item.getType().equals(CMSContentItemType.TILEGRID)) { ... | CMSPage implements Comparable<CMSPage>, Harvestable { public String getTileGridUrl(String itemId) throws IllegalRequestException { CMSContentItem item; try { item = getContentItem(itemId); } catch (CmsElementNotFoundException e) { item = null; } if (item != null && item.getType().equals(CMSContentItemType.TILEGRID)) { ... | CMSPage implements Comparable<CMSPage>, Harvestable { public String getTileGridUrl(String itemId) throws IllegalRequestException { CMSContentItem item; try { item = getContentItem(itemId); } catch (CmsElementNotFoundException e) { item = null; } if (item != null && item.getType().equals(CMSContentItemType.TILEGRID)) { ... | CMSPage implements Comparable<CMSPage>, Harvestable { public String getTileGridUrl(String itemId) throws IllegalRequestException { CMSContentItem item; try { item = getContentItem(itemId); } catch (CmsElementNotFoundException e) { item = null; } if (item != null && item.getType().equals(CMSContentItemType.TILEGRID)) { ... |
@Test public void testGetCollection() { String url = urls.path(COLLECTIONS, COLLECTIONS_COLLECTION).params(SOLR_FIELD, COLLECTION).build(); try(Response response = target(url) .request() .accept(MediaType.APPLICATION_JSON) .get()) { String entity = response.readEntity(String.class); assertEquals("Should return status 2... | @GET @javax.ws.rs.Path(COLLECTIONS_COLLECTION) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get given collection as a IIIF presentation collection") @ApiResponse(responseCode="400", description="Invalid collection name or field") public Collection getCollection( @Parameter(descript... | CollectionsResource { @GET @javax.ws.rs.Path(COLLECTIONS_COLLECTION) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get given collection as a IIIF presentation collection") @ApiResponse(responseCode="400", description="Invalid collection name or field") public Collection getCollectio... | CollectionsResource { @GET @javax.ws.rs.Path(COLLECTIONS_COLLECTION) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get given collection as a IIIF presentation collection") @ApiResponse(responseCode="400", description="Invalid collection name or field") public Collection getCollectio... | CollectionsResource { @GET @javax.ws.rs.Path(COLLECTIONS_COLLECTION) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get given collection as a IIIF presentation collection") @ApiResponse(responseCode="400", description="Invalid collection name or field") public Collection getCollectio... | CollectionsResource { @GET @javax.ws.rs.Path(COLLECTIONS_COLLECTION) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags = { "iiif" }, summary = "Get given collection as a IIIF presentation collection") @ApiResponse(responseCode="400", description="Invalid collection name or field") public Collection getCollectio... |
@Test public void testGetTranslations() throws JsonMappingException, JsonProcessingException { try(Response response = target(urls.path(LOCALIZATION, LOCALIZATION_TRANSLATIONS).build()) .queryParam("keys", "cancel,ok") .request() .accept(MediaType.APPLICATION_JSON) .get()) { assertEquals("Should return status 200", 200... | @GET @Path(ApiUrls.LOCALIZATION_TRANSLATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags= {"localization"}, summary = "Get translations for message keys", description = "Pass a list of message keys to get translations for all configured languages") @ApiResponse(responseCode = "200", description = "Return... | TranslationResource { @GET @Path(ApiUrls.LOCALIZATION_TRANSLATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags= {"localization"}, summary = "Get translations for message keys", description = "Pass a list of message keys to get translations for all configured languages") @ApiResponse(responseCode = "200",... | TranslationResource { @GET @Path(ApiUrls.LOCALIZATION_TRANSLATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags= {"localization"}, summary = "Get translations for message keys", description = "Pass a list of message keys to get translations for all configured languages") @ApiResponse(responseCode = "200",... | TranslationResource { @GET @Path(ApiUrls.LOCALIZATION_TRANSLATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags= {"localization"}, summary = "Get translations for message keys", description = "Pass a list of message keys to get translations for all configured languages") @ApiResponse(responseCode = "200",... | TranslationResource { @GET @Path(ApiUrls.LOCALIZATION_TRANSLATIONS) @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags= {"localization"}, summary = "Get translations for message keys", description = "Pass a list of message keys to get translations for all configured languages") @ApiResponse(responseCode = "200",... |
@Test public void testGetApiInfo() { try(Response response = target(urls.path().build()) .request() .accept(MediaType.APPLICATION_JSON) .get()) { ApiInfo info = response.readEntity(ApiInfo.class); assertNotNull(info); assertEquals("v1", info.version); } } | @GET @Produces(MediaType.APPLICATION_JSON) public ApiInfo getApiInfo() { ApiInfo info = new ApiInfo(); info.name = "Goobi viewer REST API"; info.version = "v1"; info.specification = urls.getApiUrl() + "/openapi.json"; return info; } | ApplicationResource { @GET @Produces(MediaType.APPLICATION_JSON) public ApiInfo getApiInfo() { ApiInfo info = new ApiInfo(); info.name = "Goobi viewer REST API"; info.version = "v1"; info.specification = urls.getApiUrl() + "/openapi.json"; return info; } } | ApplicationResource { @GET @Produces(MediaType.APPLICATION_JSON) public ApiInfo getApiInfo() { ApiInfo info = new ApiInfo(); info.name = "Goobi viewer REST API"; info.version = "v1"; info.specification = urls.getApiUrl() + "/openapi.json"; return info; } } | ApplicationResource { @GET @Produces(MediaType.APPLICATION_JSON) public ApiInfo getApiInfo() { ApiInfo info = new ApiInfo(); info.name = "Goobi viewer REST API"; info.version = "v1"; info.specification = urls.getApiUrl() + "/openapi.json"; return info; } @GET @Produces(MediaType.APPLICATION_JSON) ApiInfo getApiInfo();... | ApplicationResource { @GET @Produces(MediaType.APPLICATION_JSON) public ApiInfo getApiInfo() { ApiInfo info = new ApiInfo(); info.name = "Goobi viewer REST API"; info.version = "v1"; info.specification = urls.getApiUrl() + "/openapi.json"; return info; } @GET @Produces(MediaType.APPLICATION_JSON) ApiInfo getApiInfo();... |
@Test public void createQuery_shouldAugmentGivenQueryCorrectly() throws Exception { Assert.assertEquals("(PI:*)", RssResource.createQuery("PI:*", null, null, null, false)); } | static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getInstance().getD... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... |
@Test public void createQuery_shouldCreateBasicQueryCorrectly() throws Exception { Assert.assertEquals("(ISWORK:true)", RssResource.createQuery(null, null, null, null, false)); } | static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getInstance().getD... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... |
@Test public void createQuery_shouldAddSuffixesIfRequested() throws Exception { Assert.assertEquals("(PI:*) -BOOL_HIDE:true -DC:collection1 -DC:collection2", RssResource.createQuery("PI:*", null, null, null, true)); Assert.assertEquals("(PI:*)", RssResource.createQuery("PI:*", null, null, null, false)); } | static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getInstance().getD... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... | RssResource { static String createQuery(String query, Long bookshelfId, String partnerId, HttpServletRequest servletRequest, boolean addSuffixes) throws IndexUnreachableException, PresentationException, DAOException { if (StringUtils.isEmpty(query)) { if (bookshelfId != null) { BookmarkList bookshelf = DataManager.getI... |
@Test public void testGetItemForManifest() throws ContentNotFoundException, URISyntaxException, DAOException { Campaign campaign = DataManager.getInstance().getDao().getCampaign(1l); CampaignItem item = resource.getItemForManifest(1l, "PPN1234"); Assert.assertNotNull(item); Assert.assertEquals(campaign, item.getCampaig... | @GET @Path("/{campaignId}/{pi}") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public CampaignItem getItemForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException, ContentNotFoundException { URI manifestURI = new ManifestBuilder(urls).getManifest... | CampaignItemResource { @GET @Path("/{campaignId}/{pi}") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public CampaignItem getItemForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException, ContentNotFoundException { URI manifestURI = new ManifestBu... | CampaignItemResource { @GET @Path("/{campaignId}/{pi}") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public CampaignItem getItemForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException, ContentNotFoundException { URI manifestURI = new ManifestBu... | CampaignItemResource { @GET @Path("/{campaignId}/{pi}") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public CampaignItem getItemForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException, ContentNotFoundException { URI manifestURI = new ManifestBu... | CampaignItemResource { @GET @Path("/{campaignId}/{pi}") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public CampaignItem getItemForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException, ContentNotFoundException { URI manifestURI = new ManifestBu... |
@Test public void testSetItemForManifest() throws ContentNotFoundException, URISyntaxException, DAOException { String pi = "PPN1234"; CampaignItem item = resource.getItemForManifest(1l, pi); User user = DataManager.getInstance().getDao().getUser(1l); item.setCreatorURI(user.getIdAsURI()); item.setRecordStatus(CampaignR... | @PUT @Path("/{campaignId}/{pi}/") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setItemForManifest(CampaignItem item, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws DAOException { CampaignRecordStatus status = item.getRecordStatus(); Campaign campaign = DataManager.get... | CampaignItemResource { @PUT @Path("/{campaignId}/{pi}/") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setItemForManifest(CampaignItem item, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws DAOException { CampaignRecordStatus status = item.getRecordStatus(); Campaign cam... | CampaignItemResource { @PUT @Path("/{campaignId}/{pi}/") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setItemForManifest(CampaignItem item, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws DAOException { CampaignRecordStatus status = item.getRecordStatus(); Campaign cam... | CampaignItemResource { @PUT @Path("/{campaignId}/{pi}/") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setItemForManifest(CampaignItem item, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws DAOException { CampaignRecordStatus status = item.getRecordStatus(); Campaign cam... | CampaignItemResource { @PUT @Path("/{campaignId}/{pi}/") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setItemForManifest(CampaignItem item, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws DAOException { CampaignRecordStatus status = item.getRecordStatus(); Campaign cam... |
@Test public void testGetAnnotationsForManifest() throws URISyntaxException, DAOException { String pi = "PI_1"; List<WebAnnotation> annotationList = resource.getAnnotationsForManifest(1l, pi); Assert.assertEquals(2, annotationList.size()); } | @GET @Path("/{campaignId}/{pi}/annotations") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public List<WebAnnotation> getAnnotationsForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { Campaign campaign = DataManager.getInstance().getDao().... | CampaignItemResource { @GET @Path("/{campaignId}/{pi}/annotations") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public List<WebAnnotation> getAnnotationsForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { Campaign campaign = DataManager.... | CampaignItemResource { @GET @Path("/{campaignId}/{pi}/annotations") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public List<WebAnnotation> getAnnotationsForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { Campaign campaign = DataManager.... | CampaignItemResource { @GET @Path("/{campaignId}/{pi}/annotations") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public List<WebAnnotation> getAnnotationsForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { Campaign campaign = DataManager.... | CampaignItemResource { @GET @Path("/{campaignId}/{pi}/annotations") @Produces({ MediaType.APPLICATION_JSON }) @CORSBinding public List<WebAnnotation> getAnnotationsForManifest(@PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { Campaign campaign = DataManager.... |
@Test public void testSetAnnotationsForManifest() throws URISyntaxException, DAOException { String pi = "PI_10"; URI manifestUrl = new ManifestBuilder(urls).getManifestURI(pi); Campaign campaign = DataManager.getInstance().getDao().getCampaign(1l); String annoUrl = urls.path(ApiUrls.ANNOTATIONS, ApiUrls.ANNOTATIONS_ANN... | @PUT @Path("/{campaignId}/{pi}/annotations") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setAnnotationsForManifest(List<AnnotationPage> pages, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { IDAO dao = DataManager.getInstance().getDa... | CampaignItemResource { @PUT @Path("/{campaignId}/{pi}/annotations") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setAnnotationsForManifest(List<AnnotationPage> pages, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { IDAO dao = DataMana... | CampaignItemResource { @PUT @Path("/{campaignId}/{pi}/annotations") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setAnnotationsForManifest(List<AnnotationPage> pages, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { IDAO dao = DataMana... | CampaignItemResource { @PUT @Path("/{campaignId}/{pi}/annotations") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setAnnotationsForManifest(List<AnnotationPage> pages, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { IDAO dao = DataMana... | CampaignItemResource { @PUT @Path("/{campaignId}/{pi}/annotations") @Consumes({ MediaType.APPLICATION_JSON }) @CORSBinding public void setAnnotationsForManifest(List<AnnotationPage> pages, @PathParam("campaignId") Long campaignId, @PathParam("pi") String pi) throws URISyntaxException, DAOException { IDAO dao = DataMana... |
@Test public void testCMSPage() throws DAOException, IOException, ServletException, URISyntaxException { CMSPage page = new CMSPage(); String templateId = "template"; page.setTemplateId(templateId); CMSPageLanguageVersion german = new CMSPageLanguageVersion(); german.setLanguage("de"); german.setStatus(CMSPageStatus.FI... | public CMSPage() { } | CMSPage implements Comparable<CMSPage>, Harvestable { public CMSPage() { } } | CMSPage implements Comparable<CMSPage>, Harvestable { public CMSPage() { } CMSPage(); CMSPage(CMSPage original); } | CMSPage implements Comparable<CMSPage>, Harvestable { public CMSPage() { } CMSPage(); CMSPage(CMSPage original); @Override int compareTo(CMSPage o); boolean saveSidebarElements(); void resetItemData(); List<CMSSidebarElement> getUnusedSidebarElements(); void addSidebarElement(CMSSidebarElement element); Long getId(); ... | CMSPage implements Comparable<CMSPage>, Harvestable { public CMSPage() { } CMSPage(); CMSPage(CMSPage original); @Override int compareTo(CMSPage o); boolean saveSidebarElements(); void resetItemData(); List<CMSSidebarElement> getUnusedSidebarElements(); void addSidebarElement(CMSSidebarElement element); Long getId(); ... |
@Test public void testGetContentHtml() throws IOException, DAOException, ServletException { String output = resource.getContentHtml(1l, "de", "C1"); String expectedOutput = "<b>Hello CMS</b>"; Assert.assertEquals(resource.wrap(expectedOutput, true), output); } | @GET @Path("/content/{pageId}/{language}/{contentId}") @Produces({ MediaType.TEXT_HTML }) public String getContentHtml(@PathParam("pageId") Long pageId, @PathParam("language") String language, @PathParam("contentId") String contentId) throws IOException, DAOException, ServletException { if (servletResponse != null) { s... | CMSContentResource { @GET @Path("/content/{pageId}/{language}/{contentId}") @Produces({ MediaType.TEXT_HTML }) public String getContentHtml(@PathParam("pageId") Long pageId, @PathParam("language") String language, @PathParam("contentId") String contentId) throws IOException, DAOException, ServletException { if (servlet... | CMSContentResource { @GET @Path("/content/{pageId}/{language}/{contentId}") @Produces({ MediaType.TEXT_HTML }) public String getContentHtml(@PathParam("pageId") Long pageId, @PathParam("language") String language, @PathParam("contentId") String contentId) throws IOException, DAOException, ServletException { if (servlet... | CMSContentResource { @GET @Path("/content/{pageId}/{language}/{contentId}") @Produces({ MediaType.TEXT_HTML }) public String getContentHtml(@PathParam("pageId") Long pageId, @PathParam("language") String language, @PathParam("contentId") String contentId) throws IOException, DAOException, ServletException { if (servlet... | CMSContentResource { @GET @Path("/content/{pageId}/{language}/{contentId}") @Produces({ MediaType.TEXT_HTML }) public String getContentHtml(@PathParam("pageId") Long pageId, @PathParam("language") String language, @PathParam("contentId") String contentId) throws IOException, DAOException, ServletException { if (servlet... |
@Test public void testGetSidebarElementHtml() throws IOException, DAOException, ServletException { String output = resource.getSidebarElementHtml(1l); String expectedOutput = "<h1>Hello Sidebar</h1>"; Assert.assertEquals(resource.wrap(expectedOutput, true), output); } | @GET @Path("/sidebar/{elementId}") @Produces({ MediaType.TEXT_PLAIN }) public String getSidebarElementHtml(@PathParam("elementId") Long elementId) throws IOException, DAOException, ServletException { String output = createResponseInThread(TargetType.SIDEBAR, elementId, null, null, REQUEST_TIMEOUT); return wrap(output, ... | CMSContentResource { @GET @Path("/sidebar/{elementId}") @Produces({ MediaType.TEXT_PLAIN }) public String getSidebarElementHtml(@PathParam("elementId") Long elementId) throws IOException, DAOException, ServletException { String output = createResponseInThread(TargetType.SIDEBAR, elementId, null, null, REQUEST_TIMEOUT);... | CMSContentResource { @GET @Path("/sidebar/{elementId}") @Produces({ MediaType.TEXT_PLAIN }) public String getSidebarElementHtml(@PathParam("elementId") Long elementId) throws IOException, DAOException, ServletException { String output = createResponseInThread(TargetType.SIDEBAR, elementId, null, null, REQUEST_TIMEOUT);... | CMSContentResource { @GET @Path("/sidebar/{elementId}") @Produces({ MediaType.TEXT_PLAIN }) public String getSidebarElementHtml(@PathParam("elementId") Long elementId) throws IOException, DAOException, ServletException { String output = createResponseInThread(TargetType.SIDEBAR, elementId, null, null, REQUEST_TIMEOUT);... | CMSContentResource { @GET @Path("/sidebar/{elementId}") @Produces({ MediaType.TEXT_PLAIN }) public String getSidebarElementHtml(@PathParam("elementId") Long elementId) throws IOException, DAOException, ServletException { String output = createResponseInThread(TargetType.SIDEBAR, elementId, null, null, REQUEST_TIMEOUT);... |
@Test public void testGetContentUrl() throws DAOException, CmsElementNotFoundException { CMSPage page = DataManager.getInstance().getDao().getCMSPage(1l); CMSContentItem item = page.getContentItem("C1", "de"); String url = CMSContentResource.getContentUrl(item); url = url.substring(0, url.indexOf("?")); Assert.assertEq... | public static String getContentUrl(CMSContentItem item) { if (item != null) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.CONTENT.name().toLowerCase()); urlBuilder.append("/"); urlBuilder.append(item.g... | CMSContentResource { public static String getContentUrl(CMSContentItem item) { if (item != null) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.CONTENT.name().toLowerCase()); urlBuilder.append("/"); url... | CMSContentResource { public static String getContentUrl(CMSContentItem item) { if (item != null) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.CONTENT.name().toLowerCase()); urlBuilder.append("/"); url... | CMSContentResource { public static String getContentUrl(CMSContentItem item) { if (item != null) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.CONTENT.name().toLowerCase()); urlBuilder.append("/"); url... | CMSContentResource { public static String getContentUrl(CMSContentItem item) { if (item != null) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.CONTENT.name().toLowerCase()); urlBuilder.append("/"); url... |
@Test public void testGetSidebarElementUrl() throws DAOException { CMSSidebarElement element = DataManager.getInstance().getDao().getCMSSidebarElement(1); String url = CMSContentResource.getSidebarElementUrl(element); url = url.substring(0, url.indexOf("?")); Assert.assertEquals("/rest/cms/sidebar/1/", url); } | public static String getSidebarElementUrl(CMSSidebarElement item) { if (item != null && item.hasHtml()) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.SIDEBAR.name().toLowerCase()); urlBuilder.append("/... | CMSContentResource { public static String getSidebarElementUrl(CMSSidebarElement item) { if (item != null && item.hasHtml()) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.SIDEBAR.name().toLowerCase());... | CMSContentResource { public static String getSidebarElementUrl(CMSSidebarElement item) { if (item != null && item.hasHtml()) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.SIDEBAR.name().toLowerCase());... | CMSContentResource { public static String getSidebarElementUrl(CMSSidebarElement item) { if (item != null && item.hasHtml()) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.SIDEBAR.name().toLowerCase());... | CMSContentResource { public static String getSidebarElementUrl(CMSSidebarElement item) { if (item != null && item.hasHtml()) { StringBuilder urlBuilder = new StringBuilder(BeanUtils.getServletPathWithHostAsUrlFromJsfContext()); urlBuilder.append("/rest/cms/"); urlBuilder.append(TargetType.SIDEBAR.name().toLowerCase());... |
@Test public void testGetManifest() throws ViewerConfigurationException, ContentNotFoundException, PresentationException, IndexUnreachableException, URISyntaxException, DAOException { IPresentationModelElement manifest = resource.getManifest(PP_NUAG_FOTO_V4); Assert.assertTrue(manifest instanceof Manifest); } | @GET @Path("/{pi}/manifest") @Produces({ MediaType.APPLICATION_JSON }) public IPresentationModelElement getManifest(@PathParam("pi") String pi) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, ContentNotFoundException { return createManifest(pi, Bu... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/manifest") @Produces({ MediaType.APPLICATION_JSON }) public IPresentationModelElement getManifest(@PathParam("pi") String pi) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, ContentNotF... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/manifest") @Produces({ MediaType.APPLICATION_JSON }) public IPresentationModelElement getManifest(@PathParam("pi") String pi) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, ContentNotF... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/manifest") @Produces({ MediaType.APPLICATION_JSON }) public IPresentationModelElement getManifest(@PathParam("pi") String pi) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, ContentNotF... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/manifest") @Produces({ MediaType.APPLICATION_JSON }) public IPresentationModelElement getManifest(@PathParam("pi") String pi) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, ContentNotF... |
@Test public void testGetRange() throws ViewerConfigurationException, ContentNotFoundException, PresentationException, IndexUnreachableException, URISyntaxException, DAOException { Range range = resource.getRange(PP_NUAG_FOTO_V4, "LOG_0000"); Assert.assertTrue(range instanceof Range); } | @GET @Path("/{pi}/range/{logId}") @Produces({ MediaType.APPLICATION_JSON }) public Range getRange(@PathParam("pi") String pi, @PathParam("logId") String logId) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, ContentNotFoundException { List<StructE... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/range/{logId}") @Produces({ MediaType.APPLICATION_JSON }) public Range getRange(@PathParam("pi") String pi, @PathParam("logId") String logId) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOExcept... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/range/{logId}") @Produces({ MediaType.APPLICATION_JSON }) public Range getRange(@PathParam("pi") String pi, @PathParam("logId") String logId) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOExcept... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/range/{logId}") @Produces({ MediaType.APPLICATION_JSON }) public Range getRange(@PathParam("pi") String pi, @PathParam("logId") String logId) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOExcept... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/range/{logId}") @Produces({ MediaType.APPLICATION_JSON }) public Range getRange(@PathParam("pi") String pi, @PathParam("logId") String logId) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOExcept... |
@Test public void testGetCanvas() throws ViewerConfigurationException, ContentNotFoundException, PresentationException, IndexUnreachableException, URISyntaxException, DAOException { Canvas canvas = resource.getCanvas(PP_NUAG_FOTO_V4, 1); Assert.assertTrue(canvas instanceof Canvas); } | @GET @Path("/{pi}/canvas/{physPageNo}") @Produces({ MediaType.APPLICATION_JSON }) public Canvas getCanvas(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, ContentNotFoundException... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/canvas/{physPageNo}") @Produces({ MediaType.APPLICATION_JSON }) public Canvas getCanvas(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationExcep... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/canvas/{physPageNo}") @Produces({ MediaType.APPLICATION_JSON }) public Canvas getCanvas(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationExcep... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/canvas/{physPageNo}") @Produces({ MediaType.APPLICATION_JSON }) public Canvas getCanvas(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationExcep... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/canvas/{physPageNo}") @Produces({ MediaType.APPLICATION_JSON }) public Canvas getCanvas(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationExcep... |
@Test public void testGetOtherContent() throws ViewerConfigurationException, ContentNotFoundException, IllegalRequestException, PresentationException, IndexUnreachableException, URISyntaxException, DAOException { try { AnnotationList annoList = resource.getOtherContent(PP_NUAG_FOTO_V4, 1, AnnotationType.FULLTEXT.name()... | @GET @Path("/{pi}/list/{physPageNo}/{type}") @Produces({ MediaType.APPLICATION_JSON }) public AnnotationList getOtherContent(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo, @PathParam("type") String typeName) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigu... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/list/{physPageNo}/{type}") @Produces({ MediaType.APPLICATION_JSON }) public AnnotationList getOtherContent(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo, @PathParam("type") String typeName) throws PresentationException, IndexUnreachable... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/list/{physPageNo}/{type}") @Produces({ MediaType.APPLICATION_JSON }) public AnnotationList getOtherContent(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo, @PathParam("type") String typeName) throws PresentationException, IndexUnreachable... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/list/{physPageNo}/{type}") @Produces({ MediaType.APPLICATION_JSON }) public AnnotationList getOtherContent(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo, @PathParam("type") String typeName) throws PresentationException, IndexUnreachable... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/list/{physPageNo}/{type}") @Produces({ MediaType.APPLICATION_JSON }) public AnnotationList getOtherContent(@PathParam("pi") String pi, @PathParam("physPageNo") int physPageNo, @PathParam("type") String typeName) throws PresentationException, IndexUnreachable... |
@Test public void testGetLayer() throws ViewerConfigurationException, ContentNotFoundException, IllegalRequestException, PresentationException, IndexUnreachableException, URISyntaxException, DAOException, IOException { Layer layer = resource.getLayer(PP_NUAG_FOTO_V4, AnnotationType.FULLTEXT.name()); Assert.assertTrue(l... | @GET @Path("/{pi}/layer/{type}") @Produces({ MediaType.APPLICATION_JSON }) public Layer getLayer(@PathParam("pi") String pi, @PathParam("type") String typeName) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, ContentNotFoundException, IllegalReque... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/layer/{type}") @Produces({ MediaType.APPLICATION_JSON }) public Layer getLayer(@PathParam("pi") String pi, @PathParam("type") String typeName) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOExcep... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/layer/{type}") @Produces({ MediaType.APPLICATION_JSON }) public Layer getLayer(@PathParam("pi") String pi, @PathParam("type") String typeName) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOExcep... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/layer/{type}") @Produces({ MediaType.APPLICATION_JSON }) public Layer getLayer(@PathParam("pi") String pi, @PathParam("type") String typeName) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOExcep... | ManifestResource extends AbstractResource { @GET @Path("/{pi}/layer/{type}") @Produces({ MediaType.APPLICATION_JSON }) public Layer getLayer(@PathParam("pi") String pi, @PathParam("type") String typeName) throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOExcep... |
@Test public void getSessionInfo_shouldReturnSessionInfoCorrectly() throws Exception { Map<String, String> sessionMd = new HashMap<>(); sessionMd.put("foo", "bar"); DataManager.getInstance().getSessionMap().put(TEST_SESSION_ID, sessionMd); String ret = resource.getSessionInfo(); Assert.assertTrue(ret, resource.getSessi... | @GET @Path("/info") @Produces({ MediaType.TEXT_PLAIN }) @CORSBinding public String getSessionInfo() { if (servletRequest == null) { return "Servlet request not found"; } StringBuilder sb = new StringBuilder(); Map<String, String> sessionMap = DataManager.getInstance().getSessionMap().get(servletRequest.getSession().get... | SessionResource { @GET @Path("/info") @Produces({ MediaType.TEXT_PLAIN }) @CORSBinding public String getSessionInfo() { if (servletRequest == null) { return "Servlet request not found"; } StringBuilder sb = new StringBuilder(); Map<String, String> sessionMap = DataManager.getInstance().getSessionMap().get(servletReques... | SessionResource { @GET @Path("/info") @Produces({ MediaType.TEXT_PLAIN }) @CORSBinding public String getSessionInfo() { if (servletRequest == null) { return "Servlet request not found"; } StringBuilder sb = new StringBuilder(); Map<String, String> sessionMap = DataManager.getInstance().getSessionMap().get(servletReques... | SessionResource { @GET @Path("/info") @Produces({ MediaType.TEXT_PLAIN }) @CORSBinding public String getSessionInfo() { if (servletRequest == null) { return "Servlet request not found"; } StringBuilder sb = new StringBuilder(); Map<String, String> sessionMap = DataManager.getInstance().getSessionMap().get(servletReques... | SessionResource { @GET @Path("/info") @Produces({ MediaType.TEXT_PLAIN }) @CORSBinding public String getSessionInfo() { if (servletRequest == null) { return "Servlet request not found"; } StringBuilder sb = new StringBuilder(); Map<String, String> sessionMap = DataManager.getInstance().getSessionMap().get(servletReques... |
@Test public void exportItemFiles_shouldReturnMediaFilesDirectly() throws Exception { CMSMediaItem mediaItem = new CMSMediaItem(); mediaItem.setFileName("example.pdf"); CMSContentItem item = new CMSContentItem(CMSContentItemType.MEDIA); item.setMediaItem(mediaItem); List<File> result = CMSPage.exportItemFiles(item, "",... | static List<File> exportItemFiles(CMSContentItem item, String outputFolderPath, String namingScheme, long cmsPageId) throws IOException { if (item.getType() == null) { return Collections.emptyList(); } switch (item.getType()) { case MEDIA: return Collections.singletonList(item.getMediaItem().getFilePath().toFile()); ca... | CMSPage implements Comparable<CMSPage>, Harvestable { static List<File> exportItemFiles(CMSContentItem item, String outputFolderPath, String namingScheme, long cmsPageId) throws IOException { if (item.getType() == null) { return Collections.emptyList(); } switch (item.getType()) { case MEDIA: return Collections.singlet... | CMSPage implements Comparable<CMSPage>, Harvestable { static List<File> exportItemFiles(CMSContentItem item, String outputFolderPath, String namingScheme, long cmsPageId) throws IOException { if (item.getType() == null) { return Collections.emptyList(); } switch (item.getType()) { case MEDIA: return Collections.singlet... | CMSPage implements Comparable<CMSPage>, Harvestable { static List<File> exportItemFiles(CMSContentItem item, String outputFolderPath, String namingScheme, long cmsPageId) throws IOException { if (item.getType() == null) { return Collections.emptyList(); } switch (item.getType()) { case MEDIA: return Collections.singlet... | CMSPage implements Comparable<CMSPage>, Harvestable { static List<File> exportItemFiles(CMSContentItem item, String outputFolderPath, String namingScheme, long cmsPageId) throws IOException { if (item.getType() == null) { return Collections.emptyList(); } switch (item.getType()) { case MEDIA: return Collections.singlet... |
@Test public void addNormDataValuesToJSON_shouldAddValuesCorrectly() throws Exception { NormData normData = new NormData(); normData.setKey("NORM_FOO"); normData.getValues().add(new NormDataValue("bar", null, null)); JSONObject jsonObj =NormdataResource.addNormDataValuesToJSON(normData, null); Assert.assertNotNull(json... | static JSONObject addNormDataValuesToJSON(NormData normData, Locale locale) { JSONObject jsonObj = new JSONObject(); String translation = ViewerResourceBundle.getTranslation(normData.getKey(), locale); String translatedKey = StringUtils.isNotEmpty(translation) ? translation : normData.getKey(); for (NormDataValue value... | NormdataResource { static JSONObject addNormDataValuesToJSON(NormData normData, Locale locale) { JSONObject jsonObj = new JSONObject(); String translation = ViewerResourceBundle.getTranslation(normData.getKey(), locale); String translatedKey = StringUtils.isNotEmpty(translation) ? translation : normData.getKey(); for (... | NormdataResource { static JSONObject addNormDataValuesToJSON(NormData normData, Locale locale) { JSONObject jsonObj = new JSONObject(); String translation = ViewerResourceBundle.getTranslation(normData.getKey(), locale); String translatedKey = StringUtils.isNotEmpty(translation) ? translation : normData.getKey(); for (... | NormdataResource { static JSONObject addNormDataValuesToJSON(NormData normData, Locale locale) { JSONObject jsonObj = new JSONObject(); String translation = ViewerResourceBundle.getTranslation(normData.getKey(), locale); String translatedKey = StringUtils.isNotEmpty(translation) ? translation : normData.getKey(); for (... | NormdataResource { static JSONObject addNormDataValuesToJSON(NormData normData, Locale locale) { JSONObject jsonObj = new JSONObject(); String translation = ViewerResourceBundle.getTranslation(normData.getKey(), locale); String translatedKey = StringUtils.isNotEmpty(translation) ? translation : normData.getKey(); for (... |
@Test public void getAltoDocument_shouldReturnDocumentCorrectly() throws Exception { Assert.assertNotNull(resource.getAltoDocument(PI, "00000001.xml")); } | @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHolder.PRIV_VIEW_FULL... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... |
@Test public void getAltoDocumentZip() throws Exception { StreamingOutput response = resource.getAltoDocument(PI); Path tempFile = Paths.get("test.zip"); if (Files.exists(tempFile)) { Files.delete(tempFile); } Assert.assertFalse(Files.exists(tempFile)); try (OutputStream out = Files.newOutputStream(tempFile)) { respons... | @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHolder.PRIV_VIEW_FULL... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... |
@Test(expected = ServiceNotAllowedException.class) public void getAltoDocument_shouldThrowContentNotFoundExceptionIfFileNotFound() throws Exception { resource.getAltoDocument("notfound", "00000001.xml"); } | @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHolder.PRIV_VIEW_FULL... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... | ContentResource { @GET @Path("/alto/{pi}") @Produces({ "application/zip" }) public StreamingOutput getAltoDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, MalformedURLException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHol... |
@Test public void getContentDocument_shouldReturnDocumentCorrectly() throws Exception { Assert.assertNotNull(resource.getContentDocument(null, "fulltext", PI, "00000001.txt")); } | @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws PresentationException, IndexU... | ContentResource { @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws Presentatio... | ContentResource { @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws Presentatio... | ContentResource { @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws Presentatio... | ContentResource { @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws Presentatio... |
@Test(expected = ServiceNotAllowedException.class) public void getContentDocument_shouldThrowContentNotFoundExceptionIfFileNotFound() throws Exception { resource.getContentDocument(null, "foo", "notfound", "00000001.xml"); } | @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws PresentationException, IndexU... | ContentResource { @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws Presentatio... | ContentResource { @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws Presentatio... | ContentResource { @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws Presentatio... | ContentResource { @GET @Path("/document/{contentFolder}/{pi}/{fileName}") @Produces({ MediaType.TEXT_XML, MediaType.TEXT_PLAIN, MediaType.TEXT_HTML }) public String getContentDocument(@PathParam("contentFolder") String contentFolder, @PathParam("pi") String pi, @PathParam("fileName") String fileName) throws Presentatio... |
@Test(expected = ServiceNotAllowedException.class) public void getFulltextDocument_shouldThrowContentNotFoundExceptionIfFileNotFound() throws Exception { resource.getFulltextDocument("notfound", "00000001.txt"); } | @GET @Path("/fulltext/{pi}") @Produces({ "application/zip" }) public StreamingOutput getFulltextDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, IOException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHolder.PRIV_VIEW_FULLTE... | ContentResource { @GET @Path("/fulltext/{pi}") @Produces({ "application/zip" }) public StreamingOutput getFulltextDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, IOException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHolde... | ContentResource { @GET @Path("/fulltext/{pi}") @Produces({ "application/zip" }) public StreamingOutput getFulltextDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, IOException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHolde... | ContentResource { @GET @Path("/fulltext/{pi}") @Produces({ "application/zip" }) public StreamingOutput getFulltextDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, IOException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHolde... | ContentResource { @GET @Path("/fulltext/{pi}") @Produces({ "application/zip" }) public StreamingOutput getFulltextDocument(@PathParam("pi") String pi) throws PresentationException, ContentLibException, IndexUnreachableException, DAOException, IOException { setResponseHeader(pi + ".zip"); checkAccess(pi, IPrivilegeHolde... |
@Test public void getTeiDocument_shouldReturnDocumentCorrectly() throws Exception { String tei = resource.getTeiDocument("DE_2013_Riedel_PolitikUndCo_241__248", "de"); Assert.assertNotNull(tei); Assert.assertTrue(tei.contains("Religionen und Sinndeutungssysteme")); } | @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAccess(pi, IPrivilege... | ContentResource { @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAcc... | ContentResource { @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAcc... | ContentResource { @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAcc... | ContentResource { @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAcc... |
@Test(expected = ContentNotFoundException.class) public void getTeiDocument_shouldThrowContentNotFoundExceptionIfFileNotFound() throws Exception { resource.getTeiDocument("notfound", "en"); } | @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAccess(pi, IPrivilege... | ContentResource { @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAcc... | ContentResource { @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAcc... | ContentResource { @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAcc... | ContentResource { @GET @Path("/tei/{pi}/{lang}") @Produces({ MediaType.APPLICATION_XML }) public String getTeiDocument(@PathParam("pi") String pi, @PathParam("lang") String langCode) throws PresentationException, IndexUnreachableException, DAOException, IOException, ContentLibException { setResponseHeader(""); checkAcc... |
@Test public void testGetFiles() throws IOException { Path tempPath = Paths.get("test", "data", "temp"); try { Path folder1 = tempPath.resolve("folder1"); Path folder2 = tempPath.resolve("folder2"); Files.createDirectories(folder1); Files.createDirectories(folder2); createFile(folder1, "A"); createFile(folder1, "B"); c... | public List<java.nio.file.Path> getFiles(String pi, String foldername, String altFoldername, String filter) throws IOException, PresentationException, IndexUnreachableException { java.nio.file.Path folder1 = DataFileTools.getDataFilePath(pi, foldername, null, null); java.nio.file.Path folder2 = DataFileTools.getDataFil... | ContentResource { public List<java.nio.file.Path> getFiles(String pi, String foldername, String altFoldername, String filter) throws IOException, PresentationException, IndexUnreachableException { java.nio.file.Path folder1 = DataFileTools.getDataFilePath(pi, foldername, null, null); java.nio.file.Path folder2 = DataFi... | ContentResource { public List<java.nio.file.Path> getFiles(String pi, String foldername, String altFoldername, String filter) throws IOException, PresentationException, IndexUnreachableException { java.nio.file.Path folder1 = DataFileTools.getDataFilePath(pi, foldername, null, null); java.nio.file.Path folder2 = DataFi... | ContentResource { public List<java.nio.file.Path> getFiles(String pi, String foldername, String altFoldername, String filter) throws IOException, PresentationException, IndexUnreachableException { java.nio.file.Path folder1 = DataFileTools.getDataFilePath(pi, foldername, null, null); java.nio.file.Path folder2 = DataFi... | ContentResource { public List<java.nio.file.Path> getFiles(String pi, String foldername, String altFoldername, String filter) throws IOException, PresentationException, IndexUnreachableException { java.nio.file.Path folder1 = DataFileTools.getDataFilePath(pi, foldername, null, null); java.nio.file.Path folder2 = DataFi... |
@Test(expected = IllegalArgumentException.class) public void loadFromXML_shouldThrowIllegalArgumentExceptionIfFileIsNull() throws Exception { CMSPageTemplate.loadFromXML(null); } | public static CMSPageTemplate loadFromXML(Path file) { if (file == null) { throw new IllegalArgumentException("file may not be null"); } Document doc; try { doc = XmlTools.readXmlFile(file); } catch (IOException | JDOMException e1) { logger.error(e1.toString(), e1); return null; } if (doc != null) { Element root = doc.... | CMSPageTemplate implements Serializable { public static CMSPageTemplate loadFromXML(Path file) { if (file == null) { throw new IllegalArgumentException("file may not be null"); } Document doc; try { doc = XmlTools.readXmlFile(file); } catch (IOException | JDOMException e1) { logger.error(e1.toString(), e1); return null... | CMSPageTemplate implements Serializable { public static CMSPageTemplate loadFromXML(Path file) { if (file == null) { throw new IllegalArgumentException("file may not be null"); } Document doc; try { doc = XmlTools.readXmlFile(file); } catch (IOException | JDOMException e1) { logger.error(e1.toString(), e1); return null... | CMSPageTemplate implements Serializable { public static CMSPageTemplate loadFromXML(Path file) { if (file == null) { throw new IllegalArgumentException("file may not be null"); } Document doc; try { doc = XmlTools.readXmlFile(file); } catch (IOException | JDOMException e1) { logger.error(e1.toString(), e1); return null... | CMSPageTemplate implements Serializable { public static CMSPageTemplate loadFromXML(Path file) { if (file == null) { throw new IllegalArgumentException("file may not be null"); } Document doc; try { doc = XmlTools.readXmlFile(file); } catch (IOException | JDOMException e1) { logger.error(e1.toString(), e1); return null... |
@Test public void testcheckSearchUpdate() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException { SearchHitsNotificationResource resource = new SearchHitsNotificationResource(); Search search = new Search(); search.setQuery("ISWORK:*"); search.setLastHitsCount(200); search.... | public List<SearchHit> getNewHits(Search search) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException { Search tempSearch = new Search(search); SearchFacets facets = new SearchFacets(); facets.setCurrentFacetString(tempSearch.getFacetString()); tempSearch.execute(facets, n... | SearchHitsNotificationResource { public List<SearchHit> getNewHits(Search search) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException { Search tempSearch = new Search(search); SearchFacets facets = new SearchFacets(); facets.setCurrentFacetString(tempSearch.getFacetString... | SearchHitsNotificationResource { public List<SearchHit> getNewHits(Search search) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException { Search tempSearch = new Search(search); SearchFacets facets = new SearchFacets(); facets.setCurrentFacetString(tempSearch.getFacetString... | SearchHitsNotificationResource { public List<SearchHit> getNewHits(Search search) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException { Search tempSearch = new Search(search); SearchFacets facets = new SearchFacets(); facets.setCurrentFacetString(tempSearch.getFacetString... | SearchHitsNotificationResource { public List<SearchHit> getNewHits(Search search) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException { Search tempSearch = new Search(search); SearchFacets facets = new SearchFacets(); facets.setCurrentFacetString(tempSearch.getFacetString... |
@Test public void constructUrl_shouldConstructUrlCorrectly() throws Exception { String pi = PI_KLEIUNIV; QueryResponse qr = DataManager.getInstance().getSearchIndex().search(SolrConstants.PI + ":" + pi, 0, 1, null, null, null); Assert.assertEquals(1, qr.getResults().size()); Assert.assertEquals("/object/" + pi + "/1/LO... | static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order = (int) targetDoc.getFieldValue(SolrConsta... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... |
@Test public void constructUrl_shouldConstructAnchorUrlCorrectly() throws Exception { String pi = "306653648"; QueryResponse qr = DataManager.getInstance().getSearchIndex().search(SolrConstants.PI + ":" + pi, 0, 1, null, null, null); Assert.assertEquals(1, qr.getResults().size()); Assert.assertEquals("/toc/" + pi + "/1... | static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order = (int) targetDoc.getFieldValue(SolrConsta... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... |
@Test public void constructUrl_shouldConstructGroupUrlCorrectly() throws Exception { String pi = "PPN_GROUP"; SolrDocument doc = new SolrDocument(); doc.setField(SolrConstants.DOCTYPE, DocType.GROUP.toString()); doc.setField(SolrConstants.PI_TOPSTRUCT, pi); Assert.assertEquals("/toc/" + pi + "/1/-/", IdentifierResolver... | static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order = (int) targetDoc.getFieldValue(SolrConsta... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... |
@Test public void constructUrl_shouldConstructPageUrlCorrectly() throws Exception { String urn = "urn\\:nbn\\:at\\:at-akw\\:g-86493"; String pi = "AC11442160"; QueryResponse qr = DataManager.getInstance().getSearchIndex().search(SolrConstants.IMAGEURN + ":" + urn, 0, 1, null, null, null); Assert.assertEquals(1, qr.getR... | static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order = (int) targetDoc.getFieldValue(SolrConsta... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... |
@Test public void constructUrl_shouldConstructPreferredViewUrlCorrectly() throws Exception { String pi = "123"; SolrDocument doc = new SolrDocument(); doc.setField(SolrConstants.DOCSTRCT, "Catalogue"); doc.setField(SolrConstants.PI_TOPSTRUCT, "123"); Assert.assertEquals("/toc/" + pi + "/1/-/", IdentifierResolver.constr... | static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order = (int) targetDoc.getFieldValue(SolrConsta... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... |
@Test public void constructUrl_shouldConstructApplicationMimeTypeUrlCorrectly() throws Exception { String pi = "123"; SolrDocument doc = new SolrDocument(); doc.setField(SolrConstants.DOCSTRCT, "Monograph"); doc.setField(SolrConstants.PI_TOPSTRUCT, "123"); doc.setField(SolrConstants.MIMETYPE, "application"); Assert.ass... | static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order = (int) targetDoc.getFieldValue(SolrConsta... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... | IdentifierResolver extends HttpServlet { static String constructUrl(SolrDocument targetDoc, boolean pageResolverUrl) { int order = 1; if (targetDoc.containsKey(SolrConstants.THUMBPAGENO)) { order = (int) targetDoc.getFieldValue(SolrConstants.THUMBPAGENO); } else if (targetDoc.containsKey(SolrConstants.ORDER)) { order =... |
@Test public void parseFieldValueParameters_shouldParseFieldsAndValuesCorrectly() throws Exception { Map<Integer, String> moreFields = new HashMap<>(); Map<Integer, String> moreValues = new HashMap<>(); Map<String, String[]> parameterMap = new HashMap<>(6); parameterMap.put("field2", new String[] { "FIELD2" }); paramet... | static void parseFieldValueParameters(Map<String, String[]> parameterMap, Map<Integer, String> moreFields, Map<Integer, String> moreValues) { if (parameterMap == null || parameterMap.isEmpty()) { return; } for (String key : parameterMap.keySet()) { if (parameterMap.get(key) == null || parameterMap.get(key).length == 0)... | IdentifierResolver extends HttpServlet { static void parseFieldValueParameters(Map<String, String[]> parameterMap, Map<Integer, String> moreFields, Map<Integer, String> moreValues) { if (parameterMap == null || parameterMap.isEmpty()) { return; } for (String key : parameterMap.keySet()) { if (parameterMap.get(key) == n... | IdentifierResolver extends HttpServlet { static void parseFieldValueParameters(Map<String, String[]> parameterMap, Map<Integer, String> moreFields, Map<Integer, String> moreValues) { if (parameterMap == null || parameterMap.isEmpty()) { return; } for (String key : parameterMap.keySet()) { if (parameterMap.get(key) == n... | IdentifierResolver extends HttpServlet { static void parseFieldValueParameters(Map<String, String[]> parameterMap, Map<Integer, String> moreFields, Map<Integer, String> moreValues) { if (parameterMap == null || parameterMap.isEmpty()) { return; } for (String key : parameterMap.keySet()) { if (parameterMap.get(key) == n... | IdentifierResolver extends HttpServlet { static void parseFieldValueParameters(Map<String, String[]> parameterMap, Map<Integer, String> moreFields, Map<Integer, String> moreValues) { if (parameterMap == null || parameterMap.isEmpty()) { return; } for (String key : parameterMap.keySet()) { if (parameterMap.get(key) == n... |
@Test public void scanPersistenceXML_shouldMergePersistenceXmlFilesCorrectly() throws Exception { File masterFile = new File("src/main/resources/META-INF/persistence.xml"); Assert.assertTrue(masterFile.isFile()); URL masterUrl = new URL("file: File file = new File("src/test/resources/modules/persistence.xml"); Assert.a... | static Document scanPersistenceXML(URL masterFileUrl, List<URL> moduleUrls) throws IOException, JDOMException { logger.trace("scanPersistenceXML(): {}", masterFileUrl); Document docMerged = new Document(); Document docMaster = XmlTools.readXmlFile(masterFileUrl); Element eleMasterRoot = docMaster.getRootElement(); Map<... | JPAClassLoader extends ClassLoader { static Document scanPersistenceXML(URL masterFileUrl, List<URL> moduleUrls) throws IOException, JDOMException { logger.trace("scanPersistenceXML(): {}", masterFileUrl); Document docMerged = new Document(); Document docMaster = XmlTools.readXmlFile(masterFileUrl); Element eleMasterRo... | JPAClassLoader extends ClassLoader { static Document scanPersistenceXML(URL masterFileUrl, List<URL> moduleUrls) throws IOException, JDOMException { logger.trace("scanPersistenceXML(): {}", masterFileUrl); Document docMerged = new Document(); Document docMaster = XmlTools.readXmlFile(masterFileUrl); Element eleMasterRo... | JPAClassLoader extends ClassLoader { static Document scanPersistenceXML(URL masterFileUrl, List<URL> moduleUrls) throws IOException, JDOMException { logger.trace("scanPersistenceXML(): {}", masterFileUrl); Document docMerged = new Document(); Document docMaster = XmlTools.readXmlFile(masterFileUrl); Element eleMasterRo... | JPAClassLoader extends ClassLoader { static Document scanPersistenceXML(URL masterFileUrl, List<URL> moduleUrls) throws IOException, JDOMException { logger.trace("scanPersistenceXML(): {}", masterFileUrl); Document docMerged = new Document(); Document docMaster = XmlTools.readXmlFile(masterFileUrl); Element eleMasterRo... |
@Test public void getAllUsersTest() throws DAOException { List<User> users = DataManager.getInstance().getDao().getAllUsers(false); Assert.assertEquals(3, users.size()); } | @SuppressWarnings("unchecked") @Override public List<User> getAllUsers(boolean refresh) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u"); if (refresh) { q.setHint("javax.persistence.cache.storeMode", "REFRESH"); } return q.getResultList(); } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<User> getAllUsers(boolean refresh) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u"); if (refresh) { q.setHint("javax.persistence.cache.storeMode", "REFRESH"); } return q.getResultList(); } } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<User> getAllUsers(boolean refresh) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u"); if (refresh) { q.setHint("javax.persistence.cache.storeMode", "REFRESH"); } return q.getResultList(); } JPADAO(); JPADAO(S... | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<User> getAllUsers(boolean refresh) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u"); if (refresh) { q.setHint("javax.persistence.cache.storeMode", "REFRESH"); } return q.getResultList(); } JPADAO(); JPADAO(S... | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<User> getAllUsers(boolean refresh) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u"); if (refresh) { q.setHint("javax.persistence.cache.storeMode", "REFRESH"); } return q.getResultList(); } JPADAO(); JPADAO(S... |
@Test public void test() throws PresentationException, IndexUnreachableException, ViewerConfigurationException, DAOException, URISyntaxException, ContentNotFoundException, IOException { DataManager.getInstance().injectConfiguration(new Configuration("src/test/resources/config_viewer.test.xml")); ManifestBuilder builder... | public IPresentationModelElement generateManifest(StructElement ele) throws URISyntaxException, PresentationException, IndexUnreachableException, ViewerConfigurationException, DAOException { final AbstractPresentationModelElement manifest; if (ele.isAnchor()) { manifest = new Collection(getManifestURI(ele.getPi()), ele... | ManifestBuilder extends AbstractBuilder { public IPresentationModelElement generateManifest(StructElement ele) throws URISyntaxException, PresentationException, IndexUnreachableException, ViewerConfigurationException, DAOException { final AbstractPresentationModelElement manifest; if (ele.isAnchor()) { manifest = new C... | ManifestBuilder extends AbstractBuilder { public IPresentationModelElement generateManifest(StructElement ele) throws URISyntaxException, PresentationException, IndexUnreachableException, ViewerConfigurationException, DAOException { final AbstractPresentationModelElement manifest; if (ele.isAnchor()) { manifest = new C... | ManifestBuilder extends AbstractBuilder { public IPresentationModelElement generateManifest(StructElement ele) throws URISyntaxException, PresentationException, IndexUnreachableException, ViewerConfigurationException, DAOException { final AbstractPresentationModelElement manifest; if (ele.isAnchor()) { manifest = new C... | ManifestBuilder extends AbstractBuilder { public IPresentationModelElement generateManifest(StructElement ele) throws URISyntaxException, PresentationException, IndexUnreachableException, ViewerConfigurationException, DAOException { final AbstractPresentationModelElement manifest; if (ele.isAnchor()) { manifest = new C... |
@Test public void getUserByIdTest() throws DAOException { User user = DataManager.getInstance().getDao().getUser(1); Assert.assertNotNull(user); Assert.assertEquals(2, user.getOpenIdAccounts().size()); } | @Override public User getUser(long id) throws DAOException { preQuery(); try { User o = em.getReference(User.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } | JPADAO implements IDAO { @Override public User getUser(long id) throws DAOException { preQuery(); try { User o = em.getReference(User.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } } | JPADAO implements IDAO { @Override public User getUser(long id) throws DAOException { preQuery(); try { User o = em.getReference(User.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); } | JPADAO implements IDAO { @Override public User getUser(long id) throws DAOException { preQuery(); try { User o = em.getReference(User.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); EntityManagerFactory getFa... | JPADAO implements IDAO { @Override public User getUser(long id) throws DAOException { preQuery(); try { User o = em.getReference(User.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); EntityManagerFactory getFa... |
@Test public void getUserByEmailTest() throws DAOException { User user = DataManager.getInstance().getDao().getUserByEmail("1@UsErS.oRg"); Assert.assertNotNull(user); } | @Override public User getUserByEmail(String email) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.email) = :email"); if (email != null) { q.setParameter("email", email.toUpperCase()); } try { User o = (User) q.getSingleResult(); if (o != null) { em.refresh(o); } return o;... | JPADAO implements IDAO { @Override public User getUserByEmail(String email) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.email) = :email"); if (email != null) { q.setParameter("email", email.toUpperCase()); } try { User o = (User) q.getSingleResult(); if (o != null) { e... | JPADAO implements IDAO { @Override public User getUserByEmail(String email) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.email) = :email"); if (email != null) { q.setParameter("email", email.toUpperCase()); } try { User o = (User) q.getSingleResult(); if (o != null) { e... | JPADAO implements IDAO { @Override public User getUserByEmail(String email) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.email) = :email"); if (email != null) { q.setParameter("email", email.toUpperCase()); } try { User o = (User) q.getSingleResult(); if (o != null) { e... | JPADAO implements IDAO { @Override public User getUserByEmail(String email) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.email) = :email"); if (email != null) { q.setParameter("email", email.toUpperCase()); } try { User o = (User) q.getSingleResult(); if (o != null) { e... |
@Test public void getUserByOpenIdTest() throws DAOException { User user = DataManager.getInstance().getDao().getUserByOpenId("user_1_claimed_identifier_2"); Assert.assertNotNull(user); } | @Override public User getUserByOpenId(String identifier) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE :claimed_identifier MEMBER OF u.openIdAccounts"); q.setParameter("claimed_identifier", identifier); q.setHint("javax.persistence.cache.storeMode", "REFRESH"); try { User o = (U... | JPADAO implements IDAO { @Override public User getUserByOpenId(String identifier) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE :claimed_identifier MEMBER OF u.openIdAccounts"); q.setParameter("claimed_identifier", identifier); q.setHint("javax.persistence.cache.storeMode", "REF... | JPADAO implements IDAO { @Override public User getUserByOpenId(String identifier) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE :claimed_identifier MEMBER OF u.openIdAccounts"); q.setParameter("claimed_identifier", identifier); q.setHint("javax.persistence.cache.storeMode", "REF... | JPADAO implements IDAO { @Override public User getUserByOpenId(String identifier) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE :claimed_identifier MEMBER OF u.openIdAccounts"); q.setParameter("claimed_identifier", identifier); q.setHint("javax.persistence.cache.storeMode", "REF... | JPADAO implements IDAO { @Override public User getUserByOpenId(String identifier) throws DAOException { preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE :claimed_identifier MEMBER OF u.openIdAccounts"); q.setParameter("claimed_identifier", identifier); q.setHint("javax.persistence.cache.storeMode", "REF... |
@Test public void getUserByNicknameTest() throws DAOException { User user = DataManager.getInstance().getDao().getUserByNickname("admin"); Assert.assertNotNull(user); } | @Override public User getUserByNickname(String nickname) throws DAOException { if (StringUtils.isBlank(nickname)) { return null; } preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.nickName) = :nickname"); q.setParameter("nickname", nickname.trim().toUpperCase()); q.setHint("javax.persistence.cac... | JPADAO implements IDAO { @Override public User getUserByNickname(String nickname) throws DAOException { if (StringUtils.isBlank(nickname)) { return null; } preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.nickName) = :nickname"); q.setParameter("nickname", nickname.trim().toUpperCase()); q.setHi... | JPADAO implements IDAO { @Override public User getUserByNickname(String nickname) throws DAOException { if (StringUtils.isBlank(nickname)) { return null; } preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.nickName) = :nickname"); q.setParameter("nickname", nickname.trim().toUpperCase()); q.setHi... | JPADAO implements IDAO { @Override public User getUserByNickname(String nickname) throws DAOException { if (StringUtils.isBlank(nickname)) { return null; } preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.nickName) = :nickname"); q.setParameter("nickname", nickname.trim().toUpperCase()); q.setHi... | JPADAO implements IDAO { @Override public User getUserByNickname(String nickname) throws DAOException { if (StringUtils.isBlank(nickname)) { return null; } preQuery(); Query q = em.createQuery("SELECT u FROM User u WHERE UPPER(u.nickName) = :nickname"); q.setParameter("nickname", nickname.trim().toUpperCase()); q.setHi... |
@Test public void addUserTest() throws DAOException { User user = new User(); user.setEmail("a@b.com"); user.setPasswordHash("EEEEEE"); user.setPasswordHash("FFFFFF"); user.setFirstName("first"); user.setLastName("last"); user.setNickName("banned_admin"); user.setComments("no"); user.setUseGravatar(true); Date now = ne... | @Override public boolean addUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(user); em.getTransaction().commit(); return true; } finally { em.close(); } } | JPADAO implements IDAO { @Override public boolean addUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(user); em.getTransaction().commit(); return true; } finally { em.close(); } } } | JPADAO implements IDAO { @Override public boolean addUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(user); em.getTransaction().commit(); return true; } finally { em.close(); } } JPADAO(); JPADAO(String inPersistenceUnitN... | JPADAO implements IDAO { @Override public boolean addUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(user); em.getTransaction().commit(); return true; } finally { em.close(); } } JPADAO(); JPADAO(String inPersistenceUnitN... | JPADAO implements IDAO { @Override public boolean addUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(user); em.getTransaction().commit(); return true; } finally { em.close(); } } JPADAO(); JPADAO(String inPersistenceUnitN... |
@Test public void updateUserTest() throws DAOException { Assert.assertEquals(3, DataManager.getInstance().getDao().getAllUsers(false).size()); User user = DataManager.getInstance().getDao().getUser(1); Assert.assertNotNull(user); user.setEmail("b@b.com"); user.setPasswordHash("EFEFEF"); user.setFirstName("first"); user... | @Override public boolean updateUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(user); em.getTransaction().commit(); if (this.em.contains(user)) { this.em.refresh(user); } return true; } finally { em.close(); } } | JPADAO implements IDAO { @Override public boolean updateUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(user); em.getTransaction().commit(); if (this.em.contains(user)) { this.em.refresh(user); } return true; } finally { em.... | JPADAO implements IDAO { @Override public boolean updateUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(user); em.getTransaction().commit(); if (this.em.contains(user)) { this.em.refresh(user); } return true; } finally { em.... | JPADAO implements IDAO { @Override public boolean updateUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(user); em.getTransaction().commit(); if (this.em.contains(user)) { this.em.refresh(user); } return true; } finally { em.... | JPADAO implements IDAO { @Override public boolean updateUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(user); em.getTransaction().commit(); if (this.em.contains(user)) { this.em.refresh(user); } return true; } finally { em.... |
@Test public void deleteUserTest() throws DAOException { User user = new User(); user.setEmail("deleteme@b.com"); user.setPasswordHash("DDDDDD"); user.setFirstName("first"); user.setLastName("last"); user.setNickName("banned_admin"); user.setComments("no"); user.setActive(false); user.setSuperuser(true); DataManager.ge... | @Override public boolean deleteUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); User u = em.getReference(User.class, user.getId()); em.remove(u); em.getTransaction().commit(); return true; } finally { em.close(); } } | JPADAO implements IDAO { @Override public boolean deleteUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); User u = em.getReference(User.class, user.getId()); em.remove(u); em.getTransaction().commit(); return true; } finally { em.close... | JPADAO implements IDAO { @Override public boolean deleteUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); User u = em.getReference(User.class, user.getId()); em.remove(u); em.getTransaction().commit(); return true; } finally { em.close... | JPADAO implements IDAO { @Override public boolean deleteUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); User u = em.getReference(User.class, user.getId()); em.remove(u); em.getTransaction().commit(); return true; } finally { em.close... | JPADAO implements IDAO { @Override public boolean deleteUser(User user) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); User u = em.getReference(User.class, user.getId()); em.remove(u); em.getTransaction().commit(); return true; } finally { em.close... |
@Test public void getAllUserGroupsTest() throws DAOException { List<UserGroup> userGroups = DataManager.getInstance().getDao().getAllUserGroups(); Assert.assertEquals(2, userGroups.size()); } | @SuppressWarnings("unchecked") @Override public List<UserGroup> getAllUserGroups() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ug FROM UserGroup ug"); return q.getResultList(); } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<UserGroup> getAllUserGroups() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ug FROM UserGroup ug"); return q.getResultList(); } } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<UserGroup> getAllUserGroups() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ug FROM UserGroup ug"); return q.getResultList(); } JPADAO(); JPADAO(String inPersistenceUnitName); } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<UserGroup> getAllUserGroups() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ug FROM UserGroup ug"); return q.getResultList(); } JPADAO(); JPADAO(String inPersistenceUnitName); EntityManagerFactory getFactory(); EntityMan... | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<UserGroup> getAllUserGroups() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ug FROM UserGroup ug"); return q.getResultList(); } JPADAO(); JPADAO(String inPersistenceUnitName); EntityManagerFactory getFactory(); EntityMan... |
@Test public void getUserGroupByIdTest() throws DAOException { UserGroup ug = DataManager.getInstance().getDao().getUserGroup(1); Assert.assertNotNull(ug); Assert.assertNotNull(ug.getOwner()); Assert.assertEquals(Long.valueOf(1), ug.getOwner().getId()); Assert.assertEquals("user group 1 name", ug.getName()); Assert.ass... | @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } | JPADAO implements IDAO { @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } } | JPADAO implements IDAO { @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); } | JPADAO implements IDAO { @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); Entity... | JPADAO implements IDAO { @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); Entity... |
@Test public void getUserGroupByNameTest() throws DAOException { UserGroup userGroup = DataManager.getInstance().getDao().getUserGroup("user group 1 name"); Assert.assertNotNull(userGroup); Assert.assertNotNull(userGroup.getOwner()); Assert.assertEquals(Long.valueOf(1), userGroup.getOwner().getId()); Assert.assertEqual... | @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } | JPADAO implements IDAO { @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } } | JPADAO implements IDAO { @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); } | JPADAO implements IDAO { @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); Entity... | JPADAO implements IDAO { @Override public UserGroup getUserGroup(long id) throws DAOException { preQuery(); try { UserGroup o = em.getReference(UserGroup.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); Entity... |
@Test public void testAddOtherContent() throws PresentationException, IndexUnreachableException, URISyntaxException, ViewerConfigurationException, DAOException, ContentNotFoundException, IOException { DataManager.getInstance().injectConfiguration(new Configuration("src/test/resources/config_viewer.test.xml")); Manifest... | public Map<AnnotationType, AnnotationList> addOtherContent(StructElement doc, PhysicalElement page, Canvas canvas, boolean populate) throws URISyntaxException, IndexUnreachableException, ViewerConfigurationException { Map<AnnotationType, AnnotationList> annotationMap = new HashMap<>(); TextResourceBuilder builder = new... | SequenceBuilder extends AbstractBuilder { public Map<AnnotationType, AnnotationList> addOtherContent(StructElement doc, PhysicalElement page, Canvas canvas, boolean populate) throws URISyntaxException, IndexUnreachableException, ViewerConfigurationException { Map<AnnotationType, AnnotationList> annotationMap = new Hash... | SequenceBuilder extends AbstractBuilder { public Map<AnnotationType, AnnotationList> addOtherContent(StructElement doc, PhysicalElement page, Canvas canvas, boolean populate) throws URISyntaxException, IndexUnreachableException, ViewerConfigurationException { Map<AnnotationType, AnnotationList> annotationMap = new Hash... | SequenceBuilder extends AbstractBuilder { public Map<AnnotationType, AnnotationList> addOtherContent(StructElement doc, PhysicalElement page, Canvas canvas, boolean populate) throws URISyntaxException, IndexUnreachableException, ViewerConfigurationException { Map<AnnotationType, AnnotationList> annotationMap = new Hash... | SequenceBuilder extends AbstractBuilder { public Map<AnnotationType, AnnotationList> addOtherContent(StructElement doc, PhysicalElement page, Canvas canvas, boolean populate) throws URISyntaxException, IndexUnreachableException, ViewerConfigurationException { Map<AnnotationType, AnnotationList> annotationMap = new Hash... |
@Test public void testToJSONString() throws JsonProcessingException { String s = testObject.toJSONString(); Assert.assertEquals(testString, s); } | public String toJSONString() throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(this); } | GeoMapMarker { public String toJSONString() throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(this); } } | GeoMapMarker { public String toJSONString() throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(this); } GeoMapMarker(String name); GeoMapMarker(); } | GeoMapMarker { public String toJSONString() throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(this); } GeoMapMarker(String name); GeoMapMarker(); String getIcon(); void setIcon(String icon); String getMarkerColor(); void setMarkerColor(String markerColor); Stri... | GeoMapMarker { public String toJSONString() throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(this); } GeoMapMarker(String name); GeoMapMarker(); String getIcon(); void setIcon(String icon); String getMarkerColor(); void setMarkerColor(String markerColor); Stri... |
@Test public void addUserGroupTest() throws DAOException { User owner = DataManager.getInstance().getDao().getUser(1); Assert.assertNotNull(owner); UserGroup userGroup = new UserGroup(); userGroup.setOwner(owner); userGroup.setName("added user group name"); userGroup.setDescription("added user group desc"); userGroup.s... | @Override public boolean addUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userGroup); em.getTransaction().commit(); } finally { em.close(); } return true; } | JPADAO implements IDAO { @Override public boolean addUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userGroup); em.getTransaction().commit(); } finally { em.close(); } return true; } } | JPADAO implements IDAO { @Override public boolean addUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userGroup); em.getTransaction().commit(); } finally { em.close(); } return true; } JPADAO(); JPADAO(Strin... | JPADAO implements IDAO { @Override public boolean addUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userGroup); em.getTransaction().commit(); } finally { em.close(); } return true; } JPADAO(); JPADAO(Strin... | JPADAO implements IDAO { @Override public boolean addUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userGroup); em.getTransaction().commit(); } finally { em.close(); } return true; } JPADAO(); JPADAO(Strin... |
@Test public void updateUserGroupTest() throws DAOException { Assert.assertEquals(2, DataManager.getInstance().getDao().getAllUserGroups().size()); UserGroup userGroup = DataManager.getInstance().getDao().getUserGroup(1); Assert.assertNotNull(userGroup); Assert.assertEquals("user group 1 name", userGroup.getName()); us... | @Override public boolean updateUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userGroup); em.getTransaction().commit(); if (this.em.contains(userGroup)) { this.em.refresh(userGroup); } return true; } finally ... | JPADAO implements IDAO { @Override public boolean updateUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userGroup); em.getTransaction().commit(); if (this.em.contains(userGroup)) { this.em.refresh(userGroup); ... | JPADAO implements IDAO { @Override public boolean updateUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userGroup); em.getTransaction().commit(); if (this.em.contains(userGroup)) { this.em.refresh(userGroup); ... | JPADAO implements IDAO { @Override public boolean updateUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userGroup); em.getTransaction().commit(); if (this.em.contains(userGroup)) { this.em.refresh(userGroup); ... | JPADAO implements IDAO { @Override public boolean updateUserGroup(UserGroup userGroup) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userGroup); em.getTransaction().commit(); if (this.em.contains(userGroup)) { this.em.refresh(userGroup); ... |
@Test public void getAllUserRolesTest() throws DAOException { List<UserRole> userRoles = DataManager.getInstance().getDao().getAllUserRoles(); Assert.assertEquals(1, userRoles.size()); } | @SuppressWarnings("unchecked") @Override public List<UserRole> getAllUserRoles() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ur FROM UserRole ur"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<UserRole> getAllUserRoles() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ur FROM UserRole ur"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<UserRole> getAllUserRoles() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ur FROM UserRole ur"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } JPADAO(); JPADAO(String inPersistenceUnitName); } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<UserRole> getAllUserRoles() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ur FROM UserRole ur"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } JPADAO(); JPADAO(String inPersistenceUnitName); EntityMan... | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<UserRole> getAllUserRoles() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ur FROM UserRole ur"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } JPADAO(); JPADAO(String inPersistenceUnitName); EntityMan... |
@Test public void addUserRoleTest() throws DAOException { User user = DataManager.getInstance().getDao().getUser(2); Assert.assertNotNull(user); UserGroup userGroup = DataManager.getInstance().getDao().getUserGroup(2); Assert.assertNotNull(userGroup); Role role = DataManager.getInstance().getDao().getRole(2); Assert.as... | @Override public boolean addUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userRole); em.getTransaction().commit(); } finally { em.close(); } return true; } | JPADAO implements IDAO { @Override public boolean addUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userRole); em.getTransaction().commit(); } finally { em.close(); } return true; } } | JPADAO implements IDAO { @Override public boolean addUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userRole); em.getTransaction().commit(); } finally { em.close(); } return true; } JPADAO(); JPADAO(String in... | JPADAO implements IDAO { @Override public boolean addUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userRole); em.getTransaction().commit(); } finally { em.close(); } return true; } JPADAO(); JPADAO(String in... | JPADAO implements IDAO { @Override public boolean addUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.persist(userRole); em.getTransaction().commit(); } finally { em.close(); } return true; } JPADAO(); JPADAO(String in... |
@Test public void updateUserRoleTest() throws DAOException { Assert.assertEquals(1, DataManager.getInstance().getDao().getAllUserRoles().size()); UserRole userRole = DataManager.getInstance().getDao().getAllUserRoles().get(0); Assert.assertNotNull(userRole); Role role1 = DataManager.getInstance().getDao().getRole(1); A... | @Override public boolean updateUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userRole); em.getTransaction().commit(); return true; } finally { em.close(); } } | JPADAO implements IDAO { @Override public boolean updateUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userRole); em.getTransaction().commit(); return true; } finally { em.close(); } } } | JPADAO implements IDAO { @Override public boolean updateUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userRole); em.getTransaction().commit(); return true; } finally { em.close(); } } JPADAO(); JPADAO(String i... | JPADAO implements IDAO { @Override public boolean updateUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userRole); em.getTransaction().commit(); return true; } finally { em.close(); } } JPADAO(); JPADAO(String i... | JPADAO implements IDAO { @Override public boolean updateUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); em.merge(userRole); em.getTransaction().commit(); return true; } finally { em.close(); } } JPADAO(); JPADAO(String i... |
@Test public void deleteUserRoleTest() throws DAOException { Assert.assertEquals(1, DataManager.getInstance().getDao().getAllUserRoles().size()); UserRole userRole = DataManager.getInstance().getDao().getAllUserRoles().get(0); Assert.assertTrue(DataManager.getInstance().getDao().deleteUserRole(userRole)); Assert.assert... | @Override public boolean deleteUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); UserRole o = em.getReference(UserRole.class, userRole.getId()); em.remove(o); em.getTransaction().commit(); return true; } finally { em.close(... | JPADAO implements IDAO { @Override public boolean deleteUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); UserRole o = em.getReference(UserRole.class, userRole.getId()); em.remove(o); em.getTransaction().commit(); return tr... | JPADAO implements IDAO { @Override public boolean deleteUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); UserRole o = em.getReference(UserRole.class, userRole.getId()); em.remove(o); em.getTransaction().commit(); return tr... | JPADAO implements IDAO { @Override public boolean deleteUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); UserRole o = em.getReference(UserRole.class, userRole.getId()); em.remove(o); em.getTransaction().commit(); return tr... | JPADAO implements IDAO { @Override public boolean deleteUserRole(UserRole userRole) throws DAOException { preQuery(); EntityManager em = factory.createEntityManager(); try { em.getTransaction().begin(); UserRole o = em.getReference(UserRole.class, userRole.getId()); em.remove(o); em.getTransaction().commit(); return tr... |
@Test public void getAllIpRangesTest() throws DAOException { List<IpRange> ipRanges = DataManager.getInstance().getDao().getAllIpRanges(); Assert.assertEquals(2, ipRanges.size()); } | @SuppressWarnings("unchecked") @Override public List<IpRange> getAllIpRanges() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ipr FROM IpRange ipr"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<IpRange> getAllIpRanges() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ipr FROM IpRange ipr"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<IpRange> getAllIpRanges() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ipr FROM IpRange ipr"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } JPADAO(); JPADAO(String inPersistenceUnitName); } | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<IpRange> getAllIpRanges() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ipr FROM IpRange ipr"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } JPADAO(); JPADAO(String inPersistenceUnitName); EntityMana... | JPADAO implements IDAO { @SuppressWarnings("unchecked") @Override public List<IpRange> getAllIpRanges() throws DAOException { preQuery(); Query q = em.createQuery("SELECT ipr FROM IpRange ipr"); q.setFlushMode(FlushModeType.COMMIT); return q.getResultList(); } JPADAO(); JPADAO(String inPersistenceUnitName); EntityMana... |
@Test public void getIpRangeByIdTest() throws DAOException { IpRange ipRange = DataManager.getInstance().getDao().getIpRange(1); Assert.assertNotNull(ipRange); Assert.assertEquals(Long.valueOf(1), ipRange.getId()); Assert.assertEquals("localhost", ipRange.getName()); Assert.assertEquals("1.2.3.4/24", ipRange.getSubnetM... | @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } | JPADAO implements IDAO { @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } } | JPADAO implements IDAO { @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); } | JPADAO implements IDAO { @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); EntityManagerFactory g... | JPADAO implements IDAO { @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); EntityManagerFactory g... |
@Test public void getIpRangeByNameTest() throws DAOException { IpRange ipRange = DataManager.getInstance().getDao().getIpRange("localhost"); Assert.assertNotNull(ipRange); Assert.assertEquals(Long.valueOf(1), ipRange.getId()); Assert.assertEquals("localhost", ipRange.getName()); Assert.assertEquals("1.2.3.4/24", ipRang... | @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } | JPADAO implements IDAO { @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } } | JPADAO implements IDAO { @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); } | JPADAO implements IDAO { @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); EntityManagerFactory g... | JPADAO implements IDAO { @Override public IpRange getIpRange(long id) throws DAOException { preQuery(); try { IpRange o = em.find(IpRange.class, id); if (o != null) { em.refresh(o); } return o; } catch (EntityNotFoundException e) { return null; } } JPADAO(); JPADAO(String inPersistenceUnitName); EntityManagerFactory g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.