On Jun 12, 2008, at 2:47 AM, sdumitriu (SVN) wrote: > Author: sdumitriu > Date: 2008-06-12 02:47:34 +0200 (Thu, 12 Jun 2008) > New Revision: 10272 > > Added: > xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ > store/hibernate/DocumentWebPropertyAccessor.java > Modified: > xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.derby.hbm.xml > xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.hbm.xml > xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.oracle.hbm.xml > Log: > XWIKI-2456: Deprecate the doc.web mapping and add doc.space in the > Hibernate mapping file > Done. > > > Added: xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/ > xwiki/store/hibernate/DocumentWebPropertyAccessor.java > =================================================================== > --- xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ > store/hibernate/ > DocumentWebPropertyAccessor.java (rev 0) > +++ xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ > store/hibernate/DocumentWebPropertyAccessor.java 2008-06-12 00:47:34 > UTC (rev 10272) > @@ -0,0 +1,69 @@ > +/* > + * See the NOTICE file distributed with this work for additional > + * information regarding copyright ownership. > + * > + * This is free software; you can redistribute it and/or modify it > + * under the terms of the GNU Lesser General Public License as > + * published by the Free Software Foundation; either version 2.1 of > + * the License, or (at your option) any later version. > + * > + * This software is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with this software; if not, write to the Free > + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > + */ > +package com.xpn.xwiki.store.hibernate; > + > +import org.apache.commons.logging.Log; > +import org.apache.commons.logging.LogFactory; > +import org.hibernate.PropertyNotFoundException; > +import org.hibernate.property.BasicPropertyAccessor; > +import org.hibernate.property.Getter; > +import org.hibernate.property.PropertyAccessor; > +import org.hibernate.property.Setter; > + > +import com.xpn.xwiki.web.XWikiAction; > + > +/** > + * Hibernate property accessor that allows using the deprecated > <code>doc.web</code> in HQL queries, while using the > + * new <code>space</code> getter and setter for the actual object > access. > + * > + * @version $Id$ > + */ > +public class DocumentWebPropertyAccessor extends > BasicPropertyAccessor implements PropertyAccessor > +{ > + /** Logging helper object. */ > + private static final Log LOG = > LogFactory.getLog(XWikiAction.class); > + > + /** > + * [EMAIL PROTECTED] > + * > + * @see PropertyAccessor#getGetter(Class, String) > + */ > + @SuppressWarnings("unchecked") > + @Override > + public Getter getGetter(Class theClass, String propertyName) > throws PropertyNotFoundException > + { > + LOG.warn("Deprecated usage of doc.web property in HQL > query");
shouldn't we say: "Deprecated usage of doc.web property in HQL query, use doc.space instead." ? same below. Thanks -Vincent > > + return super.getGetter(theClass, "space"); > + } > + > + /** > + * [EMAIL PROTECTED] > + * > + * @see PropertyAccessor#getSetter(Class, String) > + */ > + @SuppressWarnings("unchecked") > + @Override > + public Setter getSetter(Class theClass, String propertyName) > throws PropertyNotFoundException > + { > + LOG.warn("Deprecated usage of doc.web property in HQL > query"); > + return super.getSetter(theClass, "space"); > + } > + > +} > > > Property changes on: xwiki-platform/core/trunk/xwiki-core/src/main/ > java/com/xpn/xwiki/store/hibernate/DocumentWebPropertyAccessor.java > ___________________________________________________________________ > Name: svn:keywords > + Id > > Modified: xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.derby.hbm.xml > =================================================================== > --- xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.derby.hbm.xml 2008-06-12 00:45:31 UTC (rev 10271) > +++ xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.derby.hbm.xml 2008-06-12 00:47:34 UTC (rev 10272) > @@ -66,10 +66,15 @@ > <column name="XWD_CREATOR" length="255" not-null="true" /> > </property> > > - <property name="web" type="string"> > + <!-- This property is deprecated and should not be used > anymore. Use .space instead. --> > + <property name="web" type="string" update="false" > insert="false" > access="com.xpn.xwiki.store.hibernate.DocumentWebPropertyAccessor"> > <column name="XWD_WEB" length="255" not-null="true"/> > </property> > > + <property name="space" type="string"> > + <column name="XWD_WEB" length="255" not-null="true"/> > + </property> > + > <property name="content" type="string"> > <column name="XWD_CONTENT" sql-type="CLOB" > length="200000" not-null="true"/> > </property> > > Modified: xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.hbm.xml > =================================================================== > --- xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.hbm.xml 2008-06-12 00:45:31 UTC (rev 10271) > +++ xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.hbm.xml 2008-06-12 00:47:34 UTC (rev 10272) > @@ -58,10 +58,15 @@ > <column name="XWD_CREATOR" length="255" not-null="true" /> > </property> > > - <property name="web" type="string"> > + <!-- This property is deprecated and should not be used > anymore. Use .space instead. --> > + <property name="web" type="string" update="false" > insert="false" > access="com.xpn.xwiki.store.hibernate.DocumentWebPropertyAccessor"> > <column name="XWD_WEB" length="255" not-null="true"/> > </property> > > + <property name="space" type="string"> > + <column name="XWD_WEB" length="255" not-null="true"/> > + </property> > + > <property name="content" type="string"> > <column name="XWD_CONTENT" length="200000" not- > null="true"/> > </property> > > Modified: xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.oracle.hbm.xml > =================================================================== > --- xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.oracle.hbm.xml 2008-06-12 00:45:31 UTC (rev 10271) > +++ xwiki-platform/core/trunk/xwiki-core/src/main/resources/ > xwiki.oracle.hbm.xml 2008-06-12 00:47:34 UTC (rev 10272) > @@ -60,10 +60,15 @@ > <column name="XWD_CREATOR" length="255"/> > </property> > > - <property name="web" type="string"> > + <!-- This property is deprecated and should not be used > anymore. Use .space instead. --> > + <property name="web" type="string" update="false" > insert="false" > access="com.xpn.xwiki.store.hibernate.DocumentWebPropertyAccessor"> > <column name="XWD_WEB" length="255" not-null="true"/> > </property> > > + <property name="space" type="string"> > + <column name="XWD_WEB" length="255" not-null="true"/> > + </property> > + > <property name="content" type="string"> > <column name="XWD_CONTENT" length="200000" not- > null="true" sql-type="clob"/> > </property> > > _______________________________________________ > notifications mailing list > [EMAIL PROTECTED] > http://lists.xwiki.org/mailman/listinfo/notifications _______________________________________________ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs