You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/06/24 06:31:48 UTC

svn commit: r201564 [1/4] - in /incubator/roller/branches/roller_2.0: ./ contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ custom/ metadata/database/ metadata/database/hibernate/ nbproject/ personal/testing/ src/org/roller/business...

Author: snoopdave
Date: Thu Jun 23 21:31:43 2005
New Revision: 201564

URL: http://svn.apache.org/viewcvs?rev=201564&view=rev
Log:
Now that PermissionsData exists to create many-to-many releationships 
between websites and users, it's time to break the old one-to-one
relationship. Here's what I've done so far:

- removed WebsiteData.getUser()
- removed RollerRequest.getUser()
- added RollerSession.getAuthenticatedUser()
- added RollerSession.getCurrentWebsite()
- picked up the pieces and make the Java classes compile again

What's next? Make the JSP pages compile again, get all the unit tests
running again and bring up the old UI on the new data model.

Added:
    incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildWebsiteIndexOperation.java
      - copied, changed from r190009, incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildUserIndexOperation.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveWebsiteIndexOperation.java
      - copied, changed from r190009, incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveUserIndexOperation.java
Removed:
    incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildUserIndexOperation.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveUserIndexOperation.java
Modified:
    incubator/roller/branches/roller_2.0/ant.properties
    incubator/roller/branches/roller_2.0/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java
    incubator/roller/branches/roller_2.0/custom/custom-ant.xmlf
    incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql
    incubator/roller/branches/roller_2.0/metadata/database/droptables.sql
    incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml
    incubator/roller/branches/roller_2.0/nbproject/project.xml
    incubator/roller/branches/roller_2.0/personal/testing/hibernate.cfg.xml
    incubator/roller/branches/roller_2.0/src/org/roller/business/FileManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/IndexManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/RefererManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/WeblogManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/search/FieldConstants.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/IndexOperation.java
    incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/SearchOperation.java
    incubator/roller/branches/roller_2.0/src/org/roller/model/IndexManager.java
    incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java
    incubator/roller/branches/roller_2.0/src/org/roller/model/WeblogManager.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/AutoPingData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/BookmarkData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/FolderData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/HierarchicalPersistentObject.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/PageData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/PermissionsData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingQueueEntryData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingTargetData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogCategoryData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogEntryData.java
    incubator/roller/branches/roller_2.0/src/org/roller/pojos/WebsiteData.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/BasePageModel.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/LanguageUtil.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerContext.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerRequest.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/RollerSession.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/atomapi/RollerAtomHandler.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/IfModifiedFilter.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/filters/RefererFilter.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/pagecache/FilterHandler.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/pagecache/PageCacheFilter.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/pagecache/rollercache/LRUCacheHandler.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/pagecache/rollercache/LRUCacheHandler2.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/pings/WeblogUpdatePinger.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/planet/SyncWebsitesTask.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/tags/menu/RollerMenuModel.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/BasePageServlet.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/CommentServlet.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/ContextLoader.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/ExportRss.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/FoafServlet.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageHelper.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/PageModel.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/velocity/SearchServlet.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/ExportEntriesAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/ImportEntriesAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/ReferersAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/ToggleLinkbackDisplayAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/WeblogEntryFormAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/actions/WeblogEntryPageModel.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/weblog/tags/RssBadgeTag.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/MaintenanceAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/PageFormAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/RollerConfigAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/ThemeEditorAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UploadFileFormAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserAdminAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserBaseAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserEditAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/UserNewAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/actions/WebsiteFormAction.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/tags/FileManagerTag.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/website/tags/FileUploadTag.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/xmlrpc/BaseAPIHandler.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/xmlrpc/BloggerAPIHandler.java
    incubator/roller/branches/roller_2.0/src/org/roller/presentation/xmlrpc/MetaWeblogAPIHandler.java
    incubator/roller/branches/roller_2.0/tests/org/roller/RollerTestBase.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/FileManagerTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/PermissionsTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/RefererManagerTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/TestAll.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/UserManagerTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/business/WeblogManagerTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/presentation/ArchiveParserTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/presentation/atomapi/AtomServletTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/presentation/bookmarks/BookmarksActionTest.java
    incubator/roller/branches/roller_2.0/tests/org/roller/presentation/weblog/WeblogEntryActionTest.java

Modified: incubator/roller/branches/roller_2.0/ant.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/ant.properties?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/ant.properties (original)
+++ incubator/roller/branches/roller_2.0/ant.properties Thu Jun 23 21:31:43 2005
@@ -1,6 +1,6 @@
-build.debug=on
+build.debug=true
 build.deprecation=false
-ro.version=1.2-dev
+ro.version=2.0-dev
 ro.build=./build
 ro.tools=./tools
 basedir=.
@@ -13,4 +13,4 @@
 #catalina.home=C:/jakarta-tomcat-5.0.28
 
 # Path to Roller source, needed by our custom Netbeans actions
-project.dir=/Users/dave/roller_main
+project.dir=/Users/dave/Source/roller-svn/roller/branches/roller_2.0

