| 1 | |
|
| 2 | |
|
| 3 | |
package org.paneris.bibliomania.generated; |
| 4 | |
|
| 5 | |
|
| 6 | |
import org.melati.poem.AccessPoemException; |
| 7 | |
import org.melati.poem.Capability; |
| 8 | |
import org.melati.poem.Column; |
| 9 | |
import org.melati.poem.Database; |
| 10 | |
import org.melati.poem.DefinitionSource; |
| 11 | |
import org.melati.poem.DisplayLevel; |
| 12 | |
import org.melati.poem.Field; |
| 13 | |
import org.melati.poem.JdbcPersistent; |
| 14 | |
import org.melati.poem.Persistent; |
| 15 | |
import org.melati.poem.PoemException; |
| 16 | |
import org.melati.poem.ReferencePoemType; |
| 17 | |
import org.melati.poem.Searchability; |
| 18 | |
import org.melati.poem.StringPoemType; |
| 19 | |
import org.melati.poem.TroidPoemType; |
| 20 | |
import org.melati.poem.ValidationPoemException; |
| 21 | |
import org.paneris.bibliomania.BibliomaniaDatabaseTables; |
| 22 | |
import org.paneris.bibliomania.Section; |
| 23 | |
import org.paneris.bibliomania.SectionGroup; |
| 24 | |
import org.paneris.bibliomania.UnitTable; |
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
public class SectionTableBase<T extends Section> extends UnitTable<T> { |
| 34 | |
|
| 35 | 2 | private Column<Integer> col_id = null; |
| 36 | 2 | private Column<String> col_displayname = null; |
| 37 | 2 | private Column<Integer> col_group = null; |
| 38 | 2 | private Column<Integer> col_defaultcanreadcontent = null; |
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
public SectionTableBase( |
| 51 | |
Database database, String name, |
| 52 | |
DefinitionSource definitionSource) throws PoemException { |
| 53 | 2 | super(database, name, definitionSource); |
| 54 | 2 | } |
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() { |
| 64 | 8 | return (BibliomaniaDatabaseTables)getDatabase(); |
| 65 | |
} |
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
public void init() throws PoemException { |
| 74 | 2 | super.init(); |
| 75 | 2 | defineColumn(col_id = |
| 76 | |
new Column<Integer>(this, "id", |
| 77 | |
new TroidPoemType(), |
| 78 | 2 | DefinitionSource.dsd) { |
| 79 | |
public Object getCooked(Persistent g) |
| 80 | |
throws AccessPoemException, PoemException { |
| 81 | 0 | return ((Section)g).getId(); |
| 82 | |
} |
| 83 | |
|
| 84 | |
public void setCooked(Persistent g, Object cooked) |
| 85 | |
throws AccessPoemException, ValidationPoemException { |
| 86 | 0 | ((Section)g).setId((Integer)cooked); |
| 87 | 0 | } |
| 88 | |
|
| 89 | |
public Field<Integer> asField(Persistent g) { |
| 90 | 0 | return ((Section)g).getIdField(); |
| 91 | |
} |
| 92 | |
|
| 93 | |
public boolean defaultUserEditable() { |
| 94 | 0 | return false; |
| 95 | |
} |
| 96 | |
|
| 97 | |
public boolean defaultUserCreateable() { |
| 98 | 0 | return false; |
| 99 | |
} |
| 100 | |
|
| 101 | |
public int defaultDisplayOrder() { |
| 102 | 0 | return 0; |
| 103 | |
} |
| 104 | |
|
| 105 | |
public Object getRaw_unsafe(Persistent g) |
| 106 | |
throws AccessPoemException { |
| 107 | 0 | return ((Section)g).getId_unsafe(); |
| 108 | |
} |
| 109 | |
|
| 110 | |
public void setRaw_unsafe(Persistent g, Object raw) |
| 111 | |
throws AccessPoemException { |
| 112 | 6 | ((Section)g).setId_unsafe((Integer)raw); |
| 113 | 6 | } |
| 114 | |
|
| 115 | |
public Object getRaw(Persistent g) |
| 116 | |
throws AccessPoemException { |
| 117 | 0 | return ((Section)g).getId(); |
| 118 | |
} |
| 119 | |
|
| 120 | |
public void setRaw(Persistent g, Object raw) |
| 121 | |
throws AccessPoemException { |
| 122 | 0 | ((Section)g).setId((Integer)raw); |
| 123 | 0 | } |
| 124 | |
}); |
| 125 | |
|
| 126 | 2 | defineColumn(col_displayname = |
| 127 | |
new Column<String>(this, "displayname", |
| 128 | |
new StringPoemType(false, -1), |
| 129 | 2 | DefinitionSource.dsd) { |
| 130 | |
public Object getCooked(Persistent g) |
| 131 | |
throws AccessPoemException, PoemException { |
| 132 | 0 | return ((Section)g).getDisplayname(); |
| 133 | |
} |
| 134 | |
|
| 135 | |
public void setCooked(Persistent g, Object cooked) |
| 136 | |
throws AccessPoemException, ValidationPoemException { |
| 137 | 0 | ((Section)g).setDisplayname((String)cooked); |
| 138 | 0 | } |
| 139 | |
|
| 140 | |
public Field<String> asField(Persistent g) { |
| 141 | 0 | return ((Section)g).getDisplaynameField(); |
| 142 | |
} |
| 143 | |
|
| 144 | |
public DisplayLevel defaultDisplayLevel() { |
| 145 | 0 | return DisplayLevel.primary; |
| 146 | |
} |
| 147 | |
|
| 148 | |
public Integer defaultDisplayOrderPriority() { |
| 149 | 0 | return new Integer(1); |
| 150 | |
} |
| 151 | |
|
| 152 | |
public String defaultDisplayName() { |
| 153 | 0 | return "Display name"; |
| 154 | |
} |
| 155 | |
|
| 156 | |
public int defaultDisplayOrder() { |
| 157 | 0 | return 1; |
| 158 | |
} |
| 159 | |
|
| 160 | |
public String defaultDescription() { |
| 161 | 0 | return "A human-readable name for the section"; |
| 162 | |
} |
| 163 | |
|
| 164 | |
public boolean defaultUnique() { |
| 165 | 0 | return true; |
| 166 | |
} |
| 167 | |
|
| 168 | |
public Object getRaw_unsafe(Persistent g) |
| 169 | |
throws AccessPoemException { |
| 170 | 2 | return ((Section)g).getDisplayname_unsafe(); |
| 171 | |
} |
| 172 | |
|
| 173 | |
public void setRaw_unsafe(Persistent g, Object raw) |
| 174 | |
throws AccessPoemException { |
| 175 | 3 | ((Section)g).setDisplayname_unsafe((String)raw); |
| 176 | 3 | } |
| 177 | |
|
| 178 | |
public Object getRaw(Persistent g) |
| 179 | |
throws AccessPoemException { |
| 180 | 0 | return ((Section)g).getDisplayname(); |
| 181 | |
} |
| 182 | |
|
| 183 | |
public void setRaw(Persistent g, Object raw) |
| 184 | |
throws AccessPoemException { |
| 185 | 0 | ((Section)g).setDisplayname((String)raw); |
| 186 | 0 | } |
| 187 | |
}); |
| 188 | |
|
| 189 | 2 | defineColumn(col_group = |
| 190 | |
new Column<Integer>(this, "group", |
| 191 | |
new ReferencePoemType(getBibliomaniaDatabaseTables(). |
| 192 | |
getSectionGroupTable(), false), |
| 193 | 2 | DefinitionSource.dsd) { |
| 194 | |
public Object getCooked(Persistent g) |
| 195 | |
throws AccessPoemException, PoemException { |
| 196 | 0 | return ((Section)g).getGroup(); |
| 197 | |
} |
| 198 | |
|
| 199 | |
public void setCooked(Persistent g, Object cooked) |
| 200 | |
throws AccessPoemException, ValidationPoemException { |
| 201 | 0 | ((Section)g).setGroup((SectionGroup)cooked); |
| 202 | 0 | } |
| 203 | |
|
| 204 | |
public Field<Integer> asField(Persistent g) { |
| 205 | 0 | return ((Section)g).getGroupField(); |
| 206 | |
} |
| 207 | |
|
| 208 | |
public Searchability defaultSearchability() { |
| 209 | 0 | return Searchability.primary; |
| 210 | |
} |
| 211 | |
|
| 212 | |
public Integer defaultDisplayOrderPriority() { |
| 213 | 0 | return new Integer(0); |
| 214 | |
} |
| 215 | |
|
| 216 | |
public int defaultDisplayOrder() { |
| 217 | 0 | return 2; |
| 218 | |
} |
| 219 | |
|
| 220 | |
public String defaultDescription() { |
| 221 | 0 | return "The group in which the category belongs"; |
| 222 | |
} |
| 223 | |
|
| 224 | |
public Object getRaw_unsafe(Persistent g) |
| 225 | |
throws AccessPoemException { |
| 226 | 0 | return ((Section)g).getGroup_unsafe(); |
| 227 | |
} |
| 228 | |
|
| 229 | |
public void setRaw_unsafe(Persistent g, Object raw) |
| 230 | |
throws AccessPoemException { |
| 231 | 3 | ((Section)g).setGroup_unsafe((Integer)raw); |
| 232 | 3 | } |
| 233 | |
|
| 234 | |
public Object getRaw(Persistent g) |
| 235 | |
throws AccessPoemException { |
| 236 | 0 | return ((Section)g).getGroupTroid(); |
| 237 | |
} |
| 238 | |
|
| 239 | |
public void setRaw(Persistent g, Object raw) |
| 240 | |
throws AccessPoemException { |
| 241 | 0 | ((Section)g).setGroupTroid((Integer)raw); |
| 242 | 0 | } |
| 243 | |
}); |
| 244 | |
|
| 245 | 2 | defineColumn(col_defaultcanreadcontent = |
| 246 | |
new Column<Integer>(this, "defaultcanreadcontent", |
| 247 | |
new ReferencePoemType(getBibliomaniaDatabaseTables(). |
| 248 | |
getCapabilityTable(), true), |
| 249 | 2 | DefinitionSource.dsd) { |
| 250 | |
public Object getCooked(Persistent g) |
| 251 | |
throws AccessPoemException, PoemException { |
| 252 | 0 | return ((Section)g).getDefaultcanreadcontent(); |
| 253 | |
} |
| 254 | |
|
| 255 | |
public void setCooked(Persistent g, Object cooked) |
| 256 | |
throws AccessPoemException, ValidationPoemException { |
| 257 | 0 | ((Section)g).setDefaultcanreadcontent((Capability)cooked); |
| 258 | 0 | } |
| 259 | |
|
| 260 | |
public Field<Integer> asField(Persistent g) { |
| 261 | 0 | return ((Section)g).getDefaultcanreadcontentField(); |
| 262 | |
} |
| 263 | |
|
| 264 | |
public DisplayLevel defaultDisplayLevel() { |
| 265 | 0 | return DisplayLevel.record; |
| 266 | |
} |
| 267 | |
|
| 268 | |
public Searchability defaultSearchability() { |
| 269 | 0 | return Searchability.no; |
| 270 | |
} |
| 271 | |
|
| 272 | |
public String defaultDisplayName() { |
| 273 | 0 | return "Default `Read content' capability"; |
| 274 | |
} |
| 275 | |
|
| 276 | |
public int defaultDisplayOrder() { |
| 277 | 0 | return 3; |
| 278 | |
} |
| 279 | |
|
| 280 | |
public String defaultDescription() { |
| 281 | 0 | return "The capability required for reading books in the section, unless overridden in the book itself"; |
| 282 | |
} |
| 283 | |
|
| 284 | |
public Object getRaw_unsafe(Persistent g) |
| 285 | |
throws AccessPoemException { |
| 286 | 0 | return ((Section)g).getDefaultcanreadcontent_unsafe(); |
| 287 | |
} |
| 288 | |
|
| 289 | |
public void setRaw_unsafe(Persistent g, Object raw) |
| 290 | |
throws AccessPoemException { |
| 291 | 3 | ((Section)g).setDefaultcanreadcontent_unsafe((Integer)raw); |
| 292 | 3 | } |
| 293 | |
|
| 294 | |
public Object getRaw(Persistent g) |
| 295 | |
throws AccessPoemException { |
| 296 | 0 | return ((Section)g).getDefaultcanreadcontentTroid(); |
| 297 | |
} |
| 298 | |
|
| 299 | |
public void setRaw(Persistent g, Object raw) |
| 300 | |
throws AccessPoemException { |
| 301 | 0 | ((Section)g).setDefaultcanreadcontentTroid((Integer)raw); |
| 302 | 0 | } |
| 303 | |
}); |
| 304 | 2 | } |
| 305 | |
|
| 306 | |
|
| 307 | |
|
| 308 | |
|
| 309 | |
|
| 310 | |
|
| 311 | |
|
| 312 | |
|
| 313 | |
|
| 314 | |
public final Column<Integer> getIdColumn() { |
| 315 | 0 | return col_id; |
| 316 | |
} |
| 317 | |
|
| 318 | |
|
| 319 | |
|
| 320 | |
|
| 321 | |
|
| 322 | |
|
| 323 | |
|
| 324 | |
|
| 325 | |
|
| 326 | |
public final Column<String> getDisplaynameColumn() { |
| 327 | 4 | return col_displayname; |
| 328 | |
} |
| 329 | |
|
| 330 | |
|
| 331 | |
|
| 332 | |
|
| 333 | |
|
| 334 | |
|
| 335 | |
|
| 336 | |
|
| 337 | |
|
| 338 | |
public final Column<Integer> getGroupColumn() { |
| 339 | 1 | return col_group; |
| 340 | |
} |
| 341 | |
|
| 342 | |
|
| 343 | |
|
| 344 | |
|
| 345 | |
|
| 346 | |
|
| 347 | |
|
| 348 | |
|
| 349 | |
|
| 350 | |
public final Column<Integer> getDefaultcanreadcontentColumn() { |
| 351 | 0 | return col_defaultcanreadcontent; |
| 352 | |
} |
| 353 | |
|
| 354 | |
|
| 355 | |
|
| 356 | |
|
| 357 | |
|
| 358 | |
|
| 359 | |
|
| 360 | |
|
| 361 | |
|
| 362 | |
public Section getSectionObject(Integer troid) { |
| 363 | 44 | return (Section)getObject(troid); |
| 364 | |
} |
| 365 | |
|
| 366 | |
|
| 367 | |
|
| 368 | |
|
| 369 | |
|
| 370 | |
|
| 371 | |
|
| 372 | |
|
| 373 | |
|
| 374 | |
public Section getSectionObject(int troid) { |
| 375 | 0 | return (Section)getObject(troid); |
| 376 | |
} |
| 377 | |
|
| 378 | |
protected JdbcPersistent _newPersistent() { |
| 379 | 3 | return new Section(); |
| 380 | |
} |
| 381 | |
public String defaultDescription() { |
| 382 | 0 | return "A category under which a book or other work can fall"; |
| 383 | |
} |
| 384 | |
|
| 385 | |
public boolean defaultRememberAllTroids() { |
| 386 | 0 | return true; |
| 387 | |
} |
| 388 | |
|
| 389 | |
public int defaultDisplayOrder() { |
| 390 | 0 | return 200; |
| 391 | |
} |
| 392 | |
} |
| 393 | |
|