1
2
3
4
5
6 package com.hack23.cia.model.core.impl;
7
8 import javax.persistence.DiscriminatorColumn;
9 import javax.persistence.DiscriminatorType;
10 import javax.persistence.Entity;
11 import javax.persistence.EnumType;
12 import javax.persistence.Enumerated;
13 import javax.persistence.GeneratedValue;
14 import javax.persistence.GenerationType;
15 import javax.persistence.Id;
16 import javax.persistence.Inheritance;
17 import javax.persistence.InheritanceType;
18 import javax.persistence.Version;
19
20 import org.hibernate.annotations.Cache;
21 import org.hibernate.annotations.CacheConcurrencyStrategy;
22
23 /***
24 * The Class AbstractResource.
25 */
26 @Entity
27 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
28 @DiscriminatorColumn(name = "abstractResourceType", discriminatorType = DiscriminatorType.STRING)
29 @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
30 public abstract class AbstractResource extends BaseEntity implements Resource {
31
32 /***
33 * The Enum ResourceType.
34 */
35 public enum ResourceType {
36
37 /*** The Configuration. */
38 Configuration,
39
40 /*** The Image. */
41 Image,
42
43 /*** The Language. */
44 Language,
45
46 /*** The Language content. */
47 LanguageContent;
48 }
49
50 /*** The Constant serialVersionUID. */
51 private static final long serialVersionUID = 1L;
52
53 /*** The id. */
54 private Long id;
55
56 /*** The resource type. */
57 private ResourceType resourceType;
58
59 /*** The version. */
60 private Long version=1L;
61
62
63
64
65
66
67 @Override
68 @Id
69 @GeneratedValue(strategy = GenerationType.AUTO)
70 public Long getId() {
71 return id;
72 }
73
74 /***
75 * Gets the resource type.
76 *
77 * @return the resource type
78 */
79 @Enumerated(EnumType.STRING)
80 public ResourceType getResourceType() {
81 return resourceType;
82 }
83
84
85
86
87 @Override
88 @Version
89 public Long getVersion() {
90 return version;
91 }
92
93 /***
94 * Sets the id.
95 *
96 * @param id the new id
97 */
98 public void setId(final Long id) {
99 this.id = id;
100 }
101
102 /***
103 * Sets the resource type.
104 *
105 * @param resourceType the new resource type
106 */
107 public void setResourceType(final ResourceType resourceType) {
108 this.resourceType = resourceType;
109 }
110
111 /***
112 * Sets the version.
113 *
114 * @param version the new version
115 */
116 public void setVersion(final Long version) {
117 this.version = version;
118 }
119
120 }