ReuseStatementMap.kt 2.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
/*
 * search-doc-service
 * Copyright (C) 2020 Memoriav
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package org.memobase.helpers

import java.lang.Exception

object ReuseStatementMap {
    private const val noConditions = "Weiternutzbar ohne Bedingungen"
    private const val ccConditions = "Weiternutzbar unter Bedingungen (CC)"
    private const val copyright = "Weiternutzbar unter Bedingungen (Copyright)"
    private const val unknownRightsHolder = "Unklar (Rechteinhaber nicht bekannt)"
    private const val unknownCopyright = "Unklar (Copyright nicht bekannt)"

    private const val pdm = "http://creativecommons.org/publicdomain/mark/1.0/"
    private const val noc_nc = "http://rightsstatements.org/vocab/NoC-NC/1.0/"
    private const val noc_oklr = "http://rightsstatements.org/vocab/NoC-OKLR/1.0/"
    private const val cc0 = "http://creativecommons.org/publicdomain/zero/1.0/"
    private const val cc_by = "http://creativecommons.org/licenses/by/4.0/"
    private const val cc_by_sa = "http://creativecommons.org/licenses/by-sa/4.0/"
    private const val cc_by_nd = "http://creativecommons.org/licenses/by-nd/4.0/"
    private const val cc_by_nc = "http://creativecommons.org/licenses/by-nc/4.0/"
    private const val cc_by_nc_sa = "http://creativecommons.org/licenses/by-nc-sa/4.0/"
    private const val cc_by_nc_nd = "http://creativecommons.org/licenses/by-nc-nd/4.0/"
    private const val inc = "http://rightsstatements.org/vocab/InC/1.0/"
    private const val inc_edu = "http://rightsstatements.org/vocab/InC-EDU/1.0/"
    private const val inc_ruu = "https://rightsstatements.org/page/InC-RUU/1.0/"
    private const val cne = "http://rightsstatements.org/vocab/CNE/1.0/"

    fun getValue(uri: String): String {
        return when (uri) {
            pdm, cc0 -> noConditions
            noc_nc, noc_oklr, cc_by, cc_by_nc,
            cc_by_nc_nd, cc_by_sa, cc_by_nc_sa, cc_by_nd -> ccConditions
            inc_edu, inc -> copyright
            inc_ruu -> unknownRightsHolder
            cne -> unknownCopyright
            else -> throw Exception("No known copyright statement!")
        }
    }
}