1packageorg.apache.jetspeed.om.dbpsml;
234import java.math.BigDecimal;
5import java.sql.Connection;
6import java.util.ArrayList;
7import java.util.Collections;
8import java.util.Date;
9import java.util.List;
1011import org.apache.commons.lang.ObjectUtils;
12import org.apache.torque.TorqueException;
13import org.apache.torque.om.BaseObject;
14import org.apache.torque.om.ComboKey;
15import org.apache.torque.om.DateKey;
16import org.apache.torque.om.NumberKey;
17import org.apache.torque.om.ObjectKey;
18import org.apache.torque.om.SimpleKey;
19import org.apache.torque.om.StringKey;
20import org.apache.torque.om.Persistent;
21import org.apache.torque.util.Criteria;
22import org.apache.torque.util.Transaction;
232425/***26 * This class was autogenerated by Torque on:27 *28 * [Thu Apr 22 23:12:36 EDT 2004]29 *30 * You should not use this class directly. It should not even be31 * extended all references should be to JetspeedRoleProfile32 */33publicabstractclassBaseJetspeedRoleProfileextends BaseObject
34 {
35/*** The Peer class */36privatestaticfinalJetspeedRoleProfilePeer peer =
37newJetspeedRoleProfilePeer();
383940/*** The value for the psmlId field */41privateint psmlId;
4243/*** The value for the roleName field */44private String roleName;
4546/*** The value for the mediaType field */47private String mediaType;
4849/*** The value for the language field */50private String language;
5152/*** The value for the country field */53private String country;
5455/*** The value for the page field */56private String page;
5758/*** The value for the profile field */59private byte[] profile;
606162/***63 * Get the PsmlId64 * @return int65 */66publicint getPsmlId()
67 {
68return psmlId;
69 }
707172/***73 * Set the value of PsmlId74 */75publicvoid setPsmlId(int v )
76 {
7778if (this.psmlId != v)
79 {
80this.psmlId = v;
81 setModified(true);
82 }
838485 }
868788/***89 * Get the RoleName90 * @return String91 */92public String getRoleName()
93 {
94return roleName;
95 }
969798/***99 * Set the value of RoleName100 */101publicvoid setRoleName(String v )
102 {
103104if (!ObjectUtils.equals(this.roleName, v))
105 {
106this.roleName = v;
107 setModified(true);
108 }
109110111 }
112113114/***115 * Get the MediaType116 * @return String117 */118public String getMediaType()
119 {
120return mediaType;
121 }
122123124/***125 * Set the value of MediaType126 */127publicvoid setMediaType(String v )
128 {
129130if (!ObjectUtils.equals(this.mediaType, v))
131 {
132this.mediaType = v;
133 setModified(true);
134 }
135136137 }
138139140/***141 * Get the Language142 * @return String143 */144public String getLanguage()
145 {
146return language;
147 }
148149150/***151 * Set the value of Language152 */153publicvoid setLanguage(String v )
154 {
155156if (!ObjectUtils.equals(this.language, v))
157 {
158this.language = v;
159 setModified(true);
160 }
161162163 }
164165166/***167 * Get the Country168 * @return String169 */170public String getCountry()
171 {
172return country;
173 }
174175176/***177 * Set the value of Country178 */179publicvoid setCountry(String v )
180 {
181182if (!ObjectUtils.equals(this.country, v))
183 {
184this.country = v;
185 setModified(true);
186 }
187188189 }
190191192/***193 * Get the Page194 * @return String195 */196public String getPage()
197 {
198return page;
199 }
200201202/***203 * Set the value of Page204 */205publicvoid setPage(String v )
206 {
207208if (!ObjectUtils.equals(this.page, v))
209 {
210this.page = v;
211 setModified(true);
212 }
213214215 }
216217218/***219 * Get the Profile220 * @return byte[]221 */222public byte[] getProfile()
223 {
224return profile;
225 }
226227228/***229 * Set the value of Profile230 */231publicvoid setProfile(byte[] v )
232 {
233234if (!ObjectUtils.equals(this.profile, v))
235 {
236this.profile = v;
237 setModified(true);
238 }
239240241 }
242243244245246privatestatic List fieldNames = null;
247248/***249 * Generate a list of field names.250 */251publicstaticsynchronized List getFieldNames()
252 {
253if (fieldNames == null)
254 {
255 fieldNames = new ArrayList();
256 fieldNames.add("PsmlId");
257 fieldNames.add("RoleName");
258 fieldNames.add("MediaType");
259 fieldNames.add("Language");
260 fieldNames.add("Country");
261 fieldNames.add("Page");
262 fieldNames.add("Profile");
263 fieldNames = Collections.unmodifiableList(fieldNames);
264 }
265return fieldNames;
266 }
267268/***269 * Retrieves a field from the object by name passed in270 * as a String.271 */272public Object getByName(String name)
273 {
274if (name.equals("PsmlId"))
275 {
276returnnew Integer(getPsmlId());
277 }
278if (name.equals("RoleName"))
279 {
280return getRoleName();
281 }
282if (name.equals("MediaType"))
283 {
284return getMediaType();
285 }
286if (name.equals("Language"))
287 {
288return getLanguage();
289 }
290if (name.equals("Country"))
291 {
292return getCountry();
293 }
294if (name.equals("Page"))
295 {
296return getPage();
297 }
298if (name.equals("Profile"))
299 {
300return getProfile();
301 }
302returnnull;
303 }
304305/***306 * Retrieves a field from the object by name passed in307 * as a String. The String must be one of the static308 * Strings defined in this Class' Peer.309 */310public Object getByPeerName(String name)
311 {
312if (name.equals(JetspeedRoleProfilePeer.PSML_ID ))
313 {
314returnnew Integer(getPsmlId());
315 }
316if (name.equals(JetspeedRoleProfilePeer.ROLE_NAME ))
317 {
318return getRoleName();
319 }
320if (name.equals(JetspeedRoleProfilePeer.MEDIA_TYPE ))
321 {
322return getMediaType();
323 }
324if (name.equals(JetspeedRoleProfilePeer.LANGUAGE ))
325 {
326return getLanguage();
327 }
328if (name.equals(JetspeedRoleProfilePeer.COUNTRY ))
329 {
330return getCountry();
331 }
332if (name.equals(JetspeedRoleProfilePeer.PAGE ))
333 {
334return getPage();
335 }
336if (name.equals(JetspeedRoleProfilePeer.PROFILE ))
337 {
338return getProfile();
339 }
340returnnull;
341 }
342343/***344 * Retrieves a field from the object by Position as specified345 * in the xml schema. Zero-based.346 */347public Object getByPosition(int pos)
348 {
349if ( pos == 0 )
350 {
351returnnew Integer(getPsmlId());
352 }
353if ( pos == 1 )
354 {
355return getRoleName();
356 }
357if ( pos == 2 )
358 {
359return getMediaType();
360 }
361if ( pos == 3 )
362 {
363return getLanguage();
364 }
365if ( pos == 4 )
366 {
367return getCountry();
368 }
369if ( pos == 5 )
370 {
371return getPage();
372 }
373if ( pos == 6 )
374 {
375return getProfile();
376 }
377returnnull;
378 }
379380/***381 * Stores the object in the database. If the object is new,382 * it inserts it; otherwise an update is performed.383 */384publicvoid save() throws Exception
385 {
386 save(JetspeedRoleProfilePeer.getMapBuilder()
387 .getDatabaseMap().getName());
388 }
389390/***391 * Stores the object in the database. If the object is new,392 * it inserts it; otherwise an update is performed.393 * Note: this code is here because the method body is394 * auto-generated conditionally and therefore needs to be395 * in this file instead of in the super class, BaseObject.396 */397publicvoid save(String dbName) throws TorqueException
398 {
399 Connection con = null;
400try401 {
402 con = Transaction.begin(dbName);
403 save(con);
404 Transaction.commit(con);
405 }
406catch(TorqueException e)
407 {
408 Transaction.safeRollback(con);
409throw e;
410 }
411 }
412413/*** flag to prevent endless save loop, if this object is referenced414 by another object which falls in this transaction. */415privateboolean alreadyInSave = false;
416/***417 * Stores the object in the database. If the object is new,418 * it inserts it; otherwise an update is performed. This method419 * is meant to be used as part of a transaction, otherwise use420 * the save() method and the connection details will be handled421 * internally422 */423publicvoid save(Connection con) throws TorqueException
424 {
425if (!alreadyInSave)
426 {
427 alreadyInSave = true;
428429430431// If this object has been modified, then save it to the database.432if (isModified())
433 {
434if (isNew())
435 {
436 JetspeedRoleProfilePeer.doInsert((JetspeedRoleProfile)this, con);
437 setNew(false);
438 }
439else440 {
441 JetspeedRoleProfilePeer.doUpdate((JetspeedRoleProfile)this, con);
442 }
443444if (isCacheOnSave())
445 {
446 JetspeedRoleProfileManager.putInstance(this);
447 }
448 }
449450 alreadyInSave = false;
451 }
452 }
453454/***455 * Specify whether to cache the object after saving to the db.456 * This method returns false457 */458protectedboolean isCacheOnSave()
459 {
460returntrue;
461 }
462463464/***465 * Set the PrimaryKey using ObjectKey.466 *467 * @param ObjectKey psmlId468 */469publicvoid setPrimaryKey(ObjectKey psmlId)
470 {
471 setPsmlId(((NumberKey)psmlId).intValue());
472 }
473474/***475 * Set the PrimaryKey using a String.476 */477publicvoid setPrimaryKey(String key)
478 {
479 setPsmlId(Integer.parseInt(key));
480 }
481482483/***484 * returns an id that differentiates this object from others485 * of its class.486 */487public ObjectKey getPrimaryKey()
488 {
489return SimpleKey.keyFor(getPsmlId());
490 }
491492493/***494 * Makes a copy of this object.495 * It creates a new object filling in the simple attributes.496 * It then fills all the association collections.497 */498publicJetspeedRoleProfile copy() throws TorqueException
499 {
500JetspeedRoleProfile copyObj = newJetspeedRoleProfile();
501 copyObj.setPsmlId(psmlId);
502 copyObj.setRoleName(roleName);
503 copyObj.setMediaType(mediaType);
504 copyObj.setLanguage(language);
505 copyObj.setCountry(country);
506 copyObj.setPage(page);
507 copyObj.setProfile(profile);
508509 copyObj.setPsmlId(0);
510511return copyObj;
512 }
513514/***515 * returns a peer instance associated with this om. Since Peer classes516 * are not to have any instance attributes, this method returns the517 * same instance for all member of this class. The method could therefore518 * be static, but this would prevent one from overriding the behavior.519 */520publicJetspeedRoleProfilePeer getPeer()
521 {
522return peer;
523 }
524 }