Modified: incubator/roller/branches/roller_2.0/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java (original)
+++ incubator/roller/branches/roller_2.0/contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java Thu Jun 23 21:31:43 2005
@@ -92,7 +92,7 @@
         {            
             String link = "<div class=\"readMore\"><a href=\"" + 
                 ctxPath + "/comments/" + 
-                entry.getWebsite().getUser().getUserName() + 
+                entry.getWebsite().getHandle() + 
                 "/" + pageLink + "/" + Utilities.encode(entry.getAnchor()) +
                 "\">Read More</a></div>";
             

Modified: incubator/roller/branches/roller_2.0/custom/custom-ant.xmlf
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/custom/custom-ant.xmlf?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/custom/custom-ant.xmlf (original)
+++ incubator/roller/branches/roller_2.0/custom/custom-ant.xmlf Thu Jun 23 21:31:43 2005
@@ -2,6 +2,7 @@
 <!-- Additional Ant tasks to include in build script -->
 
     <!-- Netbeans debug single file 
+    --> 
     <target name="debug-selected-files" if="netbeans.home" depends="build-test" 
        description="Debug a Single File">
        <fail unless="classname">Must set property 'classname'</fail>
@@ -20,9 +21,9 @@
           </classpath>
        </java>
     </target>
-    --> 
 
     <!-- Netbeans debug.single target 
+    -->
     <target name="test-selected-files" if="netbeans.home" depends="build-test" 
        description="Test/debug a Single File">
        <fail unless="classname">Must set property 'classname'</fail>
@@ -42,7 +43,6 @@
           </classpath>
        </java>
     </target>
-    -->
 
     <!-- Extend the init-hsqldb target to include custom tables
     <target name="init-hsqldb-ex" depends="init-hsqldb" >

Modified: incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/createdb-raw.sql Thu Jun 23 21:31:43 2005
@@ -32,6 +32,25 @@
 create index userrole_userid_index on userrole( userid );
 create index userrole_username_index on userrole( username@INDEXSIZE@ );
 
+-- User permissions within a website
+create table roller_user_permissions (
+    id              varchar(48) not null primary key,
+    website_id      varchar(48) not null,
+    user_id         varchar(48) not null,
+    permission_mask integer not null, -- bitmask 001 limited, 011 author, 100 admin
+    pending         @BOOLEAN_SQL_TYPE_TRUE@ not null -- pending user acceptance of invitation to join website
+);
+
+-- Audit log records time and comment about change
+create table roller_audit_log (
+    id              varchar(48) not null primary key,
+    user_id         varchar(48) not null,  -- user that made change
+    object_id       varchar(48),           -- id of associated object, if any
+    object_class    varchar(255),          -- name of associated object class (e.g. WeblogEntryData)
+    comment         varchar(255) not null, -- description of change
+    change_time     timestamp             -- time that change was made
+);
+
 create table usercookie (
     id              varchar(48) not null primary key,
     username        varchar(255) not null,
@@ -57,6 +76,7 @@
 create table website (
     id                varchar(48) not null primary key,
     name              varchar(255) not null,
+    handle            varchar(255) not null,
     description       varchar(255) not null,
     userid            varchar(48) not null,
     defaultpageid     varchar(48) default 0 not null,
@@ -69,6 +89,7 @@
     allowcomments     @BOOLEAN_SQL_TYPE_TRUE@ not null,
     emailcomments     @BOOLEAN_SQL_TYPE_FALSE@ not null,
     emailfromaddress  varchar(255) null,
+    emailaddress      varchar(255) not null,
     editortheme       varchar(255) null,
     locale            varchar(20) null,
     timezone          varchar(50) null,
@@ -79,6 +100,8 @@
 create index website_id_index on website( id );
 create index website_userid_index on website( userid );
 create index website_isenabled_index on website( isenabled );
+create index website_handle_index on userrole(handle);
+alter table website add constraint website_handle_uq unique (handle@INDEXSIZE@);
 
 create table folder (
     id               varchar(48) not null primary key,
@@ -135,6 +158,7 @@
 
 create table weblogentry (
     id              varchar(48)  not null primary key,
+    userid          varchar(48) not null,
     anchor          varchar(255)  not null,
     title           varchar(255)  not null,
     text            @TEXT_SQL_TYPE@ not null,
@@ -155,6 +179,7 @@
 create index weblogentry_pubtime_index on weblogentry( pubtime,publishentry,websiteid );
 create index weblogentry_pinnedtomain_index on weblogentry(pinnedtomain);
 create index weblogentry_publishentry_index on weblogentry(publishentry);
+create index weblogentry_userid_index on weblogentry(userid);
 
 create table newsfeed (
     id              varchar(48) not null primary key,
@@ -247,6 +272,7 @@
 create index referer_duplicate_index on referer( duplicate );
 
 -- Configuration options for Roller, should only ever be one row
+-- Deprecated in 1.2: configuration now stored in roller_properties table
 create table rollerconfig (
     id              varchar(48) not null primary key,
     sitedescription varchar(255) null,

Modified: incubator/roller/branches/roller_2.0/metadata/database/droptables.sql
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/droptables.sql?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/droptables.sql (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/droptables.sql Thu Jun 23 21:31:43 2005
@@ -18,9 +18,11 @@
 drop table rollerconfig;
 drop table rolleruser; 
 drop table usercookie; 
-drop table roller_properties;
 drop table rag_config;
 drop table rag_group;
 drop table rag_subscription;
 drop table rag_entry;
-drop table rag_group_subscription;
\ No newline at end of file
+drop table rag_group_subscription;
+drop table roller_properties;
+drop table roller_audit_log;
+drop table roller_user_permissions;
\ No newline at end of file

Modified: incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml (original)
+++ incubator/roller/branches/roller_2.0/metadata/database/hibernate/hibernate.cfg.xml Thu Jun 23 21:31:43 2005
@@ -63,6 +63,8 @@
         <mapping resource="org/roller/pojos/PlanetEntryData.hbm.xml" />
         <mapping resource="org/roller/pojos/PlanetSubscriptionData.hbm.xml" />
         <mapping resource="org/roller/pojos/PlanetGroupSubscriptionAssoc.hbm.xml" />
-
+        
+        <mapping resource="org/roller/pojos/PermissionsData.hbm.xml" />
+        
     </session-factory>
 </hibernate-configuration>

Modified: incubator/roller/branches/roller_2.0/nbproject/project.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/nbproject/project.xml?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/nbproject/project.xml (original)
+++ incubator/roller/branches/roller_2.0/nbproject/project.xml Thu Jun 23 21:31:43 2005
@@ -4,7 +4,7 @@
     <configuration>
         <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
             <!--Do not use Project Properties customizer when editing this file manually.-->
-            <name>roller</name>
+            <name>roller_2.0</name>
             <!--
             <properties>
                 <property name="src.dir">../src</property>
@@ -75,7 +75,7 @@
                         </arity>
                     </context>
                 </action>
-                <action name="test.single">
+                <action name="debug.test.single">
                     <target>test-selected-files</target>
                     <context>
                         <property>classname</property>

Modified: incubator/roller/branches/roller_2.0/personal/testing/hibernate.cfg.xml
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/personal/testing/hibernate.cfg.xml?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/personal/testing/hibernate.cfg.xml (original)
+++ incubator/roller/branches/roller_2.0/personal/testing/hibernate.cfg.xml Thu Jun 23 21:31:43 2005
@@ -49,5 +49,7 @@
         <mapping resource="org/roller/pojos/PlanetSubscriptionData.hbm.xml" />
         <mapping resource="org/roller/pojos/PlanetGroupSubscriptionAssoc.hbm.xml" />
 
+        <mapping resource="org/roller/pojos/PermissionsData.hbm.xml" />
+
     </session-factory>
 </hibernate-configuration>

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/FileManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/FileManagerImpl.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/FileManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/FileManagerImpl.java Thu Jun 23 21:31:43 2005
@@ -104,7 +104,7 @@
         BigDecimal maxDirMB = new BigDecimal(
                 ((RollerPropertyData)config.get("uploads.dir.maxsize")).getValue());
         int maxDirBytes = (int)(1024000 * maxDirMB.doubleValue());
-        int userDirSize = getUserDirSize(site.getUser().getUserName(), this.upload_dir);
+        int userDirSize = getWebsiteDirSize(site.getHandle(), this.upload_dir);
         if (userDirSize + size > maxDirBytes) {
             messages.addError("error.upload.dirmax", maxDirMB.toString());
             return false;
@@ -130,7 +130,7 @@
      */
     public File[] getFiles(WebsiteData site) throws RollerException
     {
-        String dir = this.upload_dir + site.getUser().getUserName();
+        String dir = this.upload_dir + site.getHandle();
         File uploadDir = new File(dir);
         return uploadDir.listFiles();
     }
@@ -141,7 +141,7 @@
     public void deleteFile(WebsiteData site, String name)
             throws RollerException
     {
-        String dir = this.upload_dir + site.getUser().getUserName();
+        String dir = this.upload_dir + site.getHandle();
         File f = new File(dir + File.separator + name);
         f.delete();
     }
@@ -164,9 +164,9 @@
         byte[] buffer = new byte[8192];
         int bytesRead = 0;
         String dir = this.upload_dir;
-        String userName = site.getUser().getUserName();
+        String handle = site.getHandle();
 
-        File dirPath = new File(dir + File.separator + userName);
+        File dirPath = new File(dir + File.separator + handle);
         if (!dirPath.exists())
         {
             dirPath.mkdirs();
@@ -196,7 +196,7 @@
         }
         if (mLogger.isDebugEnabled())
         {
-            mLogger.debug("The file has been written to \"" + dir + userName + "\"");
+            mLogger.debug("The file has been written to \"" + dir + handle + "\"");
         }
     }
 
@@ -233,7 +233,7 @@
      * @param dir      Upload directory
      * @return Size of user's uploaded files in bytes.
      */
-    private int getUserDirSize(String username, String dir)
+    private int getWebsiteDirSize(String username, String dir)
     {
         int userDirSize = 0;
         File d = new File(dir + File.separator + username);

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/IndexManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/IndexManagerImpl.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/IndexManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/IndexManagerImpl.java Thu Jun 23 21:31:43 2005
@@ -21,14 +21,14 @@
 import org.roller.business.search.operations.AddEntryOperation;
 import org.roller.business.search.operations.IndexOperation;
 import org.roller.business.search.operations.ReIndexEntryOperation;
-import org.roller.business.search.operations.RebuildUserIndexOperation;
+import org.roller.business.search.operations.RebuildWebsiteIndexOperation;
 import org.roller.business.search.operations.RemoveEntryOperation;
-import org.roller.business.search.operations.RemoveUserIndexOperation;
+import org.roller.business.search.operations.RemoveWebsiteIndexOperation;
 import org.roller.business.search.operations.WriteToIndexOperation;
 import org.roller.model.IndexManager;
 import org.roller.model.ThreadManager;
-import org.roller.pojos.UserData;
 import org.roller.pojos.WeblogEntryData;
+import org.roller.pojos.WebsiteData;
 
 import EDU.oswego.cs.dl.util.concurrent.ReadWriteLock;
 import EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock;
@@ -152,16 +152,22 @@
     //~ Methods
     // ================================================================
     
-    public void rebuildUserIndex() throws RollerException
+    public void rebuildWebsiteIndex() throws RollerException
     {
         scheduleIndexOperation( 
-                new RebuildUserIndexOperation(this, null));
+                new RebuildWebsiteIndexOperation(this, null));
     }
     
-    public void removeUserIndex(UserData user) throws RollerException
+    public void rebuildWebsiteIndex(WebsiteData website) throws RollerException
+    {
+        scheduleIndexOperation( 
+                new RebuildWebsiteIndexOperation(this, website));
+    }
+    
+    public void removeWebsiteIndex(WebsiteData website) throws RollerException
     {
         scheduleIndexOperation(
-                new RemoveUserIndexOperation(this, user));
+                new RemoveWebsiteIndexOperation(this, website));
     }
     
     public void addEntryIndexOperation(WeblogEntryData entry) throws RollerException

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/RefererManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/RefererManagerImpl.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/RefererManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/RefererManagerImpl.java Thu Jun 23 21:31:43 2005
@@ -182,7 +182,7 @@
             String refererUrl     = request.getRefererURL();
             WebsiteData website   = request.getWebsite();
             WeblogEntryData entry = request.getWeblogEntry();
-            String selfSiteFragment = "/page/" + website.getUser().getUserName();
+            String selfSiteFragment = "/page/" + website.getHandle();
 
             String dateString = null;
             if ( request.getDateString()!=null && request.isDateSpecified())

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/UserManagerImpl.java Thu Jun 23 21:31:43 2005
@@ -8,6 +8,8 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -21,6 +23,7 @@
 import org.roller.pojos.FolderData;
 import org.roller.pojos.PageData;
 import org.roller.pojos.PermissionsData;
+import org.roller.pojos.PlanetGroupSubscriptionAssoc;
 import org.roller.pojos.RoleData;
 import org.roller.pojos.UserCookieData;
 import org.roller.pojos.UserData;
@@ -70,15 +73,6 @@
         mStrategy.remove(id,WebsiteData.class);
     }
 
-    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-    /** 
-     * This method is a hotspot, it is called on every page request.
-     */
-    public WebsiteData getWebsite(String userName) throws RollerException
-    {
-        return getWebsite(userName, true);
-    } 
-
     //------------------------------------------------------------------- User
 
     public UserData retrieveUser(String id) throws RollerException
@@ -103,25 +97,16 @@
         return getUser(userName, true);
     }
 
-    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -     
-    public UserData getUser(String userName, boolean enabledOnly) throws RollerException
+    public WebsiteData getWebsiteByHandle(String handle) throws RollerException
     {
-        if (userName==null )
-            throw new RollerException("userName is null");
-        
-        WebsiteData website = getWebsite(userName, enabledOnly);
-        if (website != null)
-        {
-            return website.getUser();
-        }
-        return null;
+        return getWebsiteByHandle(handle, true);
     }
 
     //-----------------------------------------------------------------------
 
     public List getUsers() throws RollerException
     {
-        return getUsers(true);
+        return getUsers(Boolean.TRUE);
     }
 
     //------------------------------------------------------------------------    
@@ -176,8 +161,11 @@
 
         WebsiteData wd = pd.getWebsite();
         if (pd.getId() == wd.getDefaultPageId()) {
-            mLogger.error("Refusing to remove default page from website of: " +  wd.getUser().getUserName());
-            throw new RollerException(new IllegalArgumentException("Page is default page of website."));
+            mLogger.error(
+                   "Refusing to remove default page from website with handle: " 
+                   +  wd.getHandle());
+            throw new RollerException(
+                   new IllegalArgumentException("Page is default page of website."));
         }
         removePage(id);        
     }
@@ -241,6 +229,7 @@
         
         WebsiteData website = new WebsiteData(null,
             ud.getFullName()+"'s Weblog", // name
+            ud.getUserName(),             // handle
             ud.getFullName()+"'s Weblog", // description
             ud,                // userId
             "dummy",           // defaultPageId
@@ -423,11 +412,36 @@
     public PermissionsData inviteUser(WebsiteData website, 
             UserData user, short mask) throws RollerException
     {
+        if (website == null) throw new RollerException("Website cannot be null");
+        if (user == null) throw new RollerException("User cannot be null");        
         PermissionsData perms = new PermissionsData();
         perms.setWebsite(website);
         perms.setUser(user);
         perms.setPermissionMask(mask);
         mStrategy.store(perms);
         return perms;
+    }
+    
+    /**
+     * Remove user permissions from a website.
+     */
+    public void retireUser(WebsiteData website, UserData user) throws RollerException
+    {
+        if (website == null) throw new RollerException("Website cannot be null");
+        if (user == null) throw new RollerException("User cannot be null");        
+        Iterator perms = website.getPermissions().iterator();
+        PermissionsData target = null;
+        while (perms.hasNext())
+        {
+            PermissionsData pd = (PermissionsData)perms.next();
+            if (pd.getUser().getId().equals(user.getId()))
+            {
+                target = pd;
+                break;
+            }
+        }
+        if (target == null) throw new RollerException("User not member of website");
+        website.removePermission(target);
+        target.remove();
     }
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/WeblogManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/WeblogManagerImpl.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/WeblogManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/WeblogManagerImpl.java Thu Jun 23 21:31:43 2005
@@ -268,10 +268,10 @@
      * @return Date
      * @throws RollerException
      */
-    public Date getWeblogLastPublishTime(String userName)
+    public Date getWeblogLastPublishTime(WebsiteData website)
         throws RollerException
     {
-        return getWeblogLastPublishTime(userName, null);
+        return getWeblogLastPublishTime(website, null);
     }
 
     //--------------------------------------------------------- Implementation
@@ -503,10 +503,10 @@
      * Get absolute URL to this website.
      * @return Absolute URL to this website.
      */
-    public String getUrl(UserData user, String contextUrl)
+    public String getUrl(WebsiteData site, String contextUrl)
     {
         String url =
-            Utilities.escapeHTML(contextUrl + "/page/" + user.getUserName());
+            Utilities.escapeHTML(contextUrl + "/page/" + site.getHandle());
         return url;
     }
 

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java Thu Jun 23 21:31:43 2005
@@ -279,8 +279,7 @@
             mLogger.debug("getHits: " + website.getName());
         }
 
-        //Question: why not use website.id instead to reduce joins?
-        Object[] args = { Boolean.TRUE, website.getUser().getUserName() };
+        Object[] args = { Boolean.TRUE, website.getId() };
         Type[] types = { Hibernate.BOOLEAN, Hibernate.STRING };
 
         // For a query like this, Hibernate returns a list of lists
@@ -291,7 +290,7 @@
             results = session.find(
                "select sum(h.dayHits),sum(h.totalHits) from h in class " +
                "org.roller.pojos.RefererData " +
-               "where h.website.isEnabled=? and h.website.user.userName=? ",
+               "where h.website.isEnabled=? and h.website.id=? ",
                args, types);
         }
         catch (HibernateException e)

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateUserManagerImpl.java Thu Jun 23 21:31:43 2005
@@ -10,6 +10,7 @@
 
 import net.sf.hibernate.Criteria;
 import net.sf.hibernate.HibernateException;
+import net.sf.hibernate.Query;
 import net.sf.hibernate.Session;
 import net.sf.hibernate.expression.EqExpression;
 import net.sf.hibernate.expression.Expression;
@@ -62,24 +63,61 @@
     /**
      * Get websites of a user
      */
-    public List getWebsites(UserData user, Boolean enabled) 
+    public List getWebsites(UserData user, Boolean enabled)  throws RollerException
     {
-        return null;
+        try
+        {
+            Session session = ((HibernateStrategy)mStrategy).getSession();
+            Criteria criteria = session.createCriteria(WebsiteData.class);
+            if (user != null) 
+            {
+                criteria.createAlias("permissions","permissions");
+                criteria.add(Expression.eq("permissions.user", user));
+            }
+            if (enabled != null)
+            {
+                criteria.add(Expression.eq("isEnabled", enabled));
+            }
+            return criteria.list();
+        }
+        catch (HibernateException e)
+        {
+            throw new RollerException(e);
+        }
     }
     
     /**
      * Get users of a website
      */
-    public List  getUsers(WebsiteData user)
+    public List getUsers(WebsiteData website, Boolean enabled) 
+        throws RollerException
     {
-        return null;
+        try
+        {
+            Session session = ((HibernateStrategy)mStrategy).getSession();
+            Criteria criteria = session.createCriteria(UserData.class);
+            if (website != null) 
+            {
+                criteria.createAlias("permissions","permissions");
+                criteria.add(Expression.eq("permissions.website", website));
+            }
+            if (enabled != null)
+            {
+                criteria.add(Expression.eq("isEnabled", enabled));
+            }
+            return criteria.list();
+        }
+        catch (HibernateException e)
+        {
+            throw new RollerException(e);
+        }
     }
     
     /** 
      * Use Hibernate directly because Roller's Query API does too much allocation.
      */
     public PageData getPageByLink(WebsiteData website, String pagelink)
-                    throws RollerException
+        throws RollerException
     {
         if (website == null)
             throw new RollerException("userName is null");
@@ -104,36 +142,32 @@
     }
     
     /** 
-     * Use Hibernate directly because Roller's Query API does too much allocation.
+     * Return website specified by handle.
      */
-    public WebsiteData getWebsite(String userName, boolean enabledOnly)
+    public WebsiteData getWebsiteByHandle(String handle, boolean enabledOnly)
                     throws RollerException
     {
-        if (userName==null )
-            throw new RollerException("userName is null");
+        if (handle==null )
+            throw new RollerException("Handle cannot be null");
 
         try
         {
             Session session = ((HibernateStrategy)mStrategy).getSession();
             Criteria criteria = session.createCriteria(WebsiteData.class);
-            criteria.createAlias("user","u");
-    
             if (enabledOnly) 
             {
                 criteria.add(
                    Expression.conjunction()
-                       .add(new EqExpression("u.userName",userName,true))
-                       .add(Expression.eq("isEnabled",Boolean.TRUE)));
+                       .add(new EqExpression("handle", handle, true))
+                       .add(Expression.eq("isEnabled", Boolean.TRUE)));
             }
             else
             {
                 criteria.add(
                     Expression.conjunction()
-                       .add(new EqExpression("u.userName",userName,true)));
-            }
-        
-            List list = criteria.list();
-            return list.size()!=0 ? (WebsiteData)list.get(0) : null;
+                        .add(new EqExpression("handle", handle, true)));
+            }        
+            return (WebsiteData)criteria.uniqueResult();
         }
         catch (HibernateException e)
         {
@@ -141,6 +175,38 @@
         }
     }
     
