portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl PortletApplicationDefinitionImpl.java PortletDefinitionImpl.java
Date Tue, 02 Mar 2004 02:45:59 GMT
weaver      2004/03/01 18:45:59

  Modified:    components/registry/src/java/org/apache/jetspeed/om/portlet/impl
                        PortletApplicationDefinitionImpl.java
                        PortletDefinitionImpl.java
  Log:
  I have just put in two absolutely atrocious hacks to fix issues with references not working
  with OJB in certain circumstances.  
  
  Revision  Changes    Path
  1.3       +123 -2    jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
  
  Index: PortletApplicationDefinitionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletApplicationDefinitionImpl.java	26 Feb 2004 19:12:36 -0000	1.2
  +++ PortletApplicationDefinitionImpl.java	2 Mar 2004 02:45:59 -0000	1.3
  @@ -62,7 +62,14 @@
   import org.apache.jetspeed.om.common.impl.GenericMetadataImpl;
   import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
   import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
  +import org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl;
   import org.apache.jetspeed.util.JetspeedObjectID;
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceBrokerAware;
  +import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.broker.query.Criteria;
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryFactory;
   import org.apache.pluto.om.common.ObjectID;
   import org.apache.pluto.om.portlet.PortletDefinition;
   import org.apache.pluto.om.portlet.PortletDefinitionList;
  @@ -75,7 +82,7 @@
    * @version $Id$
    * @since 1.0
    */
  -public class PortletApplicationDefinitionImpl implements MutablePortletApplication, Serializable
  +public class PortletApplicationDefinitionImpl implements MutablePortletApplication, Serializable,
PersistenceBrokerAware
   { 
       /**
        * Unique id of the application.  This serves as the primary key in database
  @@ -293,5 +300,119 @@
       }
   
       
  +
  +    /** 
  +     * <p>
  +     * afterDelete
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterDelete(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void afterDelete(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * afterInsert
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterInsert(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void afterInsert(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * afterLookup
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterLookup(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void afterLookup(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +		if (webApplication == null)
  +		{
  +			// log.warn("Initial PortletDefintion materialization failed to retreive associated
PortletApplicationDefinition.");
  +			// TODO: NASTY HACK ALERT!!!  OJB should be doing this automatically
  +			Criteria c = new Criteria();
  +			c.addEqualTo("id", new Long(webApplicationId));
  +			Query q = QueryFactory.newQuery(WebApplicationDefinitionImpl.class, c);
  +			webApplication = (WebApplicationDefinitionImpl) arg0.getObjectByQuery(q);
  +
  +		}
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * afterUpdate
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterUpdate(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void afterUpdate(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * beforeDelete
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#beforeDelete(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void beforeDelete(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * beforeInsert
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#beforeInsert(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void beforeInsert(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * beforeUpdate
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#beforeUpdate(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void beforeUpdate(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
   
   }
  
  
  
  1.3       +124 -4    jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
  
  Index: PortletDefinitionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletDefinitionImpl.java	24 Feb 2004 00:40:48 -0000	1.2
  +++ PortletDefinitionImpl.java	2 Mar 2004 02:45:59 -0000	1.3
  @@ -79,6 +79,12 @@
   import org.apache.jetspeed.om.preference.impl.PreferenceSetImpl;
   import org.apache.jetspeed.util.HashCodeBuilder;
   import org.apache.jetspeed.util.JetspeedObjectID;
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceBrokerAware;
  +import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.broker.query.Criteria;
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryFactory;
   import org.apache.pluto.om.common.Description;
   import org.apache.pluto.om.common.DescriptionSet;
   import org.apache.pluto.om.common.DisplayName;
  @@ -107,7 +113,7 @@
    *          Exp $
    *  
    */
  -public class PortletDefinitionImpl implements PortletDefinitionComposite, Serializable
  +public class PortletDefinitionImpl implements PortletDefinitionComposite, Serializable,
PersistenceBrokerAware
   {
       private static final Log log = LogFactory.getLog(PortletDefinitionImpl.class);
       private int id;
  @@ -585,7 +591,7 @@
           descObj.setDescription(description);
           descListWrapper.addDescription(descObj);
       }
  -    
  +
       public void addDescription(Description description)
       {
           if (descriptions == null)
  @@ -633,8 +639,9 @@
        */
       public void store() throws IOException
       {
  -        throw new UnsupportedOperationException("PortletDefinitionImpl.store() is not supported."
+ 
  -        "Use the StoreablePortletDefinitionDelegate class to wrap the PortletDefinition
to store");
  +        throw new UnsupportedOperationException(
  +            "PortletDefinitionImpl.store() is not supported."
  +                + "Use the StoreablePortletDefinitionDelegate class to wrap the PortletDefinition
to store");
       }
   
       /**
  @@ -693,4 +700,117 @@
           secListWrapper.setInnerCollection(securityRoleRefSet);
           secListWrapper.add(securityRef);
       }
  +    /** 
  +     * <p>
  +     * afterDelete
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterDelete(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void afterDelete(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * afterInsert
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterInsert(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void afterInsert(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * afterLookup
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterLookup(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void afterLookup(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +         // TODO: NASTY HACK ALERT!!!  OJB should be doing this automatically
  +        if (app == null)
  +        {
  +            log.warn("Initial PortletDefintion materialization failed to retreive associated
PortletApplicationDefinition.");
  +            Criteria c = new Criteria();
  +            c.addEqualTo("id", new Long(appId));
  +            Query q = QueryFactory.newQuery(PortletApplicationDefinitionImpl.class, c);
  +            app = (PortletApplicationDefinitionImpl) arg0.getObjectByQuery(q);
  +
  +        }
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * afterUpdate
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#afterUpdate(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void afterUpdate(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * beforeDelete
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#beforeDelete(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void beforeDelete(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * beforeInsert
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#beforeInsert(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void beforeInsert(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
  +    /** 
  +     * <p>
  +     * beforeUpdate
  +     * </p>
  +     * 
  +     * @see org.apache.ojb.broker.PersistenceBrokerAware#beforeUpdate(org.apache.ojb.broker.PersistenceBroker)
  +     * @param arg0
  +     * @throws org.apache.ojb.broker.PersistenceBrokerException
  +     */
  +    public void beforeUpdate(PersistenceBroker arg0) throws PersistenceBrokerException
  +    {
  +        // TODO Auto-generated method stub
  +
  +    }
  +
   }
  
  
  

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


Mime
View raw message