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 2006/02/09 03:55:18 UTC
svn commit: r376155 - in /incubator/roller/trunk: metadata/database/
src/org/roller/business/hibernate/ src/org/roller/model/
src/org/roller/pojos/ src/org/roller/presentation/planet/
src/org/roller/presentation/xmlrpc/ web/
Author: snoopdave
Date: Wed Feb 8 18:55:16 2006
New Revision: 376155
URL: http://svn.apache.org/viewcvs?rev=376155&view=rev
Log:
Fixes ROL-485: abilty to set weblog inactive
Added:
incubator/roller/trunk/metadata/database/210-to-220-migration.vm
Modified:
incubator/roller/trunk/metadata/database/control.vm
incubator/roller/trunk/metadata/database/createdb.vm
incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java
incubator/roller/trunk/src/org/roller/business/hibernate/HibernateUserManagerImpl.java
incubator/roller/trunk/src/org/roller/model/UserManager.java
incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java
incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java
incubator/roller/trunk/src/org/roller/presentation/xmlrpc/BloggerAPIHandler.java
incubator/roller/trunk/web/login-redirect.jsp
Added: incubator/roller/trunk/metadata/database/210-to-220-migration.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/210-to-220-migration.vm?rev=376155&view=auto
==============================================================================
--- incubator/roller/trunk/metadata/database/210-to-220-migration.vm (added)
+++ incubator/roller/trunk/metadata/database/210-to-220-migration.vm Wed Feb 8 18:55:16 2006
@@ -0,0 +1,8 @@
+#**
+210-to-220-migration.vm: Velocity template that generates vendor-specific database scripts
+
+DON'T RUN THIS, IT'S NOT A DATABASE CREATION SCRIPT!!!
+**#
+
+#addColumnNotNull("website" "isactive" $BOOLEAN_SQL_TYPE $BOOLEAN_FALSE)
+
Modified: incubator/roller/trunk/metadata/database/control.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/control.vm?rev=376155&r1=376154&r2=376155&view=diff
==============================================================================
--- incubator/roller/trunk/metadata/database/control.vm (original)
+++ incubator/roller/trunk/metadata/database/control.vm Wed Feb 8 18:55:16 2006
@@ -6,6 +6,7 @@
#** Define templates to be generated **#
#set( $templates = ["createdb", "200-to-210-migration"])
+#set( $templates = ["createdb", "210-to-220-migration"])
#** Define special macro needed for alter table with not-null restriction **#
#macro(addColumnNotNull $table $column $type $default)
Modified: incubator/roller/trunk/metadata/database/createdb.vm
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/metadata/database/createdb.vm?rev=376155&r1=376154&r2=376155&view=diff
==============================================================================
--- incubator/roller/trunk/metadata/database/createdb.vm (original)
+++ incubator/roller/trunk/metadata/database/createdb.vm Wed Feb 8 18:55:16 2006
@@ -101,6 +101,7 @@
timezone varchar(50),
defaultplugins varchar(255),
isenabled $BOOLEAN_SQL_TYPE_TRUE not null,
+ isactive $BOOLEAN_SQL_TYPE_TRUE not null,
datecreated timestamp not null,
blacklist $TEXT_SQL_TYPE,
defaultallowcomments $BOOLEAN_SQL_TYPE_TRUE not null,
Modified: incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java?rev=376155&r1=376154&r2=376155&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/hibernate/HibernateRefererManagerImpl.java Wed Feb 8 18:55:16 2006
@@ -183,48 +183,53 @@
stmt = con.prepareStatement(
"select top ? w.id,w.name,w.handle,sum(r.dayhits) as s "+
"from website as w, referer as r "+
- "where r.websiteid=w.id and w.isenabled=? " +
+ "where r.websiteid=w.id and w.isenabled=? and w.isactive=? " +
"group by w.name,w.handle,w.id order by s desc");
stmt.setInt(1, max);
stmt.setBoolean(2, true);
+ stmt.setBoolean(3, true);
} else if(con.getMetaData().getDriverName().startsWith("Apache Derby")) {
// special handling for Derby
stmt = con.prepareStatement(
"select w.name, w.handle, w.id, sum(r.dayhits) as s "+
"from website as w, referer as r "+
- "where r.websiteid=w.id and w.isenabled=? " +
+ "where r.websiteid=w.id and w.isenabled=? and w.isactive=? " +
"group by w.name, w.handle, w.id order by s desc");
- stmt.setBoolean(1, true);
+ stmt.setBoolean(1, true);
+ stmt.setBoolean(2, true);
stmt.setMaxRows(max);
} else if(con.getMetaData().getDriverName().startsWith("IBM DB2")) {
// special handling for IBM DB2
stmt = con.prepareStatement(
"select u.username,w.name,w.name,sum(r.dayhits) as s "+
"from rolleruser as u, website as w, referer as r "+
- "where r.websiteid=w.id and w.userid=u.id and w.isenabled= ? " +
+ "where r.websiteid=w.id and w.userid=u.id and w.isenabled=? and w.isactive=? " +
"group by u.username,w.handle,w.id order by s desc fetch first " +
Integer.toString(max) + " rows only");
stmt.setBoolean(1, true);
+ stmt.setBoolean(2, true);
} else if (con.getMetaData().getDriverName().startsWith("Oracle")) {
String sql = "select u.username,w.name,w.handle,sum(r.dayhits) as s "+
"from rolleruser u, website w, referer r "+
- "where r.websiteid=w.id and w.userid=u.id and w.isenabled= ? and rownum <= ? " +
+ "where r.websiteid=w.id and w.userid=u.id and w.isenabled=? and w.isactive=? and rownum <= ? " +
"group by u.username,w.name,w.handle order by s desc";
stmt = con.prepareStatement(sql);
stmt.setBoolean(1, true);
- stmt.setInt(2, max );
+ stmt.setBoolean(2, true);
+ stmt.setInt(3, max );
} else {
stmt = con.prepareStatement(
"select w.id,w.name,w.handle,sum(r.dayhits) as s "+
"from website as w, referer as r "+
- "where r.websiteid=w.id and w.isenabled= ? " +
+ "where r.websiteid=w.id and w.isenabled= ? and w.isactive=? " +
// Ben Walding (a Postgres SQL user): Basically, you have
// to have all non-aggregated columns that exist in your
// 'SELECT' section, in the 'GROUP BY' section as well:
"group by w.name,w.handle,w.id order by s desc limit ?");
// and not this: "group by w.id order by s desc");
stmt.setBoolean(1, true);
- stmt.setInt(2, max);
+ stmt.setBoolean(2, true);
+ stmt.setInt(3, max);
}
ResultSet rs = stmt.executeQuery();
if ( rs.next() ) {
Modified: incubator/roller/trunk/src/org/roller/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/hibernate/HibernateUserManagerImpl.java?rev=376155&r1=376154&r2=376155&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/hibernate/HibernateUserManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/hibernate/HibernateUserManagerImpl.java Wed Feb 8 18:55:16 2006
@@ -59,7 +59,7 @@
/**
* Get websites of a user
*/
- public List getWebsites(UserData user, Boolean enabled) throws RollerException
+ public List getWebsites(UserData user, Boolean enabled, Boolean active) throws RollerException
{
try
{
@@ -74,6 +74,10 @@
if (enabled != null)
{
criteria.add(Expression.eq("enabled", enabled));
+ }
+ if (active != null)
+ {
+ criteria.add(Expression.eq("active", active));
}
return criteria.list();
}
Modified: incubator/roller/trunk/src/org/roller/model/UserManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/model/UserManager.java?rev=376155&r1=376154&r2=376155&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/model/UserManager.java (original)
+++ incubator/roller/trunk/src/org/roller/model/UserManager.java Wed Feb 8 18:55:16 2006
@@ -41,9 +41,10 @@
* 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)
+ * @param active Get all with this active state (or null or all)
* @returns List of WebsiteData objects.
*/
- public List getWebsites(UserData user, Boolean enabled)
+ public List getWebsites(UserData user, Boolean enabled, Boolean active)
throws RollerException;
/**
Modified: incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java?rev=376155&r1=376154&r2=376155&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java (original)
+++ incubator/roller/trunk/src/org/roller/pojos/WebsiteData.java Wed Feb 8 18:55:16 2006
@@ -59,7 +59,8 @@
private String locale = null;
private String timeZone = null;
private String defaultPlugins = null;
- private Boolean enabled = Boolean.TRUE;
+ private Boolean enabled = Boolean.TRUE;
+ private Boolean active = Boolean.TRUE;
private Date dateCreated = null;
private Boolean defaultAllowComments = Boolean.TRUE;
private int defaultCommentDays = 0;
@@ -777,22 +778,6 @@
defaultPlugins = string;
}
- /**
- * @roller.wrapPojoMethod type="simple"
- * @ejb:persistent-field
- * @hibernate.property column="isenabled" non-null="true" unique="false"
- */
- public Boolean getEnabled()
- {
- return this.enabled;
- }
-
- /** @ejb:persistent-field */
- public void setEnabled(Boolean enabled)
- {
- this.enabled = enabled;
- }
-
public String toString()
{
StringBuffer str = new StringBuffer("{");
@@ -1072,6 +1057,40 @@
*/
public void setEntryDisplayCount(int entryDisplayCount) {
this.entryDisplayCount = entryDisplayCount;
+ }
+
+ /**
+ * Set to FALSE to completely disable and hide this weblog from public view.
+ *
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="isenabled" non-null="true" unique="false"
+ */
+ public Boolean getEnabled()
+ {
+ return this.enabled;
+ }
+
+ /** @ejb:persistent-field */
+ public void setEnabled(Boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ /**
+ * Set to FALSE to exclude this weblog from community areas such as the
+ * front page and the planet page.
+ *
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="isactive" not-null="true"
+ */
+ public Boolean getActive() {
+ return active;
+ }
+
+ public void setActive(Boolean active) {
+ this.active = active;
}
}
Modified: incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java?rev=376155&r1=376154&r2=376155&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java Wed Feb 8 18:55:16 2006
@@ -82,8 +82,9 @@
try {
String baseFeedURL = baseURL + "/rss/";
String baseSiteURL = baseURL + "/page/";
+ // get list of all enabled and active weblogs
Iterator websites =
- roller.getUserManager().getWebsites(null, null).iterator();
+ roller.getUserManager().getWebsites(null, Boolean.TRUE, Boolean.TRUE).iterator();
while (websites.hasNext()) {
WebsiteData website = (WebsiteData)websites.next();
Modified: incubator/roller/trunk/src/org/roller/presentation/xmlrpc/BloggerAPIHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/xmlrpc/BloggerAPIHandler.java?rev=376155&r1=376154&r2=376155&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/xmlrpc/BloggerAPIHandler.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/xmlrpc/BloggerAPIHandler.java Wed Feb 8 18:55:16 2006
@@ -263,7 +263,8 @@
UserManager umgr = RollerFactory.getRoller().getUserManager();
UserData user = umgr.getUser(userid);
- List websites = umgr.getWebsites(user, Boolean.TRUE);
+ // get list of user's enabled websites
+ List websites = umgr.getWebsites(user, Boolean.TRUE, null);
Iterator iter = websites.iterator();
while (iter.hasNext()) {
WebsiteData website = (WebsiteData)iter.next();
Modified: incubator/roller/trunk/web/login-redirect.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/web/login-redirect.jsp?rev=376155&r1=376154&r2=376155&view=diff
==============================================================================
--- incubator/roller/trunk/web/login-redirect.jsp (original)
+++ incubator/roller/trunk/web/login-redirect.jsp Wed Feb 8 18:55:16 2006
@@ -10,7 +10,7 @@
Roller roller = RollerFactory.getRoller();
RollerSession rollerSession = RollerSession.getRollerSession(request);
UserData user = rollerSession.getAuthenticatedUser();
-List websites = roller.getUserManager().getWebsites(user, Boolean.TRUE);
+List websites = roller.getUserManager().getWebsites(user, Boolean.TRUE, null);
if (websites.size() == 1) {
WebsiteData website = (WebsiteData)websites.get(0);
website.hasUserPermissions(user, PermissionsData.LIMITED);