1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.model.media;
|
11
|
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
|
15
|
import com.sun.activation.registries.MimeTypeFile;
|
16
|
|
17
|
import eu.etaxonomy.cdm.model.common.VersionableEntity;
|
18
|
|
19
|
import java.util.*;
|
20
|
|
21
|
import javax.activation.MimeType;
|
22
|
import javax.persistence.*;
|
23
|
|
24
|
/**
|
25
|
* metadata for an external file such as images, phylogenetic trees, or audio
|
26
|
* recordings available through the location attribute!
|
27
|
* @author m.doering
|
28
|
* @version 1.0
|
29
|
* @created 08-Nov-2007 13:06:34
|
30
|
*/
|
31
|
@Entity
|
32
|
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
|
33
|
public class MediaInstance extends VersionableEntity {
|
34
|
private static final Logger logger = Logger.getLogger(MediaInstance.class);
|
35
|
//http://www.iana.org/assignments/media-types
|
36
|
private String mimeType;
|
37
|
//where the media file is stored
|
38
|
private String uri;
|
39
|
//in bytes
|
40
|
private Integer size;
|
41
|
private Media media;
|
42
|
|
43
|
|
44
|
/**
|
45
|
* Factory method
|
46
|
* @return
|
47
|
*/
|
48
|
public static MediaInstance NewInstance(String uri, String mimeType, Integer size){
|
49
|
MediaInstance result = new MediaInstance();
|
50
|
result.setUri(uri);
|
51
|
result.setMimeType(mimeType);
|
52
|
result.setSize(size);
|
53
|
return result;
|
54
|
}
|
55
|
|
56
|
|
57
|
|
58
|
/**
|
59
|
* Factory method
|
60
|
* @return
|
61
|
*/
|
62
|
public static MediaInstance NewInstance(){
|
63
|
return new MediaInstance();
|
64
|
}
|
65
|
|
66
|
|
67
|
|
68
|
protected MediaInstance(){
|
69
|
super();
|
70
|
}
|
71
|
|
72
|
|
73
|
public String getMimeType(){
|
74
|
return this.mimeType;
|
75
|
}
|
76
|
|
77
|
/**
|
78
|
*
|
79
|
* @param mimeType mimeType
|
80
|
*/
|
81
|
public void setMimeType(String mimeType){
|
82
|
this.mimeType = mimeType;
|
83
|
}
|
84
|
|
85
|
public String getUri(){
|
86
|
return this.uri;
|
87
|
}
|
88
|
|
89
|
/**
|
90
|
*
|
91
|
* @param uri uri
|
92
|
*/
|
93
|
public void setUri(String uri){
|
94
|
this.uri = uri;
|
95
|
}
|
96
|
|
97
|
|
98
|
/**
|
99
|
* @return
|
100
|
*/
|
101
|
public Integer getSize(){
|
102
|
return this.size;
|
103
|
}
|
104
|
/**
|
105
|
* @param size size
|
106
|
*/
|
107
|
public void setSize(Integer size){
|
108
|
this.size = size;
|
109
|
}
|
110
|
|
111
|
@ManyToOne
|
112
|
public Media getMedia() {
|
113
|
return media;
|
114
|
}
|
115
|
|
116
|
public void setMedia(Media media) {
|
117
|
this.media = media;
|
118
|
}
|
119
|
|
120
|
}
|