1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package no.sintef.assetrepository;
22
23 import java.util.Calendar;
24
25 import no.sintef.assetrepository.interfaces.AssetRepresentationValue;
26 import no.sintef.file.MimeTypeEnum;
27
28 /***
29 * @author fvr
30 *
31 * TODO To change the template for this generated type comment go to
32 * Window - Preferences - Java - Code Style - Code Templates
33 */
34 public class Representation {
35
36 private AssetRepresentationValue representation;
37
38 /***
39 * @param string
40 * @param name
41 * @param mimeType
42 * @param content
43 * @param instance
44 * @return
45 */
46 public static Representation create(String type, String name, MimeTypeEnum mimeType, Object content, Calendar instance) {
47 AssetRepresentationValue representationValue = new AssetRepresentationValue();
48 representationValue.setType(type);
49 representationValue.setName(name);
50 representationValue.setMimeType(mimeType);
51 representationValue.setContent(content);
52 representationValue.setCreationDate(Calendar.getInstance());
53 return new Representation(representationValue);
54 }
55
56 protected Representation(AssetRepresentationValue representation) {
57 super();
58 if (representation == null) {
59 throw new IllegalArgumentException("representation value is null");
60 }
61 this.representation = representation;
62 }
63
64 public String getFilename() {
65 return representation.getName();
66 }
67
68 public MimeTypeEnum getMimeType() {
69 return representation.getMimeType();
70 }
71
72 public Calendar getCreationDate() {
73 return representation.getCreationDate();
74 }
75
76 public String getType() {
77 return representation.getType();
78 }
79
80 public Object getContent() {
81 return representation.getContent();
82 }
83
84 protected AssetRepresentationValue getRepresentation() {
85 return representation;
86 }
87
88 }