+    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -     
+    public UserData getUser(String userName, boolean enabledOnly) 
+        throws RollerException
+    {
+        if (userName==null )
+            throw new RollerException("userName cannot be null");
+
+        try
+        {
+            Session session = ((HibernateStrategy)mStrategy).getSession();
+            Criteria criteria = session.createCriteria(UserData.class);
+            if (enabledOnly) 
+            {
+                criteria.add(
+                   Expression.conjunction()
+                       .add(new EqExpression("userName", userName, true))
+                       .add(Expression.eq("isEnabled", Boolean.TRUE)));
+            }
+            else
+            {
+                criteria.add(
+                    Expression.conjunction()
+                        .add(new EqExpression("userName", userName, true)));
+            }        
+            return (UserData)criteria.uniqueResult();
+        }
+        catch (HibernateException e)
+        {
+            throw new RollerException(e);
+        }
+    }
+
     /**
      * @see org.roller.model.UserManager#removeLoginCookies(java.lang.String)
      */
@@ -292,40 +358,21 @@
         }
     }
 
-    public List getUsers(boolean enabledOnly) throws RollerException
+    public List getUsers(Boolean enabled) throws RollerException
     {
         Session session = ((HibernateStrategy)mStrategy).getSession();
-        if (enabledOnly)
+        Criteria criteria = session.createCriteria(UserData.class);            
+        if (enabled != null)
         {
-            Criteria criteria = session.createCriteria(WebsiteData.class);            
-            criteria.add(Expression.eq("isEnabled", Boolean.TRUE));
-            try
-            {
-                List users = new ArrayList();
-                Iterator websites = criteria.list().iterator();
-                while (websites.hasNext())
-                {
-                    WebsiteData website = (WebsiteData) websites.next();
-                    users.add(website.getUser());
-                }
-                return users;
-            }
-            catch (HibernateException e)
-            {
-                throw new RollerException(e);
-            }
+            criteria.add(Expression.eq("isEnabled", enabled));
+        }
+        try
+        {
+            return criteria.list();
         }
-        else
+        catch (HibernateException e)
         {
-            Criteria criteria = session.createCriteria(UserData.class);            
-            try
-            {
-                return criteria.list();
-            }
-            catch (HibernateException e)
-            {
-                throw new RollerException(e);
-            }
+            throw new RollerException(e);
         }
     }
 

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/hibernate/HibernateWeblogManagerImpl.java Thu Jun 23 21:31:43 2005
@@ -340,28 +340,24 @@
     /**
      * Gets the Date of the latest Entry publish time.
      *
-     * @param userName User name of weblog or null for all users
-     * @param catName Category name of posts or null for all categories
-     * @return Date Of last publish time
+     * @param handle   Handle of website or null for all users
+     * @param catName  Category name of posts or null for all categories
+     * @return         Date Of last publish time
      * @throws RollerException
      */
