You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(48) |
Dec
(31) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(22) |
Feb
(68) |
Mar
(185) |
Apr
(11) |
May
(21) |
Jun
(23) |
Jul
(46) |
Aug
(69) |
Sep
(211) |
Oct
(26) |
Nov
(51) |
Dec
(52) |
2006 |
Jan
(13) |
Feb
(13) |
Mar
(8) |
Apr
(21) |
May
(17) |
Jun
(100) |
Jul
(34) |
Aug
(23) |
Sep
(26) |
Oct
(16) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(66) |
Oct
(10) |
Nov
(1) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(3) |
May
(8) |
Jun
(5) |
Jul
(31) |
Aug
(8) |
Sep
(11) |
Oct
(6) |
Nov
|
Dec
|
2012 |
Jan
(13) |
Feb
(2) |
Mar
(9) |
Apr
(6) |
May
(24) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(120) |
2013 |
Jan
(6) |
Feb
(35) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ssk...@re...> - 2005-01-12 21:51:22
|
Author: sskracic Date: 2005-01-12 22:41:24 +0100 (Wed, 12 Jan 2005) New Revision: 171 Modified: users/sskracic/bin/pgcompare.tcl Log: Test. Modified: users/sskracic/bin/pgcompare.tcl =================================================================== --- users/sskracic/bin/pgcompare.tcl 2005-01-05 16:32:08 UTC (rev 170) +++ users/sskracic/bin/pgcompare.tcl 2005-01-12 21:41:24 UTC (rev 171) @@ -1,4 +1,7 @@ #! /usr/bin/tclsh +# +# $Id$ +# proc has_option {opt} { upvar options options Property changes on: users/sskracic/bin/pgcompare.tcl ___________________________________________________________________ Name: svn:keywords + Id |
From: <ssk...@re...> - 2005-01-05 16:41:44
|
Author: sskracic Date: 2005-01-05 17:32:08 +0100 (Wed, 05 Jan 2005) New Revision: 170 Modified: ccm-cms/trunk/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java ccm-core/trunk/src/com/arsdigita/ui/admin/GroupAdministrationTab.java ccm-core/trunk/src/com/arsdigita/ui/admin/GroupTreeModel.java Log: Consistent group/subgroup ordering in UI, sorting by name. Modified: ccm-cms/trunk/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java 2005-01-05 16:04:29 UTC (rev 169) +++ ccm-cms/trunk/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java 2005-01-05 16:32:08 UTC (rev 170) @@ -189,7 +189,7 @@ PartyCollection parties = Party.retrieveAllParties(); parties.filter(search); - parties.addOrder(Party.DISPLAY_NAME); + parties.addOrder("lower(" + Party.DISPLAY_NAME + ") asc"); String userID, userName; while(parties.next()) { Modified: ccm-core/trunk/src/com/arsdigita/ui/admin/GroupAdministrationTab.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/ui/admin/GroupAdministrationTab.java 2005-01-05 16:04:29 UTC (rev 169) +++ ccm-core/trunk/src/com/arsdigita/ui/admin/GroupAdministrationTab.java 2005-01-05 16:32:08 UTC (rev 170) @@ -478,6 +478,7 @@ public SubGroupListModel(GroupCollection coll) { m_coll = coll; + m_coll.addOrder("lower(" + Group.DISPLAY_NAME + ") asc"); } public Object getElement() { Modified: ccm-core/trunk/src/com/arsdigita/ui/admin/GroupTreeModel.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/ui/admin/GroupTreeModel.java 2005-01-05 16:04:29 UTC (rev 169) +++ ccm-core/trunk/src/com/arsdigita/ui/admin/GroupTreeModel.java 2005-01-05 16:32:08 UTC (rev 170) @@ -126,6 +126,7 @@ } GroupCollection coll = group.getSubgroups(); + coll.addOrder("lower("+ Group.DISPLAY_NAME + ") asc"); return new GroupIterator(coll); |
From: <ssk...@re...> - 2005-01-05 16:14:02
|
Author: sskracic Date: 2005-01-05 17:04:29 +0100 (Wed, 05 Jan 2005) New Revision: 169 Modified: ccm-cms/trunk/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java Log: Per customer request: groups were not ordered in any meaningful way in UI, sorting by name improves usability very much. Modified: ccm-cms/trunk/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java 2004-12-23 14:35:58 UTC (rev 168) +++ ccm-cms/trunk/src/com/arsdigita/cms/ui/permissions/CMSPermissionsGrant.java 2005-01-05 16:04:29 UTC (rev 169) @@ -189,6 +189,7 @@ PartyCollection parties = Party.retrieveAllParties(); parties.filter(search); + parties.addOrder(Party.DISPLAY_NAME); String userID, userName; while(parties.next()) { |
From: <ssk...@re...> - 2004-12-23 14:44:50
|
Author: sskracic Date: 2004-12-23 15:35:58 +0100 (Thu, 23 Dec 2004) New Revision: 168 Modified: ccm-ldn-xmlfeed/trunk/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeed.java Log: Fixing the compile error after changes to formbuilder. Modified: ccm-ldn-xmlfeed/trunk/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeed.java =================================================================== --- ccm-ldn-xmlfeed/trunk/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeed.java 2004-12-23 14:30:31 UTC (rev 167) +++ ccm-ldn-xmlfeed/trunk/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeed.java 2004-12-23 14:35:58 UTC (rev 168) @@ -30,11 +30,12 @@ import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.formbuilder.PersistentComponentFactory; +import com.arsdigita.formbuilder.PersistentComponent; import com.arsdigita.formbuilder.PersistentForm; import com.arsdigita.formbuilder.PersistentSubmit; import com.arsdigita.formbuilder.PersistentWidget; +import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; @@ -220,10 +221,10 @@ public Iterator getFormFieldNames() { Collection names = new Vector(); - Collection allFields = getForm().getComponents(); + DataAssociationCursor allFields = getForm().getComponents(); - for (Iterator it = allFields.iterator(); it.hasNext(); ) { - PersistentComponentFactory c = (PersistentComponentFactory) it.next(); + while (allFields.next()) { + PersistentComponent c = (PersistentComponent) DomainObjectFactory.newInstance(allFields.getDataObject()); if (c instanceof PersistentWidget && !(c instanceof PersistentSubmit)) { names.add(((PersistentWidget) c).getParameterName()); } |
From: <ssk...@re...> - 2004-12-23 14:39:43
|
Author: sskracic Date: 2004-12-23 15:30:31 +0100 (Thu, 23 Dec 2004) New Revision: 167 Modified: ccm-simplesurvey/trunk/src/com/arsdigita/simplesurvey/ui/SurveyProcessListener.java Log: Making simplesurvey compile again, reflecting changes done to formbuilder. This goes without saying that ss will actually work. Modified: ccm-simplesurvey/trunk/src/com/arsdigita/simplesurvey/ui/SurveyProcessListener.java =================================================================== --- ccm-simplesurvey/trunk/src/com/arsdigita/simplesurvey/ui/SurveyProcessListener.java 2004-12-22 17:27:08 UTC (rev 166) +++ ccm-simplesurvey/trunk/src/com/arsdigita/simplesurvey/ui/SurveyProcessListener.java 2004-12-23 14:30:31 UTC (rev 167) @@ -38,6 +38,7 @@ import com.arsdigita.bebop.RequestLocal; import com.arsdigita.simplesurvey.ui.Question; import com.arsdigita.bebop.parameters.ParameterData; +import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataOperation; import com.arsdigita.persistence.SessionManager; import java.util.Iterator; @@ -190,11 +191,11 @@ s_log.debug("initializing the parameter name persistent label map"); PersistentForm persistentForm = (PersistentForm)m_persistentForm.get(ps); - Iterator componentIter = persistentForm.getComponents().iterator(); + DataAssociationCursor componentCursor = persistentForm.getComponents(); PersistentLabel lastPersistentLabel = null; - while (componentIter.hasNext()) { + while (componentCursor.next()) { - PersistentComponentFactory factory = (PersistentComponentFactory)componentIter.next(); + PersistentComponent factory = (PersistentComponent) DomainObjectFactory.newInstance(componentCursor.getDataObject()); s_log.debug("iterating, component " + factory.toString()); |
From: <mb...@re...> - 2004-12-22 17:36:03
|
Author: mbooth Date: 2004-12-22 18:27:08 +0100 (Wed, 22 Dec 2004) New Revision: 166 Modified: ccm-user-preferences/trunk/application.xml ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/PersistentUserPrefs.java ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/UserPrefs.java ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/ui/UserPrefsComponent.java Log: Fix bug owning to useless httpsessions. Modified: ccm-user-preferences/trunk/application.xml =================================================================== --- ccm-user-preferences/trunk/application.xml 2004-12-22 14:04:21 UTC (rev 165) +++ ccm-user-preferences/trunk/application.xml 2004-12-22 17:27:08 UTC (rev 166) @@ -3,7 +3,7 @@ <ccm:application name="ccm-user-preferences" prettyName="User Preferences" version="1.0.0" - release="2" + release="3" xmlns:ccm="http://ccm.redhat.com/ccm-project"> <ccm:dependencies> Modified: ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/PersistentUserPrefs.java =================================================================== --- ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/PersistentUserPrefs.java 2004-12-22 14:04:21 UTC (rev 165) +++ ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/PersistentUserPrefs.java 2004-12-22 17:27:08 UTC (rev 166) @@ -85,8 +85,11 @@ PersistentUserPrefs prefs = null; if( pups.next() ) { prefs = new PersistentUserPrefs( pups.getDataObject() ); - s_log.warn( "User " + user.getOID() + " has multiple user " + - "preferences" ); + + if( pups.next() ) { + s_log.warn( "User " + user.getOID() + " has multiple user " + + "preferences" ); + } } pups.close(); Modified: ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/UserPrefs.java =================================================================== --- ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/UserPrefs.java 2004-12-22 14:04:21 UTC (rev 165) +++ ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/UserPrefs.java 2004-12-22 17:27:08 UTC (rev 166) @@ -16,6 +16,7 @@ package com.arsdigita.london.userprefs; +import com.arsdigita.caching.CacheTable; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainCollection; import com.arsdigita.kernel.Kernel; @@ -34,8 +35,7 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSessionEvent; -import javax.servlet.http.HttpSessionActivationListener; +import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; @@ -55,33 +55,6 @@ * @author Matthew Booth <mb...@re...> */ -// LAZY PERSISTENCE - -// My original intention was that save would not save immediately, but rather -// only save when the session expires. This is not terribly safe for the data, -// but these are only user preferences and I didn't want to unnecessarily hit -// the database. As long as data is not usually lost, that's fine. - -// I was originally going to achieve this by implementing -// HttpSessionBindingListener in the understanding that objects would be unbound -// before the session is destroyed. They're not. Instead I tried -// HttpSessionActivationListener which is called when a Session is migrated -// between servers. This isn't used either, but I left that in because it -// seems like a good idea. - -// Finally I tried HttpSessionListener. It looks like I should have tried this -// first, as it appears to be the correct interface for the job. However, the -// sessionDestroyed() method is only called *after* the Session object is -// invalidated. This means that not only can you not retrieve attributes from -// it, but you can't even get the session ID. You know that a session was just -// destroyed, but you have no way of knowing which one. In fact, it's utterly, -// utterly, utterly useless. It's completely without merit. A waste of bits. -// Who on earth came up with that? - -// There seems to be some talk of this being fixed in the Servlet 2.4 spec. - -// Matt <mb...@re...> - public class UserPrefs { private static final Logger s_log = Logger.getLogger( UserPrefs.class ); @@ -94,9 +67,16 @@ private HashMap m_prefs = new HashMap(); + private static final CacheTable s_prefsCache = + new CacheTable( "user_preferences" ); + private UserPrefs() {}; private UserPrefs( PersistentUserPrefs persistentPrefs ) { + init( persistentPrefs ); + } + + private void init( PersistentUserPrefs persistentPrefs ) { m_persistentPrefs = persistentPrefs.getOID(); m_cookie = persistentPrefs.getCookie(); m_user = persistentPrefs.getUser() == null ? @@ -124,68 +104,83 @@ */ public static UserPrefs retrieve( HttpServletRequest req, HttpServletResponse res ) { - UserPrefs prefs = (UserPrefs) - req.getSession().getAttribute( SESSION_ATTRIBUTE ); + HttpSession session = req.getSession(); - if( null != prefs ) return prefs; + // Yes, this seems like a silly use of an HttpSession, but they really + // are broken in almost every useful way. + UserPrefs prefs = (UserPrefs) s_prefsCache.get( session.getId() ); + if( null != prefs ) { + if( s_log.isDebugEnabled() ) { + s_log.debug( "Retrieved user prefs for session " + + session.getId() ); + } + return prefs; + } + + PersistentUserPrefs persistentPrefs = retrievePersistent( req, res ); + if( null != persistentPrefs ) { + prefs = new UserPrefs( persistentPrefs ); + } else { + prefs = new UserPrefs(); + + User user = (User) Kernel.getContext().getParty(); + if( null != user ) { + prefs.m_user = user.getOID(); + } else { + Long cookie; + try { + SecureRandom random = SecureRandom.getInstance( "SHA1PRNG" ); + cookie = new Long( random.nextLong() ); + } catch( NoSuchAlgorithmException ex ) { + s_log.warn( "Unable to get SecureRandom for SHA1PRNG. " + + "Falling back to insecure random generator." ); + cookie = new Long( new Random().nextLong() ); + } + + prefs.m_cookie = cookie; + setCookie( res, cookie.toString() ); + } + + s_log.debug( "Created new prefs" ); + } + + s_prefsCache.put( session.getId(), prefs ); + return prefs; + } + + private static PersistentUserPrefs retrievePersistent + ( HttpServletRequest req, HttpServletResponse res ) + { + PersistentUserPrefs persistentPrefs = null; + User user = (User) Kernel.getContext().getParty(); if( null != user ) { - PersistentUserPrefs persistentPrefs = - PersistentUserPrefs.retrieveForUser( user ); - if( null != persistentPrefs ) { - prefs = new UserPrefs( persistentPrefs ); - } + persistentPrefs = PersistentUserPrefs.retrieveForUser( user ); } - if( null != prefs ) { + if( null != persistentPrefs ) { s_log.debug( "Got prefs for user" ); - req.getSession().setAttribute( SESSION_ATTRIBUTE, prefs ); - return prefs; + return persistentPrefs; } Long cookie = getCookie( req ); if( null != cookie ) { - PersistentUserPrefs persistentPrefs = - PersistentUserPrefs.retrieveForCookie( cookie ); + persistentPrefs = PersistentUserPrefs.retrieveForCookie( cookie ); // Remove a bogus cookie if( null == persistentPrefs ) { removeCookie( res ); } - - else { - prefs = new UserPrefs( persistentPrefs ); - } } - if( null != prefs ) { + if( null != persistentPrefs ) { s_log.debug( "Got prefs for cookie" ); - req.getSession().setAttribute( SESSION_ATTRIBUTE, prefs ); - return prefs; + return persistentPrefs; } - prefs = new UserPrefs(); - - if( null != user ) { - prefs.m_user = user.getOID(); - } else { - try { - SecureRandom random = SecureRandom.getInstance( "SHA1PRNG" ); - cookie = new Long( random.nextLong() ); - } catch( NoSuchAlgorithmException ex ) { - s_log.warn( "Unable to get SecureRandom for SHA1PRNG. " + - "Falling back to insecure random generator." ); - cookie = new Long( new Random().nextLong() ); - } - - prefs.m_cookie = cookie; - setCookie( res, cookie.toString() ); - } - - s_log.debug( "Created new prefs" ); - req.getSession().setAttribute( SESSION_ATTRIBUTE, prefs ); - return prefs; + s_log.debug( "No existing prefs" ); + return null; } /** @@ -214,9 +209,13 @@ * @param key The identifier of the preference to be stored * @param value The value of the preference to be stored */ - public void set( String key, String value ) { + public void set( String key, String value, + HttpServletRequest req, HttpServletResponse res ) { m_prefs.put( key, value ); - getPersistent().setValue( key, value ); + + PersistentUserPrefs prefs = getPersistent(); + if( null == prefs ) prefs = createPersistent( req, res ); + prefs.setValue( key, value ); } /** @@ -224,23 +223,31 @@ * * @param key The identifier of the preference to be removed */ - public void remove( String key ) { + public void remove( String key, HttpServletRequest req ) { m_prefs.remove( key ); + PersistentUserPrefs persistent = getPersistent(); + if( !m_prefs.isEmpty() ) { - getPersistent().removeValue( key ); + if( null != persistent ) persistent.removeValue( key ); } else { - getPersistent().delete(); + if( null != persistent ) persistent.delete(); + + req.getSession().setAttribute( SESSION_ATTRIBUTE, null ); + m_persistentPrefs = null; } } /** * Save user preferences to the database */ - public void persist() { + public void persist( HttpServletRequest req, + HttpServletResponse res ) { s_log.info( "Persisting session" ); PersistentUserPrefs prefs = getPersistent(); + if( null == prefs ) prefs = createPersistent( req, res ); + prefs.setAllValues( m_prefs ); prefs.save(); @@ -251,22 +258,36 @@ * Get a PersistentUserPrefs object. Create one if necessary. */ private PersistentUserPrefs getPersistent() { - PersistentUserPrefs prefs; + PersistentUserPrefs prefs = null; - if( null == m_persistentPrefs ) { - prefs = new PersistentUserPrefs(); - } else { + if( null != m_persistentPrefs ) { try { prefs = new PersistentUserPrefs( m_persistentPrefs ); } catch( DataObjectNotFoundException ex ) { s_log.warn( "User preferences object contained bogus " + "persistent preferences OID" ); - prefs = new PersistentUserPrefs(); } } - // If this is newly persisted, set appropriately - if( prefs.isNew() ) { + // If we're saving something and we have a user object now, use that + // in preference + if( null == m_user ) { + User user = (User) Kernel.getContext().getParty(); + if( null != user ) { + prefs.setUser( user ); + prefs.setCookie( null ); + } + } + + return prefs; + } + + private PersistentUserPrefs createPersistent( HttpServletRequest req, + HttpServletResponse res ) { + PersistentUserPrefs prefs = retrievePersistent( req, res ); + if( null == prefs ) { + prefs = new PersistentUserPrefs(); + if( s_log.isDebugEnabled() ) { s_log.debug( "Initializing new user preferences: " + prefs.getOID() ); @@ -283,20 +304,17 @@ else { throw new UncheckedWrapperException ( "User preferences object doesn't contain either a user or a cookie object" ); } - } - // If we're saving something and we have a user object now, use that - // in preference - if( null == m_user ) { - User user = (User) Kernel.getContext().getParty(); - if( null != user ) { - prefs.setUser( user ); - prefs.setCookie( null ); + m_persistentPrefs = prefs.getOID(); + } else { + if( s_log.isDebugEnabled() ) { + s_log.debug( "Reusing existing persistent preferences " + + prefs.getOID() ); } + + init( prefs ); } - m_persistentPrefs = prefs.getOID(); - return prefs; } Modified: ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/ui/UserPrefsComponent.java =================================================================== --- ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/ui/UserPrefsComponent.java 2004-12-22 14:04:21 UTC (rev 165) +++ ccm-user-preferences/trunk/src/com/arsdigita/london/userprefs/ui/UserPrefsComponent.java 2004-12-22 17:27:08 UTC (rev 166) @@ -94,12 +94,25 @@ boolean acted = false; if( null != setKey ) { - prefs.set( setKey, setValue ); + if( s_log.isDebugEnabled() ) { + s_log.debug( "Set in " + + ps.getRequest().getRequestURI() + '?' + + ps.getRequest().getQueryString() ); + } + + prefs.set( setKey, setValue, + ps.getRequest(), ps.getResponse() ); acted = true; } if( null != remove ) { - prefs.remove( remove ); + if( s_log.isDebugEnabled() ) { + s_log.debug( "Remove in " + + ps.getRequest().getRequestURI() + '?' + + ps.getRequest().getQueryString() ); + } + + prefs.remove( remove, ps.getRequest() ); acted = true; } |
From: <mb...@re...> - 2004-12-22 14:13:10
|
Author: mbooth Date: 2004-12-22 15:04:21 +0100 (Wed, 22 Dec 2004) New Revision: 165 Modified: ccm-forum/trunk/application.xml Log: Bump version number Modified: ccm-forum/trunk/application.xml =================================================================== --- ccm-forum/trunk/application.xml 2004-12-22 13:59:16 UTC (rev 164) +++ ccm-forum/trunk/application.xml 2004-12-22 14:04:21 UTC (rev 165) @@ -3,7 +3,7 @@ <ccm:application name="ccm-forum" prettyName="Forum" version="1.4.1" - release="14" + release="15" xmlns:ccm="http://ccm.redhat.com/ccm-project"> <ccm:dependencies> |
From: <mb...@re...> - 2004-12-22 14:08:08
|
Author: mbooth Date: 2004-12-22 14:59:16 +0100 (Wed, 22 Dec 2004) New Revision: 164 Modified: ccm-cms-types-formitem/trunk/application.xml ccm-cms-types-formsectionitem/trunk/application.xml ccm-cms/trunk/application.xml ccm-core/trunk/application.xml Log: Bump version numbers Modified: ccm-cms/trunk/application.xml =================================================================== --- ccm-cms/trunk/application.xml 2004-12-22 13:58:03 UTC (rev 163) +++ ccm-cms/trunk/application.xml 2004-12-22 13:59:16 UTC (rev 164) @@ -3,7 +3,7 @@ <ccm:application name="ccm-cms" prettyName="Red Hat CCM Content Management System" version="6.1.0" - release="13" + release="14" webapp="ROOT" xmlns:ccm="http://ccm.redhat.com/ccm-project"> Modified: ccm-cms-types-formitem/trunk/application.xml =================================================================== --- ccm-cms-types-formitem/trunk/application.xml 2004-12-22 13:58:03 UTC (rev 163) +++ ccm-cms-types-formitem/trunk/application.xml 2004-12-22 13:59:16 UTC (rev 164) @@ -3,7 +3,7 @@ <ccm:application name="ccm-cms-types-formitem" prettyName="Red Hat CCM Content Types" version="6.1.0" - release="8" + release="9" webapp="ROOT" xmlns:ccm="http://ccm.redhat.com/ccm-project"> Modified: ccm-cms-types-formsectionitem/trunk/application.xml =================================================================== --- ccm-cms-types-formsectionitem/trunk/application.xml 2004-12-22 13:58:03 UTC (rev 163) +++ ccm-cms-types-formsectionitem/trunk/application.xml 2004-12-22 13:59:16 UTC (rev 164) @@ -3,7 +3,7 @@ <ccm:application name="ccm-cms-types-formsectionitem" prettyName="Red Hat CCM Content Types" version="6.1.0" - release="8" + release="9" webapp="ROOT" xmlns:ccm="http://ccm.redhat.com/ccm-project"> Modified: ccm-core/trunk/application.xml =================================================================== --- ccm-core/trunk/application.xml 2004-12-22 13:58:03 UTC (rev 163) +++ ccm-core/trunk/application.xml 2004-12-22 13:59:16 UTC (rev 164) @@ -3,7 +3,7 @@ <ccm:application name="ccm-core" prettyName="Core" version="6.1.0" - release="18" + release="19" webapp="ROOT" buildHooks="build-hooks.xml" xmlns:ccm="http://ccm.redhat.com/ccm-project"> |
From: <mb...@re...> - 2004-12-22 14:06:58
|
Author: mbooth Date: 2004-12-22 14:58:03 +0100 (Wed, 22 Dec 2004) New Revision: 163 Added: ccm-core/trunk/sql/ccm-core/fixes/ ccm-core/trunk/sql/ccm-core/fixes/formbuilder/ ccm-core/trunk/sql/ccm-core/fixes/formbuilder/delete-bogus-form-widgets.sql ccm-core/trunk/sql/ccm-core/fixes/messaging/ ccm-core/trunk/sql/ccm-core/fixes/messaging/update-thread-replies.sql Log: A couple of scripts which clean up some dm bogosity. Added: ccm-core/trunk/sql/ccm-core/fixes/formbuilder/delete-bogus-form-widgets.sql =================================================================== --- ccm-core/trunk/sql/ccm-core/fixes/formbuilder/delete-bogus-form-widgets.sql 2004-12-22 13:54:02 UTC (rev 162) +++ ccm-core/trunk/sql/ccm-core/fixes/formbuilder/delete-bogus-form-widgets.sql 2004-12-22 13:58:03 UTC (rev 163) @@ -0,0 +1,277 @@ +-- Delete bogus entries +delete from bebop_component_hierarchy h1 + where not exists( + select 1 + from acs_objects + where object_id = h1.container_id + and object_type = 'com.arsdigita.formbuilder.FormSection' + ) + and not exists( + select 1 + from bebop_component_hierarchy h2 + where h2.component_id = h1.container_id + ); + +delete from bebop_widgets w + where not exists( select 1 from bebop_component_hierarchy h + where h.component_id = w.widget_id + or h.container_id = w.widget_id ); + +delete from bebop_listener_map m + where not exists( select 1 from bebop_component_hierarchy h + where h.component_id = m.component_id + or h.container_id = m.component_id ); + +delete from bebop_listeners l + where not exists( select 1 from bebop_listener_map m + where l.listener_id = m.listener_id ); + +delete from bebop_components c + where not exists( + select 1 + from bebop_component_hierarchy h + where h.component_id = c.component_id + or h.container_id = c.component_id + ) + and not exists ( + select 1 + from acs_objects o + where o.object_id = c.component_id + and o.object_type = 'com.arsdigita.formbuilder.FormSection' + ); + +delete from bebop_options o + where not exists( select 1 from bebop_components c + where o.option_id = c.component_id ); + +-- Delete orphaned Listeners + +delete from bebop_component_hierarchy + where component_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Listener' + and not exists( + select 1 + from bebop_listeners l + where o.object_id = l.listener_id + ) + ); + +delete from bebop_components + where component_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Listener' + and not exists( + select 1 + from bebop_listeners l + where o.object_id = l.listener_id + ) + ); + +delete from object_context + where object_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Listener' + and not exists( + select 1 + from bebop_listeners l + where o.object_id = l.listener_id + ) + ); + +delete from object_container_map + where object_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Listener' + and not exists( + select 1 + from bebop_listeners l + where o.object_id = l.listener_id + ) + ); + +delete from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Listener' + and not exists( + select 1 + from bebop_listeners l + where o.object_id = l.listener_id + ); + +-- Delete orphaned WidgetLabels + +delete from bebop_component_hierarchy + where component_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.WidgetLabel' + and not exists( + select 1 + from forms_widget_label l + where o.object_id = l.label_id + ) + ); + +delete from bebop_components + where component_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.WidgetLabel' + and not exists( + select 1 + from forms_widget_label l + where o.object_id = l.label_id + ) + ); + +delete from object_context + where object_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.WidgetLabel' + and not exists( + select 1 + from forms_widget_label l + where o.object_id = l.label_id + ) + ); + +delete from object_container_map + where object_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.WidgetLabel' + and not exists( + select 1 + from forms_widget_label l + where o.object_id = l.label_id + ) + ); + +delete from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.WidgetLabel' + and not exists( + select 1 + from forms_widget_label l + where o.object_id = l.label_id + ); + +-- Delete orphaned Options + +delete from bebop_component_hierarchy + where component_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Option' + and not exists( + select 1 + from bebop_options b + where o.object_id = b.option_id + ) + ); + +delete from bebop_components + where component_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Option' + and not exists( + select 1 + from bebop_options b + where o.object_id = b.option_id + ) + ); + +delete from object_context + where object_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Option' + and not exists( + select 1 + from bebop_options b + where o.object_id = b.option_id + ) + ); + +delete from object_container_map + where object_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Option' + and not exists( + select 1 + from bebop_options b + where o.object_id = b.option_id + ) + ); + +delete from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Option' + and not exists( + select 1 + from bebop_options b + where o.object_id = b.option_id + ); + +-- Delete orphaned Widgets + +delete from bebop_component_hierarchy + where component_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Widget' + and not exists( + select 1 + from bebop_widgets w + where o.object_id = w.widget_id + ) + ); + +delete from bebop_components + where component_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Widget' + and not exists( + select 1 + from bebop_widgets w + where o.object_id = w.widget_id + ) + ); + +delete from object_context + where object_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Widget' + and not exists( + select 1 + from bebop_widgets w + where o.object_id = w.widget_id + ) + ); + +delete from object_container_map + where object_id in ( + select o.object_id + from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Widget' + and not exists( + select 1 + from bebop_widgets w + where o.object_id = w.widget_id + ) + ); + +delete from acs_objects o + where o.object_type = 'com.arsdigita.formbuilder.Widget' + and not exists( + select 1 + from bebop_widgets w + where o.object_id = w.widget_id + ); Added: ccm-core/trunk/sql/ccm-core/fixes/messaging/update-thread-replies.sql =================================================================== --- ccm-core/trunk/sql/ccm-core/fixes/messaging/update-thread-replies.sql 2004-12-22 13:54:02 UTC (rev 162) +++ ccm-core/trunk/sql/ccm-core/fixes/messaging/update-thread-replies.sql 2004-12-22 13:58:03 UTC (rev 163) @@ -0,0 +1,6 @@ + update message_threads t + set num_replies = ( + select count( m.message_id ) + from messages m + where m.root_id = t.root_id + ); |
From: <mb...@re...> - 2004-12-22 14:02:51
|
Author: mbooth Date: 2004-12-22 14:54:02 +0100 (Wed, 22 Dec 2004) New Revision: 162 Modified: ccm-core/trunk/src/com/arsdigita/caching/CacheTable.java Log: Javadoc change Modified: ccm-core/trunk/src/com/arsdigita/caching/CacheTable.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/caching/CacheTable.java 2004-12-21 19:39:29 UTC (rev 161) +++ ccm-core/trunk/src/com/arsdigita/caching/CacheTable.java 2004-12-22 13:54:02 UTC (rev 162) @@ -106,8 +106,8 @@ * and <code>waf.caching.[id].max_age</code>. </p> * * @param id Unique identifier for the new storage area - * @param size Initial default size - * @param age Initial default age + * @param size Initial default size (number of elements) + * @param age Initial default age (seconds) * @pre id != null * @throws NullPointerException if <code>id</code> is <code>null</code> */ |
From: <mb...@re...> - 2004-12-21 19:48:21
|
Author: mbooth Date: 2004-12-21 20:39:29 +0100 (Tue, 21 Dec 2004) New Revision: 161 Modified: ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormCopier.java Log: Remove debugging stacktraces Modified: ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormCopier.java =================================================================== --- ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormCopier.java 2004-12-21 19:37:41 UTC (rev 160) +++ ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormCopier.java 2004-12-21 19:39:29 UTC (rev 161) @@ -147,7 +147,7 @@ PersistentWidget tgt = (PersistentWidget)copyObject(src); if( s_log.isDebugEnabled() ) { - s_log.debug("Copying form widget " + src.getClass().getName(), new Exception() ); + s_log.debug("Copying form widget " + src.getClass().getName()); } copyDataObjectAssociation(getDataObject(src), @@ -165,7 +165,7 @@ String javaClass = (String)get(src, ACSObject.DEFAULT_DOMAIN_CLASS); if( s_log.isDebugEnabled() ) { - s_log.debug("Copying object " + src.getClass().getName() + " " + src.getOID(), new Exception()); + s_log.debug("Copying object " + src.getClass().getName() + " " + src.getOID()); } Assert.exists(objectType, String.class); |
Author: mbooth Date: 2004-12-21 20:37:41 +0100 (Tue, 21 Dec 2004) New Revision: 160 Removed: ccm-core/trunk/src/com/arsdigita/formbuilder/AttributeMetaDataProvider.java ccm-core/trunk/src/com/arsdigita/formbuilder/FormBuilderDispatcher.java ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentComponentFactory.java ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormGenerator.java ccm-core/trunk/src/com/arsdigita/formbuilder/SimpleQuestionnaire.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/FormBuildingPage.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/FormPropertiesForm.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/FormPropertiesFormPageConnector.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/FormPropertiesPage.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/FormViewPage.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/IndexPage.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/OptionGroupPage.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/PreviewForm.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/PreviewFormPageConnector.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/PropertiesMetaForm.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/PropertiesMetaFormConnector.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/QuestionPropertiesForm.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/SimpleQuestionnaireList.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/SimpleQuestionnaireListModel.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/TemplatePage.java Modified: ccm-cms-types-formitem/trunk/src/com/arsdigita/cms/formbuilder/FormItem.java ccm-cms-types-formitem/trunk/src/com/arsdigita/cms/ui/formbuilder/FormControls.java ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormCopier.java ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormSectionItem.java ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormSectionWrapper.java ccm-cms/trunk/src/com/arsdigita/cms/ui/authoring/PageCreateDynamic.java ccm-cms/trunk/src/com/arsdigita/cms/ui/authoring/PageEditDynamic.java ccm-core/trunk/pdl/com/arsdigita/formbuilder/Component.pdl ccm-core/trunk/pdl/com/arsdigita/formbuilder/ProcessListener.pdl ccm-core/trunk/pdl/com/arsdigita/formbuilder/WidgetLabel.pdl ccm-core/trunk/src/com/arsdigita/formbuilder/ComponentAddObserver.java ccm-core/trunk/src/com/arsdigita/formbuilder/FormSectionGenerator.java ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentComponent.java ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentContainer.java ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentDeditor.java ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormSection.java ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentOptionGroup.java ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentTextArea.java ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentWidget.java ccm-core/trunk/src/com/arsdigita/formbuilder/TestAttributeListener.java ccm-core/trunk/src/com/arsdigita/formbuilder/WidgetLabel.java ccm-core/trunk/src/com/arsdigita/formbuilder/actions/SimpleEmailListener.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/BaseAddObserver.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/BaseEditAddObserver.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ControlEditor.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ControlProperties.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/MoveControl.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/NewSection.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/OptionEditor.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/OptionGroupForm.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/TemplateEmailForm.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/WidgetLabelForm.java ccm-core/trunk/src/com/arsdigita/formbuilder/util/FormBuilderUtil.java ccm-core/trunk/src/com/arsdigita/formbuilder/util/PersistentContainerHelper.java Log: Significant refactoring of formbuilder. Fixes copying of forms, and hence publishing of forms, and also deleting of forms. Involves deletion of unused SimpleQuestionnaire, and all related UI. Also deletion of two idiotic abstractions. Datamodel upgrade scripts not required, but might be advisable. Previous code left lots of cruft in DB, so cruft cleanup script definitely required. Will follow. Modified: ccm-cms/trunk/src/com/arsdigita/cms/ui/authoring/PageCreateDynamic.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/ui/authoring/PageCreateDynamic.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-cms/trunk/src/com/arsdigita/cms/ui/authoring/PageCreateDynamic.java 2004-12-21 19:37:41 UTC (rev 160) @@ -57,13 +57,14 @@ import com.arsdigita.dispatcher.MultipartHttpServletRequest; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.formbuilder.PersistentComponentFactory; +import com.arsdigita.formbuilder.PersistentComponent; import com.arsdigita.formbuilder.PersistentForm; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Party; import com.arsdigita.kernel.User; import com.arsdigita.metadata.DynamicObjectType; import com.arsdigita.mimetypes.ImageMimeType; +import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; @@ -254,15 +255,15 @@ } FormSection thisSection = new FormSection(new ColumnPanel(3)); - Iterator componentIter = pForm.getComponents().iterator(); + DataAssociationCursor components = pForm.getComponents(); String associationTypeParameter = null; String associationContentType = null; //add all persistent components to this form - while (componentIter.hasNext()) { + while (components.next()) { + PersistentComponent component = (PersistentComponent) + DomainObjectFactory.newInstance( components.getDataObject() ); - PersistentComponentFactory componentFactory = - (PersistentComponentFactory)componentIter.next(); - Component thisComponent = componentFactory.createComponent(); + Component thisComponent = component.createComponent(); if (thisComponent instanceof Hidden) { String thisParameterName = ((Hidden) thisComponent).getParameterModel().getName(); String thisValue = ((Hidden) thisComponent).getDefaultValue(); Modified: ccm-cms/trunk/src/com/arsdigita/cms/ui/authoring/PageEditDynamic.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/ui/authoring/PageEditDynamic.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-cms/trunk/src/com/arsdigita/cms/ui/authoring/PageEditDynamic.java 2004-12-21 19:37:41 UTC (rev 160) @@ -55,10 +55,12 @@ import com.arsdigita.dispatcher.MultipartHttpServletRequest; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObject; -import com.arsdigita.formbuilder.PersistentComponentFactory; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.formbuilder.PersistentComponent; import com.arsdigita.formbuilder.PersistentForm; import com.arsdigita.metadata.DynamicObjectType; import com.arsdigita.mimetypes.ImageMimeType; +import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.SessionManager; @@ -315,15 +317,15 @@ ContentType type = itemSel.getContentType(); PersistentForm pForm = m_originatingType.getItemForm(); - Iterator componentIter = pForm.getComponents().iterator(); + DataAssociationCursor components = pForm.getComponents(); String associationTypeParameter = null; String associationContentType = null; //add all persistent components to this form - while (componentIter.hasNext()) { + while (components.next()) { + PersistentComponent component = (PersistentComponent) + DomainObjectFactory.newInstance( components.getDataObject() ); - PersistentComponentFactory componentFactory = - (PersistentComponentFactory)componentIter.next(); - Component thisComponent = componentFactory.createComponent(); + Component thisComponent = component.createComponent(); if (thisComponent instanceof Hidden) { String thisParameterName = ((Hidden) thisComponent).getParameterModel().getName(); String thisValue = ((Hidden) thisComponent).getDefaultValue(); Modified: ccm-cms-types-formitem/trunk/src/com/arsdigita/cms/formbuilder/FormItem.java =================================================================== --- ccm-cms-types-formitem/trunk/src/com/arsdigita/cms/formbuilder/FormItem.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-cms-types-formitem/trunk/src/com/arsdigita/cms/formbuilder/FormItem.java 2004-12-21 19:37:41 UTC (rev 160) @@ -37,7 +37,8 @@ import com.arsdigita.cms.dispatcher.XMLGenerator; import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.formbuilder.PersistentComponentFactory; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.formbuilder.PersistentComponent; import com.arsdigita.formbuilder.PersistentForm; import com.arsdigita.formbuilder.PersistentFormSection; import com.arsdigita.formbuilder.ui.BaseAddObserver; @@ -45,6 +46,7 @@ import com.arsdigita.formbuilder.ui.FormBuilderXMLRenderer; import com.arsdigita.formbuilder.ui.ComponentTraverse; import com.arsdigita.formbuilder.util.FormBuilderUtil; +import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; @@ -62,8 +64,6 @@ import java.util.Collection; import java.util.Iterator; - - public class FormItem extends ContentPage implements XMLGenerator { public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.formbuilder.FormItem"; @@ -108,44 +108,24 @@ super.beforeSave(); } - public void delete() { + protected void beforeDelete() { PersistentForm form = getForm(); - - Collection children = form.getComponents(); - form.clearComponents(); - - Iterator i = children.iterator(); - while (i.hasNext()) { - PersistentComponentFactory c = (PersistentComponentFactory)i.next(); - - if (c instanceof PersistentFormSection) { - // In draft version, Form Sections are shared - if (DRAFT.equals(getVersion())) { - continue; - } else { - deleteSection((PersistentFormSection)c); - } - } else { - c.delete(); - } - } - - super.delete(); - form.delete(); + + super.beforeDelete(); } private void deleteSection(PersistentFormSection form) { - Collection children = form.getComponents(); - form.clearComponents(); + DataAssociationCursor children = form.getComponents(); - Iterator i = children.iterator(); - while (i.hasNext()) { - PersistentComponentFactory c = (PersistentComponentFactory)i.next(); + while (children.next()) { + PersistentComponent c = (PersistentComponent) + DomainObjectFactory.newInstance( children.getDataObject() ); c.delete(); } + form.clearComponents(); form.delete(); } Modified: ccm-cms-types-formitem/trunk/src/com/arsdigita/cms/ui/formbuilder/FormControls.java =================================================================== --- ccm-cms-types-formitem/trunk/src/com/arsdigita/cms/ui/formbuilder/FormControls.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-cms-types-formitem/trunk/src/com/arsdigita/cms/ui/formbuilder/FormControls.java 2004-12-21 19:37:41 UTC (rev 160) @@ -32,7 +32,7 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.formbuilder.PersistentComponentFactory; +import com.arsdigita.formbuilder.PersistentComponent; import com.arsdigita.formbuilder.ui.ControlEditor; import com.arsdigita.persistence.OID; import com.arsdigita.util.UncheckedWrapperException; @@ -59,8 +59,8 @@ super.addEditableComponent(container, lock); } - protected PersistentComponentFactory getFormSection(PageState state, - BigDecimal sectionID) { + protected PersistentComponent getFormSection(PageState state, + BigDecimal sectionID) { FormSectionItem section = null; try { section = (FormSectionItem)DomainObjectFactory.newInstance( Modified: ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormCopier.java =================================================================== --- ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormCopier.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormCopier.java 2004-12-21 19:37:41 UTC (rev 160) @@ -18,6 +18,11 @@ */ package com.arsdigita.cms.formbuilder; +import com.arsdigita.formbuilder.PersistentForm; +import com.arsdigita.formbuilder.PersistentFormSection; +import com.arsdigita.formbuilder.PersistentOptionGroup; +import com.arsdigita.formbuilder.PersistentWidget; +import com.arsdigita.formbuilder.WidgetLabel; import com.arsdigita.cms.ACSObjectFactory; import com.arsdigita.cms.ContentItem; @@ -26,11 +31,6 @@ import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainService; import com.arsdigita.domain.InstantiatorNotFoundException; -import com.arsdigita.formbuilder.PersistentForm; -import com.arsdigita.formbuilder.PersistentFormSection; -import com.arsdigita.formbuilder.PersistentOptionGroup; -import com.arsdigita.formbuilder.PersistentWidget; -import com.arsdigita.formbuilder.WidgetLabel; import com.arsdigita.kernel.ACSObject; import com.arsdigita.persistence.DataAssociation; import com.arsdigita.persistence.DataAssociationCursor; @@ -41,6 +41,7 @@ import com.arsdigita.util.UncheckedWrapperException; import java.util.Collection; +import java.util.HashMap; import java.util.Iterator; /** @@ -54,6 +55,8 @@ private static org.apache.log4j.Logger s_log = org.apache.log4j.Logger.getLogger(FormCopier.class); + private HashMap m_copied = new HashMap(); + public PersistentForm copyForm(PersistentForm form) { PersistentForm tgt = (PersistentForm)copyFormSection(form); @@ -63,7 +66,9 @@ public PersistentFormSection copyFormSection(PersistentFormSection src) { PersistentFormSection tgt = (PersistentFormSection)copyObject(src); - s_log.debug("Copying form section " + src.getClass().getName()); + if( s_log.isDebugEnabled() ) { + s_log.debug("Copying form section " + src.getClass().getName()); + } copyDataObjectAssociation(getDataObject(src), getDataObject(tgt), @@ -81,7 +86,9 @@ protected FormSectionWrapper copyFormSectionWrapper(FormSectionWrapper src) { FormSectionWrapper tgt = (FormSectionWrapper)copyObject(src); - s_log.debug("Copying form section wrapper " + src.getOID()); + if( s_log.isDebugEnabled() ) { + s_log.debug("Copying form section wrapper " + src.getOID()); + } tgt.setFormSectionItem(src.getFormSectionItem()); tgt.setVersion(ContentItem.LIVE); @@ -94,7 +101,9 @@ protected WidgetLabel copyWidgetLabel(WidgetLabel src) { WidgetLabel tgt = (WidgetLabel)copyObject(src); - s_log.debug("Copying widget label " + src.getOID()); + if( s_log.isDebugEnabled() ) { + s_log.debug("Copying widget label " + src.getOID()); + } PersistentWidget srcWgt = null; try { @@ -103,7 +112,11 @@ throw new UncheckedWrapperException( "cannot find widget for label " + src.getOID(), ex); } - PersistentWidget dstWgt = (PersistentWidget)copyObject(srcWgt); + + DataObject dstObj = copySingleObject( getDataObject( srcWgt ) ); + + PersistentWidget dstWgt = (PersistentWidget) + DomainObjectFactory.newInstance( dstObj ); tgt.setWidget(dstWgt); @@ -116,7 +129,9 @@ public PersistentOptionGroup copyOptionGroup(PersistentOptionGroup src) { PersistentOptionGroup tgt = (PersistentOptionGroup)copyWidget(src); - s_log.debug("Copying option group " + src.getClass().getName()); + if( s_log.isDebugEnabled() ) { + s_log.debug("Copying option group " + src.getClass().getName()); + } copyDataObjectAssociation(getDataObject(src), getDataObject(tgt), @@ -131,7 +146,9 @@ private PersistentWidget copyWidget(PersistentWidget src) { PersistentWidget tgt = (PersistentWidget)copyObject(src); - s_log.debug("Copying form widget " + src.getClass().getName()); + if( s_log.isDebugEnabled() ) { + s_log.debug("Copying form widget " + src.getClass().getName(), new Exception() ); + } copyDataObjectAssociation(getDataObject(src), getDataObject(tgt), @@ -147,13 +164,15 @@ String objectType = src.getSpecificObjectType(); String javaClass = (String)get(src, ACSObject.DEFAULT_DOMAIN_CLASS); - s_log.debug("Copying object " + src.getClass().getName()); + if( s_log.isDebugEnabled() ) { + s_log.debug("Copying object " + src.getClass().getName() + " " + src.getOID(), new Exception()); + } Assert.exists(objectType, String.class); Assert.exists(javaClass, String.class); + // Attempt to instantiate the copy ACSObject tgt; - // Attempt to instantiate the copy try { tgt = (ACSObject)ACSObjectFactory.createACSObject(javaClass, objectType); @@ -174,21 +193,26 @@ private void copyDataObjectAssociation(DataObject src, DataObject tgt, String name) { - s_log.debug("Copy association " + src.get("objectType") + " " + name); + if( s_log.isDebugEnabled() ) { + s_log.debug("Copy association " + src.get("objectType") + " " + name); + } DataAssociation tgtAssoc = (DataAssociation)tgt.get(name); DataAssociation srcAssoc = (DataAssociation)src.get(name); - DataAssociationCursor daCursor = - ((DataAssociation)srcAssoc).getDataAssociationCursor(); + DataAssociationCursor daCursor = ((DataAssociation)srcAssoc).cursor(); while (daCursor.next()) { - s_log.debug("Copy association object " + name + - " " + daCursor.getDataObject()); + if( s_log.isDebugEnabled() ) { + s_log.debug("Copy association object " + name + + " " + daCursor.getDataObject()); + } DataObject copy = copySingleObject(daCursor.getDataObject()); DataObject tgtLink = tgtAssoc.add(copy); if (tgtLink != null) { - s_log.debug("Copy link " + daCursor.getLink()); + if( s_log.isDebugEnabled() ) { + s_log.debug("Copy link " + daCursor.getLink()); + } copyDataObjectAttributes(daCursor.getLink(), tgtLink); } @@ -198,29 +222,34 @@ } private DataObject copySingleObject(DataObject src) { - // Specialize the object to ensure we have the right OID - ACSObject srcObj = null; - try { - srcObj = (ACSObject)DomainObjectFactory.newInstance(src); - } catch (InstantiatorNotFoundException ex) { - throw new UncheckedWrapperException( - (String) GlobalizationUtil.globalize( - "cms.formbuilder.cannot_instantiate_object").localize(), ex); - } + ACSObject srcObj = (ACSObject) DomainObjectFactory.newInstance(src); - ACSObject tgtObj; - if (srcObj instanceof PersistentFormSection) { - tgtObj = copyFormSection((PersistentFormSection)srcObj); - } else if (srcObj instanceof PersistentOptionGroup) { - tgtObj = copyOptionGroup((PersistentOptionGroup)srcObj); - } else if (srcObj instanceof FormSectionWrapper) { - tgtObj = copyFormSectionWrapper((FormSectionWrapper)srcObj); - } else if (srcObj instanceof PersistentWidget) { - tgtObj = copyWidget((PersistentWidget)srcObj); - } else if (srcObj instanceof WidgetLabel) { - tgtObj = copyWidgetLabel((WidgetLabel)srcObj); + ACSObject tgtObj = (ACSObject) m_copied.get( srcObj.getOID().toString() ); + if( null != tgtObj ) { + if( s_log.isDebugEnabled() ) { + s_log.debug( "Using cached copy of " + srcObj.getOID() ); + } } else { - tgtObj = copyObject(srcObj); + if( s_log.isDebugEnabled() ) { + s_log.debug( "Copying " + srcObj.getClass().getName() + " " + + srcObj.getOID() ); + } + + if (srcObj instanceof PersistentFormSection) { + tgtObj = copyFormSection((PersistentFormSection)srcObj); + } else if (srcObj instanceof PersistentOptionGroup) { + tgtObj = copyOptionGroup((PersistentOptionGroup)srcObj); + } else if (srcObj instanceof FormSectionWrapper) { + tgtObj = copyFormSectionWrapper((FormSectionWrapper)srcObj); + } else if (srcObj instanceof PersistentWidget) { + tgtObj = copyWidget((PersistentWidget)srcObj); + } else if (srcObj instanceof WidgetLabel) { + tgtObj = copyWidgetLabel((WidgetLabel)srcObj); + } else { + tgtObj = copyObject(srcObj); + } + + m_copied.put( srcObj.getOID().toString(), tgtObj ); } return getDataObject(tgtObj); Modified: ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormSectionItem.java =================================================================== --- ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormSectionItem.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormSectionItem.java 2004-12-21 19:37:41 UTC (rev 160) @@ -33,7 +33,7 @@ import com.arsdigita.cms.ItemCopier; import com.arsdigita.cms.dispatcher.XMLGenerator; import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.formbuilder.PersistentComponentFactory; +import com.arsdigita.formbuilder.PersistentComponent; import com.arsdigita.formbuilder.PersistentFormSection; import com.arsdigita.formbuilder.ui.BaseAddObserver; import com.arsdigita.formbuilder.ui.PlaceholdersInitListener; @@ -107,21 +107,26 @@ } - public void delete() { + protected void beforeDelete() { PersistentFormSection form = getFormSection(); + form.delete(); + super.beforeDelete(); + + /* Collection children = form.getComponents(); form.clearComponents(); Iterator i = children.iterator(); while (i.hasNext()) { - PersistentComponentFactory c = (PersistentComponentFactory)i.next(); + PersistentComponent c = (PersistentComponent) i.next(); c.delete(); } super.delete(); form.delete(); + */ } public boolean copyProperty(CustomCopy src, Modified: ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormSectionWrapper.java =================================================================== --- ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormSectionWrapper.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-cms-types-formsectionitem/trunk/src/com/arsdigita/cms/formbuilder/FormSectionWrapper.java 2004-12-21 19:37:41 UTC (rev 160) @@ -25,7 +25,6 @@ import com.arsdigita.formbuilder.ComponentAddObserver; import com.arsdigita.formbuilder.CompoundComponent; import com.arsdigita.formbuilder.PersistentComponent; -import com.arsdigita.formbuilder.PersistentComponentFactory; import com.arsdigita.formbuilder.PersistentFormSection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; @@ -166,30 +165,30 @@ } */ - public void addComponent(PersistentComponentFactory componentFactory) { + public void addComponent(PersistentComponent component) { FormSectionItem item = getFormSectionItem(); Assert.exists(item, FormSectionItem.class); - item.getFormSection().addComponent(componentFactory); + item.getFormSection().addComponent(component); } - public void addComponent(PersistentComponentFactory componentFactory, + public void addComponent(PersistentComponent component, int position) { FormSectionItem item = getFormSectionItem(); Assert.exists(item, FormSectionItem.class); - item.getFormSection().addComponent(componentFactory, position); + item.getFormSection().addComponent(component, position); } - public void removeComponent(PersistentComponentFactory componentFactory) { + public void removeComponent(PersistentComponent component) { FormSectionItem item = getFormSectionItem(); Assert.exists(item, FormSectionItem.class); - item.getFormSection().removeComponent(componentFactory); + item.getFormSection().removeComponent(component); } - public void moveComponent(PersistentComponentFactory componentFactory, + public void moveComponent(PersistentComponent component, int toPosition) { FormSectionItem item = getFormSectionItem(); Assert.exists(item, FormSectionItem.class); - item.getFormSection().moveComponent(componentFactory, toPosition); + item.getFormSection().moveComponent(component, toPosition); } public void clearComponents() { Modified: ccm-core/trunk/pdl/com/arsdigita/formbuilder/Component.pdl =================================================================== --- ccm-core/trunk/pdl/com/arsdigita/formbuilder/Component.pdl 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/pdl/com/arsdigita/formbuilder/Component.pdl 2004-12-21 19:37:41 UTC (rev 160) @@ -36,11 +36,11 @@ // Disabled pending reworking of the whole PersistentContainerHelper // class and removal of the old UI. association { - Component[0..n] componentContainer = join bebop_components.component_id + composite Component[0..1] componentContainer = join bebop_components.component_id to bebop_component_hierarchy.component_id, join bebop_component_hierarchy.container_id to bebop_components.component_id; - Component[0..n] \component = join bebop_components.component_id + component Component[0..n] \component = join bebop_components.component_id to bebop_component_hierarchy.container_id, join bebop_component_hierarchy.component_id to bebop_components.component_id; Modified: ccm-core/trunk/pdl/com/arsdigita/formbuilder/ProcessListener.pdl =================================================================== --- ccm-core/trunk/pdl/com/arsdigita/formbuilder/ProcessListener.pdl 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/pdl/com/arsdigita/formbuilder/ProcessListener.pdl 2004-12-21 19:37:41 UTC (rev 160) @@ -29,9 +29,8 @@ reference key (bebop_process_listeners.listener_id); } - association { - FormSection[0..1] form = join bebop_process_listeners.listener_id + composite FormSection[0..1] form = join bebop_process_listeners.listener_id to bebop_form_process_listeners.listener_id, join bebop_form_process_listeners.form_section_id to bebop_form_sections.form_section_id; Modified: ccm-core/trunk/pdl/com/arsdigita/formbuilder/WidgetLabel.pdl =================================================================== --- ccm-core/trunk/pdl/com/arsdigita/formbuilder/WidgetLabel.pdl 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/pdl/com/arsdigita/formbuilder/WidgetLabel.pdl 2004-12-21 19:37:41 UTC (rev 160) @@ -20,7 +20,12 @@ model com.arsdigita.formbuilder; object type WidgetLabel extends Component { - BigDecimal[1..1] widgetId = forms_widget_label.widget_id INTEGER; - reference key (forms_widget_label.label_id); } + +association { + component WidgetLabel[0..1] widgetLabel = join bebop_widgets.widget_id to + forms_widget_label.widget_id; + composite Widget[1..1] widget = join forms_widget_label.widget_id to + bebop_widgets.widget_id; +} Deleted: ccm-core/trunk/src/com/arsdigita/formbuilder/AttributeMetaDataProvider.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/AttributeMetaDataProvider.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/AttributeMetaDataProvider.java 2004-12-21 19:37:41 UTC (rev 160) @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. - * - * This library 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 library 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 library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package com.arsdigita.formbuilder; - - -/** - * This interface should be implemented by classes implementing the - * <code>FormProcessListener</code> that are used by persistent forms. The attribute - * metadata provided serves a number of purposes when building a PersistentForm: - * - * <ul> - * - * <li>We can ensure that the PersistentForm submits the parameters that the process listener - expects</li> - * - * <li> We can generate a default form that can be customized and persisted with the Form Builder admin UI. - * We thus avoid that the administrator having to build the persistent form scratch.</li> - * - * </ul> - * - * @author Peter Marklund - * @version $Id: //core-platform/dev/src/com/arsdigita/formbuilder/AttributeMetaDataProvider.java#8 $ - * - */ -public interface AttributeMetaDataProvider { - - public static final String versionId = "$Id: //core-platform/dev/src/com/arsdigita/formbuilder/AttributeMetaDataProvider.java#8 $ by $Author: dennis $, $DateTime: 2004/08/16 18:10:38 $"; - - public AttributeMetaDataList getAttributeMetaData(); -} Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/ComponentAddObserver.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/ComponentAddObserver.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/ComponentAddObserver.java 2004-12-21 19:37:41 UTC (rev 160) @@ -21,7 +21,7 @@ import com.arsdigita.bebop.Component; import com.arsdigita.bebop.FormSection; -import com.arsdigita.formbuilder.PersistentComponentFactory; +import com.arsdigita.formbuilder.PersistentComponent; /** @@ -32,14 +32,14 @@ public interface ComponentAddObserver { public void beforeAddingComponent(FormSection formSection, - PersistentComponentFactory componentFactory, + PersistentComponent component, int componentPosition); - public void addingComponent(PersistentComponentFactory componentFactory, + public void addingComponent(PersistentComponent persistentComponent, int componentPosition, Component component); public void afterAddingComponent(FormSection formSection, - PersistentComponentFactory componentFactory, + PersistentComponent component, int componentPosition); } Deleted: ccm-core/trunk/src/com/arsdigita/formbuilder/FormBuilderDispatcher.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/FormBuilderDispatcher.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/FormBuilderDispatcher.java 2004-12-21 19:37:41 UTC (rev 160) @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. - * - * This library 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 library 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 library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package com.arsdigita.formbuilder; - - -// This BebopMapDispatcher lets us map Bebop pages to URLs -// in a convenient way -import com.arsdigita.bebop.BebopMapDispatcher; - - -// All admin UI pages extend this class - -// The Pages of the admin UI -import com.arsdigita.formbuilder.ui.IndexPage; -import com.arsdigita.formbuilder.ui.FormPropertiesPage; -import com.arsdigita.formbuilder.ui.FormBuildingPage; -import com.arsdigita.formbuilder.ui.FormViewPage; -import com.arsdigita.formbuilder.ui.OptionGroupPage; - -// We shouldn't need those here, but BebopMapDispatcher has -// no addPage method - -import org.apache.log4j.Logger; - - - -/** - * The dispatcher of the Form Builder admin UI. All admin UI classes - * are in the <code>com.arsdigita.formbuilder.ui</code> package. There are - * a handful of pages that are each mapped to one relative URL and each - * page is implemented by its own class (a subclass of Bebop Page). - * - * @author Peter Marklund - * @version $Id: //core-platform/dev/src/com/arsdigita/formbuilder/FormBuilderDispatcher.java#10 $ - */ -public class FormBuilderDispatcher extends BebopMapDispatcher { - - public static final String versionId = "$Id: //core-platform/dev/src/com/arsdigita/formbuilder/FormBuilderDispatcher.java#10 $ by $Author: dennis $, $DateTime: 2004/08/16 18:10:38 $"; - - private static final Logger s_log = - Logger.getLogger(FormBuilderDispatcher.class); - - private static final String URL_ENDING = ".acs"; - - /** - * Constructor. Builds all pages and maps them to urls. - */ - public FormBuilderDispatcher() { - super(); - - buildAndMapPages(); - } - - /** - * Will populate the url-page map. - */ - private void buildAndMapPages() { - - // Setup up the map between Pages and relative URLs - addPage(IndexPage.instance().getRelativeURL(), IndexPage.instance()); - addPage("", IndexPage.instance()); - addPage(FormPropertiesPage.instance().getRelativeURL(), FormPropertiesPage.instance()); - addPage(FormBuildingPage.instance().getRelativeURL(), FormBuildingPage.instance()); - addPage(FormViewPage.instance().getRelativeURL(), FormViewPage.instance()); - addPage(OptionGroupPage.instance().getRelativeURL(), OptionGroupPage.instance()); - } - - public static String getURLEnding() { - return URL_ENDING; - } -} Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/FormSectionGenerator.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/FormSectionGenerator.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/FormSectionGenerator.java 2004-12-21 19:37:41 UTC (rev 160) @@ -56,8 +56,8 @@ /** - * This class can generate a Bebop Form given an object implementing the - * <code>AttributeMetaDataProvider</code> interface. The Form Builder uses + * This class can generate a Bebop Form given a PersistentComponent. + * The Form Builder uses * this class for its own admin UI to generate forms for the various persistent * components. It is unclear how useful this class will be applicable outside * the Form Builder since its functionality is still restricted. @@ -73,13 +73,13 @@ private static final Logger s_log = Logger.getLogger(FormSectionGenerator.class.getName()); - private AttributeMetaDataProvider m_metaDataProvider; + private PersistentComponent m_component; private boolean m_isAdd = true; - public FormSectionGenerator(AttributeMetaDataProvider metaDataProvider) { + public FormSectionGenerator(PersistentComponent component) { - m_metaDataProvider = metaDataProvider; + m_component = component; } public FormSection generateFormSection() { @@ -105,7 +105,7 @@ m_isAdd = isAdd; // Loop over the attributes and add appropriate widgets to the Form - AttributeMetaDataList attributeList = m_metaDataProvider.getAttributeMetaData(); + AttributeMetaDataList attributeList = m_component.getAttributeMetaData(); attributeList.setIteratorAtStart(); while(attributeList.hasNext()) { @@ -155,16 +155,7 @@ // Add a process listener that sets the attributes formSection.addProcessListener(getSetProcessListener()); - - // Save if this is a domain object - // This is a hack - I should check for a save method instead - Class domainObjectClass = - FormBuilderUtil.loadClass("com.arsdigita.domain.DomainObject"); - if (domainObjectClass.isAssignableFrom(m_metaDataProvider.getClass()) - || m_metaDataProvider instanceof com.arsdigita.formbuilder.PersistentComponentFactory) { - - formSection.addProcessListener(getDomainObjectSaveListener()); - } + formSection.addProcessListener(getDomainObjectSaveListener()); } return formSection; @@ -184,7 +175,7 @@ FormData formData = event.getFormData(); // Iterate over the attributes and set them - AttributeMetaDataList attributeList = m_metaDataProvider.getAttributeMetaData(); + AttributeMetaDataList attributeList = m_component.getAttributeMetaData(); attributeList.setIteratorAtStart(); while(attributeList.hasNext()) { @@ -203,7 +194,7 @@ try { FormBuilderUtil.invokeMethod(setMethod, - m_metaDataProvider, + m_component, new Object[] {parameterValue}); } catch (IllegalArgumentException e) { @@ -225,7 +216,7 @@ Method getMethod = getParameterMethod(parameterName, false); Object defaultValue = FormBuilderUtil.invokeMethod(getMethod, - m_metaDataProvider, + m_component, new Object[] {}); if (defaultValue != null) { @@ -263,7 +254,7 @@ Method returnMethod = null; // Simply loop over the methods and look for a matching set method name - Method[] methods = m_metaDataProvider.getClass().getMethods(); + Method[] methods = m_component.getClass().getMethods(); for (int i = 0; i < methods.length; ++i) { Method method = methods[i]; @@ -287,17 +278,10 @@ private FormProcessListener getDomainObjectSaveListener() { return new FormProcessListener() { - - public void process(FormSectionEvent event) { - - if (m_metaDataProvider instanceof com.arsdigita.domain.DomainObject) { - ((DomainObject)m_metaDataProvider).save(); - } else { - - ((PersistentComponentFactory)m_metaDataProvider).save(); - } - } - }; + public void process(FormSectionEvent event) { + m_component.save(); + } + }; } private void addValidationListeners(Widget widget, List validationListeners) { Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentComponent.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentComponent.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentComponent.java 2004-12-21 19:37:41 UTC (rev 160) @@ -59,8 +59,7 @@ * @version $Id: //core-platform/dev/src/com/arsdigita/formbuilder/PersistentComponent.java#15 $ * */ -public abstract class PersistentComponent extends AuditedACSObject - implements PersistentComponentFactory, AttributeMetaDataProvider { +public abstract class PersistentComponent extends AuditedACSObject { public static final String versionId = "$Id: //core-platform/dev/src/com/arsdigita/formbuilder/PersistentComponent.java#15 $ by $Author: dennis $, $DateTime: 2004/08/16 18:10:38 $"; @@ -82,6 +81,8 @@ // *** Constructors ------------- + private RuntimeException m_creation; + /** * Sub classes can create a new component domain object with * this constructor. @@ -92,10 +93,14 @@ // We need to save the class name of this factory object be able // to resurrect it set("defaultDomainClass", this.getClass().getName()); + + m_creation = new RuntimeException( getClass().getName() ); } public PersistentComponent(ObjectType type) { super(type); + + m_creation = new RuntimeException( getClass().getName() ); } /** @@ -106,12 +111,16 @@ throws DataObjectNotFoundException { super(oID); + + m_creation = new RuntimeException( getClass().getName() ); } public PersistentComponent(DataObject obj) { super(obj); + + m_creation = new RuntimeException( getClass().getName() ); } /** @@ -127,7 +136,15 @@ m_attributeChanged = false; } + if( s_log.isDebugEnabled() ) { + s_log.debug( "Saving a " + getClass().getName() ); + } + + try { super.beforeSave(); + } catch( Exception ex ) { + throw m_creation; + } } /** Deleted: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentComponentFactory.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentComponentFactory.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentComponentFactory.java 2004-12-21 19:37:41 UTC (rev 160) @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. - * - * This library 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 library 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 library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package com.arsdigita.formbuilder; - - -// Each factory has a unique id by which it can be retrievd -import java.math.BigDecimal; - -// The factory creates Bebop Components -import com.arsdigita.bebop.Component; - - -/** - * Implemented by classes that can persist and create a Bebop - * Component. - * - * @author Peter Marklund - * @version $Id: //core-platform/dev/src/com/arsdigita/formbuilder/PersistentComponentFactory.java#9 $ - * - */ -public interface PersistentComponentFactory { - - public static final String versionId = "$Id: //core-platform/dev/src/com/arsdigita/formbuilder/PersistentComponentFactory.java#9 $ by $Author: dennis $, $DateTime: 2004/08/16 18:10:38 $"; - - /** - * Using the metadata in this persistent component - * create a Bebop component that is a snapshot of - * this data. - */ - public Component createComponent(); - - public void save(); - - public void delete(); - - public BigDecimal getID(); - - /** - * Indicates if the factory has been saved or not. See - * {@link com.arsdigita.domain.DomainObject#isNew()} - */ - public boolean isNew(); -} Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentContainer.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentContainer.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentContainer.java 2004-12-21 19:37:41 UTC (rev 160) @@ -23,7 +23,7 @@ /** * Implemented by classes that contain persistent Bebop components. The - * components are added via their corresponding PersistentComponentFactory that + * components are added via their corresponding PersistentComponent that * knows how to create the component. The relationship between the container * and the components is an aggregate association (in UML terminology) with * multiplicity 0..N on both ends of the association. @@ -40,7 +40,7 @@ * Add a component last in the list of components in * this container. */ - public void addComponent(PersistentComponentFactory componentFactory); + public void addComponent(PersistentComponent component); /** @@ -49,20 +49,20 @@ * @param position The position to add the component at. Positions start * with 1 */ - public void addComponent(PersistentComponentFactory componentFactory, + public void addComponent(PersistentComponent component, int position); /** * Remove a component from the Container */ - public void removeComponent(PersistentComponentFactory componentFactory); + public void removeComponent(PersistentComponent component); /** * Move component to new position. * * @param toPosition The position to move the component to. Positions start with 1. */ - public void moveComponent(PersistentComponentFactory componentFactory, + public void moveComponent(PersistentComponent component, int toPosition); /** Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentDeditor.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentDeditor.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentDeditor.java 2004-12-21 19:37:41 UTC (rev 160) @@ -25,7 +25,7 @@ // This factory creates a Deditor import com.arsdigita.bebop.form.Deditor; -// Every PersistentComponentFactory can create a Bebop Component +// Every PersistentComponent can create a Bebop Component import com.arsdigita.bebop.Component; // Id class used by internal constructor @@ -52,8 +52,7 @@ * @version $Id: //core-platform/dev/src/com/arsdigita/formbuilder/PersistentDeditor.java#9 $ * */ -public class PersistentDeditor extends PersistentWidget - implements AttributeMetaDataProvider { +public class PersistentDeditor extends PersistentWidget { public static final String versionId = "$Id: //core-platform/dev/src/com/arsdigita/formbuilder/PersistentDeditor.java#9 $ by $Author: dennis $, $DateTime: 2004/08/16 18:10:38 $"; Deleted: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormGenerator.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormGenerator.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormGenerator.java 2004-12-21 19:37:41 UTC (rev 160) @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved. - * - * This library 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 library 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 library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -package com.arsdigita.formbuilder; - - -/** - * This class can generate a PersistentForm given an object implementing the - * <code>AttributeMetaDataProvider</code> interface. Such a persistent form - * can be used as a starting point for an administrator building a persistent form - * for a certain process listener. - * - * @author Peter Marklund - * @version $Id: //core-platform/dev/src/com/arsdigita/formbuilder/PersistentFormGenerator.java#8 $ - * - */ -public class PersistentFormGenerator { - - public static final String versionId = "$Id: //core-platform/dev/src/com/arsdigita/formbuilder/PersistentFormGenerator.java#8 $ by $Author: dennis $, $DateTime: 2004/08/16 18:10:38 $"; - - private AttributeMetaDataProvider m_metaDataProvider; - - public PersistentFormGenerator(AttributeMetaDataProvider metaDataProvider) { - - m_metaDataProvider = metaDataProvider; - } - - public PersistentForm generatePersistentForm() { - - // TODO - return PersistentForm.create("dummy form"); - } -} Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormSection.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormSection.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormSection.java 2004-12-21 19:37:41 UTC (rev 160) @@ -18,46 +18,27 @@ */ package com.arsdigita.formbuilder; - -// This domain object can create a Bebop FormSection -import com.arsdigita.bebop.FormSection; - -// Manages associations with child components import com.arsdigita.formbuilder.util.PersistentContainerHelper; -// For the FormSection constructor - -// What we add to the form section import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Container; +import com.arsdigita.bebop.FormSection; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataAssociation; +import com.arsdigita.persistence.DataAssociationCursor; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.metadata.ObjectType; -// For attributes of the form - -// Child components are returned in a collection +import java.math.BigDecimal; import java.util.Collection; import java.util.Iterator; import java.util.ArrayList; -// Thrown if the underlying DataObject with given id cannot be found -import com.arsdigita.domain.DataObjectNotFoundException; - -// We are persisting these via their class name - -// For instantiating objects - -// All ACSObjects have a unique id -import java.math.BigDecimal; -import com.arsdigita.persistence.OID; -import com.arsdigita.persistence.DataObject; -import com.arsdigita.persistence.metadata.ObjectType; - -// ACS 5 uses Log4J for logging import org.apache.log4j.Logger; -import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.persistence.DataAssociationCursor; -import com.arsdigita.persistence.DataAssociation; - /** * This domain object manages persistence of a Bebop FormSection. * @@ -147,19 +128,36 @@ * I am overriding this method to delete all associations with * components before the form is deleted. The components themselves are not deleted. */ - public void delete() { + /* + protected void beforeDelete() { + if( s_log.isDebugEnabled() ) { + s_log.debug( "Deleting children of " + getOID() ); + } - m_container.clearComponents(); + DataAssociationCursor components = m_container.getComponents(); + while( components.next() ) { + DomainObject obj = + DomainObjectFactory.newInstance( components.getDataObject() ); - super.delete(); + if( s_log.isDebugEnabled() ) { + s_log.debug( "Deleting child of " + getOID() + ": " + + obj.getOID() + "(" + obj.getClass().getName() + + ")" ); + } + obj.delete(); + } + + //m_container.clearComponents(); + super.beforeDelete(); } + */ /** * Add a component after the already added components (in the last position). * If this domain object has not been saved (with save()) before you invoke this method * it will be saved by this method. */ - public void addComponent(PersistentComponentFactory componentFactory) { + public void addComponent(PersistentComponent componentFactory) { // Delegate to the Container helper m_container.addComponent(componentFactory); @@ -174,7 +172,7 @@ * the third component to be added to the form this * value would be 3) */ - public void addComponent(PersistentComponentFactory componentFactory, + public void addComponent(PersistentComponent componentFactory, int position) { // Delegate to the Container helper @@ -186,7 +184,7 @@ * If this domain object has not been saved (with save()) before you invoke this method * it will be saved by this method. */ - public void removeComponent(PersistentComponentFactory componentFactory) { + public void removeComponent(PersistentComponent componentFactory) { // Delegate to the Container helper m_container.removeComponent(componentFactory); @@ -197,7 +195,7 @@ * * @param toPosition The position to move the component to. Positions start with 1. */ - public void moveComponent(PersistentComponentFactory componentFactory, + public void moveComponent(PersistentComponent componentFactory, int toPosition) { // Delegate to the Container helper @@ -234,10 +232,9 @@ } /** - * Return all children components represented by their PersistentComponentFactory - * objects. + * Return all child components */ - public Collection getComponents() { + public DataAssociationCursor getComponents() { // Delegate to the Container helper return m_container.getComponents(); @@ -260,40 +257,38 @@ } /** - * Add all child components to the FormSection. Each persisted component has an associated - * PersistentComponentFactory that can be resurrected with the id of the component. - * The Bebop components are created with the createComponent() method of their factory. + * Add all child components to the FormSection. */ protected void addComponents(FormSection formSection) { - Iterator componentIter = m_container.getComponents().iterator(); + DataAssociationCursor components = m_container.getComponents(); // Loop over the child components int componentCounter = 1; - while (componentIter.hasNext()) { - // Fetch the next component factory from the list - PersistentComponentFactory factory = - (PersistentComponentFactory)componentIter.next(); + while (components.next()) { + // Fetch the next component from the list + PersistentComponent persistentComponent = (PersistentComponent) + DomainObjectFactory.newInstance( components.getDataObject() ); - // Add the component to the form with the factory + // Add the component to the form // Fire the component add observer if (m_componentAddObserver != null) { - m_componentAddObserver.beforeAddingComponent(formSection, factory, componentCounter); + m_componentAddObserver.beforeAddingComponent(formSection, persistentComponent, componentCounter); } - Component component = factory.createComponent(); + Component component = persistentComponent.createComponent(); // Give the observer an opportunity to modify the component that we add to the form if (m_componentAddObserver != null) { - m_componentAddObserver.addingComponent(factory, componentCounter, component); + m_componentAddObserver.addingComponent(persistentComponent, componentCounter, component); } formSection.add(component); // Fire the component add observer if (m_componentAddObserver != null) { - m_componentAddObserver.afterAddingComponent(formSection, factory, componentCounter); + m_componentAddObserver.afterAddingComponent(formSection, persistentComponent, componentCounter); } ++componentCounter; Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentOptionGroup.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentOptionGroup.java 2004-12-21 19:20:24 UTC (rev 159) +++ ccm-core/trunk/src/com/arsdigita/fo... [truncated message content] |
From: <mb...@re...> - 2004-12-21 19:29:16
|
Author: mbooth Date: 2004-12-21 20:20:24 +0100 (Tue, 21 Dec 2004) New Revision: 159 Modified: ccm-forum/trunk/src/com/arsdigita/forum/ui/EditPostForm.java ccm-forum/trunk/src/com/arsdigita/forum/ui/NewPostForm.java ccm-forum/trunk/src/com/arsdigita/forum/ui/PostForm.java ccm-forum/trunk/src/com/arsdigita/forum/ui/ThreadComponent.java Log: Don't redirect after posting because it results in the wizard not being properly reset. This still needs to be fixed properly. Modified: ccm-forum/trunk/src/com/arsdigita/forum/ui/EditPostForm.java =================================================================== --- ccm-forum/trunk/src/com/arsdigita/forum/ui/EditPostForm.java 2004-12-17 17:26:33 UTC (rev 158) +++ ccm-forum/trunk/src/com/arsdigita/forum/ui/EditPostForm.java 2004-12-21 19:20:24 UTC (rev 159) @@ -36,7 +36,6 @@ import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.kernel.ui.ACSObjectSelectionModel; import com.arsdigita.util.UncheckedWrapperException; -import com.arsdigita.web.RedirectSignal; import java.io.IOException; import java.math.BigDecimal; import org.apache.log4j.Logger; Modified: ccm-forum/trunk/src/com/arsdigita/forum/ui/NewPostForm.java =================================================================== --- ccm-forum/trunk/src/com/arsdigita/forum/ui/NewPostForm.java 2004-12-17 17:26:33 UTC (rev 158) +++ ccm-forum/trunk/src/com/arsdigita/forum/ui/NewPostForm.java 2004-12-21 19:20:24 UTC (rev 159) @@ -32,7 +32,6 @@ import com.arsdigita.forum.Forum; import com.arsdigita.kernel.Kernel; import com.arsdigita.util.UncheckedWrapperException; -import com.arsdigita.web.RedirectSignal; import java.io.IOException; import java.math.BigDecimal; Modified: ccm-forum/trunk/src/com/arsdigita/forum/ui/PostForm.java =================================================================== --- ccm-forum/trunk/src/com/arsdigita/forum/ui/PostForm.java 2004-12-17 17:26:33 UTC (rev 158) +++ ccm-forum/trunk/src/com/arsdigita/forum/ui/PostForm.java 2004-12-21 19:20:24 UTC (rev 159) @@ -171,7 +171,7 @@ public void process(FormSectionEvent e) throws FormProcessException { - PageState state = e.getPageState(); + final PageState state = e.getPageState(); Post post = getPost(state, true); processWidgets(state, post); @@ -182,6 +182,8 @@ post.save(); fireCompletionEvent(state); + /* XXX: This is the right thing to do, however it results in + the wizard not being reset. I haven't tracked down why. state.clearControlEvent(); try { @@ -189,6 +191,7 @@ } catch( IOException ex ) { throw new UncheckedWrapperException( ex ); } + */ } } Modified: ccm-forum/trunk/src/com/arsdigita/forum/ui/ThreadComponent.java =================================================================== --- ccm-forum/trunk/src/com/arsdigita/forum/ui/ThreadComponent.java 2004-12-17 17:26:33 UTC (rev 158) +++ ccm-forum/trunk/src/com/arsdigita/forum/ui/ThreadComponent.java 2004-12-21 19:20:24 UTC (rev 159) @@ -49,7 +49,6 @@ import com.arsdigita.messaging.MessageThread; import com.arsdigita.messaging.ThreadedMessage; import com.arsdigita.util.Assert; -import com.arsdigita.web.RedirectSignal; import com.arsdigita.web.URL; import com.arsdigita.xml.Element; |
From: <ss...@re...> - 2004-12-17 17:35:16
|
Author: sshinde Date: 2004-12-17 18:26:33 +0100 (Fri, 17 Dec 2004) New Revision: 158 Modified: ccm-core/trunk/src/com/arsdigita/messaging/ThreadedMessage.java ccm-forum/trunk/src/com/arsdigita/forum/Post.java Log: Make the beforeDelete() method in both classes protected. This is the right change which should fix change no. 156. Modified: ccm-core/trunk/src/com/arsdigita/messaging/ThreadedMessage.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/messaging/ThreadedMessage.java 2004-12-17 15:08:30 UTC (rev 157) +++ ccm-core/trunk/src/com/arsdigita/messaging/ThreadedMessage.java 2004-12-17 17:26:33 UTC (rev 158) @@ -29,7 +29,6 @@ import com.arsdigita.persistence.PersistenceException; import com.arsdigita.persistence.Session; import com.arsdigita.persistence.SessionManager; -import com.arsdigita.util.UncheckedWrapperException; // Java Core classes import java.math.BigDecimal; @@ -430,7 +429,7 @@ return child; } - public void beforeDelete() { + protected void beforeDelete() { if( s_log.isDebugEnabled() ) { s_log.debug( "Deleting children of " + getOID() ); } Modified: ccm-forum/trunk/src/com/arsdigita/forum/Post.java =================================================================== --- ccm-forum/trunk/src/com/arsdigita/forum/Post.java 2004-12-17 15:08:30 UTC (rev 157) +++ ccm-forum/trunk/src/com/arsdigita/forum/Post.java 2004-12-17 17:26:33 UTC (rev 158) @@ -447,7 +447,7 @@ return m_moderator; } - public void beforeDelete() { + protected void beforeDelete() { // First delete associated entries in nt_requests this entry and // all of its replies (in case of a root message) have List replies = new ArrayList(); |
From: <ss...@re...> - 2004-12-17 15:17:26
|
Author: sshinde Date: 2004-12-17 16:08:30 +0100 (Fri, 17 Dec 2004) New Revision: 157 Modified: ccm-forum/trunk/src/com/arsdigita/forum/Post.java Log: Modified: ccm-forum/trunk/src/com/arsdigita/forum/Post.java =================================================================== --- ccm-forum/trunk/src/com/arsdigita/forum/Post.java 2004-12-16 15:51:05 UTC (rev 156) +++ ccm-forum/trunk/src/com/arsdigita/forum/Post.java 2004-12-17 15:08:30 UTC (rev 157) @@ -23,7 +23,6 @@ import com.arsdigita.categorization.CategorizedObject; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.domain.DomainService; import com.arsdigita.kernel.Party; import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.Kernel; @@ -34,7 +33,6 @@ import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataOperation; -import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.PersistenceException; import com.arsdigita.persistence.SessionManager; @@ -42,8 +40,6 @@ import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.Collection; -import java.util.Collections; import java.math.BigDecimal; import org.apache.log4j.Logger; @@ -451,7 +447,7 @@ return m_moderator; } - protected void beforeDelete() { + public void beforeDelete() { // First delete associated entries in nt_requests this entry and // all of its replies (in case of a root message) have List replies = new ArrayList(); @@ -463,7 +459,7 @@ msgs.addEqualsFilter("root", getID()); while (msgs.next()) { replies.add(msgs.getDataObject()); - msgIdList.add( (BigDecimal) msgs.getDataObject().getOID().get("id")); + msgIdList.add( msgs.getDataObject().getOID().get("id")); } } DataCollection requests = SessionManager.getSession() @@ -479,7 +475,7 @@ // This posting is the root of the thread. Make sure all postings // in this thread are deleted before this very one. Also // take care of thread subscription. - ThreadSubscription sub = ThreadSubscription.getThreadSubscription(this); + ThreadSubscription sub = ThreadSubscription.getThreadSubscription(this.getThread()); sub.delete(); MessageThread thread = MessageThread.getFromRootMessage(this); thread.delete(); |
From: <mb...@re...> - 2004-12-16 15:59:45
|
Author: mbooth Date: 2004-12-16 16:51:05 +0100 (Thu, 16 Dec 2004) New Revision: 156 Modified: ccm-core/trunk/pdl/com/arsdigita/messaging/Thread.pdl ccm-core/trunk/src/com/arsdigita/messaging/MessageThread.java ccm-core/trunk/src/com/arsdigita/messaging/ThreadedMessage.java Log: Update the number of replies in a thread when deleting messages Modified: ccm-core/trunk/pdl/com/arsdigita/messaging/Thread.pdl =================================================================== --- ccm-core/trunk/pdl/com/arsdigita/messaging/Thread.pdl 2004-12-16 15:50:11 UTC (rev 155) +++ ccm-core/trunk/pdl/com/arsdigita/messaging/Thread.pdl 2004-12-16 15:51:05 UTC (rev 156) @@ -53,3 +53,11 @@ where thread_id = :threadID } } + +data operation decrNumReplies { + do { + update message_threads + set num_replies = num_replies - 1 + where thread_id = :threadID + } +} Modified: ccm-core/trunk/src/com/arsdigita/messaging/MessageThread.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/messaging/MessageThread.java 2004-12-16 15:50:11 UTC (rev 155) +++ ccm-core/trunk/src/com/arsdigita/messaging/MessageThread.java 2004-12-16 15:51:05 UTC (rev 156) @@ -121,6 +121,7 @@ /** * Increments the number of messages in the thread by one. + * The reason for the continued existance of this is thread safety */ private void incrNumberOfReplies() { DataOperation op = SessionManager.getSession().retrieveDataOperation( @@ -130,6 +131,17 @@ } /** + * Decrements the number of messages in the thread by one. + * The reason for the continued existance of this is thread safety + */ + private void decrNumberOfReplies() { + DataOperation op = SessionManager.getSession().retrieveDataOperation( + "com.arsdigita.messaging.decrNumReplies"); + op.setParameter("threadID", getID()); + op.execute(); + } + + /** * Gets the Date of the most recent message added to this thread */ public Date getLatestUpdateDate() { @@ -183,7 +195,19 @@ incrNumberOfReplies(); } + /** + * updates the MessageThread as necessary for a Message being removed. + * This is only meant to be called by the ThreadedMessage class + * + * @pre msg.getThread().equals(this) + */ + void removeMessage(ThreadedMessage msg) { + Assert.assertTrue(msg.getThread().equals(this)); + decrNumberOfReplies(); + } + + /** * retrieves the MessageThread object which has the specified * ThreadedMessage as its root * Modified: ccm-core/trunk/src/com/arsdigita/messaging/ThreadedMessage.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/messaging/ThreadedMessage.java 2004-12-16 15:50:11 UTC (rev 155) +++ ccm-core/trunk/src/com/arsdigita/messaging/ThreadedMessage.java 2004-12-16 15:51:05 UTC (rev 156) @@ -19,8 +19,9 @@ package com.arsdigita.messaging; // ACS Core classes -import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.kernel.Party; +import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.Filter; @@ -171,9 +172,7 @@ * @param key the id of the message. */ - public ThreadedMessage(BigDecimal id) - throws DataObjectNotFoundException - { + public ThreadedMessage(BigDecimal id) { super(new OID(BASE_DATA_OBJECT_TYPE, id)); } @@ -184,9 +183,7 @@ * @param oid the OID of the message */ - public ThreadedMessage(OID oid) - throws DataObjectNotFoundException - { + public ThreadedMessage(OID oid) { super(oid); } @@ -341,16 +338,7 @@ if (rootID == null) { root = this; } else { - try { - root = new ThreadedMessage(rootID); - } catch (DataObjectNotFoundException e) { - throw new UncheckedWrapperException( - "Tried to retrieve the root message " + - "(believed to have ID #" + rootID + ") of message #" + - getID() + " and failed. This is indicative of " + - "something profoundly wrong with the state of " + - "the database.", e); - } + root = new ThreadedMessage(rootID); } m_thread = MessageThread.getFromRootMessage(root); } @@ -441,4 +429,24 @@ return child; } + + public void beforeDelete() { + if( s_log.isDebugEnabled() ) { + s_log.debug( "Deleting children of " + getOID() ); + } + + DataCollection children = SessionManager.getSession().retrieve + ( BASE_DATA_OBJECT_TYPE ); + children.addEqualsFilter( Message.INREPLYTO, getID() ); + + while( children.next() ) { + DomainObjectFactory.newInstance( children.getDataObject() ).delete(); + } + + getThread().removeMessage( this ); + + if( s_log.isDebugEnabled() ) { + s_log.debug( "Deleting " + getOID() ); + } + } } |
From: <mb...@re...> - 2004-12-16 15:58:45
|
Author: mbooth Date: 2004-12-16 16:50:11 +0100 (Thu, 16 Dec 2004) New Revision: 155 Modified: ccm-core/trunk/src/com/arsdigita/bebop/FormModel.java Log: If a process listener throws a redirect signal, wait until all other listeners have fired before actually redirecting. Modified: ccm-core/trunk/src/com/arsdigita/bebop/FormModel.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/bebop/FormModel.java 2004-12-16 09:31:39 UTC (rev 154) +++ ccm-core/trunk/src/com/arsdigita/bebop/FormModel.java 2004-12-16 15:50:11 UTC (rev 155) @@ -30,6 +30,7 @@ import com.arsdigita.util.Assert; import com.arsdigita.util.Lockable; import com.arsdigita.util.URLRewriter; +import com.arsdigita.web.RedirectSignal; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -498,9 +499,26 @@ throw new IllegalStateException("Request data must be valid " + "prior to running processing filters."); } Iterator i = m_listenerList.getListenerIterator(FormProcessListener.class); + + RedirectSignal redirect = null; while (i.hasNext()) { - ((FormProcessListener) i.next()).process(e); + try { + ((FormProcessListener) i.next()).process(e); + } catch( RedirectSignal signal ) { + if( s_log.isDebugEnabled() ) { + s_log.debug( "Delaying redirect to " + + signal.getDestinationURL() ); + } + + if( null != redirect ) { + s_log.error( "Non-deterministic redirect. Ignoring earlier occurrence.", redirect ); + } + + redirect = signal; + } } + + if( null != redirect ) throw redirect; } /** |
From: <mb...@re...> - 2004-12-16 09:40:32
|
Author: mbooth Date: 2004-12-16 10:31:39 +0100 (Thu, 16 Dec 2004) New Revision: 154 Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ProcessListenerEditor.java Log: Redirect after action events to avoid refresh error. Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ProcessListenerEditor.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ProcessListenerEditor.java 2004-12-15 23:33:49 UTC (rev 153) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ProcessListenerEditor.java 2004-12-16 09:31:39 UTC (rev 154) @@ -45,7 +45,9 @@ import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.OID; import com.arsdigita.util.UncheckedWrapperException; +import com.arsdigita.web.RedirectSignal; +import java.io.IOException; import java.math.BigDecimal; /** @@ -203,6 +205,13 @@ throw new UncheckedWrapperException("cannot find listener", ex); } } + + state.clearControlEvent(); + try { + throw new RedirectSignal( state.stateAsURL(), true ); + } catch( IOException ex ) { + throw new UncheckedWrapperException( ex ); + } } } |
From: <mb...@re...> - 2004-12-15 23:42:28
|
Author: mbooth Date: 2004-12-16 00:33:49 +0100 (Thu, 16 Dec 2004) New Revision: 153 Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormSection.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ProcessListenerEditor.java Log: Fix a bug when deleting form actions. Somebody already wrote the code to recalculate action positions, but it wasn't being called. Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormSection.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormSection.java 2004-12-15 22:33:54 UTC (rev 152) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentFormSection.java 2004-12-15 23:33:49 UTC (rev 153) @@ -343,6 +343,9 @@ remove("listeners", listener); m_listeners.remove(position); + + if( s_log.isDebugEnabled() ) + s_log.debug( "Removing process listener at position " + position ); DataAssociation listeners = (DataAssociation)get("listeners"); DataAssociationCursor cursor = listeners.cursor(); @@ -351,6 +354,10 @@ while (cursor.next()) { DataObject link = cursor.getLink(); BigDecimal current = (BigDecimal)link.get("position"); + if( s_log.isDebugEnabled() ) { + s_log.debug( "Position " + current ); + } + if (current.intValue() > position) { link.set("position", new BigDecimal(current.intValue() - 1)); } Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ProcessListenerEditor.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ProcessListenerEditor.java 2004-12-15 22:33:54 UTC (rev 152) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/ui/ProcessListenerEditor.java 2004-12-15 23:33:49 UTC (rev 153) @@ -21,35 +21,33 @@ import com.arsdigita.formbuilder.util.GlobalizationUtil ; -import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.formbuilder.PersistentFormSection; +import com.arsdigita.formbuilder.PersistentProcessListener; +import com.arsdigita.formbuilder.util.FormBuilderUtil; + +import com.arsdigita.bebop.BoxPanel; +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.Label; -import com.arsdigita.bebop.event.FormSectionEvent; -import com.arsdigita.bebop.FormProcessException; -import com.arsdigita.bebop.Component; -import com.arsdigita.bebop.Table; -import com.arsdigita.formbuilder.ui.ProcessListenerProperties; -import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.domain.DomainObjectFactory; -import com.arsdigita.persistence.OID; -import com.arsdigita.util.UncheckedWrapperException; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.Page; -import com.arsdigita.bebop.BoxPanel; -import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.PageState; -import com.arsdigita.formbuilder.PersistentProcessListener; -import com.arsdigita.formbuilder.ui.NewAction; -import com.arsdigita.formbuilder.ui.ProcessListenerTableModelBuilder; -import com.arsdigita.formbuilder.util.FormBuilderUtil; import com.arsdigita.bebop.SimpleContainer; -import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.SingleSelectionModel; +import com.arsdigita.bebop.Table; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionListener; +import com.arsdigita.bebop.table.TableCellRenderer; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.OID; +import com.arsdigita.util.UncheckedWrapperException; + import java.math.BigDecimal; -import com.arsdigita.bebop.Link; -import com.arsdigita.bebop.Label; - /** * This class provides a pluggable widget for editing the * persistent process listeners for a persistent form. It @@ -190,11 +188,17 @@ BigDecimal action_id = (BigDecimal)m_action.getSelectedKey(state); try { + BigDecimal formID = (BigDecimal) + m_form.getSelectedKey( state ); + PersistentFormSection form = + new PersistentFormSection( formID ); + PersistentProcessListener l = (PersistentProcessListener) DomainObjectFactory.newInstance( new OID(PersistentProcessListener.BASE_DATA_OBJECT_TYPE, action_id)); - l.delete(); + //l.delete(); + form.removeProcessListener( l ); } catch (DataObjectNotFoundException ex) { throw new UncheckedWrapperException("cannot find listener", ex); } |
From: <mb...@re...> - 2004-12-15 22:42:35
|
Author: mbooth Date: 2004-12-15 23:33:54 +0100 (Wed, 15 Dec 2004) New Revision: 152 Modified: ccm-cms/trunk/src/com/arsdigita/cms/ContentItem.java Log: Fix republish Modified: ccm-cms/trunk/src/com/arsdigita/cms/ContentItem.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/ContentItem.java 2004-12-10 13:57:54 UTC (rev 151) +++ ccm-cms/trunk/src/com/arsdigita/cms/ContentItem.java 2004-12-15 22:33:54 UTC (rev 152) @@ -1116,7 +1116,7 @@ "; unpublishing the parent"); } - ((ContentItem) parent).unpublish(); + ((ContentItem) parent).setLive( null ); } s_log.debug("Setting the live version association to null and " + @@ -1240,6 +1240,9 @@ s_log.debug( "Republishing item " + getOID().toString() ); } + applyTag( "Republished" ); + Versions.suspendVersioning(); + Assert.truth( isLive(), "Attempt to republish non live item " + getOID() ); Lifecycle cycle = getLifecycle(); @@ -1250,6 +1253,7 @@ } ContentItem newLive = createPendingVersion( cycle ); + setLive( null ); promotePendingVersion( newLive ); } |
From: <mb...@re...> - 2004-12-10 14:06:20
|
Author: mbooth Date: 2004-12-10 14:57:54 +0100 (Fri, 10 Dec 2004) New Revision: 151 Modified: ccm-cms/trunk/application.xml ccm-core/trunk/application.xml Log: Bump release numbers again Modified: ccm-cms/trunk/application.xml =================================================================== --- ccm-cms/trunk/application.xml 2004-12-10 13:56:28 UTC (rev 150) +++ ccm-cms/trunk/application.xml 2004-12-10 13:57:54 UTC (rev 151) @@ -3,7 +3,7 @@ <ccm:application name="ccm-cms" prettyName="Red Hat CCM Content Management System" version="6.1.0" - release="12" + release="13" webapp="ROOT" xmlns:ccm="http://ccm.redhat.com/ccm-project"> Modified: ccm-core/trunk/application.xml =================================================================== --- ccm-core/trunk/application.xml 2004-12-10 13:56:28 UTC (rev 150) +++ ccm-core/trunk/application.xml 2004-12-10 13:57:54 UTC (rev 151) @@ -3,7 +3,7 @@ <ccm:application name="ccm-core" prettyName="Core" version="6.1.0" - release="17" + release="18" webapp="ROOT" buildHooks="build-hooks.xml" xmlns:ccm="http://ccm.redhat.com/ccm-project"> |
From: <mb...@re...> - 2004-12-10 14:04:51
|
Author: mbooth Date: 2004-12-10 14:56:28 +0100 (Fri, 10 Dec 2004) New Revision: 150 Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/OptionEditor.java Log: Add notnullvalidationlisteners to widgets to avoid submission errors. Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/OptionEditor.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/OptionEditor.java 2004-12-10 13:51:26 UTC (rev 149) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/OptionEditor.java 2004-12-10 13:56:28 UTC (rev 150) @@ -44,6 +44,7 @@ import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionListener; import com.arsdigita.bebop.form.TextField; +import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.table.AbstractTableModelBuilder; import com.arsdigita.bebop.table.TableModel; @@ -174,9 +175,11 @@ if (showOptionValue()) { m_value = new TextField(new StringParameter("opt_value")); + m_value.addValidationListener( new NotNullValidationListener() ); } m_label = new TextField(new StringParameter("opt_label")); + m_label.addValidationListener( new NotNullValidationListener() ); m_buttons = new SaveCancelSection(); |
From: <mb...@re...> - 2004-12-10 13:59:51
|
Author: mbooth Date: 2004-12-10 14:51:26 +0100 (Fri, 10 Dec 2004) New Revision: 149 Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentWidget.java ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/WidgetForm.java Log: Correctly initialise "Answer required" in WidgetForm Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentWidget.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentWidget.java 2004-12-10 12:52:56 UTC (rev 148) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/PersistentWidget.java 2004-12-10 13:51:26 UTC (rev 149) @@ -77,6 +77,7 @@ private Class DEFAULT_VALUE_CLASS = String.class; public static final String DEFAULT_VALUE = "defaultValue"; + public static final String REQUIRED = "widgetRequired"; /** * BASE_DATA_OBJECT_TYPE represents the full name of the @@ -278,6 +279,18 @@ } /** + * Set this + */ + public void setRequired( boolean required ) { + setComponentAttribute( REQUIRED, new Boolean( required ).toString() ); + } + + public boolean isRequired() { + String required = getComponentAttribute( REQUIRED ); + return !Boolean.FALSE.toString().equals( required ); + } + + /** * This provides a method to take a default value and deserialize * it in to its original object. This is useful if the defaultValue * is actually something like a serialized java.util.Date Modified: ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/WidgetForm.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/WidgetForm.java 2004-12-10 12:52:56 UTC (rev 148) +++ ccm-core/trunk/src/com/arsdigita/formbuilder/ui/editors/WidgetForm.java 2004-12-10 13:51:26 UTC (rev 149) @@ -52,6 +52,7 @@ import com.arsdigita.formbuilder.ui.PropertiesForm; import com.arsdigita.util.Assert; +import com.arsdigita.bebop.parameters.BooleanParameter; import com.arsdigita.bebop.parameters.URLTokenValidationListener; import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.StringInRangeValidationListener; @@ -59,7 +60,11 @@ import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.xml.Element; +import org.apache.log4j.Logger; + public abstract class WidgetForm extends PropertiesForm { + private static final Logger s_log = Logger.getLogger( WidgetForm.class ); + private SingleSelectionModel m_form; private SingleSelectionModel m_action; @@ -172,7 +177,7 @@ } if (includeRequiredRadioGroup()) { - m_required = new RadioGroup("required"); + m_required = new RadioGroup( new BooleanParameter( "required" ) ); section.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.editors.answer_required")), ColumnPanel.RIGHT); section.add(m_required); @@ -272,6 +277,8 @@ if (showDescription()) { m_description.setValue(state, widget.getDescription()); } + + m_required.setValue( state, new Boolean( widget.isRequired() ) ); } } @@ -297,14 +304,16 @@ } if (includeRequiredRadioGroup()) { - if (((String)m_required.getValue(pageState)).equals(Boolean.TRUE.toString())) { + boolean required = ( (Boolean) m_required.getValue( pageState ) ).booleanValue(); + + widget.setRequired( required ); + if( required ) { // Answer is required String listenerClassName = "com.arsdigita.bebop.parameters.NotEmptyValidationListener"; PersistentParameterListener listener = new PersistentParameterListener(listenerClassName); widget.addValidationListener(listener); - } else { // Answer is not required // We need not add any listener |
From: <mb...@re...> - 2004-12-10 13:01:24
|
Author: mbooth Date: 2004-12-10 13:52:56 +0100 (Fri, 10 Dec 2004) New Revision: 148 Modified: ccm-cms/trunk/src/com/arsdigita/cms/portlet/ContentItemPortlet.java ccm-core/trunk/src/com/arsdigita/bebop/portal/AbstractPortletRenderer.java Log: AbstractPortletRenderer caches too much info. Don't cache the portlet element itself, just its contents. Modified: ccm-cms/trunk/src/com/arsdigita/cms/portlet/ContentItemPortlet.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/portlet/ContentItemPortlet.java 2004-12-09 18:10:06 UTC (rev 147) +++ ccm-cms/trunk/src/com/arsdigita/cms/portlet/ContentItemPortlet.java 2004-12-10 12:52:56 UTC (rev 148) @@ -41,13 +41,6 @@ return BASE_DATA_OBJECT_TYPE; } - public String getTitle() { - // I neither know or care why this works, but it does. - // Makes bebop:portlet have the correct title attribute - // mb...@re... 04/12/2004 - return ""; - } - public ContentItem getContentItem() { return (ContentItem) DomainObjectFactory.newInstance ((DataObject) get(ITEM)); Modified: ccm-core/trunk/src/com/arsdigita/bebop/portal/AbstractPortletRenderer.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/bebop/portal/AbstractPortletRenderer.java 2004-12-09 18:10:06 UTC (rev 147) +++ ccm-core/trunk/src/com/arsdigita/bebop/portal/AbstractPortletRenderer.java 2004-12-10 12:52:56 UTC (rev 148) @@ -78,7 +78,9 @@ private Element makeXML(PageState state) { Element holder = new Element("holder"); setDateCached(new Date()); - super.generateXML(state, holder); + + generateXMLBody(state, holder); + generateChildrenXML(state, holder); return holder; } @@ -101,8 +103,10 @@ Iterator iter = xml.getChildren().iterator(); + Element wrapper = generateXMLHelper( parent ); + while (iter.hasNext()) { - parent.newChildElement((Element) iter.next()); + wrapper.newChildElement((Element) iter.next()); } } |
From: <ssk...@re...> - 2004-12-09 18:18:30
|
Author: sskracic Date: 2004-12-09 19:10:06 +0100 (Thu, 09 Dec 2004) New Revision: 147 Modified: ccm-core/trunk/application.xml ccm-core/trunk/pdl/com/arsdigita/categorization/query-getSubcategories.ora.pdl ccm-core/trunk/pdl/com/arsdigita/categorization/query-getSubcategories.pg.pdl Log: Corrected getSubcategories query so that it filters out related categories that are not children, but only related terms. Oh, and bump the release number while we're at it. Modified: ccm-core/trunk/application.xml =================================================================== --- ccm-core/trunk/application.xml 2004-12-08 22:01:19 UTC (rev 146) +++ ccm-core/trunk/application.xml 2004-12-09 18:10:06 UTC (rev 147) @@ -3,7 +3,7 @@ <ccm:application name="ccm-core" prettyName="Core" version="6.1.0" - release="16" + release="17" webapp="ROOT" buildHooks="build-hooks.xml" xmlns:ccm="http://ccm.redhat.com/ccm-project"> Modified: ccm-core/trunk/pdl/com/arsdigita/categorization/query-getSubcategories.ora.pdl =================================================================== --- ccm-core/trunk/pdl/com/arsdigita/categorization/query-getSubcategories.ora.pdl 2004-12-08 22:01:19 UTC (rev 146) +++ ccm-core/trunk/pdl/com/arsdigita/categorization/query-getSubcategories.ora.pdl 2004-12-09 18:10:06 UTC (rev 147) @@ -36,12 +36,14 @@ select g.name, g.category_id, count(sd2.category_id) as sub_count, abstract_p, sd1.sort_key - from cat_categories g, + from cat_categories g, cat_category_category_map sd1, cat_category_category_map sd2 where sd1.category_id = :objectID and g.category_id = sd1.related_category_id + and sd1.relation_type = 'child' and sd2.category_id(+) = sd1.related_category_id + and sd2.relation_type(+) = 'child' group by g.name, g.category_id, abstract_p, sd1.sort_key } map { id = g.category_id; Modified: ccm-core/trunk/pdl/com/arsdigita/categorization/query-getSubcategories.pg.pdl =================================================================== --- ccm-core/trunk/pdl/com/arsdigita/categorization/query-getSubcategories.pg.pdl 2004-12-08 22:01:19 UTC (rev 146) +++ ccm-core/trunk/pdl/com/arsdigita/categorization/query-getSubcategories.pg.pdl 2004-12-09 18:10:06 UTC (rev 147) @@ -30,14 +30,15 @@ select g.name, g.category_id, count(sd2.category_id) as sub_count, - g.abstract_p, + g.abstract_p, sd1.sort_key from cat_category_category_map sd1 - left join cat_categories g on + left join cat_categories g on (g.category_id = sd1.related_category_id) left join cat_category_category_map sd2 on - (sd1.related_category_id = sd2.category_id) + (sd1.related_category_id = sd2.category_id and sd2.relation_type='child') where sd1.category_id = :objectID + and sd1.relation_type='child' group by g.name, g.category_id,g.abstract_p, sd1.sort_key } map { id = g.category_id; |