portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile BaseProfileLocator.java QueryLocator.java
Date Mon, 12 Nov 2001 03:37:54 GMT
taylor      01/11/11 19:37:54

  Modified:    src/java/org/apache/jetspeed/om/profile
                        BaseProfileLocator.java QueryLocator.java
  Added:       src/java/org/apache/jetspeed/om/dbpsml
                        BaseJetspeedAnonProfile.java
                        BaseJetspeedAnonProfilePeer.java
                        BaseJetspeedGroupProfile.java
                        BaseJetspeedGroupProfilePeer.java
                        BaseJetspeedRoleProfile.java
                        BaseJetspeedRoleProfilePeer.java
                        BaseJetspeedUserProfile.java
                        BaseJetspeedUserProfilePeer.java
                        JetspeedAnonProfile.java
                        JetspeedAnonProfilePeer.java
                        JetspeedGroupProfile.java
                        JetspeedGroupProfilePeer.java
                        JetspeedRoleProfile.java
                        JetspeedRoleProfilePeer.java
                        JetspeedUserProfile.java
                        JetspeedUserProfilePeer.java
               src/java/org/apache/jetspeed/om/dbpsml/map
                        JetspeedAnonProfileMapBuilder.java
                        JetspeedGroupProfileMapBuilder.java
                        JetspeedRoleProfileMapBuilder.java
                        JetspeedUserProfileMapBuilder.java
  Log:
  dbpsml OM classes. These were generated by Torque, and the 4 Jetspeed*ProfilePeer.java files were extended.
  If you regenerate the torque peers, all files will be overwritten except for the 4 stated above.
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/BaseJetspeedAnonProfile.java
  
  Index: BaseJetspeedAnonProfile.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  import org.apache.turbine.util.ObjectUtils;
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  /** 
   * You should not use this class directly.  It should not even be
   * extended all references should be to JetspeedAnonProfile 
   */
  public abstract class BaseJetspeedAnonProfile extends BaseObject
      implements Retrievable
  {
            /** the value for the psml_id field */
      private NumberKey psml_id;
            /** the value for the media_type field */
      private String media_type;
            /** the value for the language field */
      private String language;
            /** the value for the country field */
      private String country;
            /** the value for the page field */
      private String page;
            /** the value for the profile field */
      private byte[] profile;
    
  
        /**
       * Get the PsmlId
       * @return NumberKey
       */
       public NumberKey getPsmlId()
       {
            return psml_id;
       }
  
                              
      /**
       * Set the value of PsmlId
       */
       public void setPsmlId(NumberKey v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.psml_id, v) )
          {
                         if (this.psml_id == null)
              {
                  this.psml_id = new NumberKey(v);
              }
              else
              {
                  this.psml_id.setValue(v);
              }
                        setModified(true);
          }
       }
  
       /**
      * Set the value of PsmlId as a string.
      */
      public void setPsmlId(String v ) 
      {
           setPsmlId(new NumberKey(v));
      }
    
      /**
       * Get the MediaType
       * @return String
       */
       public String getMediaType()
       {
            return media_type;
       }
  
                              
      /**
       * Set the value of MediaType
       */
       public void setMediaType(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.media_type, v) )
          {
                         this.media_type = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Language
       * @return String
       */
       public String getLanguage()
       {
            return language;
       }
  
                              
      /**
       * Set the value of Language
       */
       public void setLanguage(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.language, v) )
          {
                         this.language = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Country
       * @return String
       */
       public String getCountry()
       {
            return country;
       }
  
                              
      /**
       * Set the value of Country
       */
       public void setCountry(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.country, v) )
          {
                         this.country = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Page
       * @return String
       */
       public String getPage()
       {
            return page;
       }
  
                              
      /**
       * Set the value of Page
       */
       public void setPage(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.page, v) )
          {
                         this.page = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Profile
       * @return byte[]
       */
       public byte[] getProfile()
       {
            return profile;
       }
  
                              
      /**
       * Set the value of Profile
       */
       public void setProfile(byte[] v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.profile, v) )
          {
                         this.profile = v;
                        setModified(true);
          }
       }
  
    
  
   
      
          
      
      private static Vector fieldNames_ = null;
  
      /**
       * Generate a list of field names.
       */
      public static synchronized List getFieldNames()
      {
        if (fieldNames_ == null)
        {
          fieldNames_ = new Vector();
              fieldNames_.add("PsmlId");
              fieldNames_.add("MediaType");
              fieldNames_.add("Language");
              fieldNames_.add("Country");
              fieldNames_.add("Page");
              fieldNames_.add("Profile");
            }
        return fieldNames_;
      }
  
      /**
       * Retrieves a field from the object by name passed in
       * as a String.
       */
      public Object getByName(String name)
      {
              if (name.equals("PsmlId"))
  	{
  	  	    return getPsmlId();
  	  	}
              if (name.equals("MediaType"))
  	{
  	  	    return getMediaType();
  	  	}
              if (name.equals("Language"))
  	{
  	  	    return getLanguage();
  	  	}
              if (name.equals("Country"))
  	{
  	  	    return getCountry();
  	  	}
              if (name.equals("Page"))
  	{
  	  	    return getPage();
  	  	}
              if (name.equals("Profile"))
  	{
  	  	    return getProfile();
  	  	}
              return null; 
      }
      /**
       * Retrieves a field from the object by name passed in
       * as a String.  The String must be one of the static
       * Strings defined in this Class' Peer.
       */
      public Object getByPeerName(String name)
      {
              if (name.equals(JetspeedAnonProfilePeer.PSML_ID ))
  	    {
  	  	    return getPsmlId();
  	  	}
              if (name.equals(JetspeedAnonProfilePeer.MEDIA_TYPE ))
  	    {
  	  	    return getMediaType();
  	  	}
              if (name.equals(JetspeedAnonProfilePeer.LANGUAGE ))
  	    {
  	  	    return getLanguage();
  	  	}
              if (name.equals(JetspeedAnonProfilePeer.COUNTRY ))
  	    {
  	  	    return getCountry();
  	  	}
              if (name.equals(JetspeedAnonProfilePeer.PAGE ))
  	    {
  	  	    return getPage();
  	  	}
              if (name.equals(JetspeedAnonProfilePeer.PROFILE ))
  	    {
  	  	    return getProfile();
  	  	}
              return null; 
      }
  
      /**
       * Retrieves a field from the object by Position as specified
       * in the xml schema.  Zero-based.
       */
      public Object getByPosition(int pos)
      {
              if ( pos == 0 )
  	{
  	  	    return getPsmlId();
  	  	}
              if ( pos == 1 )
  	{
  	  	    return getMediaType();
  	  	}
              if ( pos == 2 )
  	{
  	  	    return getLanguage();
  	  	}
              if ( pos == 3 )
  	{
  	  	    return getCountry();
  	  	}
              if ( pos == 4 )
  	{
  	  	    return getPage();
  	  	}
              if ( pos == 5 )
  	{
  	  	    return getProfile();
  	  	}
                  return null; 
      }
  
       	
  
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save() throws Exception
      {
               save(JetspeedAnonProfilePeer.getMapBuilder()
                  .getDatabaseMap().getName());
       }
  
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save(String dbName) throws Exception
      {
          DBConnection dbCon = null;
           try
          {
              dbCon = BasePeer.beginTransaction(dbName);
              save(dbCon);
          }
          catch(Exception e)
          {
              BasePeer.rollBackTransaction(dbCon);
              throw e;
          }
          BasePeer.commitTransaction(dbCon);
  
       }
  
        // flag to prevent endless save loop, if this object is referenced
      // by another object which falls in this transaction.
      private boolean alreadyInSave = false;
        /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.  This method
       * is meant to be used as part of a transaction, otherwise use
       * the save() method and the connection details will be handled
       * internally
       */
      public void save(DBConnection dbCon) throws Exception
      {
          if (!alreadyInSave)
        {
          alreadyInSave = true;
            if (isModified())
          {
              if (isNew())
              {
                  JetspeedAnonProfilePeer.doInsert((JetspeedAnonProfile)this, dbCon);
                  setNew(false);
              }
              else
              {
                  JetspeedAnonProfilePeer.doUpdate((JetspeedAnonProfile)this, dbCon);
              }
          }
  
                alreadyInSave = false;
        }
        }
  
  
                  
      
      
  
          /** 
       * Set the PrimaryKey using ObjectKey.
       *
       * @param ObjectKey psml_id
       */
      public void setPrimaryKey(ObjectKey psml_id) 
           {
           setPsmlId((NumberKey)psml_id);
      }
  
      /** 
       * Set the PrimaryKey using a String.
       */
      public void setPrimaryKey(String key) 
      {
          setPsmlId(new NumberKey(key) );
      }
  
  
  
      /** 
       * returns an id that differentiates this object from others
       * of its class.
       */
      public ObjectKey getPrimaryKey() 
      {
          return getPsmlId();
      }
  
   
      /** 
       * get an id that differentiates this object from others
       * of its class.
       */
      public String getQueryKey() 
      {
          if (getPrimaryKey() == null)
          {
              return "";
          }
          else
          {
              return getPrimaryKey().toString();
          }
      }
  
      /** 
       * set an id that differentiates this object from others
       * of its class.
       */
      public void setQueryKey(String key) 
          throws Exception
      {
          setPrimaryKey(key);
      }
  
      /**
       * Makes a copy of this object.  
       * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
       * related objects to isNew=true.
       */
      public JetspeedAnonProfile copy() throws Exception
      {
          JetspeedAnonProfile copyObj = new JetspeedAnonProfile();
          copyObj.setPsmlId(psml_id);
          copyObj.setMediaType(media_type);
          copyObj.setLanguage(language);
          copyObj.setCountry(country);
          copyObj.setPage(page);
          copyObj.setProfile(profile);
  
  
      
              copyObj.setPsmlId((NumberKey)null);
                                  return copyObj;
      }
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/BaseJetspeedAnonProfilePeer.java
  
  Index: BaseJetspeedAnonProfilePeer.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  import java.util.*;
  import java.math.*;
  import java.sql.*;
  import com.workingdogs.village.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.TurbineException;
  
  // Local classes
  import org.apache.jetspeed.om.dbpsml.map.*;
  
  /**
   */
  public abstract class BaseJetspeedAnonProfilePeer 
      extends org.apache.turbine.om.peer.BasePeer
  {
  
      /** the mapbuilder for this class */
      private static final JetspeedAnonProfileMapBuilder mapBuilder = 
          (JetspeedAnonProfileMapBuilder)getMapBuilder(JetspeedAnonProfileMapBuilder.CLASS_NAME);
  
      /** the table name for this class */
      public static final String TABLE_NAME = mapBuilder.getTable();
  
      /** 
       * @return the map builder for this peer
       */
      public static MapBuilder getMapBuilder()
      {
         return(mapBuilder);
      }
  
      /** the column name for the PSML_ID field */
      public static final String PSML_ID = mapBuilder.getJetspeedAnonProfile_PsmlId();
      /** the column name for the MEDIA_TYPE field */
      public static final String MEDIA_TYPE = mapBuilder.getJetspeedAnonProfile_MediaType();
      /** the column name for the LANGUAGE field */
      public static final String LANGUAGE = mapBuilder.getJetspeedAnonProfile_Language();
      /** the column name for the COUNTRY field */
      public static final String COUNTRY = mapBuilder.getJetspeedAnonProfile_Country();
      /** the column name for the PAGE field */
      public static final String PAGE = mapBuilder.getJetspeedAnonProfile_Page();
      /** the column name for the PROFILE field */
      public static final String PROFILE = mapBuilder.getJetspeedAnonProfile_Profile();
  
   
      /** number of columns for this peer */
      public static final int numColumns =  6;
  
      /** A class that can be returned by this peer. */
      protected static final String CLASSNAME_DEFAULT = 
          "org.apache.jetspeed.om.dbpsml.JetspeedAnonProfile";
  
      /** A class that can be returned by this peer. */
      protected static final Class CLASS_DEFAULT = initClass();
  
      /** Initialization method for static CLASS_DEFAULT attribute */
      private static Class initClass()
      {
          Class c = null;
          try
          { 
              c = Class.forName(CLASSNAME_DEFAULT);
          }
          catch (Exception e)
          {
              Log.error("A FATAL ERROR has occurred which should not" +
                  "have happened under any circumstance.  Please notify" +
                  "Turbine and give as many details as possible including the " +
                  "error stacktrace.", e);
          }
          return c;
      }
  
  
      /**
       * Get the list of objects for a ResultSet.  Please not that your
       * resultset MUST return columns in the right order.  You can use
       * getFieldNames() in BaseObject to get the correct sequence.
       */
      public static Vector resultSet2Objects (java.sql.ResultSet results) throws Exception
      {
          QueryDataSet qds = null;
          Vector rows = null;
          try
          {
              qds = new QueryDataSet( results );
              rows = getSelectResults( qds );
          }
          finally
          {
              if (qds != null) qds.close();
          }
  
          return populateObjects (rows);
  
      }
  
  
  
      /** Method to do inserts */
      public static ObjectKey doInsert( Criteria criteria ) throws Exception
      {
                                                                                                       return BasePeer.doInsert( criteria );
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert(Criteria) method.  It will take care of 
       * the connection details internally. 
       */
      public static ObjectKey doInsert( Criteria criteria, DBConnection dbCon ) 
          throws Exception
      {
                                                                                                       return BasePeer.doInsert( criteria, dbCon );
      }
  
      /** Add all the columns needed to create a new object */
      public static void addSelectColumns (Criteria criteria) throws Exception
      {
              criteria.addSelectColumn( PSML_ID );
              criteria.addSelectColumn( MEDIA_TYPE );
              criteria.addSelectColumn( LANGUAGE );
              criteria.addSelectColumn( COUNTRY );
              criteria.addSelectColumn( PAGE );
              criteria.addSelectColumn( PROFILE );
          }
  
  
      /** 
       * Create a new object of type cls from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static JetspeedAnonProfile row2Object (Record row, 
                                                int offset, 
                                                Class cls ) 
          throws Exception
      {
          JetspeedAnonProfile obj = (JetspeedAnonProfile)cls.newInstance();
          populateObject(row, offset, obj);
                      obj.setModified(false);
                  obj.setNew(false);
  
          return obj;
      }
  
      /** 
       * Populates an object from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static void populateObject (Record row, 
                                         int offset, 
                                         JetspeedAnonProfile obj ) 
          throws Exception
      {
                                                          obj.setPsmlId(
                  new NumberKey(row.getValue(offset+0).asBigDecimal()));
                                                                              obj.setMediaType(row.getValue(offset+1).asString());
                                                                              obj.setLanguage(row.getValue(offset+2).asString());
                                                                              obj.setCountry(row.getValue(offset+3).asString());
                                                                              obj.setPage(row.getValue(offset+4).asString());
                                                                              obj.setProfile(row.getValue(offset+5).asBytes());
                                          }
  
      /** Method to do selects */
      public static Vector doSelect( Criteria criteria ) throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria) ); 
      }
  
  
      /** Method to do selects within a transaction */
      public static Vector doSelect( Criteria criteria, 
                                     DBConnection dbCon ) 
          throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria, dbCon) ); 
      }
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method handles connections internally.  The Record objects
       * returned by this method should be considered readonly.  Do not
       * alter the data and call save(), your results may vary, but are
       * certainly likely to result in hard to track MT bugs.
       */
      public static Vector doSelectVillageRecords( Criteria criteria ) 
          throws Exception
      {
              if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
                                                                                           
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria);
      }
  
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method should be used for transactions 
       */
      public static Vector doSelectVillageRecords( Criteria criteria, 
                                                   DBConnection dbCon ) 
          throws Exception
      {
          if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
                                                                                           
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria, dbCon);
      }
  
      /** 
       * The returned vector will contain objects of the default type or
       * objects that inherit from the default.
       */
      public static Vector populateObjects(Vector records) 
          throws Exception
      {
          Vector results = new Vector(records.size());
  
          // populate the object(s)
          for ( int i=0; i<records.size(); i++ )
          {
              Record row = (Record)records.elementAt(i);
              results.add(JetspeedAnonProfilePeer.row2Object(row, 1,
                  JetspeedAnonProfilePeer.getOMClass()));
          }
          return results;
      }
   
  
      /** 
       * The class that the Peer will make instances of. 
       * If the BO is abstract then you must implement this method
       * in the BO.
       */
      public static Class getOMClass() 
          throws Exception
      {
              return CLASS_DEFAULT;
          }
  
  
      /**
       * Method to do updates. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria) throws Exception
      {
              Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
                                  selectCriteria.put( PSML_ID, criteria.remove(PSML_ID) );
                                                                                                                                            BasePeer.doUpdate( selectCriteria, criteria );
      }
  
      /** 
       * Method to do updates.  This method is to be used during a transaction,
       * otherwise use the doUpdate(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria, DBConnection dbCon) throws Exception
      {
              Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
                                  selectCriteria.put( PSML_ID, criteria.remove(PSML_ID) );
                                                                                                                                            BasePeer.doUpdate( selectCriteria, criteria, dbCon );
       }
  
      /** 
       * Method to do deletes.
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria) throws Exception
       {
                                                                                                        BasePeer.doDelete ( criteria );
       }
  
      /** 
       * Method to do deletes.  This method is to be used during a transaction,
       * otherwise use the doDelete(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria, DBConnection dbCon) throws Exception
       {
                                                                                                        BasePeer.doDelete ( criteria, dbCon );
       }
  
      /** Method to do inserts */
      public static void doInsert( JetspeedAnonProfile obj ) throws Exception
      {
                  obj.setPrimaryKey(doInsert(buildCriteria(obj)));
                  obj.setNew(false);
      }
  
      /**
       * @param obj the data object to update in the database.
       */
      public static void doUpdate(JetspeedAnonProfile obj) throws Exception
      {
          doUpdate(buildCriteria(obj));
      }
      /**
       * @param obj the data object to delete in the database.
       */
      public static void doDelete(JetspeedAnonProfile obj) throws Exception
      {
          doDelete(buildCriteria(obj));
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert(JetspeedAnonProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to insert into the database.
       */
      public static void doInsert( JetspeedAnonProfile obj, DBConnection dbCon) throws Exception
      {
                  obj.setPrimaryKey(doInsert(buildCriteria(obj), dbCon));
                  obj.setNew(false);
      }
  
      /**
       * Method to do update.  This method is to be used during a transaction,
       * otherwise use the doUpdate(JetspeedAnonProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to update in the database.
       */
      public static void doUpdate(JetspeedAnonProfile obj, DBConnection dbCon) throws Exception
      {
          doUpdate(buildCriteria(obj), dbCon);
      }
      /**
       * Method to delete.  This method is to be used during a transaction,
       * otherwise use the doDelete(JetspeedAnonProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to delete in the database.
       */
      public static void doDelete(JetspeedAnonProfile obj, DBConnection dbCon) throws Exception
      {
          doDelete(buildCriteria(obj), dbCon);
      }
  
      /** Build a Criteria object from the data object for this peer */
      public static Criteria buildCriteria( JetspeedAnonProfile obj )
      {
          Criteria criteria = new Criteria();
                              if ( !obj.isNew() )
                         criteria.add( PSML_ID, obj.getPsmlId() );
                                  criteria.add( MEDIA_TYPE, obj.getMediaType() );
                                  criteria.add( LANGUAGE, obj.getLanguage() );
                                  criteria.add( COUNTRY, obj.getCountry() );
                                  criteria.add( PAGE, obj.getPage() );
                                  criteria.add( PROFILE, obj.getProfile() );
                  return criteria;
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       */
      public static JetspeedAnonProfile retrieveByPK( ObjectKey pk )
          throws Exception
      {
          DBConnection db = null;
          JetspeedAnonProfile retVal = null;
         try
          {
             db = TurbineDB.getConnection( mapBuilder.getDatabaseMap().getName() );
             retVal = retrieveByPK( pk, db );
          }
          finally
          {
             if (db != null)
                TurbineDB.releaseConnection(db);
          }
          return(retVal);
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       * @param DBConnection dbcon
       */
      public static JetspeedAnonProfile retrieveByPK( ObjectKey pk, DBConnection dbcon )
          throws Exception
      {
  
          Criteria criteria = new Criteria();
              criteria.add( PSML_ID, pk );
          Vector v = doSelect(criteria, dbcon);
          if ( v.size() != 1)
          {
              throw new Exception("Failed to select one and only one row.");
          }
          else
          {
              return (JetspeedAnonProfile)v.firstElement();
          }
      }
  
  
  
   
  
      
   
  
    
  
  
      /** 
       * Returns the TableMap related to this peer.  This method is not 
       * needed for general use but a specific application could have a
       * need.
       */
      protected static TableMap getTableMap()
      {
          return mapBuilder.getDatabaseMap().getTable(TABLE_NAME);
      }     
   
  
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/BaseJetspeedGroupProfile.java
  
  Index: BaseJetspeedGroupProfile.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  import org.apache.turbine.util.ObjectUtils;
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  /** 
   * You should not use this class directly.  It should not even be
   * extended all references should be to JetspeedGroupProfile 
   */
  public abstract class BaseJetspeedGroupProfile extends BaseObject
      implements Retrievable
  {
            /** the value for the psml_id field */
      private NumberKey psml_id;
            /** the value for the group_name field */
      private String group_name;
            /** the value for the media_type field */
      private String media_type;
            /** the value for the language field */
      private String language;
            /** the value for the country field */
      private String country;
            /** the value for the page field */
      private String page;
            /** the value for the profile field */
      private byte[] profile;
    
  
        /**
       * Get the PsmlId
       * @return NumberKey
       */
       public NumberKey getPsmlId()
       {
            return psml_id;
       }
  
                              
      /**
       * Set the value of PsmlId
       */
       public void setPsmlId(NumberKey v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.psml_id, v) )
          {
                         if (this.psml_id == null)
              {
                  this.psml_id = new NumberKey(v);
              }
              else
              {
                  this.psml_id.setValue(v);
              }
                        setModified(true);
          }
       }
  
       /**
      * Set the value of PsmlId as a string.
      */
      public void setPsmlId(String v ) 
      {
           setPsmlId(new NumberKey(v));
      }
    
      /**
       * Get the GroupName
       * @return String
       */
       public String getGroupName()
       {
            return group_name;
       }
  
                              
      /**
       * Set the value of GroupName
       */
       public void setGroupName(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.group_name, v) )
          {
                         this.group_name = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the MediaType
       * @return String
       */
       public String getMediaType()
       {
            return media_type;
       }
  
                              
      /**
       * Set the value of MediaType
       */
       public void setMediaType(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.media_type, v) )
          {
                         this.media_type = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Language
       * @return String
       */
       public String getLanguage()
       {
            return language;
       }
  
                              
      /**
       * Set the value of Language
       */
       public void setLanguage(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.language, v) )
          {
                         this.language = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Country
       * @return String
       */
       public String getCountry()
       {
            return country;
       }
  
                              
      /**
       * Set the value of Country
       */
       public void setCountry(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.country, v) )
          {
                         this.country = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Page
       * @return String
       */
       public String getPage()
       {
            return page;
       }
  
                              
      /**
       * Set the value of Page
       */
       public void setPage(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.page, v) )
          {
                         this.page = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Profile
       * @return byte[]
       */
       public byte[] getProfile()
       {
            return profile;
       }
  
                              
      /**
       * Set the value of Profile
       */
       public void setProfile(byte[] v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.profile, v) )
          {
                         this.profile = v;
                        setModified(true);
          }
       }
  
    
  
   
      
          
      
      private static Vector fieldNames_ = null;
  
      /**
       * Generate a list of field names.
       */
      public static synchronized List getFieldNames()
      {
        if (fieldNames_ == null)
        {
          fieldNames_ = new Vector();
              fieldNames_.add("PsmlId");
              fieldNames_.add("GroupName");
              fieldNames_.add("MediaType");
              fieldNames_.add("Language");
              fieldNames_.add("Country");
              fieldNames_.add("Page");
              fieldNames_.add("Profile");
            }
        return fieldNames_;
      }
  
      /**
       * Retrieves a field from the object by name passed in
       * as a String.
       */
      public Object getByName(String name)
      {
              if (name.equals("PsmlId"))
  	{
  	  	    return getPsmlId();
  	  	}
              if (name.equals("GroupName"))
  	{
  	  	    return getGroupName();
  	  	}
              if (name.equals("MediaType"))
  	{
  	  	    return getMediaType();
  	  	}
              if (name.equals("Language"))
  	{
  	  	    return getLanguage();
  	  	}
              if (name.equals("Country"))
  	{
  	  	    return getCountry();
  	  	}
              if (name.equals("Page"))
  	{
  	  	    return getPage();
  	  	}
              if (name.equals("Profile"))
  	{
  	  	    return getProfile();
  	  	}
              return null; 
      }
      /**
       * Retrieves a field from the object by name passed in
       * as a String.  The String must be one of the static
       * Strings defined in this Class' Peer.
       */
      public Object getByPeerName(String name)
      {
              if (name.equals(JetspeedGroupProfilePeer.PSML_ID ))
  	    {
  	  	    return getPsmlId();
  	  	}
              if (name.equals(JetspeedGroupProfilePeer.GROUP_NAME ))
  	    {
  	  	    return getGroupName();
  	  	}
              if (name.equals(JetspeedGroupProfilePeer.MEDIA_TYPE ))
  	    {
  	  	    return getMediaType();
  	  	}
              if (name.equals(JetspeedGroupProfilePeer.LANGUAGE ))
  	    {
  	  	    return getLanguage();
  	  	}
              if (name.equals(JetspeedGroupProfilePeer.COUNTRY ))
  	    {
  	  	    return getCountry();
  	  	}
              if (name.equals(JetspeedGroupProfilePeer.PAGE ))
  	    {
  	  	    return getPage();
  	  	}
              if (name.equals(JetspeedGroupProfilePeer.PROFILE ))
  	    {
  	  	    return getProfile();
  	  	}
              return null; 
      }
  
      /**
       * Retrieves a field from the object by Position as specified
       * in the xml schema.  Zero-based.
       */
      public Object getByPosition(int pos)
      {
              if ( pos == 0 )
  	{
  	  	    return getPsmlId();
  	  	}
              if ( pos == 1 )
  	{
  	  	    return getGroupName();
  	  	}
              if ( pos == 2 )
  	{
  	  	    return getMediaType();
  	  	}
              if ( pos == 3 )
  	{
  	  	    return getLanguage();
  	  	}
              if ( pos == 4 )
  	{
  	  	    return getCountry();
  	  	}
              if ( pos == 5 )
  	{
  	  	    return getPage();
  	  	}
              if ( pos == 6 )
  	{
  	  	    return getProfile();
  	  	}
                  return null; 
      }
  
       	
  
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save() throws Exception
      {
               save(JetspeedGroupProfilePeer.getMapBuilder()
                  .getDatabaseMap().getName());
       }
  
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save(String dbName) throws Exception
      {
          DBConnection dbCon = null;
           try
          {
              dbCon = BasePeer.beginTransaction(dbName);
              save(dbCon);
          }
          catch(Exception e)
          {
              BasePeer.rollBackTransaction(dbCon);
              throw e;
          }
          BasePeer.commitTransaction(dbCon);
  
       }
  
        // flag to prevent endless save loop, if this object is referenced
      // by another object which falls in this transaction.
      private boolean alreadyInSave = false;
        /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.  This method
       * is meant to be used as part of a transaction, otherwise use
       * the save() method and the connection details will be handled
       * internally
       */
      public void save(DBConnection dbCon) throws Exception
      {
          if (!alreadyInSave)
        {
          alreadyInSave = true;
            if (isModified())
          {
              if (isNew())
              {
                  JetspeedGroupProfilePeer.doInsert((JetspeedGroupProfile)this, dbCon);
                  setNew(false);
              }
              else
              {
                  JetspeedGroupProfilePeer.doUpdate((JetspeedGroupProfile)this, dbCon);
              }
          }
  
                alreadyInSave = false;
        }
        }
  
  
                  
      
      
  
          /** 
       * Set the PrimaryKey using ObjectKey.
       *
       * @param ObjectKey psml_id
       */
      public void setPrimaryKey(ObjectKey psml_id) 
           {
           setPsmlId((NumberKey)psml_id);
      }
  
      /** 
       * Set the PrimaryKey using a String.
       */
      public void setPrimaryKey(String key) 
      {
          setPsmlId(new NumberKey(key) );
      }
  
  
  
      /** 
       * returns an id that differentiates this object from others
       * of its class.
       */
      public ObjectKey getPrimaryKey() 
      {
          return getPsmlId();
      }
  
   
      /** 
       * get an id that differentiates this object from others
       * of its class.
       */
      public String getQueryKey() 
      {
          if (getPrimaryKey() == null)
          {
              return "";
          }
          else
          {
              return getPrimaryKey().toString();
          }
      }
  
      /** 
       * set an id that differentiates this object from others
       * of its class.
       */
      public void setQueryKey(String key) 
          throws Exception
      {
          setPrimaryKey(key);
      }
  
      /**
       * Makes a copy of this object.  
       * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
       * related objects to isNew=true.
       */
      public JetspeedGroupProfile copy() throws Exception
      {
          JetspeedGroupProfile copyObj = new JetspeedGroupProfile();
          copyObj.setPsmlId(psml_id);
          copyObj.setGroupName(group_name);
          copyObj.setMediaType(media_type);
          copyObj.setLanguage(language);
          copyObj.setCountry(country);
          copyObj.setPage(page);
          copyObj.setProfile(profile);
  
  
      
              copyObj.setPsmlId((NumberKey)null);
                                      return copyObj;
      }
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/BaseJetspeedGroupProfilePeer.java
  
  Index: BaseJetspeedGroupProfilePeer.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  import java.util.*;
  import java.math.*;
  import java.sql.*;
  import com.workingdogs.village.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.TurbineException;
  
  // Local classes
  import org.apache.jetspeed.om.dbpsml.map.*;
  
  /**
   */
  public abstract class BaseJetspeedGroupProfilePeer 
      extends org.apache.turbine.om.peer.BasePeer
  {
  
      /** the mapbuilder for this class */
      private static final JetspeedGroupProfileMapBuilder mapBuilder = 
          (JetspeedGroupProfileMapBuilder)getMapBuilder(JetspeedGroupProfileMapBuilder.CLASS_NAME);
  
      /** the table name for this class */
      public static final String TABLE_NAME = mapBuilder.getTable();
  
      /** 
       * @return the map builder for this peer
       */
      public static MapBuilder getMapBuilder()
      {
         return(mapBuilder);
      }
  
      /** the column name for the PSML_ID field */
      public static final String PSML_ID = mapBuilder.getJetspeedGroupProfile_PsmlId();
      /** the column name for the GROUP_NAME field */
      public static final String GROUP_NAME = mapBuilder.getJetspeedGroupProfile_GroupName();
      /** the column name for the MEDIA_TYPE field */
      public static final String MEDIA_TYPE = mapBuilder.getJetspeedGroupProfile_MediaType();
      /** the column name for the LANGUAGE field */
      public static final String LANGUAGE = mapBuilder.getJetspeedGroupProfile_Language();
      /** the column name for the COUNTRY field */
      public static final String COUNTRY = mapBuilder.getJetspeedGroupProfile_Country();
      /** the column name for the PAGE field */
      public static final String PAGE = mapBuilder.getJetspeedGroupProfile_Page();
      /** the column name for the PROFILE field */
      public static final String PROFILE = mapBuilder.getJetspeedGroupProfile_Profile();
  
   
      /** number of columns for this peer */
      public static final int numColumns =  7;
  
      /** A class that can be returned by this peer. */
      protected static final String CLASSNAME_DEFAULT = 
          "org.apache.jetspeed.om.dbpsml.JetspeedGroupProfile";
  
      /** A class that can be returned by this peer. */
      protected static final Class CLASS_DEFAULT = initClass();
  
      /** Initialization method for static CLASS_DEFAULT attribute */
      private static Class initClass()
      {
          Class c = null;
          try
          { 
              c = Class.forName(CLASSNAME_DEFAULT);
          }
          catch (Exception e)
          {
              Log.error("A FATAL ERROR has occurred which should not" +
                  "have happened under any circumstance.  Please notify" +
                  "Turbine and give as many details as possible including the " +
                  "error stacktrace.", e);
          }
          return c;
      }
  
  
      /**
       * Get the list of objects for a ResultSet.  Please not that your
       * resultset MUST return columns in the right order.  You can use
       * getFieldNames() in BaseObject to get the correct sequence.
       */
      public static Vector resultSet2Objects (java.sql.ResultSet results) throws Exception
      {
          QueryDataSet qds = null;
          Vector rows = null;
          try
          {
              qds = new QueryDataSet( results );
              rows = getSelectResults( qds );
          }
          finally
          {
              if (qds != null) qds.close();
          }
  
          return populateObjects (rows);
  
      }
  
  
  
      /** Method to do inserts */
      public static ObjectKey doInsert( Criteria criteria ) throws Exception
      {
                                                                                                                     return BasePeer.doInsert( criteria );
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert(Criteria) method.  It will take care of 
       * the connection details internally. 
       */
      public static ObjectKey doInsert( Criteria criteria, DBConnection dbCon ) 
          throws Exception
      {
                                                                                                                     return BasePeer.doInsert( criteria, dbCon );
      }
  
      /** Add all the columns needed to create a new object */
      public static void addSelectColumns (Criteria criteria) throws Exception
      {
              criteria.addSelectColumn( PSML_ID );
              criteria.addSelectColumn( GROUP_NAME );
              criteria.addSelectColumn( MEDIA_TYPE );
              criteria.addSelectColumn( LANGUAGE );
              criteria.addSelectColumn( COUNTRY );
              criteria.addSelectColumn( PAGE );
              criteria.addSelectColumn( PROFILE );
          }
  
  
      /** 
       * Create a new object of type cls from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static JetspeedGroupProfile row2Object (Record row, 
                                                int offset, 
                                                Class cls ) 
          throws Exception
      {
          JetspeedGroupProfile obj = (JetspeedGroupProfile)cls.newInstance();
          populateObject(row, offset, obj);
                      obj.setModified(false);
                  obj.setNew(false);
  
          return obj;
      }
  
      /** 
       * Populates an object from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static void populateObject (Record row, 
                                         int offset, 
                                         JetspeedGroupProfile obj ) 
          throws Exception
      {
                                                          obj.setPsmlId(
                  new NumberKey(row.getValue(offset+0).asBigDecimal()));
                                                                              obj.setGroupName(row.getValue(offset+1).asString());
                                                                              obj.setMediaType(row.getValue(offset+2).asString());
                                                                              obj.setLanguage(row.getValue(offset+3).asString());
                                                                              obj.setCountry(row.getValue(offset+4).asString());
                                                                              obj.setPage(row.getValue(offset+5).asString());
                                                                              obj.setProfile(row.getValue(offset+6).asBytes());
                                          }
  
      /** Method to do selects */
      public static Vector doSelect( Criteria criteria ) throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria) ); 
      }
  
  
      /** Method to do selects within a transaction */
      public static Vector doSelect( Criteria criteria, 
                                     DBConnection dbCon ) 
          throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria, dbCon) ); 
      }
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method handles connections internally.  The Record objects
       * returned by this method should be considered readonly.  Do not
       * alter the data and call save(), your results may vary, but are
       * certainly likely to result in hard to track MT bugs.
       */
      public static Vector doSelectVillageRecords( Criteria criteria ) 
          throws Exception
      {
              if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
                                                                                                         
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria);
      }
  
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method should be used for transactions 
       */
      public static Vector doSelectVillageRecords( Criteria criteria, 
                                                   DBConnection dbCon ) 
          throws Exception
      {
          if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
                                                                                                         
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria, dbCon);
      }
  
      /** 
       * The returned vector will contain objects of the default type or
       * objects that inherit from the default.
       */
      public static Vector populateObjects(Vector records) 
          throws Exception
      {
          Vector results = new Vector(records.size());
  
          // populate the object(s)
          for ( int i=0; i<records.size(); i++ )
          {
              Record row = (Record)records.elementAt(i);
              results.add(JetspeedGroupProfilePeer.row2Object(row, 1,
                  JetspeedGroupProfilePeer.getOMClass()));
          }
          return results;
      }
   
  
      /** 
       * The class that the Peer will make instances of. 
       * If the BO is abstract then you must implement this method
       * in the BO.
       */
      public static Class getOMClass() 
          throws Exception
      {
              return CLASS_DEFAULT;
          }
  
  
      /**
       * Method to do updates. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria) throws Exception
      {
              Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
                                  selectCriteria.put( PSML_ID, criteria.remove(PSML_ID) );
                                                                                                                                                                   BasePeer.doUpdate( selectCriteria, criteria );
      }
  
      /** 
       * Method to do updates.  This method is to be used during a transaction,
       * otherwise use the doUpdate(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria, DBConnection dbCon) throws Exception
      {
              Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
                                  selectCriteria.put( PSML_ID, criteria.remove(PSML_ID) );
                                                                                                                                                                   BasePeer.doUpdate( selectCriteria, criteria, dbCon );
       }
  
      /** 
       * Method to do deletes.
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria) throws Exception
       {
                                                                                                                      BasePeer.doDelete ( criteria );
       }
  
      /** 
       * Method to do deletes.  This method is to be used during a transaction,
       * otherwise use the doDelete(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria, DBConnection dbCon) throws Exception
       {
                                                                                                                      BasePeer.doDelete ( criteria, dbCon );
       }
  
      /** Method to do inserts */
      public static void doInsert( JetspeedGroupProfile obj ) throws Exception
      {
                  obj.setPrimaryKey(doInsert(buildCriteria(obj)));
                  obj.setNew(false);
      }
  
      /**
       * @param obj the data object to update in the database.
       */
      public static void doUpdate(JetspeedGroupProfile obj) throws Exception
      {
          doUpdate(buildCriteria(obj));
      }
      /**
       * @param obj the data object to delete in the database.
       */
      public static void doDelete(JetspeedGroupProfile obj) throws Exception
      {
          doDelete(buildCriteria(obj));
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert(JetspeedGroupProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to insert into the database.
       */
      public static void doInsert( JetspeedGroupProfile obj, DBConnection dbCon) throws Exception
      {
                  obj.setPrimaryKey(doInsert(buildCriteria(obj), dbCon));
                  obj.setNew(false);
      }
  
      /**
       * Method to do update.  This method is to be used during a transaction,
       * otherwise use the doUpdate(JetspeedGroupProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to update in the database.
       */
      public static void doUpdate(JetspeedGroupProfile obj, DBConnection dbCon) throws Exception
      {
          doUpdate(buildCriteria(obj), dbCon);
      }
      /**
       * Method to delete.  This method is to be used during a transaction,
       * otherwise use the doDelete(JetspeedGroupProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to delete in the database.
       */
      public static void doDelete(JetspeedGroupProfile obj, DBConnection dbCon) throws Exception
      {
          doDelete(buildCriteria(obj), dbCon);
      }
  
      /** Build a Criteria object from the data object for this peer */
      public static Criteria buildCriteria( JetspeedGroupProfile obj )
      {
          Criteria criteria = new Criteria();
                              if ( !obj.isNew() )
                         criteria.add( PSML_ID, obj.getPsmlId() );
                                  criteria.add( GROUP_NAME, obj.getGroupName() );
                                  criteria.add( MEDIA_TYPE, obj.getMediaType() );
                                  criteria.add( LANGUAGE, obj.getLanguage() );
                                  criteria.add( COUNTRY, obj.getCountry() );
                                  criteria.add( PAGE, obj.getPage() );
                                  criteria.add( PROFILE, obj.getProfile() );
                  return criteria;
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       */
      public static JetspeedGroupProfile retrieveByPK( ObjectKey pk )
          throws Exception
      {
          DBConnection db = null;
          JetspeedGroupProfile retVal = null;
         try
          {
             db = TurbineDB.getConnection( mapBuilder.getDatabaseMap().getName() );
             retVal = retrieveByPK( pk, db );
          }
          finally
          {
             if (db != null)
                TurbineDB.releaseConnection(db);
          }
          return(retVal);
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       * @param DBConnection dbcon
       */
      public static JetspeedGroupProfile retrieveByPK( ObjectKey pk, DBConnection dbcon )
          throws Exception
      {
  
          Criteria criteria = new Criteria();
              criteria.add( PSML_ID, pk );
          Vector v = doSelect(criteria, dbcon);
          if ( v.size() != 1)
          {
              throw new Exception("Failed to select one and only one row.");
          }
          else
          {
              return (JetspeedGroupProfile)v.firstElement();
          }
      }
  
  
  
   
  
      
   
  
    
  
  
      /** 
       * Returns the TableMap related to this peer.  This method is not 
       * needed for general use but a specific application could have a
       * need.
       */
      protected static TableMap getTableMap()
      {
          return mapBuilder.getDatabaseMap().getTable(TABLE_NAME);
      }     
   
  
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/BaseJetspeedRoleProfile.java
  
  Index: BaseJetspeedRoleProfile.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  import org.apache.turbine.util.ObjectUtils;
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  /** 
   * You should not use this class directly.  It should not even be
   * extended all references should be to JetspeedRoleProfile 
   */
  public abstract class BaseJetspeedRoleProfile extends BaseObject
      implements Retrievable
  {
            /** the value for the psml_id field */
      private NumberKey psml_id;
            /** the value for the role_name field */
      private String role_name;
            /** the value for the media_type field */
      private String media_type;
            /** the value for the language field */
      private String language;
            /** the value for the country field */
      private String country;
            /** the value for the page field */
      private String page;
            /** the value for the profile field */
      private byte[] profile;
    
  
        /**
       * Get the PsmlId
       * @return NumberKey
       */
       public NumberKey getPsmlId()
       {
            return psml_id;
       }
  
                              
      /**
       * Set the value of PsmlId
       */
       public void setPsmlId(NumberKey v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.psml_id, v) )
          {
                         if (this.psml_id == null)
              {
                  this.psml_id = new NumberKey(v);
              }
              else
              {
                  this.psml_id.setValue(v);
              }
                        setModified(true);
          }
       }
  
       /**
      * Set the value of PsmlId as a string.
      */
      public void setPsmlId(String v ) 
      {
           setPsmlId(new NumberKey(v));
      }
    
      /**
       * Get the RoleName
       * @return String
       */
       public String getRoleName()
       {
            return role_name;
       }
  
                              
      /**
       * Set the value of RoleName
       */
       public void setRoleName(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.role_name, v) )
          {
                         this.role_name = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the MediaType
       * @return String
       */
       public String getMediaType()
       {
            return media_type;
       }
  
                              
      /**
       * Set the value of MediaType
       */
       public void setMediaType(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.media_type, v) )
          {
                         this.media_type = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Language
       * @return String
       */
       public String getLanguage()
       {
            return language;
       }
  
                              
      /**
       * Set the value of Language
       */
       public void setLanguage(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.language, v) )
          {
                         this.language = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Country
       * @return String
       */
       public String getCountry()
       {
            return country;
       }
  
                              
      /**
       * Set the value of Country
       */
       public void setCountry(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.country, v) )
          {
                         this.country = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Page
       * @return String
       */
       public String getPage()
       {
            return page;
       }
  
                              
      /**
       * Set the value of Page
       */
       public void setPage(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.page, v) )
          {
                         this.page = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Profile
       * @return byte[]
       */
       public byte[] getProfile()
       {
            return profile;
       }
  
                              
      /**
       * Set the value of Profile
       */
       public void setProfile(byte[] v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.profile, v) )
          {
                         this.profile = v;
                        setModified(true);
          }
       }
  
    
  
   
      
          
      
      private static Vector fieldNames_ = null;
  
      /**
       * Generate a list of field names.
       */
      public static synchronized List getFieldNames()
      {
        if (fieldNames_ == null)
        {
          fieldNames_ = new Vector();
              fieldNames_.add("PsmlId");
              fieldNames_.add("RoleName");
              fieldNames_.add("MediaType");
              fieldNames_.add("Language");
              fieldNames_.add("Country");
              fieldNames_.add("Page");
              fieldNames_.add("Profile");
            }
        return fieldNames_;
      }
  
      /**
       * Retrieves a field from the object by name passed in
       * as a String.
       */
      public Object getByName(String name)
      {
              if (name.equals("PsmlId"))
  	{
  	  	    return getPsmlId();
  	  	}
              if (name.equals("RoleName"))
  	{
  	  	    return getRoleName();
  	  	}
              if (name.equals("MediaType"))
  	{
  	  	    return getMediaType();
  	  	}
              if (name.equals("Language"))
  	{
  	  	    return getLanguage();
  	  	}
              if (name.equals("Country"))
  	{
  	  	    return getCountry();
  	  	}
              if (name.equals("Page"))
  	{
  	  	    return getPage();
  	  	}
              if (name.equals("Profile"))
  	{
  	  	    return getProfile();
  	  	}
              return null; 
      }
      /**
       * Retrieves a field from the object by name passed in
       * as a String.  The String must be one of the static
       * Strings defined in this Class' Peer.
       */
      public Object getByPeerName(String name)
      {
              if (name.equals(JetspeedRoleProfilePeer.PSML_ID ))
  	    {
  	  	    return getPsmlId();
  	  	}
              if (name.equals(JetspeedRoleProfilePeer.ROLE_NAME ))
  	    {
  	  	    return getRoleName();
  	  	}
              if (name.equals(JetspeedRoleProfilePeer.MEDIA_TYPE ))
  	    {
  	  	    return getMediaType();
  	  	}
              if (name.equals(JetspeedRoleProfilePeer.LANGUAGE ))
  	    {
  	  	    return getLanguage();
  	  	}
              if (name.equals(JetspeedRoleProfilePeer.COUNTRY ))
  	    {
  	  	    return getCountry();
  	  	}
              if (name.equals(JetspeedRoleProfilePeer.PAGE ))
  	    {
  	  	    return getPage();
  	  	}
              if (name.equals(JetspeedRoleProfilePeer.PROFILE ))
  	    {
  	  	    return getProfile();
  	  	}
              return null; 
      }
  
      /**
       * Retrieves a field from the object by Position as specified
       * in the xml schema.  Zero-based.
       */
      public Object getByPosition(int pos)
      {
              if ( pos == 0 )
  	{
  	  	    return getPsmlId();
  	  	}
              if ( pos == 1 )
  	{
  	  	    return getRoleName();
  	  	}
              if ( pos == 2 )
  	{
  	  	    return getMediaType();
  	  	}
              if ( pos == 3 )
  	{
  	  	    return getLanguage();
  	  	}
              if ( pos == 4 )
  	{
  	  	    return getCountry();
  	  	}
              if ( pos == 5 )
  	{
  	  	    return getPage();
  	  	}
              if ( pos == 6 )
  	{
  	  	    return getProfile();
  	  	}
                  return null; 
      }
  
       	
  
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save() throws Exception
      {
               save(JetspeedRoleProfilePeer.getMapBuilder()
                  .getDatabaseMap().getName());
       }
  
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save(String dbName) throws Exception
      {
          DBConnection dbCon = null;
           try
          {
              dbCon = BasePeer.beginTransaction(dbName);
              save(dbCon);
          }
          catch(Exception e)
          {
              BasePeer.rollBackTransaction(dbCon);
              throw e;
          }
          BasePeer.commitTransaction(dbCon);
  
       }
  
        // flag to prevent endless save loop, if this object is referenced
      // by another object which falls in this transaction.
      private boolean alreadyInSave = false;
        /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.  This method
       * is meant to be used as part of a transaction, otherwise use
       * the save() method and the connection details will be handled
       * internally
       */
      public void save(DBConnection dbCon) throws Exception
      {
          if (!alreadyInSave)
        {
          alreadyInSave = true;
            if (isModified())
          {
              if (isNew())
              {
                  JetspeedRoleProfilePeer.doInsert((JetspeedRoleProfile)this, dbCon);
                  setNew(false);
              }
              else
              {
                  JetspeedRoleProfilePeer.doUpdate((JetspeedRoleProfile)this, dbCon);
              }
          }
  
                alreadyInSave = false;
        }
        }
  
  
                  
      
      
  
          /** 
       * Set the PrimaryKey using ObjectKey.
       *
       * @param ObjectKey psml_id
       */
      public void setPrimaryKey(ObjectKey psml_id) 
           {
           setPsmlId((NumberKey)psml_id);
      }
  
      /** 
       * Set the PrimaryKey using a String.
       */
      public void setPrimaryKey(String key) 
      {
          setPsmlId(new NumberKey(key) );
      }
  
  
  
      /** 
       * returns an id that differentiates this object from others
       * of its class.
       */
      public ObjectKey getPrimaryKey() 
      {
          return getPsmlId();
      }
  
   
      /** 
       * get an id that differentiates this object from others
       * of its class.
       */
      public String getQueryKey() 
      {
          if (getPrimaryKey() == null)
          {
              return "";
          }
          else
          {
              return getPrimaryKey().toString();
          }
      }
  
      /** 
       * set an id that differentiates this object from others
       * of its class.
       */
      public void setQueryKey(String key) 
          throws Exception
      {
          setPrimaryKey(key);
      }
  
      /**
       * Makes a copy of this object.  
       * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
       * related objects to isNew=true.
       */
      public JetspeedRoleProfile copy() throws Exception
      {
          JetspeedRoleProfile copyObj = new JetspeedRoleProfile();
          copyObj.setPsmlId(psml_id);
          copyObj.setRoleName(role_name);
          copyObj.setMediaType(media_type);
          copyObj.setLanguage(language);
          copyObj.setCountry(country);
          copyObj.setPage(page);
          copyObj.setProfile(profile);
  
  
      
              copyObj.setPsmlId((NumberKey)null);
                                      return copyObj;
      }
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/BaseJetspeedRoleProfilePeer.java
  
  Index: BaseJetspeedRoleProfilePeer.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  import java.util.*;
  import java.math.*;
  import java.sql.*;
  import com.workingdogs.village.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.TurbineException;
  
  // Local classes
  import org.apache.jetspeed.om.dbpsml.map.*;
  
  /**
   */
  public abstract class BaseJetspeedRoleProfilePeer 
      extends org.apache.turbine.om.peer.BasePeer
  {
  
      /** the mapbuilder for this class */
      private static final JetspeedRoleProfileMapBuilder mapBuilder = 
          (JetspeedRoleProfileMapBuilder)getMapBuilder(JetspeedRoleProfileMapBuilder.CLASS_NAME);
  
      /** the table name for this class */
      public static final String TABLE_NAME = mapBuilder.getTable();
  
      /** 
       * @return the map builder for this peer
       */
      public static MapBuilder getMapBuilder()
      {
         return(mapBuilder);
      }
  
      /** the column name for the PSML_ID field */
      public static final String PSML_ID = mapBuilder.getJetspeedRoleProfile_PsmlId();
      /** the column name for the ROLE_NAME field */
      public static final String ROLE_NAME = mapBuilder.getJetspeedRoleProfile_RoleName();
      /** the column name for the MEDIA_TYPE field */
      public static final String MEDIA_TYPE = mapBuilder.getJetspeedRoleProfile_MediaType();
      /** the column name for the LANGUAGE field */
      public static final String LANGUAGE = mapBuilder.getJetspeedRoleProfile_Language();
      /** the column name for the COUNTRY field */
      public static final String COUNTRY = mapBuilder.getJetspeedRoleProfile_Country();
      /** the column name for the PAGE field */
      public static final String PAGE = mapBuilder.getJetspeedRoleProfile_Page();
      /** the column name for the PROFILE field */
      public static final String PROFILE = mapBuilder.getJetspeedRoleProfile_Profile();
  
   
      /** number of columns for this peer */
      public static final int numColumns =  7;
  
      /** A class that can be returned by this peer. */
      protected static final String CLASSNAME_DEFAULT = 
          "org.apache.jetspeed.om.dbpsml.JetspeedRoleProfile";
  
      /** A class that can be returned by this peer. */
      protected static final Class CLASS_DEFAULT = initClass();
  
      /** Initialization method for static CLASS_DEFAULT attribute */
      private static Class initClass()
      {
          Class c = null;
          try
          { 
              c = Class.forName(CLASSNAME_DEFAULT);
          }
          catch (Exception e)
          {
              Log.error("A FATAL ERROR has occurred which should not" +
                  "have happened under any circumstance.  Please notify" +
                  "Turbine and give as many details as possible including the " +
                  "error stacktrace.", e);
          }
          return c;
      }
  
  
      /**
       * Get the list of objects for a ResultSet.  Please not that your
       * resultset MUST return columns in the right order.  You can use
       * getFieldNames() in BaseObject to get the correct sequence.
       */
      public static Vector resultSet2Objects (java.sql.ResultSet results) throws Exception
      {
          QueryDataSet qds = null;
          Vector rows = null;
          try
          {
              qds = new QueryDataSet( results );
              rows = getSelectResults( qds );
          }
          finally
          {
              if (qds != null) qds.close();
          }
  
          return populateObjects (rows);
  
      }
  
  
  
      /** Method to do inserts */
      public static ObjectKey doInsert( Criteria criteria ) throws Exception
      {
                                                                                                                     return BasePeer.doInsert( criteria );
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert(Criteria) method.  It will take care of 
       * the connection details internally. 
       */
      public static ObjectKey doInsert( Criteria criteria, DBConnection dbCon ) 
          throws Exception
      {
                                                                                                                     return BasePeer.doInsert( criteria, dbCon );
      }
  
      /** Add all the columns needed to create a new object */
      public static void addSelectColumns (Criteria criteria) throws Exception
      {
              criteria.addSelectColumn( PSML_ID );
              criteria.addSelectColumn( ROLE_NAME );
              criteria.addSelectColumn( MEDIA_TYPE );
              criteria.addSelectColumn( LANGUAGE );
              criteria.addSelectColumn( COUNTRY );
              criteria.addSelectColumn( PAGE );
              criteria.addSelectColumn( PROFILE );
          }
  
  
      /** 
       * Create a new object of type cls from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static JetspeedRoleProfile row2Object (Record row, 
                                                int offset, 
                                                Class cls ) 
          throws Exception
      {
          JetspeedRoleProfile obj = (JetspeedRoleProfile)cls.newInstance();
          populateObject(row, offset, obj);
                      obj.setModified(false);
                  obj.setNew(false);
  
          return obj;
      }
  
      /** 
       * Populates an object from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static void populateObject (Record row, 
                                         int offset, 
                                         JetspeedRoleProfile obj ) 
          throws Exception
      {
                                                          obj.setPsmlId(
                  new NumberKey(row.getValue(offset+0).asBigDecimal()));
                                                                              obj.setRoleName(row.getValue(offset+1).asString());
                                                                              obj.setMediaType(row.getValue(offset+2).asString());
                                                                              obj.setLanguage(row.getValue(offset+3).asString());
                                                                              obj.setCountry(row.getValue(offset+4).asString());
                                                                              obj.setPage(row.getValue(offset+5).asString());
                                                                              obj.setProfile(row.getValue(offset+6).asBytes());
                                          }
  
      /** Method to do selects */
      public static Vector doSelect( Criteria criteria ) throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria) ); 
      }
  
  
      /** Method to do selects within a transaction */
      public static Vector doSelect( Criteria criteria, 
                                     DBConnection dbCon ) 
          throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria, dbCon) ); 
      }
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method handles connections internally.  The Record objects
       * returned by this method should be considered readonly.  Do not
       * alter the data and call save(), your results may vary, but are
       * certainly likely to result in hard to track MT bugs.
       */
      public static Vector doSelectVillageRecords( Criteria criteria ) 
          throws Exception
      {
              if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
                                                                                                         
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria);
      }
  
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method should be used for transactions 
       */
      public static Vector doSelectVillageRecords( Criteria criteria, 
                                                   DBConnection dbCon ) 
          throws Exception
      {
          if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
                                                                                                         
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria, dbCon);
      }
  
      /** 
       * The returned vector will contain objects of the default type or
       * objects that inherit from the default.
       */
      public static Vector populateObjects(Vector records) 
          throws Exception
      {
          Vector results = new Vector(records.size());
  
          // populate the object(s)
          for ( int i=0; i<records.size(); i++ )
          {
              Record row = (Record)records.elementAt(i);
              results.add(JetspeedRoleProfilePeer.row2Object(row, 1,
                  JetspeedRoleProfilePeer.getOMClass()));
          }
          return results;
      }
   
  
      /** 
       * The class that the Peer will make instances of. 
       * If the BO is abstract then you must implement this method
       * in the BO.
       */
      public static Class getOMClass() 
          throws Exception
      {
              return CLASS_DEFAULT;
          }
  
  
      /**
       * Method to do updates. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria) throws Exception
      {
              Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
                                  selectCriteria.put( PSML_ID, criteria.remove(PSML_ID) );
                                                                                                                                                                   BasePeer.doUpdate( selectCriteria, criteria );
      }
  
      /** 
       * Method to do updates.  This method is to be used during a transaction,
       * otherwise use the doUpdate(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria, DBConnection dbCon) throws Exception
      {
              Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
                                  selectCriteria.put( PSML_ID, criteria.remove(PSML_ID) );
                                                                                                                                                                   BasePeer.doUpdate( selectCriteria, criteria, dbCon );
       }
  
      /** 
       * Method to do deletes.
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria) throws Exception
       {
                                                                                                                      BasePeer.doDelete ( criteria );
       }
  
      /** 
       * Method to do deletes.  This method is to be used during a transaction,
       * otherwise use the doDelete(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria, DBConnection dbCon) throws Exception
       {
                                                                                                                      BasePeer.doDelete ( criteria, dbCon );
       }
  
      /** Method to do inserts */
      public static void doInsert( JetspeedRoleProfile obj ) throws Exception
      {
                  obj.setPrimaryKey(doInsert(buildCriteria(obj)));
                  obj.setNew(false);
      }
  
      /**
       * @param obj the data object to update in the database.
       */
      public static void doUpdate(JetspeedRoleProfile obj) throws Exception
      {
          doUpdate(buildCriteria(obj));
      }
      /**
       * @param obj the data object to delete in the database.
       */
      public static void doDelete(JetspeedRoleProfile obj) throws Exception
      {
          doDelete(buildCriteria(obj));
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert(JetspeedRoleProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to insert into the database.
       */
      public static void doInsert( JetspeedRoleProfile obj, DBConnection dbCon) throws Exception
      {
                  obj.setPrimaryKey(doInsert(buildCriteria(obj), dbCon));
                  obj.setNew(false);
      }
  
      /**
       * Method to do update.  This method is to be used during a transaction,
       * otherwise use the doUpdate(JetspeedRoleProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to update in the database.
       */
      public static void doUpdate(JetspeedRoleProfile obj, DBConnection dbCon) throws Exception
      {
          doUpdate(buildCriteria(obj), dbCon);
      }
      /**
       * Method to delete.  This method is to be used during a transaction,
       * otherwise use the doDelete(JetspeedRoleProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to delete in the database.
       */
      public static void doDelete(JetspeedRoleProfile obj, DBConnection dbCon) throws Exception
      {
          doDelete(buildCriteria(obj), dbCon);
      }
  
      /** Build a Criteria object from the data object for this peer */
      public static Criteria buildCriteria( JetspeedRoleProfile obj )
      {
          Criteria criteria = new Criteria();
                              if ( !obj.isNew() )
                         criteria.add( PSML_ID, obj.getPsmlId() );
                                  criteria.add( ROLE_NAME, obj.getRoleName() );
                                  criteria.add( MEDIA_TYPE, obj.getMediaType() );
                                  criteria.add( LANGUAGE, obj.getLanguage() );
                                  criteria.add( COUNTRY, obj.getCountry() );
                                  criteria.add( PAGE, obj.getPage() );
                                  criteria.add( PROFILE, obj.getProfile() );
                  return criteria;
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       */
      public static JetspeedRoleProfile retrieveByPK( ObjectKey pk )
          throws Exception
      {
          DBConnection db = null;
          JetspeedRoleProfile retVal = null;
         try
          {
             db = TurbineDB.getConnection( mapBuilder.getDatabaseMap().getName() );
             retVal = retrieveByPK( pk, db );
          }
          finally
          {
             if (db != null)
                TurbineDB.releaseConnection(db);
          }
          return(retVal);
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       * @param DBConnection dbcon
       */
      public static JetspeedRoleProfile retrieveByPK( ObjectKey pk, DBConnection dbcon )
          throws Exception
      {
  
          Criteria criteria = new Criteria();
              criteria.add( PSML_ID, pk );
          Vector v = doSelect(criteria, dbcon);
          if ( v.size() != 1)
          {
              throw new Exception("Failed to select one and only one row.");
          }
          else
          {
              return (JetspeedRoleProfile)v.firstElement();
          }
      }
  
  
  
   
  
      
   
  
    
  
  
      /** 
       * Returns the TableMap related to this peer.  This method is not 
       * needed for general use but a specific application could have a
       * need.
       */
      protected static TableMap getTableMap()
      {
          return mapBuilder.getDatabaseMap().getTable(TABLE_NAME);
      }     
   
  
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/BaseJetspeedUserProfile.java
  
  Index: BaseJetspeedUserProfile.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  import org.apache.turbine.util.ObjectUtils;
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  /** 
   * You should not use this class directly.  It should not even be
   * extended all references should be to JetspeedUserProfile 
   */
  public abstract class BaseJetspeedUserProfile extends BaseObject
      implements Retrievable
  {
            /** the value for the psml_id field */
      private NumberKey psml_id;
            /** the value for the user_name field */
      private String user_name;
            /** the value for the media_type field */
      private String media_type;
            /** the value for the language field */
      private String language;
            /** the value for the country field */
      private String country;
            /** the value for the page field */
      private String page;
            /** the value for the profile field */
      private byte[] profile;
    
  
        /**
       * Get the PsmlId
       * @return NumberKey
       */
       public NumberKey getPsmlId()
       {
            return psml_id;
       }
  
                              
      /**
       * Set the value of PsmlId
       */
       public void setPsmlId(NumberKey v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.psml_id, v) )
          {
                         if (this.psml_id == null)
              {
                  this.psml_id = new NumberKey(v);
              }
              else
              {
                  this.psml_id.setValue(v);
              }
                        setModified(true);
          }
       }
  
       /**
      * Set the value of PsmlId as a string.
      */
      public void setPsmlId(String v ) 
      {
           setPsmlId(new NumberKey(v));
      }
    
      /**
       * Get the UserName
       * @return String
       */
       public String getUserName()
       {
            return user_name;
       }
  
                              
      /**
       * Set the value of UserName
       */
       public void setUserName(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.user_name, v) )
          {
                         this.user_name = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the MediaType
       * @return String
       */
       public String getMediaType()
       {
            return media_type;
       }
  
                              
      /**
       * Set the value of MediaType
       */
       public void setMediaType(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.media_type, v) )
          {
                         this.media_type = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Language
       * @return String
       */
       public String getLanguage()
       {
            return language;
       }
  
                              
      /**
       * Set the value of Language
       */
       public void setLanguage(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.language, v) )
          {
                         this.language = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Country
       * @return String
       */
       public String getCountry()
       {
            return country;
       }
  
                              
      /**
       * Set the value of Country
       */
       public void setCountry(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.country, v) )
          {
                         this.country = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Page
       * @return String
       */
       public String getPage()
       {
            return page;
       }
  
                              
      /**
       * Set the value of Page
       */
       public void setPage(String v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.page, v) )
          {
                         this.page = v;
                        setModified(true);
          }
       }
  
    
      /**
       * Get the Profile
       * @return byte[]
       */
       public byte[] getProfile()
       {
            return profile;
       }
  
                              
      /**
       * Set the value of Profile
       */
       public void setProfile(byte[] v ) 
       {
    
    
  
           if ( !ObjectUtils.equals(this.profile, v) )
          {
                         this.profile = v;
                        setModified(true);
          }
       }
  
    
  
   
      
          
      
      private static Vector fieldNames_ = null;
  
      /**
       * Generate a list of field names.
       */
      public static synchronized List getFieldNames()
      {
        if (fieldNames_ == null)
        {
          fieldNames_ = new Vector();
              fieldNames_.add("PsmlId");
              fieldNames_.add("UserName");
              fieldNames_.add("MediaType");
              fieldNames_.add("Language");
              fieldNames_.add("Country");
              fieldNames_.add("Page");
              fieldNames_.add("Profile");
            }
        return fieldNames_;
      }
  
      /**
       * Retrieves a field from the object by name passed in
       * as a String.
       */
      public Object getByName(String name)
      {
              if (name.equals("PsmlId"))
  	{
  	  	    return getPsmlId();
  	  	}
              if (name.equals("UserName"))
  	{
  	  	    return getUserName();
  	  	}
              if (name.equals("MediaType"))
  	{
  	  	    return getMediaType();
  	  	}
              if (name.equals("Language"))
  	{
  	  	    return getLanguage();
  	  	}
              if (name.equals("Country"))
  	{
  	  	    return getCountry();
  	  	}
              if (name.equals("Page"))
  	{
  	  	    return getPage();
  	  	}
              if (name.equals("Profile"))
  	{
  	  	    return getProfile();
  	  	}
              return null; 
      }
      /**
       * Retrieves a field from the object by name passed in
       * as a String.  The String must be one of the static
       * Strings defined in this Class' Peer.
       */
      public Object getByPeerName(String name)
      {
              if (name.equals(JetspeedUserProfilePeer.PSML_ID ))
  	    {
  	  	    return getPsmlId();
  	  	}
              if (name.equals(JetspeedUserProfilePeer.USER_NAME ))
  	    {
  	  	    return getUserName();
  	  	}
              if (name.equals(JetspeedUserProfilePeer.MEDIA_TYPE ))
  	    {
  	  	    return getMediaType();
  	  	}
              if (name.equals(JetspeedUserProfilePeer.LANGUAGE ))
  	    {
  	  	    return getLanguage();
  	  	}
              if (name.equals(JetspeedUserProfilePeer.COUNTRY ))
  	    {
  	  	    return getCountry();
  	  	}
              if (name.equals(JetspeedUserProfilePeer.PAGE ))
  	    {
  	  	    return getPage();
  	  	}
              if (name.equals(JetspeedUserProfilePeer.PROFILE ))
  	    {
  	  	    return getProfile();
  	  	}
              return null; 
      }
  
      /**
       * Retrieves a field from the object by Position as specified
       * in the xml schema.  Zero-based.
       */
      public Object getByPosition(int pos)
      {
              if ( pos == 0 )
  	{
  	  	    return getPsmlId();
  	  	}
              if ( pos == 1 )
  	{
  	  	    return getUserName();
  	  	}
              if ( pos == 2 )
  	{
  	  	    return getMediaType();
  	  	}
              if ( pos == 3 )
  	{
  	  	    return getLanguage();
  	  	}
              if ( pos == 4 )
  	{
  	  	    return getCountry();
  	  	}
              if ( pos == 5 )
  	{
  	  	    return getPage();
  	  	}
              if ( pos == 6 )
  	{
  	  	    return getProfile();
  	  	}
                  return null; 
      }
  
       	
  
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save() throws Exception
      {
               save(JetspeedUserProfilePeer.getMapBuilder()
                  .getDatabaseMap().getName());
       }
  
      /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.
       */
      public void save(String dbName) throws Exception
      {
          DBConnection dbCon = null;
           try
          {
              dbCon = BasePeer.beginTransaction(dbName);
              save(dbCon);
          }
          catch(Exception e)
          {
              BasePeer.rollBackTransaction(dbCon);
              throw e;
          }
          BasePeer.commitTransaction(dbCon);
  
       }
  
        // flag to prevent endless save loop, if this object is referenced
      // by another object which falls in this transaction.
      private boolean alreadyInSave = false;
        /**
       * Stores the object in the database.  If the object is new,
       * it inserts it; otherwise an update is performed.  This method
       * is meant to be used as part of a transaction, otherwise use
       * the save() method and the connection details will be handled
       * internally
       */
      public void save(DBConnection dbCon) throws Exception
      {
          if (!alreadyInSave)
        {
          alreadyInSave = true;
            if (isModified())
          {
              if (isNew())
              {
                  JetspeedUserProfilePeer.doInsert((JetspeedUserProfile)this, dbCon);
                  setNew(false);
              }
              else
              {
                  JetspeedUserProfilePeer.doUpdate((JetspeedUserProfile)this, dbCon);
              }
          }
  
                alreadyInSave = false;
        }
        }
  
  
                  
      
      
  
          /** 
       * Set the PrimaryKey using ObjectKey.
       *
       * @param ObjectKey psml_id
       */
      public void setPrimaryKey(ObjectKey psml_id) 
           {
           setPsmlId((NumberKey)psml_id);
      }
  
      /** 
       * Set the PrimaryKey using a String.
       */
      public void setPrimaryKey(String key) 
      {
          setPsmlId(new NumberKey(key) );
      }
  
  
  
      /** 
       * returns an id that differentiates this object from others
       * of its class.
       */
      public ObjectKey getPrimaryKey() 
      {
          return getPsmlId();
      }
  
   
      /** 
       * get an id that differentiates this object from others
       * of its class.
       */
      public String getQueryKey() 
      {
          if (getPrimaryKey() == null)
          {
              return "";
          }
          else
          {
              return getPrimaryKey().toString();
          }
      }
  
      /** 
       * set an id that differentiates this object from others
       * of its class.
       */
      public void setQueryKey(String key) 
          throws Exception
      {
          setPrimaryKey(key);
      }
  
      /**
       * Makes a copy of this object.  
       * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
       * related objects to isNew=true.
       */
      public JetspeedUserProfile copy() throws Exception
      {
          JetspeedUserProfile copyObj = new JetspeedUserProfile();
          copyObj.setPsmlId(psml_id);
          copyObj.setUserName(user_name);
          copyObj.setMediaType(media_type);
          copyObj.setLanguage(language);
          copyObj.setCountry(country);
          copyObj.setPage(page);
          copyObj.setProfile(profile);
  
  
      
              copyObj.setPsmlId((NumberKey)null);
                                      return copyObj;
      }
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/BaseJetspeedUserProfilePeer.java
  
  Index: BaseJetspeedUserProfilePeer.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  import java.util.*;
  import java.math.*;
  import java.sql.*;
  import com.workingdogs.village.*;
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.TurbineException;
  
  // Local classes
  import org.apache.jetspeed.om.dbpsml.map.*;
  
  /**
   */
  public abstract class BaseJetspeedUserProfilePeer 
      extends org.apache.turbine.om.peer.BasePeer
  {
  
      /** the mapbuilder for this class */
      private static final JetspeedUserProfileMapBuilder mapBuilder = 
          (JetspeedUserProfileMapBuilder)getMapBuilder(JetspeedUserProfileMapBuilder.CLASS_NAME);
  
      /** the table name for this class */
      public static final String TABLE_NAME = mapBuilder.getTable();
  
      /** 
       * @return the map builder for this peer
       */
      public static MapBuilder getMapBuilder()
      {
         return(mapBuilder);
      }
  
      /** the column name for the PSML_ID field */
      public static final String PSML_ID = mapBuilder.getJetspeedUserProfile_PsmlId();
      /** the column name for the USER_NAME field */
      public static final String USER_NAME = mapBuilder.getJetspeedUserProfile_UserName();
      /** the column name for the MEDIA_TYPE field */
      public static final String MEDIA_TYPE = mapBuilder.getJetspeedUserProfile_MediaType();
      /** the column name for the LANGUAGE field */
      public static final String LANGUAGE = mapBuilder.getJetspeedUserProfile_Language();
      /** the column name for the COUNTRY field */
      public static final String COUNTRY = mapBuilder.getJetspeedUserProfile_Country();
      /** the column name for the PAGE field */
      public static final String PAGE = mapBuilder.getJetspeedUserProfile_Page();
      /** the column name for the PROFILE field */
      public static final String PROFILE = mapBuilder.getJetspeedUserProfile_Profile();
  
   
      /** number of columns for this peer */
      public static final int numColumns =  7;
  
      /** A class that can be returned by this peer. */
      protected static final String CLASSNAME_DEFAULT = 
          "org.apache.jetspeed.om.dbpsml.JetspeedUserProfile";
  
      /** A class that can be returned by this peer. */
      protected static final Class CLASS_DEFAULT = initClass();
  
      /** Initialization method for static CLASS_DEFAULT attribute */
      private static Class initClass()
      {
          Class c = null;
          try
          { 
              c = Class.forName(CLASSNAME_DEFAULT);
          }
          catch (Exception e)
          {
              Log.error("A FATAL ERROR has occurred which should not" +
                  "have happened under any circumstance.  Please notify" +
                  "Turbine and give as many details as possible including the " +
                  "error stacktrace.", e);
          }
          return c;
      }
  
  
      /**
       * Get the list of objects for a ResultSet.  Please not that your
       * resultset MUST return columns in the right order.  You can use
       * getFieldNames() in BaseObject to get the correct sequence.
       */
      public static Vector resultSet2Objects (java.sql.ResultSet results) throws Exception
      {
          QueryDataSet qds = null;
          Vector rows = null;
          try
          {
              qds = new QueryDataSet( results );
              rows = getSelectResults( qds );
          }
          finally
          {
              if (qds != null) qds.close();
          }
  
          return populateObjects (rows);
  
      }
  
  
  
      /** Method to do inserts */
      public static ObjectKey doInsert( Criteria criteria ) throws Exception
      {
                                                                                                                     return BasePeer.doInsert( criteria );
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert(Criteria) method.  It will take care of 
       * the connection details internally. 
       */
      public static ObjectKey doInsert( Criteria criteria, DBConnection dbCon ) 
          throws Exception
      {
                                                                                                                     return BasePeer.doInsert( criteria, dbCon );
      }
  
      /** Add all the columns needed to create a new object */
      public static void addSelectColumns (Criteria criteria) throws Exception
      {
              criteria.addSelectColumn( PSML_ID );
              criteria.addSelectColumn( USER_NAME );
              criteria.addSelectColumn( MEDIA_TYPE );
              criteria.addSelectColumn( LANGUAGE );
              criteria.addSelectColumn( COUNTRY );
              criteria.addSelectColumn( PAGE );
              criteria.addSelectColumn( PROFILE );
          }
  
  
      /** 
       * Create a new object of type cls from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static JetspeedUserProfile row2Object (Record row, 
                                                int offset, 
                                                Class cls ) 
          throws Exception
      {
          JetspeedUserProfile obj = (JetspeedUserProfile)cls.newInstance();
          populateObject(row, offset, obj);
                      obj.setModified(false);
                  obj.setNew(false);
  
          return obj;
      }
  
      /** 
       * Populates an object from a resultset row starting
       * from a specified offset.  This is done so that you can select
       * other rows than just those needed for this object.  You may
       * for example want to create two objects from the same row.
       */
      public static void populateObject (Record row, 
                                         int offset, 
                                         JetspeedUserProfile obj ) 
          throws Exception
      {
                                                          obj.setPsmlId(
                  new NumberKey(row.getValue(offset+0).asBigDecimal()));
                                                                              obj.setUserName(row.getValue(offset+1).asString());
                                                                              obj.setMediaType(row.getValue(offset+2).asString());
                                                                              obj.setLanguage(row.getValue(offset+3).asString());
                                                                              obj.setCountry(row.getValue(offset+4).asString());
                                                                              obj.setPage(row.getValue(offset+5).asString());
                                                                              obj.setProfile(row.getValue(offset+6).asBytes());
                                          }
  
      /** Method to do selects */
      public static Vector doSelect( Criteria criteria ) throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria) ); 
      }
  
  
      /** Method to do selects within a transaction */
      public static Vector doSelect( Criteria criteria, 
                                     DBConnection dbCon ) 
          throws Exception
      {
          return populateObjects( doSelectVillageRecords(criteria, dbCon) ); 
      }
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method handles connections internally.  The Record objects
       * returned by this method should be considered readonly.  Do not
       * alter the data and call save(), your results may vary, but are
       * certainly likely to result in hard to track MT bugs.
       */
      public static Vector doSelectVillageRecords( Criteria criteria ) 
          throws Exception
      {
              if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
                                                                                                         
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria);
      }
  
  
      /** 
       * Grabs the raw Village records to be formed into objects.
       * This method should be used for transactions 
       */
      public static Vector doSelectVillageRecords( Criteria criteria, 
                                                   DBConnection dbCon ) 
          throws Exception
      {
          if (criteria.getSelectColumns().size() == 0)
          {
              addSelectColumns ( criteria );
          }
  
                                                                                                         
          // BasePeer returns a Vector of Value (Village) arrays.  The array
          // order follows the order columns were placed in the Select clause.
          return BasePeer.doSelect(criteria, dbCon);
      }
  
      /** 
       * The returned vector will contain objects of the default type or
       * objects that inherit from the default.
       */
      public static Vector populateObjects(Vector records) 
          throws Exception
      {
          Vector results = new Vector(records.size());
  
          // populate the object(s)
          for ( int i=0; i<records.size(); i++ )
          {
              Record row = (Record)records.elementAt(i);
              results.add(JetspeedUserProfilePeer.row2Object(row, 1,
                  JetspeedUserProfilePeer.getOMClass()));
          }
          return results;
      }
   
  
      /** 
       * The class that the Peer will make instances of. 
       * If the BO is abstract then you must implement this method
       * in the BO.
       */
      public static Class getOMClass() 
          throws Exception
      {
              return CLASS_DEFAULT;
          }
  
  
      /**
       * Method to do updates. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria) throws Exception
      {
              Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
                                  selectCriteria.put( PSML_ID, criteria.remove(PSML_ID) );
                                                                                                                                                                   BasePeer.doUpdate( selectCriteria, criteria );
      }
  
      /** 
       * Method to do updates.  This method is to be used during a transaction,
       * otherwise use the doUpdate(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used to create the UPDATE statement.
       */
      public static void doUpdate(Criteria criteria, DBConnection dbCon) throws Exception
      {
              Criteria selectCriteria = new
              Criteria(mapBuilder.getDatabaseMap().getName(), 2);
                                  selectCriteria.put( PSML_ID, criteria.remove(PSML_ID) );
                                                                                                                                                                   BasePeer.doUpdate( selectCriteria, criteria, dbCon );
       }
  
      /** 
       * Method to do deletes.
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria) throws Exception
       {
                                                                                                                      BasePeer.doDelete ( criteria );
       }
  
      /** 
       * Method to do deletes.  This method is to be used during a transaction,
       * otherwise use the doDelete(Criteria) method.  It will take care of 
       * the connection details internally. 
       *
       * @param Criteria object containing data that is used DELETE from database.
       */
       public static void doDelete(Criteria criteria, DBConnection dbCon) throws Exception
       {
                                                                                                                      BasePeer.doDelete ( criteria, dbCon );
       }
  
      /** Method to do inserts */
      public static void doInsert( JetspeedUserProfile obj ) throws Exception
      {
                  obj.setPrimaryKey(doInsert(buildCriteria(obj)));
                  obj.setNew(false);
      }
  
      /**
       * @param obj the data object to update in the database.
       */
      public static void doUpdate(JetspeedUserProfile obj) throws Exception
      {
          doUpdate(buildCriteria(obj));
      }
      /**
       * @param obj the data object to delete in the database.
       */
      public static void doDelete(JetspeedUserProfile obj) throws Exception
      {
          doDelete(buildCriteria(obj));
      }
  
      /** 
       * Method to do inserts.  This method is to be used during a transaction,
       * otherwise use the doInsert(JetspeedUserProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to insert into the database.
       */
      public static void doInsert( JetspeedUserProfile obj, DBConnection dbCon) throws Exception
      {
                  obj.setPrimaryKey(doInsert(buildCriteria(obj), dbCon));
                  obj.setNew(false);
      }
  
      /**
       * Method to do update.  This method is to be used during a transaction,
       * otherwise use the doUpdate(JetspeedUserProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to update in the database.
       */
      public static void doUpdate(JetspeedUserProfile obj, DBConnection dbCon) throws Exception
      {
          doUpdate(buildCriteria(obj), dbCon);
      }
      /**
       * Method to delete.  This method is to be used during a transaction,
       * otherwise use the doDelete(JetspeedUserProfile) method.  It will take 
       * care of the connection details internally. 
       *
       * @param obj the data object to delete in the database.
       */
      public static void doDelete(JetspeedUserProfile obj, DBConnection dbCon) throws Exception
      {
          doDelete(buildCriteria(obj), dbCon);
      }
  
      /** Build a Criteria object from the data object for this peer */
      public static Criteria buildCriteria( JetspeedUserProfile obj )
      {
          Criteria criteria = new Criteria();
                              if ( !obj.isNew() )
                         criteria.add( PSML_ID, obj.getPsmlId() );
                                  criteria.add( USER_NAME, obj.getUserName() );
                                  criteria.add( MEDIA_TYPE, obj.getMediaType() );
                                  criteria.add( LANGUAGE, obj.getLanguage() );
                                  criteria.add( COUNTRY, obj.getCountry() );
                                  criteria.add( PAGE, obj.getPage() );
                                  criteria.add( PROFILE, obj.getProfile() );
                  return criteria;
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       */
      public static JetspeedUserProfile retrieveByPK( ObjectKey pk )
          throws Exception
      {
          DBConnection db = null;
          JetspeedUserProfile retVal = null;
         try
          {
             db = TurbineDB.getConnection( mapBuilder.getDatabaseMap().getName() );
             retVal = retrieveByPK( pk, db );
          }
          finally
          {
             if (db != null)
                TurbineDB.releaseConnection(db);
          }
          return(retVal);
      }
  
      /** 
       * Retrieve a single object by pk
       *
       * @param ObjectKey pk
       * @param DBConnection dbcon
       */
      public static JetspeedUserProfile retrieveByPK( ObjectKey pk, DBConnection dbcon )
          throws Exception
      {
  
          Criteria criteria = new Criteria();
              criteria.add( PSML_ID, pk );
          Vector v = doSelect(criteria, dbcon);
          if ( v.size() != 1)
          {
              throw new Exception("Failed to select one and only one row.");
          }
          else
          {
              return (JetspeedUserProfile)v.firstElement();
          }
      }
  
  
  
   
  
      
   
  
    
  
  
      /** 
       * Returns the TableMap related to this peer.  This method is not 
       * needed for general use but a specific application could have a
       * need.
       */
      protected static TableMap getTableMap()
      {
          return mapBuilder.getDatabaseMap().getTable(TABLE_NAME);
      }     
   
  
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedAnonProfile.java
  
  Index: JetspeedAnonProfile.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  
  // JDK classes
  import java.util.*;
  
  // Turbine classes
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  import org.apache.turbine.util.ObjectUtils;
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  /** 
    * You should add additional methods to this class to meet the
    * application requirements.  This class will only be generated as
    * long as it does not already exist in the output directory.
    */
  public  class JetspeedAnonProfile 
      extends org.apache.jetspeed.om.dbpsml.BaseJetspeedAnonProfile
      implements Persistent
  {
  }
  
  
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedAnonProfilePeer.java
  
  Index: JetspeedAnonProfilePeer.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  // JDK classes
  import java.util.*;
  
  // Village classes
  import com.workingdogs.village.*;
  
  // Turbine classes
  import org.apache.turbine.om.security.*;
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  import org.apache.turbine.util.db.Criteria;
  
  // Local classes
  import org.apache.jetspeed.om.dbpsml.map.*;
  
  import org.apache.jetspeed.om.profile.Profile;
  import org.apache.jetspeed.om.profile.ProfileLocator;
  import org.apache.jetspeed.services.psmlmanager.db.DBOperations;
  import org.apache.jetspeed.services.psmlmanager.db.DBUtils;
  
  /** 
    *
    * @author <a href="mailto:adambalk@cisco.com">Atul Dambalkar</a>
    */
  public class JetspeedAnonProfilePeer 
      extends org.apache.jetspeed.om.dbpsml.BaseJetspeedAnonProfilePeer
      implements DBOperations
  {
   
      /**
       * Default constructor.
       */
      public JetspeedAnonProfilePeer() {}
       
   
      /**
       * Insert anonymous profile record in the database table.
       *
       * @param profile Profile object that will be inserted in the database
       */
      public void insert(Profile profile) throws Exception
      {
          doInsertOrUpdate(profile, INSERT);
      }
  
      /**
       * Update anonymous profile record from the database table.
       *
       * @param profile Profile object that will be deleted from the database
       */
      public void update(Profile profile) throws Exception
      {
          doInsertOrUpdate(profile, UPDATE);
      }
  
      private void doInsertOrUpdate(Profile profile, int operation) 
                             throws Exception
      {
          JetspeedAnonProfile anonProfile = new JetspeedAnonProfile();
  
          anonProfile.setMediaType(profile.getMediaType());
          anonProfile.setLanguage(profile.getLanguage());
          anonProfile.setCountry(profile.getCountry());
          anonProfile.setPage(profile.getName());
          anonProfile.setProfile(DBUtils.portletsToBytes(
                                         profile.getDocument().getPortlets()));
  
          if (operation == INSERT)
          {
              super.doInsert(anonProfile);
          }
          else if (operation == UPDATE)
          {
              super.doUpdate(anonProfile);
          }
      }
  
      /**
       * Delete anonymous profile record from the database table for the given
       * locator object.
       *
       * @param profile Profile object that will be deleted from the database
       */
      public void delete(ProfileLocator locator) throws Exception
      {
          JetspeedAnonProfile anonProfile = new JetspeedAnonProfile();
  
          anonProfile.setMediaType(locator.getMediaType());
          anonProfile.setLanguage(locator.getLanguage());
          anonProfile.setCountry(locator.getCountry());
          anonProfile.setPage(locator.getName());
  
          super.doDelete(anonProfile);
      }
  
      /**
       * Select anonymous profile record from the database table for the given
       * locator object.
       *
       * @param locator ProfileLocator object that will be used to select required
       * profile from the database
       * @return Vector of records that statisfy the given locator criteria.
       */
      public Vector select(ProfileLocator locator) throws Exception
      {
          Criteria criteria = new Criteria();
  
          String mediaType = locator.getMediaType();
          String language = locator.getLanguage();
          String country = locator.getCountry();
          String pageName = locator.getName();
  
          if (pageName != null && pageName.length() > 0) 
          {
              criteria.add(PAGE, pageName);
          }
          
          if (mediaType != null && mediaType.length() > 0) 
          {
              criteria.add(MEDIA_TYPE, locator.getMediaType());
          }
  
          if (language != null && language.length() > 0) 
          {
               criteria.add(LANGUAGE, locator.getLanguage());
          }
  
          if (country != null && country.length() > 0) 
          {
              criteria.add(COUNTRY, locator.getCountry());
          }
  
          return super.doSelect(criteria);
      }
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedGroupProfile.java
  
  Index: JetspeedGroupProfile.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  
  // JDK classes
  import java.util.*;
  
  // Turbine classes
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  import org.apache.turbine.util.ObjectUtils;
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  /** 
    * You should add additional methods to this class to meet the
    * application requirements.  This class will only be generated as
    * long as it does not already exist in the output directory.
    */
  public  class JetspeedGroupProfile 
      extends org.apache.jetspeed.om.dbpsml.BaseJetspeedGroupProfile
      implements Persistent
  {
  }
  
  
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedGroupProfilePeer.java
  
  Index: JetspeedGroupProfilePeer.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  // JDK classes
  import java.util.*;
  
  // Village classes
  import com.workingdogs.village.*;
  
  // Turbine classes
  import org.apache.turbine.om.security.*;
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  // Local classes
  import org.apache.jetspeed.om.dbpsml.map.*;
  
  import org.apache.jetspeed.om.profile.Profile;
  import org.apache.jetspeed.om.profile.ProfileLocator;
  import org.apache.jetspeed.services.psmlmanager.db.DBOperations;
  import org.apache.jetspeed.services.psmlmanager.db.DBUtils;
  
  /** 
    * The skeleton for this class was autogenerated by Torque on:
    *
    * [Mon Sep 10 13:30:53 PDT 2001]
    *
    *  You should add additional methods to this class to meet the
    *  application requirements.  This class will only be generated as
    *  long as it does not already exist in the output directory.
    *
    * @author <a href="mailto:adambalk@cisco.com">Atul Dambalkar</a>
    */
  public class JetspeedGroupProfilePeer 
      extends org.apache.jetspeed.om.dbpsml.BaseJetspeedGroupProfilePeer
      implements DBOperations
  {
   
      /**
       * Default constructor.
       */
      public JetspeedGroupProfilePeer() {}
       
   
      /**
       * Insert a group profile record in the database table.
       *
       * @param profile Profile object that will be inserted in the database
       */
      public void insert(Profile profile) throws Exception
      {
          doInsertOrUpdate(profile, INSERT);
      }
  
      /**
       * Update group profile record from the database table.
       *
       * @param profile Profile object that will be deleted from the database
       */
      public void update(Profile profile) throws Exception
      {
          doInsertOrUpdate(profile, UPDATE);
      }
  
  
      private void doInsertOrUpdate(Profile profile, int operation)
                             throws Exception
      {
          JetspeedGroupProfile groupProfile = new JetspeedGroupProfile();
  
          groupProfile.setGroupName(profile.getGroup().getName());
          groupProfile.setMediaType(profile.getMediaType());
          groupProfile.setLanguage(profile.getLanguage());
          groupProfile.setCountry(profile.getCountry());
          groupProfile.setPage(profile.getName());
          groupProfile.setProfile(DBUtils.portletsToBytes(
                                          profile.getDocument().getPortlets()));
  
          if (operation == INSERT) 
          {
              super.doInsert(groupProfile);
          }
          else if (operation == UPDATE) 
          {
              super.doUpdate(groupProfile);
          }
      }
  
  
      /**
       * Delete group profile record from the database table.
       *  
       * @param profile Profile object that will be deleted from the database
       */ 
      public void delete(ProfileLocator locator) throws Exception
      {   
          JetspeedGroupProfile groupProfile = new JetspeedGroupProfile();
   
          groupProfile.setGroupName(locator.getGroup().getName());
          groupProfile.setMediaType(locator.getMediaType());
          groupProfile.setLanguage(locator.getLanguage());
          groupProfile.setCountry(locator.getCountry());
          groupProfile.setPage(locator.getName());
   
          super.doDelete(groupProfile);
      }
  
      /**
       * Select group profile record from the database table for the given
       * locator object.
       *
       * @param locator ProfileLocator object that will be used to select required
       * profile from the database
       * @return Vector of records that statisfy the given locator criteria.
       */
      public Vector select(ProfileLocator locator) throws Exception
      {
          Criteria criteria = new Criteria();
  
          String mediaType = locator.getMediaType();
          String language = locator.getLanguage();
          String country = locator.getCountry();
          String pageName = locator.getName();
          String groupName = null;
  
          Group group = locator.getGroup();
          if (group != null) {
              groupName = group.getName();
          }
  
          if (groupName != null && groupName.length() > 0) 
          {
              criteria.add(GROUP_NAME, groupName);
          }
  
          if (pageName != null && pageName.length() > 0) 
          {
              criteria.add(PAGE, pageName);
          }
          
          if (mediaType != null && mediaType.length() > 0) 
          {
              criteria.add(MEDIA_TYPE, locator.getMediaType());
          }
  
          if (language != null && language.length() > 0) 
          {
               criteria.add(LANGUAGE, locator.getLanguage());
          }
  
          if (country != null && country.length() > 0) 
          {
              criteria.add(COUNTRY, locator.getCountry());
          }
  
          return super.doSelect(criteria);
      }
  
      /** 
       * Delete all records from the database table for a group.
       *   
       * @param group Group object for which all the records will be deleted from the database
       */  
      public void delete(Group group) throws Exception
      {   
          Criteria criteria = new Criteria();
   
          criteria.add(GROUP_NAME, group.getName());
  
          super.doDelete(criteria);
      }
  
  
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedRoleProfile.java
  
  Index: JetspeedRoleProfile.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  
  // JDK classes
  import java.util.*;
  
  // Turbine classes
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  import org.apache.turbine.util.ObjectUtils;
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  /** 
    * You should add additional methods to this class to meet the
    * application requirements.  This class will only be generated as
    * long as it does not already exist in the output directory.
    */
  public  class JetspeedRoleProfile 
      extends org.apache.jetspeed.om.dbpsml.BaseJetspeedRoleProfile
      implements Persistent
  {
  }
  
  
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedRoleProfilePeer.java
  
  Index: JetspeedRoleProfilePeer.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  // JDK classes
  import java.util.*;
  
  // Village classes
  import com.workingdogs.village.*;
  
  // Turbine classes
  import org.apache.turbine.om.security.*;
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  // Local classes
  import org.apache.jetspeed.om.dbpsml.map.*;
  
  import org.apache.jetspeed.om.profile.Profile;
  import org.apache.jetspeed.om.profile.ProfileLocator;
  import org.apache.jetspeed.services.psmlmanager.db.DBOperations;
  import org.apache.jetspeed.services.psmlmanager.db.DBUtils;
  
  /** 
    * The skeleton for this class was autogenerated by Torque on:
    *
    * [Mon Sep 10 13:30:53 PDT 2001]
    *
    *  You should add additional methods to this class to meet the
    *  application requirements.  This class will only be generated as
    *  long as it does not already exist in the output directory.
    *
    * @author <a href="mailto:adambalk@cisco.com">Atul Dambalkar</a>
    */
  public class JetspeedRoleProfilePeer 
      extends org.apache.jetspeed.om.dbpsml.BaseJetspeedRoleProfilePeer
      implements DBOperations
  {
   
      /** 
       * Default constructor. 
       */ 
      public JetspeedRoleProfilePeer() {} 
        
   
      /** 
       * Insert a role profile record in the database table.
       * 
       * @param profile Profile object that will be inserted in the database 
       */
      public void insert(Profile profile) throws Exception
      {
          doInsertOrUpdate(profile, INSERT);
      }
  
      /**
       * Update role profile record from the database table.
       *
       * @param profile Profile object that will be deleted from the database
       */
      public void update(Profile profile) throws Exception
      {
          doInsertOrUpdate(profile, UPDATE);
      }
  
  
      private void doInsertOrUpdate(Profile profile, int operation)
                             throws Exception
      {
          JetspeedRoleProfile roleProfile = new JetspeedRoleProfile();
   
          roleProfile.setRoleName(profile.getRole().getName());
          roleProfile.setMediaType(profile.getMediaType());  
          roleProfile.setLanguage(profile.getLanguage()); 
          roleProfile.setCountry(profile.getCountry()); 
          roleProfile.setPage(profile.getName());
          roleProfile.setProfile(DBUtils.portletsToBytes(
                                         profile.getDocument().getPortlets()));
  
          if (operation == INSERT)
          {
              super.doInsert(roleProfile);
          }
          else if (operation == UPDATE)
          {
              super.doUpdate(roleProfile);
          }
      }   
   
      /** 
       * Delete role profile record from the database table. 
       *   
       * @param profile Profile object that will be deleted from the database 
       */  
      public void delete(ProfileLocator locator) throws Exception
      {   
          JetspeedRoleProfile roleProfile = new JetspeedRoleProfile(); 
    
          roleProfile.setRoleName(locator.getRole().getName());
          roleProfile.setMediaType(locator.getMediaType()); 
          roleProfile.setLanguage(locator.getLanguage()); 
          roleProfile.setCountry(locator.getCountry()); 
          roleProfile.setPage(locator.getName()); 
    
          super.doDelete(roleProfile); 
      }   
  
      /**
       * Select role profile record from the database table for the given
       * locator object.
       *
       * @param locator ProfileLocator object that will be used to select required
       * profile from the database
       * @return Vector of records that statisfy the given locator criteria.
       */
      public Vector select(ProfileLocator locator) throws Exception
      {
          Criteria criteria = new Criteria();
  
          String mediaType = locator.getMediaType();
          String language = locator.getLanguage();
          String country = locator.getCountry();
          String pageName = locator.getName();
          String roleName = null;
  
          Role role = locator.getRole();
          if (role != null) {
              roleName = role.getName();
          }
  
          if (roleName != null && roleName.length() > 0) 
          {
              criteria.add(ROLE_NAME, roleName);
          }
  
          if (pageName != null && pageName.length() > 0) 
          {
              criteria.add(PAGE, pageName);
          }
  
          if (mediaType != null && mediaType.length() > 0) 
          {
              criteria.add(MEDIA_TYPE, locator.getMediaType());
          }
  
          if (language != null && language.length() > 0) 
          {
               criteria.add(LANGUAGE, locator.getLanguage());
          }
  
          if (country != null && country.length() > 0) 
          {
              criteria.add(COUNTRY, locator.getCountry());
          }
          
          return super.doSelect(criteria);
      }
  
      /** 
       * Delete all records from the database table for a role.
       *   
       * @param role Role object for which all the records will be deleted from the database
       */  
      public void delete(Role role) throws Exception
      {   
          Criteria criteria = new Criteria();
   
          criteria.add(ROLE_NAME, role.getName());
  
          super.doDelete(criteria);
      }
  
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedUserProfile.java
  
  Index: JetspeedUserProfile.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  
  // JDK classes
  import java.util.*;
  
  // Turbine classes
  import org.apache.turbine.om.*;
  import org.apache.turbine.om.peer.BasePeer;
  import org.apache.turbine.util.db.Criteria;
  import org.apache.turbine.util.ObjectUtils;
  import org.apache.turbine.util.StringUtils;
  import org.apache.turbine.util.ParameterParser;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  /** 
    * You should add additional methods to this class to meet the
    * application requirements.  This class will only be generated as
    * long as it does not already exist in the output directory.
    */
  public  class JetspeedUserProfile 
      extends org.apache.jetspeed.om.dbpsml.BaseJetspeedUserProfile
      implements Persistent
  {
  }
  
  
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/JetspeedUserProfilePeer.java
  
  Index: JetspeedUserProfilePeer.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml;
  
  // JDK classes
  import java.util.*;
  
  // Jetspeed classes (Profiler)
  import org.apache.jetspeed.om.profile.Profile;
  
  // Jetspeed classes for Database PsmlManager implementation
  import org.apache.jetspeed.services.psmlmanager.db.DBUtils;
  
  // Village classes
  import com.workingdogs.village.*;
  
  // Turbine classes
  import org.apache.turbine.om.security.*;
  import org.apache.turbine.om.peer.*;
  import org.apache.turbine.util.*;
  import org.apache.turbine.util.db.*;
  import org.apache.turbine.util.db.map.*;
  import org.apache.turbine.util.db.pool.DBConnection;
  
  // Local classes
  import org.apache.jetspeed.om.dbpsml.map.*;
  
  import org.apache.jetspeed.om.profile.Profile;
  import org.apache.jetspeed.om.profile.ProfileLocator;
  import org.apache.jetspeed.services.psmlmanager.db.DBOperations;
  import org.apache.jetspeed.services.psmlmanager.db.DBUtils;
  
  /** 
    * The skeleton for this class was autogenerated by Torque on:
    *
    * [Mon Sep 10 13:30:53 PDT 2001]
    *
    *  You should add additional methods to this class to meet the
    *  application requirements.  This class will only be generated as
    *  long as it does not already exist in the output directory.
    *
    * @author <a href="mailto:adambalk@cisco.com">Atul Dambalkar</a>
    */
  public class JetspeedUserProfilePeer 
      extends org.apache.jetspeed.om.dbpsml.BaseJetspeedUserProfilePeer 
      implements DBOperations
  {
  
      /**
       * Default constructor. 
       */
      public JetspeedUserProfilePeer() {}
      
  
      /**
       * Insert a user profile record in the database table.
       *
       * @param profile Profile object that will be inserted in the database
       */
      public void insert(Profile profile) throws Exception
      {
          doInsertOrUpdate(profile, INSERT);
      }  
  
      /**
       * Insert a user profile record in the database table.
       *
       * @param profile Profile object that will be inserted in the database
       */
      public void update(Profile profile) throws Exception
      {
          doInsertOrUpdate(profile, UPDATE);
      }  
  
      private void doInsertOrUpdate(Profile profile, int operation) 
                           throws Exception 
      {
          JetspeedUserProfile userProfile = new JetspeedUserProfile();
  
          userProfile.setUserName(profile.getUser().getUserName());
          userProfile.setMediaType(profile.getMediaType());
          userProfile.setLanguage(profile.getLanguage());
          userProfile.setCountry(profile.getCountry());
          userProfile.setPage(profile.getName());
          userProfile.setProfile(DBUtils.portletsToBytes(
                                          profile.getDocument().getPortlets()));
  
          if (operation == INSERT) 
          {
              super.doInsert(userProfile);
          } 
          else if (operation == UPDATE) 
          {
              super.doUpdate(userProfile);
          } 
      }  
   
   
      /** 
       * Delete user profile record from the database table.
       *   
       * @param profile Profile object that will be deleted from the database
       */  
      public void delete(ProfileLocator locator) throws Exception
      {   
          JetspeedUserProfile userProfile = new JetspeedUserProfile();
   
          userProfile.setUserName(locator.getUser().getUserName());
          userProfile.setMediaType(locator.getMediaType());
          userProfile.setLanguage(locator.getLanguage());
          userProfile.setCountry(locator.getCountry());
          userProfile.setPage(locator.getName());
   
          super.doDelete(userProfile);
      }
  
      /**
       * Select user profile record from the database table for the given
       * locator object.
       *
       * @param locator ProfileLocator object that will be used to select required
       * profile from the database
       * @return Vector of records that statisfy the given locator criteria.
       */
      public Vector select(ProfileLocator locator) throws Exception
      {
          Criteria criteria = new Criteria();
  
          String mediaType = locator.getMediaType();
          String language = locator.getLanguage();
          String country = locator.getCountry();
          String pageName = locator.getName();
          String userName = null;
          User user= locator.getUser();
  
          if (user != null) {
              userName = user.getUserName();
          }
  
          if (userName != null && userName.length() > 0) 
          {
              criteria.add(USER_NAME, userName) ;
          }
  
          if (pageName != null && pageName.length() > 0) 
          {
              criteria.add(PAGE, pageName);
          }
  
          if (mediaType != null && mediaType.length() > 0) 
          {
              criteria.add(MEDIA_TYPE, mediaType);
          }
  
          if (language != null && language.length() > 0) 
          {
               criteria.add(LANGUAGE, language);
          }
  
          if (country != null && country.length() > 0) 
          {
              criteria.add(COUNTRY, country);
          }
          
          return super.doSelect(criteria);
      }
  
      /** 
       * Delete all records from the database table for a user.
       *   
       * @param user User object for which all the records will be deleted from the database
       */  
      public void delete(User user) throws Exception
      {   
          Criteria criteria = new Criteria(); 
  
          criteria.add(USER_NAME, user.getUserName());
   
          super.doDelete(criteria);
      }
  
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedAnonProfileMapBuilder.java
  
  Index: JetspeedAnonProfileMapBuilder.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml.map;
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.services.db.PoolBrokerService;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.db.map.MapBuilder;
  import org.apache.turbine.util.db.map.DatabaseMap;
  import org.apache.turbine.util.db.map.TableMap;
  
  /**
   */
  public class JetspeedAnonProfileMapBuilder implements MapBuilder
  {
      /** the name of this class */
      public static final String CLASS_NAME = "org.apache.jetspeed.om.dbpsml.map.JetspeedAnonProfileMapBuilder";
  
      /** item */
      public static String getTable( )
      {
          return "JETSPEED_ANON_PROFILE";
      }
  
  
      /** JETSPEED_ANON_PROFILE.PSML_ID */
      public static String getJetspeedAnonProfile_PsmlId()
      {
          return getTable() + ".PSML_ID";
      }
  
      /** JETSPEED_ANON_PROFILE.MEDIA_TYPE */
      public static String getJetspeedAnonProfile_MediaType()
      {
          return getTable() + ".MEDIA_TYPE";
      }
  
      /** JETSPEED_ANON_PROFILE.LANGUAGE */
      public static String getJetspeedAnonProfile_Language()
      {
          return getTable() + ".LANGUAGE";
      }
  
      /** JETSPEED_ANON_PROFILE.COUNTRY */
      public static String getJetspeedAnonProfile_Country()
      {
          return getTable() + ".COUNTRY";
      }
  
      /** JETSPEED_ANON_PROFILE.PAGE */
      public static String getJetspeedAnonProfile_Page()
      {
          return getTable() + ".PAGE";
      }
  
      /** JETSPEED_ANON_PROFILE.PROFILE */
      public static String getJetspeedAnonProfile_Profile()
      {
          return getTable() + ".PROFILE";
      }
  
      /**  the database map  */
      private DatabaseMap dbMap = null;
  
      /**
          tells us if this DatabaseMapBuilder is built so that we don't have
          to re-build it every time
      */
      public boolean isBuilt()
      {
          if ( dbMap != null )
              return true;
          return false;
      }
  
      /**  gets the databasemap this map builder built.  */
      public DatabaseMap getDatabaseMap()
      {
          return this.dbMap;
      }
      /** the doBuild() method builds the DatabaseMap */
      public void doBuild() throws Exception
      {
          dbMap = TurbineDB.getDatabaseMap("default");
  
          dbMap.addTable(getTable());
          TableMap tMap = dbMap.getTable(getTable());
  
                  tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
          
          tMap.setPrimaryKeyMethodInfo(tMap.getName());
  
  
                    tMap.addPrimaryKey ( getJetspeedAnonProfile_PsmlId(), new Integer(0) );
            
                    tMap.addColumn ( getJetspeedAnonProfile_MediaType(), new String() );
            
                    tMap.addColumn ( getJetspeedAnonProfile_Language(), new String() );
            
                    tMap.addColumn ( getJetspeedAnonProfile_Country(), new String() );
            
                    tMap.addColumn ( getJetspeedAnonProfile_Page(), new String() );
            
                    tMap.addColumn ( getJetspeedAnonProfile_Profile(), new Object() );
            
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedGroupProfileMapBuilder.java
  
  Index: JetspeedGroupProfileMapBuilder.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml.map;
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.services.db.PoolBrokerService;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.db.map.MapBuilder;
  import org.apache.turbine.util.db.map.DatabaseMap;
  import org.apache.turbine.util.db.map.TableMap;
  
  /**
   */
  public class JetspeedGroupProfileMapBuilder implements MapBuilder
  {
      /** the name of this class */
      public static final String CLASS_NAME = "org.apache.jetspeed.om.dbpsml.map.JetspeedGroupProfileMapBuilder";
  
      /** item */
      public static String getTable( )
      {
          return "JETSPEED_GROUP_PROFILE";
      }
  
  
      /** JETSPEED_GROUP_PROFILE.PSML_ID */
      public static String getJetspeedGroupProfile_PsmlId()
      {
          return getTable() + ".PSML_ID";
      }
  
      /** JETSPEED_GROUP_PROFILE.GROUP_NAME */
      public static String getJetspeedGroupProfile_GroupName()
      {
          return getTable() + ".GROUP_NAME";
      }
  
      /** JETSPEED_GROUP_PROFILE.MEDIA_TYPE */
      public static String getJetspeedGroupProfile_MediaType()
      {
          return getTable() + ".MEDIA_TYPE";
      }
  
      /** JETSPEED_GROUP_PROFILE.LANGUAGE */
      public static String getJetspeedGroupProfile_Language()
      {
          return getTable() + ".LANGUAGE";
      }
  
      /** JETSPEED_GROUP_PROFILE.COUNTRY */
      public static String getJetspeedGroupProfile_Country()
      {
          return getTable() + ".COUNTRY";
      }
  
      /** JETSPEED_GROUP_PROFILE.PAGE */
      public static String getJetspeedGroupProfile_Page()
      {
          return getTable() + ".PAGE";
      }
  
      /** JETSPEED_GROUP_PROFILE.PROFILE */
      public static String getJetspeedGroupProfile_Profile()
      {
          return getTable() + ".PROFILE";
      }
  
      /**  the database map  */
      private DatabaseMap dbMap = null;
  
      /**
          tells us if this DatabaseMapBuilder is built so that we don't have
          to re-build it every time
      */
      public boolean isBuilt()
      {
          if ( dbMap != null )
              return true;
          return false;
      }
  
      /**  gets the databasemap this map builder built.  */
      public DatabaseMap getDatabaseMap()
      {
          return this.dbMap;
      }
      /** the doBuild() method builds the DatabaseMap */
      public void doBuild() throws Exception
      {
          dbMap = TurbineDB.getDatabaseMap("default");
  
          dbMap.addTable(getTable());
          TableMap tMap = dbMap.getTable(getTable());
  
                  tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
          
          tMap.setPrimaryKeyMethodInfo(tMap.getName());
  
  
                    tMap.addPrimaryKey ( getJetspeedGroupProfile_PsmlId(), new Integer(0) );
            
                    tMap.addColumn ( getJetspeedGroupProfile_GroupName(), new String() );
            
                    tMap.addColumn ( getJetspeedGroupProfile_MediaType(), new String() );
            
                    tMap.addColumn ( getJetspeedGroupProfile_Language(), new String() );
            
                    tMap.addColumn ( getJetspeedGroupProfile_Country(), new String() );
            
                    tMap.addColumn ( getJetspeedGroupProfile_Page(), new String() );
            
                    tMap.addColumn ( getJetspeedGroupProfile_Profile(), new Object() );
            
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedRoleProfileMapBuilder.java
  
  Index: JetspeedRoleProfileMapBuilder.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml.map;
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.services.db.PoolBrokerService;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.db.map.MapBuilder;
  import org.apache.turbine.util.db.map.DatabaseMap;
  import org.apache.turbine.util.db.map.TableMap;
  
  /**
   */
  public class JetspeedRoleProfileMapBuilder implements MapBuilder
  {
      /** the name of this class */
      public static final String CLASS_NAME = "org.apache.jetspeed.om.dbpsml.map.JetspeedRoleProfileMapBuilder";
  
      /** item */
      public static String getTable( )
      {
          return "JETSPEED_ROLE_PROFILE";
      }
  
  
      /** JETSPEED_ROLE_PROFILE.PSML_ID */
      public static String getJetspeedRoleProfile_PsmlId()
      {
          return getTable() + ".PSML_ID";
      }
  
      /** JETSPEED_ROLE_PROFILE.ROLE_NAME */
      public static String getJetspeedRoleProfile_RoleName()
      {
          return getTable() + ".ROLE_NAME";
      }
  
      /** JETSPEED_ROLE_PROFILE.MEDIA_TYPE */
      public static String getJetspeedRoleProfile_MediaType()
      {
          return getTable() + ".MEDIA_TYPE";
      }
  
      /** JETSPEED_ROLE_PROFILE.LANGUAGE */
      public static String getJetspeedRoleProfile_Language()
      {
          return getTable() + ".LANGUAGE";
      }
  
      /** JETSPEED_ROLE_PROFILE.COUNTRY */
      public static String getJetspeedRoleProfile_Country()
      {
          return getTable() + ".COUNTRY";
      }
  
      /** JETSPEED_ROLE_PROFILE.PAGE */
      public static String getJetspeedRoleProfile_Page()
      {
          return getTable() + ".PAGE";
      }
  
      /** JETSPEED_ROLE_PROFILE.PROFILE */
      public static String getJetspeedRoleProfile_Profile()
      {
          return getTable() + ".PROFILE";
      }
  
      /**  the database map  */
      private DatabaseMap dbMap = null;
  
      /**
          tells us if this DatabaseMapBuilder is built so that we don't have
          to re-build it every time
      */
      public boolean isBuilt()
      {
          if ( dbMap != null )
              return true;
          return false;
      }
  
      /**  gets the databasemap this map builder built.  */
      public DatabaseMap getDatabaseMap()
      {
          return this.dbMap;
      }
      /** the doBuild() method builds the DatabaseMap */
      public void doBuild() throws Exception
      {
          dbMap = TurbineDB.getDatabaseMap("default");
  
          dbMap.addTable(getTable());
          TableMap tMap = dbMap.getTable(getTable());
  
                  tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
          
          tMap.setPrimaryKeyMethodInfo(tMap.getName());
  
  
                    tMap.addPrimaryKey ( getJetspeedRoleProfile_PsmlId(), new Integer(0) );
            
                    tMap.addColumn ( getJetspeedRoleProfile_RoleName(), new String() );
            
                    tMap.addColumn ( getJetspeedRoleProfile_MediaType(), new String() );
            
                    tMap.addColumn ( getJetspeedRoleProfile_Language(), new String() );
            
                    tMap.addColumn ( getJetspeedRoleProfile_Country(), new String() );
            
                    tMap.addColumn ( getJetspeedRoleProfile_Page(), new String() );
            
                    tMap.addColumn ( getJetspeedRoleProfile_Profile(), new Object() );
            
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/om/dbpsml/map/JetspeedUserProfileMapBuilder.java
  
  Index: JetspeedUserProfileMapBuilder.java
  ===================================================================
  package org.apache.jetspeed.om.dbpsml.map;
  
  import java.util.*;
  import java.math.*;
  import org.apache.turbine.services.db.PoolBrokerService;
  import org.apache.turbine.services.db.TurbineDB;
  import org.apache.turbine.util.db.map.MapBuilder;
  import org.apache.turbine.util.db.map.DatabaseMap;
  import org.apache.turbine.util.db.map.TableMap;
  
  /**
   */
  public class JetspeedUserProfileMapBuilder implements MapBuilder
  {
      /** the name of this class */
      public static final String CLASS_NAME = "org.apache.jetspeed.om.dbpsml.map.JetspeedUserProfileMapBuilder";
  
      /** item */
      public static String getTable( )
      {
          return "JETSPEED_USER_PROFILE";
      }
  
  
      /** JETSPEED_USER_PROFILE.PSML_ID */
      public static String getJetspeedUserProfile_PsmlId()
      {
          return getTable() + ".PSML_ID";
      }
  
      /** JETSPEED_USER_PROFILE.USER_NAME */
      public static String getJetspeedUserProfile_UserName()
      {
          return getTable() + ".USER_NAME";
      }
  
      /** JETSPEED_USER_PROFILE.MEDIA_TYPE */
      public static String getJetspeedUserProfile_MediaType()
      {
          return getTable() + ".MEDIA_TYPE";
      }
  
      /** JETSPEED_USER_PROFILE.LANGUAGE */
      public static String getJetspeedUserProfile_Language()
      {
          return getTable() + ".LANGUAGE";
      }
  
      /** JETSPEED_USER_PROFILE.COUNTRY */
      public static String getJetspeedUserProfile_Country()
      {
          return getTable() + ".COUNTRY";
      }
  
      /** JETSPEED_USER_PROFILE.PAGE */
      public static String getJetspeedUserProfile_Page()
      {
          return getTable() + ".PAGE";
      }
  
      /** JETSPEED_USER_PROFILE.PROFILE */
      public static String getJetspeedUserProfile_Profile()
      {
          return getTable() + ".PROFILE";
      }
  
      /**  the database map  */
      private DatabaseMap dbMap = null;
  
      /**
          tells us if this DatabaseMapBuilder is built so that we don't have
          to re-build it every time
      */
      public boolean isBuilt()
      {
          if ( dbMap != null )
              return true;
          return false;
      }
  
      /**  gets the databasemap this map builder built.  */
      public DatabaseMap getDatabaseMap()
      {
          return this.dbMap;
      }
      /** the doBuild() method builds the DatabaseMap */
      public void doBuild() throws Exception
      {
          dbMap = TurbineDB.getDatabaseMap("default");
  
          dbMap.addTable(getTable());
          TableMap tMap = dbMap.getTable(getTable());
  
                  tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
          
          tMap.setPrimaryKeyMethodInfo(tMap.getName());
  
  
                    tMap.addPrimaryKey ( getJetspeedUserProfile_PsmlId(), new Integer(0) );
            
                    tMap.addColumn ( getJetspeedUserProfile_UserName(), new String() );
            
                    tMap.addColumn ( getJetspeedUserProfile_MediaType(), new String() );
            
                    tMap.addColumn ( getJetspeedUserProfile_Language(), new String() );
            
                    tMap.addColumn ( getJetspeedUserProfile_Country(), new String() );
            
                    tMap.addColumn ( getJetspeedUserProfile_Page(), new String() );
            
                    tMap.addColumn ( getJetspeedUserProfile_Profile(), new Object() );
            
      }
  
  }
  
  
  
  1.3       +21 -2     jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/BaseProfileLocator.java
  
  Index: BaseProfileLocator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/BaseProfileLocator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BaseProfileLocator.java	2001/07/17 16:41:03	1.2
  +++ BaseProfileLocator.java	2001/11/12 03:37:54	1.3
  @@ -56,11 +56,14 @@
   
   import org.apache.turbine.util.Log;
   import org.apache.turbine.om.security.User;
  +import org.apache.turbine.om.security.TurbineUser;
   import org.apache.turbine.om.security.Role;
   import org.apache.turbine.om.security.Group;
   import org.apache.turbine.util.security.UnknownEntityException;
   
   import org.apache.jetspeed.services.JetspeedSecurity;
  +import org.apache.turbine.services.TurbineServices;
  +import org.apache.turbine.services.ServiceBroker;
   
   /**
    * Interface definition for a Profile Locator.
  @@ -70,7 +73,7 @@
    *
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    * @author <a href="mailto:adambalk@cisco.com">Atul Dambalkar</a>
  - * @version $Id: BaseProfileLocator.java,v 1.2 2001/07/17 16:41:03 taylor Exp $
  + * @version $Id: BaseProfileLocator.java,v 1.3 2001/11/12 03:37:54 taylor Exp $
   */
   
   public class BaseProfileLocator implements ProfileLocator, Cloneable
  @@ -134,7 +137,17 @@
       {
           try
           {
  -             this.setUser( JetspeedSecurity.getAnonymousUser() );
  +            if (SecurityServiceRegistered())
  +                this.setUser( JetspeedSecurity.getAnonymousUser() );
  +            else
  +            {
  +                // warning: this ties us to turbine security
  +                // we could load class from TRP 
  +                // (services.SecurityService.user.class)
  +                User user = new TurbineUser();
  +                user.setUserName("anon");
  +                this.setUser(user);
  +            }
           }
           catch (UnknownEntityException e)
           {
  @@ -144,6 +157,12 @@
           {
               this.anonymous = anonymous;
           }
  +    }
  +
  +    private boolean SecurityServiceRegistered()
  +    {
  +        ServiceBroker broker = TurbineServices.getInstance();
  +        return (broker.isRegistered("SecurityService"));
       }
   
       /*
  
  
  
  1.3       +5 -5      jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/QueryLocator.java
  
  Index: QueryLocator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/QueryLocator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QueryLocator.java	2001/07/30 05:45:39	1.2
  +++ QueryLocator.java	2001/11/12 03:37:54	1.3
  @@ -57,11 +57,11 @@
   public class QueryLocator extends BaseProfileLocator
   {
   
  -    public static int  QUERY_USER = 1;
  -    public static int QUERY_ROLE = 2;
  -    public static int QUERY_GROUP = 4;
  -    public static int QUERY_ANON = 8;
  -    public static int QUERY_ALL = 15;
  +    public static final int  QUERY_USER = 1;
  +    public static final int QUERY_ROLE = 2;
  +    public static final int QUERY_GROUP = 4;
  +    public static final int QUERY_ANON = 8;
  +    public static final int QUERY_ALL = 15;
   
       private int qm = QUERY_USER;
       private String query ;
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message