-    public Date getWeblogLastPublishTime( String userName, String catName )
+    public Date getWeblogLastPublishTime(WebsiteData website, String catName)
         throws RollerException
     {
         WeblogCategoryData cat = null;
         Roller mRoller = RollerFactory.getRoller();
-        if (userName != null) 
+        if (catName != null && website != null)
+        {    
+           cat = getWeblogCategoryByPath(website, null, catName);
+           if (cat == null) catName = null;
+        }
+        if (catName != null && catName.trim().equals("/"))
         {
-            WebsiteData website = mRoller.getUserManager().getWebsite(userName);
-            if (catName != null && website != null)
-            {    
-               cat = getWeblogCategoryByPath(website, null, catName);
-               if (cat == null) catName = null;
-            }
-            if (catName != null && catName.trim().equals("/"))
-            {
-                catName = null;
-            }
+            catName = null;
         }
         
         Session session = ((HibernateStrategy)mStrategy).getSession();
@@ -371,9 +367,8 @@
 
         try
         {
-            if ( userName != null )
+            if (website != null)
             {
-                WebsiteData website = mRoller.getUserManager().getWebsite(userName);
                 criteria.add(Expression.eq("website", website));
             }
 

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/search/FieldConstants.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/search/FieldConstants.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/search/FieldConstants.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/search/FieldConstants.java Thu Jun 23 21:31:43 2005
@@ -30,4 +30,5 @@
     public static final String C_NAME = "name";
     public static final String CONSTANT = "constant";
     public static final String CONSTANT_V = "v"; //must be lowercase, or match the transform rules of the analyzer
+    public static final String WEBSITE_HANDLE = "handle";
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/IndexOperation.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/IndexOperation.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/IndexOperation.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/IndexOperation.java Thu Jun 23 21:31:43 2005
@@ -1 +1 @@
-/*
 * Created on Jul 16, 2003
 * Authored by: Mindaugas Idzelis  (min@idzelis.com)
 */
package org.roller.business.search.operations;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.roller.business.IndexManagerImpl;
import org.roller.business.search.FieldConstants;
import org.roller.pojos.CommentData;
import org.roller.pojos.WeblogCategoryData;
import org.roller.pojos.WeblogEntryData;
import org.roller.util.Utilities;

/**
 * @author aim4min
 * 
 * This is the base class for all index operation. These operations include:
 * 
 * SearchOperation AddWeblogOperation RemoveWeblogOperation
 * RebuildUserIndexOperation
 *  
 */
public abstract class IndexOperation implements Runnable
{
    private static Log mLogger =
        LogFactory.getFactory().getInstance(IndexOperation.class);

    //~ Instance fields
    // ========================================================
    protected IndexManagerImpl manager;

    private IndexReader reader;

    private IndexWriter writer;

    //~ Constructors
    // ===========================================================

    public IndexOperation(IndexManagerImpl manager)
    {
        this.manager = manager;
    }

    //~ Methods
    // ================================================================

    protected Document getDocument(WeblogEntryData data)
    {
        StringBuffer commentEmail = new StringBuffer();
        StringBuffer commentContent = new StringBuffer();
        StringBuffer commentName = new StringBuffer();

        List comments = data.getComments();
        if (comments != null)
        {
            for (Iterator cItr = comments.iterator(); cItr.hasNext();)
            {
                CommentData comment = (CommentData) cItr.next();
                if (comment.getSpam() == null
                        || !comment.getSpam().booleanValue())
                {
                    if (comment.getContent() != null)
                    {
                        commentContent.append(comment.getContent());
                        commentContent.append(",");
                    }
                    if (comment.getEmail() != null)
                    {
                        commentEmail.append(comment.getEmail());
                        commentEmail.append(",");
                    }
                    if (comment.getName() != null)
                    {
                        commentName.append(comment.getName());
                        commentName.append(",");
                    }
                }
            }
        }

        Document doc = new Document();
        doc.add(Field.Keyword(FieldConstants.ID, data.getId()));
        doc.add(Field.UnIndexed(FieldConstants.ANCHOR, data.getAnchor()));
        doc.add(Field.Text(FieldConstants.USERNAME, data.getWebsite().getUser()
                .getUserName()));
        doc.add(Field.Text(FieldConstants.TITLE, data.getTitle()));

        // index the entry text, but don't store it - moved to end of block
        doc.add(Field.UnStored(FieldConstants.CONTENT, data.getText()));

        // store an abbreviated version of the entry text, but don't index
        doc.add(Field.UnIndexed(FieldConstants.CONTENT_STORED, Utilities
                .truncateNicely(Utilities.removeHTML(data.getText()), 240, 260,
                        "...")));

        doc.add(Field.Keyword(FieldConstants.UPDATED, data.getUpdateTime()
                .toString()));
        doc.add(Field.Keyword(FieldConstants.PUBLISHED, data.getPubTime()
                .toString()));

        // index Comments
        doc.add(Field.UnStored(FieldConstants.C_CONTENT, commentContent
                .toString()));
        doc
                .add(Field.UnStored(FieldConstants.C_EMAIL, commentEmail
                        .toString()));
        doc.add(Field.UnStored(FieldConstants.C_NAME, commentName.toString()));

        doc.add(Field.UnStored(FieldConstants.CONSTANT,
                FieldConstants.CONSTANT_V));

        // index Category
        WeblogCategoryData categorydata = data.getCategory();
        Field category = (categorydata == null) ? Field.UnStored(
                FieldConstants.CATEGORY, "") : Field.Text(
                FieldConstants.CATEGORY, categorydata.getName());
        doc.add(category);

        return doc;
    }

    protected IndexReader beginDeleting()
    {
        try
        {
            reader = IndexReader.open(manager.getIndexDirectory());
        }
        catch (IOException e)
        {
        }

        return reader;
    }

    protected void endDeleting()
    {
        if (reader != null)
        {
            try
            {
                reader.close();
            }
            catch (IOException e)
            {
            }
        }
    }

    protected IndexWriter beginWriting()
    {
        try
        {
            writer = new IndexWriter(manager.getIndexDirectory(),
                    IndexManagerImpl.getAnalyzer(), false);
        }
        catch (IOException e)
        {
            mLogger.error("ERROR creating writer");
        }

        return writer;
    }

    protected void endWriting()
    {
        if (writer != null)
        {
            try
            {
                writer.close();
            }
            catch (IOException e)
            {
                mLogger.error("ERROR closing writer",e);
            }
        }
    }

    public void run()
    {
        doRun();
    }

    protected abstract void doRun();
}
\ No newline at end of file
+/*
 * Created on Jul 16, 2003
 * Authored by: Mindaugas Idzelis  (min@idzelis.com)
 */
package org.roller.business.search.operations;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.roller.business.IndexManagerImpl;
import org.roller.business.search.FieldConstants;
import org.roller.pojos.CommentData;
import org.roller.pojos.WeblogCategoryData;
import org.roller.pojos.WeblogEntryData;
import org.roller.util.Utilities;

/**
 * @author aim4min
 * 
 * This is the base class for all index operation. These operations include:
 * 
 * SearchOperation AddWeblogOperation RemoveWeblogOperation
 * RebuildUserIndexOperation
 *  
 */
public abstract class IndexOperation implements Runnable
{
    private static Log mLogger =
        LogFactory.getFactory().getInstance(IndexOperation.class);

    //~ Instance fields
    // ========================================================
    protected IndexManagerImpl manager;

    private IndexReader reader;

    private IndexWriter writer;

    //~ Constructors
    // ===========================================================

    public IndexOperation(IndexManagerImpl manager)
    {
        this.manager = manager;
    }

    //~ Methods
    // ================================================================

    protected Document getDocument(WeblogEntryData data)
    {
        StringBuffer commentEmail = new StringBuffer();
        StringBuffer commentContent = new StringBuffer();
        StringBuffer commentName = new StringBuffer();

        List comments = data.getComments();
        if (comments != null)
        {
            for (Iterator cItr = comments.iterator(); cItr.hasNext();)
            {
                CommentData comment = (CommentData) cItr.next();
                if (comment.getSpam() == null
                        || !comment.getSpam().booleanValue())
                {
                    if (comment.getContent() != null)
                    {
                        commentContent.append(comment.getContent());
                        commentContent.append(",");
                    }
                    if (comment.getEmail() != null)
                    {
                        commentEmail.append(comment.getEmail());
                        commentEmail.append(",");
                    }
                    if (comment.getName() != null)
                    {
                        commentName.append(comment.getName());
                        commentName.append(",");
                    }
                }
            }
        }

        Document doc = new Document();
        
        doc.add(Field.Keyword(FieldConstants.ID, data.getId()));
        
        doc.add(Field.Keyword(FieldConstants.WEBSITE_HANDLE, 
                data.getWebsite().getHandle()));

        doc.add(Field.UnIndexed(FieldConstants.ANCHOR, data.getAnchor()));
        doc.add(Field.Text(FieldConstants.USERNAME, 
                data.getCreator().getUserName()));
        doc.add(Field.Text(FieldConstants.TITLE, data.getTitle()));

        // index the entry text, but don't store it - moved to end of block
        doc.add(Field.UnStored(FieldConstants.CONTENT, data.getText()));

        // store an abbreviated version of the entry text, but don't index
        doc.add(Field.UnIndexed(FieldConstants.CONTENT_STORED, Utilities
                .truncateNicely(Utilities.removeHTML(data.getText()), 240, 260,
                        "...")));

        doc.add(Field.Keyword(FieldConstants.UPDATED, data.getUpdateTime()
                .toString()));
        doc.add(Field.Keyword(FieldConstants.PUBLISHED, data.getPubTime()
                .toString()));

        // index Comments
        doc.add(Field.UnStored(FieldConstants.C_CONTENT, commentContent
                .toString()));
        doc
                .add(Field.UnStored(FieldConstants.C_EMAIL, commentEmail
                        .toString()));
        doc.add(Field.UnStored(FieldConstants.C_NAME, commentName.toString()));

        doc.add(Field.UnStored(FieldConstants.CONSTANT,
                FieldConstants.CONSTANT_V));

        // index Category
        WeblogCategoryData categorydata = data.getCategory();
        Field category = (categorydata == null) ? Field.UnStored(
                FieldConstants.CATEGORY, "") : Field.Text(
                FieldConstants.CATEGORY, categorydata.getName());
        doc.add(category);

        return doc;
    }

    protected IndexReader beginDeleting()
    {
        try
        {
            reader = IndexReader.open(manager.getIndexDirectory());
        }
        catch (IOException e)
        {
        }

        return reader;
    }

    protected void endDeleting()
    {
        if (reader != null)
        {
            try
            {
                reader.close();
            }
            catch (IOException e)
            {
            }
        }
    }

    protected IndexWriter beginWriting()
    {
        try
        {
            writer = new IndexWriter(manager.getIndexDirectory(),
                    IndexManagerImpl.getAnalyzer(), false);
        }
        catch (IOException e)
        {
            mLogger.error("ERROR creating writer");
        }

        return writer;
    }

    protected void endWriting()
    {
        if (writer != null)
        {
            try
            {
                writer.close();
            }
            catch (IOException e)
            {
                mLogger.error("ERROR closing writer",e);
            }
        }
    }

    public void run()
    {
        doRun();
    }

    protected abstract void doRun();
}
\ No newline at end of file

Copied: incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildWebsiteIndexOperation.java (from r190009, incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildUserIndexOperation.java)
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildWebsiteIndexOperation.java?p2=incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildWebsiteIndexOperation.java&p1=incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildUserIndexOperation.java&r1=190009&r2=201564&rev=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildUserIndexOperation.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RebuildWebsiteIndexOperation.java Thu Jun 23 21:31:43 2005
@@ -32,12 +32,12 @@
  *
  * An index operation that rebuilds a given users index (or all indexes.)
  */
-public class RebuildUserIndexOperation extends WriteToIndexOperation
+public class RebuildWebsiteIndexOperation extends WriteToIndexOperation
 {
     //~ Static fields/initializers =============================================
 
     private static Log mLogger =
-        LogFactory.getFactory().getInstance(RebuildUserIndexOperation.class);
+        LogFactory.getFactory().getInstance(RebuildWebsiteIndexOperation.class);
 
     //~ Instance fields ========================================================
 
@@ -50,7 +50,7 @@
      *
      * @param website The website to rebuild the index for, or null for all users.
      */
-    public RebuildUserIndexOperation(IndexManagerImpl mgr, WebsiteData website)
+    public RebuildWebsiteIndexOperation(IndexManagerImpl mgr, WebsiteData website)
     {
         super(mgr);
         this.website = website;
@@ -71,17 +71,11 @@
         {
             if (reader != null)
             {
-                String userName = null;
-                if (website != null && website.getUser() != null)
+                Term tWebsite = IndexUtil.getTerm(FieldConstants.WEBSITE_HANDLE, 
+                                   website.getHandle());
+                if (tWebsite != null)
                 {
-                    userName = website.getUser().getUserName();
-                }
-                Term tUsername =
-                    IndexUtil.getTerm(FieldConstants.USERNAME, userName);
-
-                if (tUsername != null)
-                {
-                    reader.delete(tUsername);
+                    reader.delete(tWebsite);
                 }
                 else
                 {
@@ -151,8 +145,8 @@
         }
         else
         {
-            mLogger.info("Completed rebuilding index for '" +
-                 website.getUser().getUserName() + "' in '" + length + "' seconds");
+            mLogger.info("Completed rebuilding index for website handle: '" +
+                 website.getHandle() + "' in '" + length + "' seconds");
         }
     }
 }

Copied: incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveWebsiteIndexOperation.java (from r190009, incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveUserIndexOperation.java)
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveWebsiteIndexOperation.java?p2=incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveWebsiteIndexOperation.java&p1=incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveUserIndexOperation.java&r1=190009&r2=201564&rev=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveUserIndexOperation.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/RemoveWebsiteIndexOperation.java Thu Jun 23 21:31:43 2005
@@ -15,7 +15,7 @@
 import org.roller.business.IndexManagerImpl;
 import org.roller.business.search.FieldConstants;
 import org.roller.business.search.IndexUtil;
-import org.roller.pojos.UserData;
+import org.roller.pojos.WebsiteData;
 
 
 /**
@@ -23,28 +23,28 @@
  *
  * An index operation that rebuilds a given users index (or all indexes.)
  */
-public class RemoveUserIndexOperation extends WriteToIndexOperation
+public class RemoveWebsiteIndexOperation extends WriteToIndexOperation
 {
     //~ Static fields/initializers =============================================
 
     private static Log mLogger =
-        LogFactory.getFactory().getInstance(RemoveUserIndexOperation.class);
+        LogFactory.getFactory().getInstance(RemoveWebsiteIndexOperation.class);
 
     //~ Instance fields ========================================================
 
-    private UserData user;
+    private WebsiteData website;
 
     //~ Constructors ===========================================================
 
     /**
      * Create a new operation that will recreate an index.
      *
-     * @param website The website to rebuild the index for, or null for all users.
+     * @param website The website to rebuild the index for, or null for all sites.
      */
-    public RemoveUserIndexOperation(IndexManagerImpl mgr, UserData user)
+    public RemoveWebsiteIndexOperation(IndexManagerImpl mgr, WebsiteData website)
     {
         super(mgr);
-        this.user = user;
+        this.website = website;
     }
 
     //~ Methods ================================================================
@@ -55,24 +55,22 @@
     public void doRun()
     {
         Date start = new Date();
-
         IndexReader reader = beginDeleting();
-
         try
         {
             if (reader != null)
             {
-                String userName = null;
-                if (user != null)
+                String handle = null;
+                if (website != null)
                 {
-                    userName = user.getUserName();
+                    handle = website.getHandle();
                 }
-                Term tUsername =
-                    IndexUtil.getTerm(FieldConstants.USERNAME, userName);
+                Term tHandle =
+                    IndexUtil.getTerm(FieldConstants.WEBSITE_HANDLE, handle);
 
-                if (tUsername != null)
+                if (tHandle != null)
                 {
-                    reader.delete(tUsername);
+                    reader.delete(tHandle);
                 }
             }
         }
@@ -88,10 +86,10 @@
         Date end = new Date();
         double length = (end.getTime() - start.getTime()) / (double) 1000;
 
-        if (user != null)
+        if (website != null)
         {
-            mLogger.info("Completed deleting indices for '" +
-                            user.getUserName() + "' in '" + length + "' seconds");
+            mLogger.info("Completed deleting indices for website '" +
+                    website.getName() + "' in '" + length + "' seconds");
         }
     }
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/SearchOperation.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/SearchOperation.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/SearchOperation.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/business/search/operations/SearchOperation.java Thu Jun 23 21:31:43 2005
@@ -49,7 +49,7 @@
     //~ Instance fields ========================================================
 
     private String term;
-    private String username;
+    private String websiteHandle;
     private String category;
     private Hits searchresults;
     private String parseError;
@@ -91,7 +91,7 @@
                     term, SEARCH_FIELDS, new StandardAnalyzer());
 
             Term tUsername =
-                IndexUtil.getTerm(FieldConstants.USERNAME, username);
+                IndexUtil.getTerm(FieldConstants.WEBSITE_HANDLE, websiteHandle);
 
             if (tUsername != null)
             {
@@ -146,9 +146,9 @@
     /**
      * @param string
      */
-    public void setUsername(String username)
+    public void setWebsiteHandle(String websiteHandle)
     {
-        this.username = username;
+        this.websiteHandle = websiteHandle;
     }
 
     /**

Modified: incubator/roller/branches/roller_2.0/src/org/roller/model/IndexManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/model/IndexManager.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/model/IndexManager.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/model/IndexManager.java Thu Jun 23 21:31:43 2005
@@ -4,6 +4,7 @@
 import org.roller.business.search.operations.IndexOperation;
 import org.roller.pojos.UserData;
 import org.roller.pojos.WeblogEntryData;
+import org.roller.pojos.WebsiteData;
 
 /**
  * Interface to Roller's Lucene-based search facility.
@@ -14,11 +15,8 @@
     /** Does index need to be rebuild */
     public abstract boolean isInconsistentAtStartup();
     
-    /** Rebuild index, returns immediately and operates in background */
-    public void rebuildUserIndex() throws RollerException;
-    
     /** Remove user from index, returns immediately and operates in background */
-    public void removeUserIndex(UserData user) throws RollerException;
+    public void removeWebsiteIndex(WebsiteData website) throws RollerException;
     
     /** Remove entry from index, returns immediately and operates in background */
     public void removeEntryIndexOperation(WeblogEntryData entry) throws RollerException;
@@ -37,4 +35,8 @@
     
     /** Shutdown to be called on application shutdown */
     public abstract void shutdown();
+
+    public abstract void rebuildWebsiteIndex(WebsiteData website) throws RollerException;
+
+    public abstract void rebuildWebsiteIndex() throws RollerException;
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/model/UserManager.java Thu Jun 23 21:31:43 2005
@@ -31,21 +31,17 @@
      * @param website Get all users of this website (or null for all)
      * @returns List of UserData objects.
      */
-    public List getUsers(WebsiteData website);
+    public List getUsers(WebsiteData website, Boolean enabled) 
+        throws RollerException;
     
     /** 
-     * Get website by name
-     * @param name Name of website
-     */
-    //public WebsiteData getWebsiteByName(String name);
-
-    /** 
      * Get all websites of which user is a member
      * @param user    Get all websites for this user (or null for all)
      * @param enabled Get all with this enabled state (or null or all)
      * @returns List of WebsiteData objects.
      */
-    public List getWebsites(UserData user, Boolean enabled);
+    public List getWebsites(UserData user, Boolean enabled)
+        throws RollerException;
 
     /** 
      * Get pending permissions for user
@@ -80,6 +76,14 @@
     public PermissionsData inviteUser(
             WebsiteData website, UserData user, short perms) throws RollerException;
 
+    /**
+     * Retire user from a website
+     * @param website Website to be retired from (persistent instance) 
+     * @param user    User to be retired (persistent instance)
+     */
+    public void retireUser(
+            WebsiteData website, UserData user) throws RollerException;
+
     /** Release any resources used */
     public void release();
     
@@ -88,8 +92,11 @@
     /** Get all enabled users */
     public List getUsers() throws RollerException;
     
-	/** Get all users, optionally include dis-enabled users */
-	public List getUsers(boolean enabledOnly) throws RollerException;
+	/** 
+     * Get all users, optionally include dis-enabled users.
+     * @param enabled True for enabled only, false for disabled only, null for all
+     */
+	public List getUsers(Boolean enabled) throws RollerException;
 
     /** Get user object by user name (only enabled users) */
     public UserData getUser( String userName ) throws RollerException;
@@ -115,13 +122,22 @@
 
     //------------------------------------------------------------ WebsiteData
     
-    /** Get website object by user name */
-    public WebsiteData getWebsite(String userName) throws RollerException;
-	public WebsiteData getWebsite(String userName, boolean enabledOnly) throws RollerException;
+    /** 
+     * Get website specified by handle (or null if enabled website not found).
+     * @param handle  Handle of website
+     */
+    public WebsiteData getWebsiteByHandle(String handle) 
+        throws RollerException;
+
+    /** 
+     * Get website specified by handle with option to return only enabled websites.
+     * @param handle  Handle of website
+     */
+    public WebsiteData getWebsiteByHandle(String handle, boolean enabled) 
+        throws RollerException;
 
     public WebsiteData retrieveWebsite(String id) throws RollerException;
     public void storeWebsite(WebsiteData data) throws RollerException;
-    public void removeWebsite(String id) throws RollerException;
 
     //--------------------------------------------------------------- PageData
     

Modified: incubator/roller/branches/roller_2.0/src/org/roller/model/WeblogManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/model/WeblogManager.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/model/WeblogManager.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/model/WeblogManager.java Thu Jun 23 21:31:43 2005
@@ -292,7 +292,7 @@
         WebsiteData website, String anchor ) throws RollerException;
 
     /** Get time of last update for a weblog specified by username */
-    public Date getWeblogLastPublishTime( String userName )
+    public Date getWeblogLastPublishTime(WebsiteData website)
         throws RollerException;
 
     /**
@@ -302,7 +302,7 @@
      * @return         Date Of last publish time
      * @throws         RollerException
      */
-    public Date getWeblogLastPublishTime( String userName, String catName )
+    public Date getWeblogLastPublishTime(WebsiteData website, String catName )
         throws RollerException;
 
     /**
@@ -358,5 +358,5 @@
      * @return the url of the user's weblog
      * @throws RollerException
      */
-    public String getUrl(UserData user, String contextUrl) throws RollerException;
+    public String getUrl(WebsiteData website, String contextUrl) throws RollerException;
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/AutoPingData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/AutoPingData.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/AutoPingData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/AutoPingData.java Thu Jun 23 21:31:43 2005
@@ -165,7 +165,7 @@
         return "AutoPingData{" +
             "id='" + id + "'" +
             ", pingTarget=" + pingTarget +
-            ", website= " + (website == null ? "null" : "{id='" + website.getId() + "', user='" + website.getUser().getUserName() + "'} ") +
+            ", website= " + (website == null ? "null" : "{id='" + website.getId() +"'} ") +
             "}";
     }
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/BookmarkData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/BookmarkData.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/BookmarkData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/BookmarkData.java Thu Jun 23 21:31:43 2005
@@ -20,7 +20,7 @@
  * @hibernate.class table="bookmark"
  * hibernate.jcs-cache usage="read-write" 
  */
-public class BookmarkData extends org.roller.pojos.PersistentObject
+public class BookmarkData extends WebsiteObject
     implements Serializable, Comparable
 {
     static final long serialVersionUID = 2315131256728236003L;
@@ -412,17 +412,9 @@
         bookmarkManager = bmgr;
     }
 
-    public boolean canSave() throws RollerException
+    public WebsiteData getWebsite()
     {
-        Roller roller = RollerFactory.getRoller();
-        if (roller.getUser().equals(UserData.SYSTEM_USER)) 
-        {
-            return true;
-        }
-        if (roller.getUser().equals(getFolder().getWebsite().getUser()))
-        {
-            return true;
-        }
-        return false;
+        return this.folder.getWebsite();
     }
+
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/FolderData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/FolderData.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/FolderData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/FolderData.java Thu Jun 23 21:31:43 2005
@@ -487,17 +487,4 @@
         pstrategy.remove(po);
     }
 
-    public boolean canSave() throws RollerException
-    {
-        Roller roller = RollerFactory.getRoller();
-        if (roller.getUser().equals(UserData.SYSTEM_USER)) 
-        {
-            return true;
-        }
-        if (roller.getUser().equals(getWebsite().getUser()))
-        {
-            return true;
-        }
-        return false;
-    }
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/HierarchicalPersistentObject.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/HierarchicalPersistentObject.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/HierarchicalPersistentObject.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/HierarchicalPersistentObject.java Thu Jun 23 21:31:43 2005
@@ -18,7 +18,7 @@
  * 
  * @author David M Johnson
  */
-public abstract class HierarchicalPersistentObject extends PersistentObject
+public abstract class HierarchicalPersistentObject extends WebsiteObject
 {        
     protected HierarchicalPersistentObject mNewParent = null;   
     

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/PageData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/PageData.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/PageData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/PageData.java Thu Jun 23 21:31:43 2005
@@ -1,11 +1,8 @@
 package org.roller.pojos;
 
+import java.io.Serializable;
 import java.util.Date;
 
-import org.roller.RollerException;
-import org.roller.model.Roller;
-import org.roller.model.RollerFactory;
-
 
 /** Page bean.
  * @author David M Johnson
@@ -15,9 +12,7 @@
  * @hibernate.class table="webpage" 
  * hibernate.jcs-cache usage="read-write"
  */
-public class PageData
-   extends org.roller.pojos.PersistentObject
-   implements java.io.Serializable
+public class PageData extends WebsiteObject implements Serializable
 {
    static final long serialVersionUID = -613737191638263428L;
 
@@ -287,20 +282,6 @@
       this.template = ((PageData)otherData).template;
 
       this.updateTime = ((PageData)otherData).updateTime;
-   }
-
-   public boolean canSave() throws RollerException
-   {
-       Roller roller = RollerFactory.getRoller();
-       if (roller.getUser().equals(UserData.SYSTEM_USER)) 
-       {
-           return true;
-       }
-       if (roller.getUser().equals(getWebsite().getUser()))
-       {
-           return true;
-       }
-       return false;
    }
 
 }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/PermissionsData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/PermissionsData.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/PermissionsData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/PermissionsData.java Thu Jun 23 21:31:43 2005
@@ -31,9 +31,9 @@
     private WebsiteData website = null;
     private UserData    user = null;
     private boolean     pending = true;
-    public static short LIMITED = 0x00;
-    public static short AUTHOR = 0x01;
-    public static short ADMIN = 0x02;
+    public static short LIMITED = 0x00; // 0000 
+    public static short AUTHOR  = 0x01; // 0001
+    public static short ADMIN   = 0x03; // 0011 
     private short       permissionMask = LIMITED;
     
     /** Creates a new instance of PermissionsData */

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingQueueEntryData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingQueueEntryData.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingQueueEntryData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingQueueEntryData.java Thu Jun 23 21:31:43 2005
@@ -231,7 +231,7 @@
             "id='" + id + "'" +
             ", entryTime=" + entryTime +
             ", pingTarget=" + pingTarget +
-            ", website= " + (website == null ? "null" : "{id='" + website.getId() + "', user='" + website.getUser().getUserName() + "'} ") +
+            ", website= " + (website == null ? "null" : "{id='" + website.getId() + "'} ") +
             ", attempts=" + attempts +
             "}";
     }

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingTargetData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingTargetData.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingTargetData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/PingTargetData.java Thu Jun 23 21:31:43 2005
@@ -275,7 +275,8 @@
         {
             return true;
         }
-        if (website != null && website.getUser().equals(user))
+        if (website != null && website.hasUserPermissions(
+                user, (short)(PermissionsData.ADMIN | PermissionsData.AUTHOR))) 
         {
             return true;
         }
@@ -311,7 +312,7 @@
             "id='" + id + "'" +
             ", name='" + name + "'" +
             ", pingUrl='" + pingUrl + "'" +
-            ", website= " + (website == null ? "null" : "{id='" + website.getId() + "', user='" + website.getUser().getUserName() + "'} ") +
+            ", website= " + (website == null ? "null" : "{id='" + website.getId() + "'} ") +
             ", conditionCode=" + conditionCode +
             ", lastSuccess=" + lastSuccess +
             "}";

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/UserData.java Thu Jun 23 21:31:43 2005
@@ -3,6 +3,7 @@
 
 import java.util.Date;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -29,7 +30,7 @@
 {
     public static final UserData SYSTEM_USER = 
         new UserData("n/a","systemuser","n/a","systemuser","n/a",new Date());
-    
+       
     public static final UserData ANONYMOUS_USER = 
         new UserData("n/a","anonymoususer","n/a","anonymoususer","n/a",new Date());
    
@@ -41,7 +42,9 @@
    protected java.lang.String fullName;
    protected java.lang.String emailAddress;
    protected java.util.Date dateCreated;
+   protected Boolean isEnabled;
    private Set roles = new TreeSet();
+   private List permissions;
 
    public UserData()
    {
@@ -70,7 +73,37 @@
 
 	}
 
-   /** Id of the User.
+    /** 
+     * @hibernate.bag lazy="true" inverse="true" cascade="delete" 
+     * @hibernate.collection-key column="user_id"
+     * @hibernate.collection-one-to-many 
+     *    class="org.roller.pojos.PermissionsData"
+     */
+    public List getPermissions() 
+    {
+        return permissions;
+    }
+    public void setPermissions(List perms)
+    {
+        permissions = perms;
+    }
+
+    /**
+     * @ejb:persistent-field
+     * @hibernate.property column="isenabled" non-null="true" unique="false"
+     */
+    public Boolean getIsEnabled()
+    {
+        return this.isEnabled;
+    }
+    
+    /** @ejb:persistent-field */ 
+    public void setIsEnabled(Boolean isEnabled)
+    {
+        this.isEnabled = isEnabled;
+    }
+    
+    /** Id of the User.
      * Not remote since primary key may be extracted by other means.
      * 
      * @struts.validator type="required" msgkey="errors.required"
@@ -178,6 +211,7 @@
 	   }
    }
 
+   //------------------------------------------------------------------- citizenship
    public String toString()
    {
 		StringBuffer str = new StringBuffer("{");

Modified: incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogCategoryData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogCategoryData.java?rev=201564&r1=201563&r2=201564&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogCategoryData.java (original)
+++ incubator/roller/branches/roller_2.0/src/org/roller/pojos/WeblogCategoryData.java Thu Jun 23 21:31:43 2005
@@ -471,18 +471,4 @@
         return RollerFactory.getRoller().getWeblogManager().getWeblogCategoryAncestorAssocs(this);
     }
 
-    public boolean canSave() throws RollerException
-    {
-        Roller roller = RollerFactory.getRoller();
-        if (roller.getUser().equals(UserData.SYSTEM_USER)) 
-        {
-            return true;
-        }
-        if (roller.getUser().equals(getWebsite().getUser()))
-        {
-            return true;
-        }
-        return false;
-    }
-
 }