MemobaseResource.scala 1.87 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
/*
 * Media Converter
 * Extracts media files from Fedora repository
 * 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 ch.memobase.models

/**
 * Represents an instantiation type as defined in the Memobase internal data model
 */
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
25
sealed trait MemobaseResource
26
27
28
29

/**
 * Represents a digital object
 */
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
30
case object DigitalObject extends MemobaseResource
31
32
33
34

/**
 * Represents a physical object
 */
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
35
case object PhysicalObject extends MemobaseResource
36
37
38
39

/**
 * Represents a thumbnail / preview image / poster
 */
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
case object Thumbnail extends MemobaseResource

/**
 * Represents a record
 */
case object Record extends MemobaseResource

/**
 * Represents a audio snippet. This instantiation doesn't
 * exist in the data model, however it is used internally
 * by the service to differentiate between several derived
 * types.
 */
case object AudioSnippet extends MemobaseResource
54
55
56
57

/**
 * Unknown instantiation
 */
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
58
case object UnknownResource extends MemobaseResource
59
60
61
62
63


/**
 * Helper functions for Instantiation type
 */
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
64
65
object MemobaseResource {
  def apply(i: String): MemobaseResource = i match {
66
67
68
    case "digitalObject" => DigitalObject
    case "thumbnail" => Thumbnail
    case "physicalObject" => PhysicalObject
Sebastian Schüpbach's avatar
Sebastian Schüpbach committed
69
    case _ => UnknownResource
70
71
  }
}