⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baseportletmediatype.java

📁 jetspeed源代码
💻 JAVA
字号:
package org.apache.jetspeed.om.dbregistry;import java.math.BigDecimal;import java.sql.Connection;import java.util.ArrayList;import java.util.Collections;import java.util.Date;import java.util.List;import org.apache.commons.lang.ObjectUtils;import org.apache.torque.TorqueException;import org.apache.torque.om.BaseObject;import org.apache.torque.om.ComboKey;import org.apache.torque.om.DateKey;import org.apache.torque.om.NumberKey;import org.apache.torque.om.ObjectKey;import org.apache.torque.om.SimpleKey;import org.apache.torque.om.StringKey;import org.apache.torque.om.Persistent;import org.apache.torque.util.Criteria;import org.apache.torque.util.Transaction;        /** * This class was autogenerated by Torque on: * * [Thu Apr 22 15:30:48 PDT 2004] * * You should not use this class directly.  It should not even be * extended all references should be to PortletMediatype */public abstract class BasePortletMediatype extends BaseObject{    /** The Peer class */    private static final PortletMediatypePeer peer =        new PortletMediatypePeer();          /** The value for the id field */    private long id;          /** The value for the mediaId field */    private long mediaId;        /**     * Get the Id     * @return long     */    public long getId()    {        return id;    }                                  /**     * Set the value of Id     */    public void setId(long v ) throws TorqueException    {                      if (this.id != v)              {            this.id = v;            setModified(true);        }                                                      if (aPortletDbEntry != null && !(aPortletDbEntry.getId() == v))                {            aPortletDbEntry = null;        }                    }      /**     * Get the MediaId     * @return long     */    public long getMediaId()    {        return mediaId;    }                                  /**     * Set the value of MediaId     */    public void setMediaId(long v ) throws TorqueException    {                      if (this.mediaId != v)              {            this.mediaId = v;            setModified(true);        }                                                      if (aMediatype != null && !(aMediatype.getId() == v))                {            aMediatype = null;        }                    }                                          private PortletDbEntry aPortletDbEntry;    /**     * Declares an association between this object and a PortletDbEntry object     *     * @param PortletDbEntry v     */    public void setPortletDbEntry(PortletDbEntry v) throws TorqueException    {            if (v == null)        {                  setId(0);              }        else        {            setId(v.getId());        }            aPortletDbEntry = v;    }                            public PortletDbEntry getPortletDbEntry() throws TorqueException    {        if ( getId()>0 )        {                return PortletDbEntryManager.getInstance(SimpleKey.keyFor(getId()));            }        return aPortletDbEntry;    }    /**     * Provides convenient way to set a relationship based on a     * ObjectKey.  e.g.     * <code>bar.setFooKey(foo.getPrimaryKey())</code>     *         */    public void setPortletDbEntryKey(ObjectKey key) throws TorqueException    {                        setId(((NumberKey) key).longValue());              }                                    private Mediatype aMediatype;    /**     * Declares an association between this object and a Mediatype object     *     * @param Mediatype v     */    public void setMediatype(Mediatype v) throws TorqueException    {            if (v == null)        {                  setMediaId(0);              }        else        {            setMediaId(v.getId());        }            aMediatype = v;    }                            public Mediatype getMediatype() throws TorqueException    {        if ( getMediaId()>0 )        {                return MediatypeManager.getInstance(SimpleKey.keyFor(getMediaId()));            }        return aMediatype;    }    /**     * Provides convenient way to set a relationship based on a     * ObjectKey.  e.g.     * <code>bar.setFooKey(foo.getPrimaryKey())</code>     *         */    public void setMediatypeKey(ObjectKey key) throws TorqueException    {                        setMediaId(((NumberKey) key).longValue());              }                         private static List fieldNames = null;    /**     * Generate a list of field names.     */    public static synchronized List getFieldNames()    {        if (fieldNames == null)        {            fieldNames = new ArrayList();              fieldNames.add("Id");              fieldNames.add("MediaId");              fieldNames = Collections.unmodifiableList(fieldNames);        }        return fieldNames;    }    /**     * Retrieves a field from the object by name passed in     * as a String.     */    public Object getByName(String name)    {          if (name.equals("Id"))        {                return new Long(getId());            }          if (name.equals("MediaId"))        {                return new Long(getMediaId());            }          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(PortletMediatypePeer.ID ))        {                return new Long(getId());            }          if (name.equals(PortletMediatypePeer.MEDIA_ID ))        {                return new Long(getMediaId());            }          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 new Long(getId());            }              if ( pos == 1 )        {                return new Long(getMediaId());            }              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(PortletMediatypePeer.getMapBuilder()                .getDatabaseMap().getName());      }    /**     * Stores the object in the database.  If the object is new,     * it inserts it; otherwise an update is performed.       * Note: this code is here because the method body is     * auto-generated conditionally and therefore needs to be     * in this file instead of in the super class, BaseObject.       */    public void save(String dbName) throws TorqueException    {        Connection con = null;          try        {            con = Transaction.begin(dbName);            save(con);            Transaction.commit(con);        }        catch(TorqueException e)        {            Transaction.safeRollback(con);            throw e;        }      }      /** 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(Connection con) throws TorqueException    {          if (!alreadyInSave)        {            alreadyInSave = true;              // If this object has been modified, then save it to the database.            if (isModified())            {                if (isNew())                {                    PortletMediatypePeer.doInsert((PortletMediatype)this, con);                    setNew(false);                }                else                {                    PortletMediatypePeer.doUpdate((PortletMediatype)this, con);                }              }                      alreadyInSave = false;        }      }        /**     * returns an id that differentiates this object from others     * of its class.     */    public ObjectKey getPrimaryKey()    {          return null;      }     /**     * Makes a copy of this object.     * It creates a new object filling in the simple attributes.       * It then fills all the association collections.       */      public PortletMediatype copy() throws TorqueException    {        PortletMediatype copyObj = new PortletMediatype();            copyObj.setId(id);          copyObj.setMediaId(mediaId);                                return copyObj;    }    /**     * returns a peer instance associated with this om.  Since Peer classes     * are not to have any instance attributes, this method returns the     * same instance for all member of this class. The method could therefore     * be static, but this would prevent one from overriding the behavior.     */    public PortletMediatypePeer getPeer()    {        return peer;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -