Project

General

Profile

« Previous | Next » 

Revision 49805fb2

Added by Andreas Kohlbecker almost 4 years ago

ref #8867 showing licenses also in manifest attributions

View differences:

cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/iiif/ManifestController.java
111 111

  
112 112
    private String[] tumbnailMimetypes = new String[] {"image/.*", ".*"};
113 113

  
114
    /**
115
     * Universalviewer only shows one attribution value in the popup panel
116
     * Therefore it makes sense to join all of them.
117
     */
118
    private boolean doJoinAttributions = true;
119

  
114 120
    @RequestMapping(
115 121
            value = {"taxon/{uuid}/manifest"},
116 122
            method = RequestMethod.GET)
......
201 207
            // extractAndAddDesciptions(canvas, mediaMetadata);
202 208
            mediaMetadata = deduplicateMetadata(mediaMetadata);
203 209
            canvas = addAttributionAndLicense(media, canvas, mediaMetadata);
204
            canvas.addLicense("https://creativecommons.org/publicdomain/zero/1.0/deed.de");
205 210
            orderMedatadaItems(canvas);
206 211
            canvas.addMetadata(mediaMetadata.toArray(new MetadataEntry[mediaMetadata.size()]));
207 212
            canvases.add(canvas);
......
234 239
     * to show attribution and licenses, therefore we copy this data to
235 240
     * also to the metadata
236 241
     *
237
     * <b>NOTE:</b> This method expects that the canvas anntributions and
242
     * <b>NOTE:</b> This method expects that the canvas attributions and
238 243
     * licenses are not localized!!!!
239 244
     *
240 245
     * @param canvas
......
298 303
            } else {
299 304
                diversityInfo = "Same " + dataTypes + " for any Item:";
300 305
            }
306
            if(hasAttributions){
307
                if(doJoinAttributions){
308
                    ArrayList<String> attrs = new ArrayList<>(attributions.getValues());
309
                    attrs.add(0, diversityInfo + "<br/>" + attrs.get(0));
310
                    attrs.remove(1);
311
                    manifest.addAttribution(attrs.stream().collect(Collectors.joining("; ")));
312
                } else {
313
                    manifest.addAttribution(diversityInfo, attributions.getValues().toArray(
314
                            new String[attributions.getValues().size()]
315
                            ));
316
                }
317
            }
318
            licenses.stream()
319
                .map(URI::toString)
320
                .sorted()
321
                .distinct()
322
                .forEachOrdered(l -> manifest.addLicense(l));
301 323
        }
302
        manifest.addAttribution(diversityInfo, attributions.getValues().toArray(
303
                    new String[attributions.getValues().size()]
304
                ));
305
        licenses.stream()
306
            .map(URI::toString)
307
            .sorted()
308
            .distinct()
309
            .forEachOrdered(l -> manifest.addLicense(l));
310

  
311 324
    }
312 325

  
313 326
    /**
......
432 445

  
433 446
        if(entity.getRights() != null && entity.getRights().size() > 0){
434 447
            for(Rights right : entity.getRights()){
435
                // TODO get localized text
448
                // TODO get localized texts
436 449
                String rightText = "";
437 450
                if(right.getText() != null){
438 451
                    rightText += right.getText();
......
440 453
                if(rightText.isEmpty() && right.getAbbreviatedText() != null){
441 454
                    rightText += right.getAbbreviatedText();
442 455
                }
443
                if(right.getUri() != null){
444
                    rightText +=  htmlLink(right.getUri());
445
                    if(right.getType().equals(RightsType.LICENSE())){
456
                if(right.getType().equals(RightsType.LICENSE())){
457
                    if(right.getUri() != null){
458
                        rightText =  htmlLink(right.getUri(), rightText);
446 459
                        license.add(right.getUri());
447 460
                    }
448 461
                }
......
451 464
                    rightText += " " + right.getAgent().getTitleCache();
452 465
                }
453 466
                rightsTexts.add(rightText);
454
                //if(metadata.add(e))
455 467
            }
456 468
        }
457 469
        if(entity.getCredits() != null && entity.getCredits().size() > 0){
......
493 505
     * @param right
494 506
     * @return
495 507
     */
496
    String htmlLink(URI uri) {
497
        return String.format(" <a href=\"%s\">%s</a>", uri, uri);
508
    String htmlLink(URI uri, String text) {
509
        return String.format(" <a href=\"%s\">%s</a>", uri, text);
498 510
    }
499 511

  
500 512
    /**

Also available in: Unified diff