1
2
3
4
5
6 package com.hack23.cia.model.application.impl.common;
7
8 import javax.persistence.Column;
9 import javax.persistence.DiscriminatorValue;
10 import javax.persistence.Entity;
11 import javax.persistence.Lob;
12
13 import org.hibernate.annotations.Cache;
14 import org.hibernate.annotations.CacheConcurrencyStrategy;
15
16 import com.hack23.cia.model.core.impl.AbstractResource;
17
18 /***
19 * The Class ImageContent.
20 */
21 @Entity
22 @Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
23 @DiscriminatorValue("ImageContent")
24 public class ImageContent extends AbstractResource {
25
26 /*** The Constant serialVersionUID. */
27 private static final long serialVersionUID = 1L;
28
29 /*** The file name. */
30 private String fileName;
31
32 /*** The image content. */
33 private byte[] imageContent;
34
35 /*** The mimetype. */
36 private String mimetype;
37
38 /***
39 * Instantiates a new image content.
40 */
41 public ImageContent() {
42 super();
43 setResourceType(ResourceType.Image);
44 }
45
46 /***
47 * Gets the file name.
48 *
49 * @return the file name
50 */
51 public String getFileName() {
52 return fileName;
53 }
54
55 /***
56 * Gets the image content.
57 *
58 * @return the image content
59 */
60 @Lob
61 @Column(length=2097105200)
62 public byte[] getImageContent() {
63 return imageContent;
64 }
65
66 /***
67 * Gets the mimetype.
68 *
69 * @return the mimetype
70 */
71 public String getMimetype() {
72 return mimetype;
73 }
74
75 /***
76 * Sets the file name.
77 *
78 * @param fileName the new file name
79 */
80 public void setFileName(final String fileName) {
81 this.fileName = fileName;
82 }
83
84 /***
85 * Sets the image content.
86 *
87 * @param imageContent the new image content
88 */
89 public void setImageContent(final byte[] imageContent) {
90 this.imageContent = imageContent;
91 }
92
93 /***
94 * Sets the mimetype.
95 *
96 * @param mimetype the new mimetype
97 */
98 public void setMimetype(final String mimetype) {
99 this.mimetype = mimetype;
100 }
101
102
103
104
105 @Override
106 public String toString() {
107 return "ImageContent [fileName=" + fileName + ", mimetype=" + mimetype
108 + "]";
109 }
110
111 }