1 /*
2 * Copyright (c) 2003
3 * Information Desire GmbH
4 * All rights reserved.
5 */
6 package com.infodesire.infobit.dao;
7
8 import com.infodesire.infobit.data.Content;
9 import com.infodesire.infobit.data.Version;
10 import com.infodesire.infobit.data.Attributed;
11
12 import java.util.Map;
13 import java.util.HashMap;
14 import java.util.Collections;
15 import java.util.Set;
16
17 /***
18 * abstract base class representing certain content
19 *
20 * @author konstantin
21 * @created August 15, 2003
22 * @version $Revision: 1.6 $
23 * @hibernate.class table="content" polymorphism="implicit"
24 * @hibernate.discriminator column="type"
25 */
26 abstract class ContentImpl extends BaseEntityImpl implements Content, Attributed, AttributeSettable {
27
28 /***
29 */
30 private Version _version;
31
32 private Set _keywords;
33
34 private Integer _id;
35
36 private Map _attributes = new HashMap();
37
38
39 /***
40 * note that we like to have property named attributes, to be able to
41 * produce queries easily
42 *
43 * @return The Attributes value
44 * @hibernate.map cascade="all" lazy="true"
45 * table="content_attributes"
46 * @hibernate.collection-key column="contentid"
47 * @hibernate.collection-index column="name" type="string"
48 * @hibernate.collection-element column="value" type="string"
49 */
50
51 public Map getAttributes() {
52 return _attributes;
53 }
54
55
56 /***
57 * provide unmodifiable attrobute map.
58 *
59 * @return Description of the Returned Value
60 */
61 public Map getAttributeMap() {
62 return Collections.unmodifiableMap(getAttributes());
63 }
64
65
66 /***
67 * @return The Version value
68 * @hibernate.one-to-one cascade="none"
69 * class="com.infodesire.infobit.dao.VersionImpl"
70 */
71 public Version getVersion() {
72 return _version;
73 }
74
75
76 /***
77 * @return The Id value
78 * @hibernate.id generator-class="assigned"
79 */
80 public Integer getId() {
81 if (getVersion() != null) {
82 return getVersion().getId();
83 }
84 return _id;
85 }
86
87
88 /***
89 * Gets the Keywords attribute of the ContentImpl object
90 *
91 * @return The Keywords value
92 * @hibernate.set table="keywords" cascade="all"
93 * lazy="true" not-null="false"
94 * @hibernate.collection-element column="keyword" type="string"
95 * @hibernate.collection-key column="contentid"
96 */
97 public Set getKeywords() {
98 return _keywords;
99 }
100
101
102 /***
103 * provide name of template to render exported version of
104 *
105 * @return The TemplateName value
106 */
107 public String getTemplateName() {
108 return getClass().getName().replace('.', '/') + ".vm";
109 }
110
111
112 /***
113 * Sets the Attributes attribute of the ContentImpl object
114 *
115 * @param attributes The new Attributes value
116 */
117 public void setAttributes(Map attributes) {
118 _attributes = attributes;
119 }
120
121
122 /***
123 * @param version The new Version value
124 */
125 public void setVersion(Version version) {
126 _version = version;
127 }
128
129
130 /***
131 * does not do anything. since we have 1-1 mapping to version, we just
132 * ignore any id setting on infobit, and delegate id getting to version.
133 *
134 * @param id id value we are not interested at all :)
135 */
136 public void setId(Integer id) {
137
138 }
139
140
141 /***
142 * Sets the Keywords attribute of the ContentImpl object
143 *
144 * @param keywords The new Keywords value
145 */
146 public void setKeywords(Set keywords) {
147 _keywords = keywords;
148 }
149 }
This page was automatically generated by Maven