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

📄 baseportletdbentry.java

📁 jetspeed源代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    /**     * 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("Name"))        {                return getName();            }          if (name.equals("Hidden"))        {                return new Boolean(getHidden());            }          if (name.equals("Classname"))        {                return getClassname();            }          if (name.equals("Type"))        {                return getType();            }          if (name.equals("Application"))        {                return new Boolean(getApplication());            }          if (name.equals("ParentRef"))        {                return new Long(getParentRef());            }          if (name.equals("URL"))        {                return getURL();            }          if (name.equals("Cachedonurl"))        {                return new Boolean(getCachedonurl());            }          if (name.equals("Role"))        {                return getRole();            }          if (name.equals("Title"))        {                return getTitle();            }          if (name.equals("Description"))        {                return getDescription();            }          if (name.equals("Image"))        {                return getImage();            }          if (name.equals("SecurityRef"))        {                return getSecurityRef();            }          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(PortletDbEntryPeer.ID ))        {                return new Long(getId());            }          if (name.equals(PortletDbEntryPeer.NAME ))        {                return getName();            }          if (name.equals(PortletDbEntryPeer.HIDDEN ))        {                return new Boolean(getHidden());            }          if (name.equals(PortletDbEntryPeer.CLASSNAME ))        {                return getClassname();            }          if (name.equals(PortletDbEntryPeer.TYPE ))        {                return getType();            }          if (name.equals(PortletDbEntryPeer.APPLICATION ))        {                return new Boolean(getApplication());            }          if (name.equals(PortletDbEntryPeer.PARENT ))        {                return new Long(getParentRef());            }          if (name.equals(PortletDbEntryPeer.URL ))        {                return getURL();            }          if (name.equals(PortletDbEntryPeer.CACHEDONURL ))        {                return new Boolean(getCachedonurl());            }          if (name.equals(PortletDbEntryPeer.ROLE ))        {                return getRole();            }          if (name.equals(PortletDbEntryPeer.TITLE ))        {                return getTitle();            }          if (name.equals(PortletDbEntryPeer.DESCRIPTION ))        {                return getDescription();            }          if (name.equals(PortletDbEntryPeer.IMAGE ))        {                return getImage();            }          if (name.equals(PortletDbEntryPeer.SECURITY ))        {                return getSecurityRef();            }          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 getName();            }              if ( pos == 2 )        {                return new Boolean(getHidden());            }              if ( pos == 3 )        {                return getClassname();            }              if ( pos == 4 )        {                return getType();            }              if ( pos == 5 )        {                return new Boolean(getApplication());            }              if ( pos == 6 )        {                return new Long(getParentRef());            }              if ( pos == 7 )        {                return getURL();            }              if ( pos == 8 )        {                return new Boolean(getCachedonurl());            }              if ( pos == 9 )        {                return getRole();            }              if ( pos == 10 )        {                return getTitle();            }              if ( pos == 11 )        {                return getDescription();            }              if ( pos == 12 )        {                return getImage();            }              if ( pos == 13 )        {                return getSecurityRef();            }              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(PortletDbEntryPeer.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())                {                    PortletDbEntryPeer.doInsert((PortletDbEntry)this, con);                    setNew(false);                }                else                {                    PortletDbEntryPeer.doUpdate((PortletDbEntry)this, con);                }                      if (isCacheOnSave())                {                    PortletDbEntryManager.putInstance(this);                }              }                                                                  if (collPortletCategorys != null )            {                for (int i = 0; i < collPortletCategorys.size(); i++)                {                    ((PortletCategory)collPortletCategorys.get(i)).save(con);                }            }                                                                      if (collPortletParameters != null )            {                for (int i = 0; i < collPortletParameters.size(); i++)                {                    ((PortletParameter)collPortletParameters.get(i)).save(con);                }            }                                                                      if (collPortletMediatypes != null )            {                for (int i = 0; i < collPortletMediatypes.size(); i++)                {                    ((PortletMediatype)collPortletMediatypes.get(i)).save(con);                }            }                          alreadyInSave = false;        }      }    /**     * Specify whether to cache the object after saving to the db.     * This method returns false     */    protected boolean isCacheOnSave()    {        return true;    }                              /**     * Set the PrimaryKey using ObjectKey.     *     * @param ObjectKey id     */    public void setPrimaryKey(ObjectKey id)        throws TorqueException {            setId(((NumberKey)id).longValue());        }    /**     * Set the PrimaryKey using a String.     */    public void setPrimaryKey(String key) throws TorqueException    {            setId(Long.parseLong(key));        }      /**     * returns an id that differentiates this object from others     * of its class.     */    public ObjectKey getPrimaryKey()    {          return SimpleKey.keyFor(getId());      }     /**     * Makes a copy of this object.     * It creates a new object filling in the simple attributes.       * It then fills all the association collections.       */      public PortletDbEntry copy() throws TorqueException    {        PortletDbEntry copyObj = new PortletDbEntry();            copyObj.setId(id);          copyObj.setName(name);          copyObj.setHidden(hidden);          copyObj.setClassname(classname);          copyObj.setType(type);          copyObj.setApplication(application);          copyObj.setParentRef(parentRef);          copyObj.setURL(uRL);          copyObj.setCachedonurl(cachedonurl);          copyObj.setRole(role);          copyObj.setTitle(title);          copyObj.setDescription(description);          copyObj.setImage(image);          copyObj.setSecurityRef(securityRef);                        copyObj.setId(0);                                                                                                                                                        List v = getPortletCategorys();        for (int i = 0; i < v.size(); i++)        {            PortletCategory obj = (PortletCategory) v.get(i);            copyObj.addPortletCategory(obj.copy());        }                                                                          v = getPortletParameters();        for (int i = 0; i < v.size(); i++)        {            PortletParameter obj = (PortletParameter) v.get(i);            copyObj.addPortletParameter(obj.copy());        }                                                                          v = getPortletMediatypes();        for (int i = 0; i < v.size(); i++)        {            PortletMediatype obj = (PortletMediatype) v.get(i);            copyObj.addPortletMediatype(obj.copy());        }                            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 PortletDbEntryPeer getPeer()    {        return peer;    }}

⌨️ 快捷键说明

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