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/05/02 00:23:34 UTC
svn commit: r398712 [8/32] - in /incubator/roller/trunk/src/org/apache: ./
roller/ roller/business/ roller/business/hibernate/
roller/business/referrers/ roller/business/runnable/
roller/business/search/ roller/business/search/operations/ roller/busine...
Added: incubator/roller/trunk/src/org/apache/roller/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/package.html?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/package.html (added)
+++ incubator/roller/trunk/src/org/apache/roller/package.html Mon May 1 15:23:02 2006
@@ -0,0 +1,27 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. The ASF licenses this file to You
+ under the Apache License, Version 2.0 (the "License"); you may not
+ use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. For additional information regarding
+ copyright in this work, please see the NOTICE file in the top level
+ directory of this distribution.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title></title>
+</head>
+<body>
+Exceptions thrown by Roller business layer.
+
+</body>
+</html>
Added: incubator/roller/trunk/src/org/apache/roller/pojos/Assoc.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/Assoc.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/Assoc.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/Assoc.java Mon May 1 15:23:02 2006
@@ -0,0 +1,51 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Created on Jan 13, 2004
+ */
+
+package org.apache.roller.pojos;
+
+import org.apache.roller.RollerException;
+import java.io.Serializable;
+
+
+/**
+ * Interface for hierarchical assocations.
+ */
+public interface Assoc extends Serializable {
+
+ public static final String PARENT = "PARENT";
+ public static final String GRANDPARENT = "GRANDPARENT";
+
+ /** Object that owns this association. */
+ public HierarchicalPersistentObject getObject();
+
+ public void setObject(HierarchicalPersistentObject hpo);
+
+
+ /** Associated object. */
+ public HierarchicalPersistentObject getAncestor();
+
+ public void setAncestor(HierarchicalPersistentObject hpo);
+
+
+ /** Type of relationship, PARENT or GRANDPARENT. */
+ public String getRelation();
+
+}
Added: incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java Mon May 1 15:23:02 2006
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.pojos;
+
+import java.io.Serializable;
+
+/**
+ * Automatic ping configuration. An instance of this class relates a website and ping target; it indicates that the specified
+ * ping target should be pinged when the corresponding website is changed. Pinging can be restricted to changes to
+ * specific categories on the website by instances of the {@link PingCategoryRestrictionData} object. In the absence of
+ * any category restrictions, the ping target is pinged whenever the corresponding website changes.
+ *
+ * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
+ * @ejb:bean name="AutoPingData"
+ * @hibernate.class lazy="false" table="autoping"
+ * @hibernate.cache usage="read-write"
+ */
+public class AutoPingData extends PersistentObject implements Serializable
+{
+ private String id = null;
+ private PingTargetData pingTarget = null;
+ private WebsiteData website = null;
+
+ public static final long serialVersionUID = -9105985454111986435L;
+
+ /**
+ * Default constructor. Leaves all fields null. Required for bean compliance.
+ */
+ public AutoPingData()
+ {
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param id unique id (primary key) for this instance
+ * @param pingtarget ping target that should be pinged
+ * @param website website to which this configuration applies
+ */
+ public AutoPingData(String id, PingTargetData pingtarget, WebsiteData website)
+ {
+ this.id = id;
+ this.website = website;
+ this.pingTarget = pingtarget;
+ }
+
+ /**
+ * Setter needed by RollerImpl.storePersistentObject()
+ */
+ public void setData(PersistentObject vo)
+ {
+ AutoPingData other = (AutoPingData)vo;
+
+ id = other.getId();
+ website = other.getWebsite();
+ pingTarget = other.getPingTarget();
+ }
+
+ /**
+ * Get the unique id (primary key) of this object.
+ *
+ * @return the unique id of this object. -- struts.validator type="required" msgkey="errors.required"
+ * @ejb:persistent-field
+ * @hibernate.id column="id" generator-class="uuid.hex" unsaved-value="null"
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+ /**
+ * Set the unique id (primary key) of this object
+ *
+ * @param id
+ * @ejb:persistent-field
+ */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * Get the website. Get the website whose changes should result in a ping to the ping target specified by this
+ * object.
+ *
+ * @return the website.
+ * @ejb:persistent-field
+ * @hibernate.many-to-one column="websiteid" cascade="none" not-null="false"
+ */
+ public WebsiteData getWebsite()
+ {
+ return website;
+ }
+
+ /**
+ * Set the website. Set the website whose changes should result in a ping to the ping target specified by this
+ * object.
+ *
+ * @param website the website.
+ * @ejb:persistent-field
+ */
+ public void setWebsite(WebsiteData website)
+ {
+ this.website = website;
+ }
+
+ /**
+ * Get the ping target. Get the target to be pinged when the corresponding website changes.
+ *
+ * @return the target to be pinged.
+ * @ejb:persistent-field
+ * @hibernate.many-to-one column="pingtargetid" cascade="none" not-null="false"
+ */
+ public PingTargetData getPingTarget()
+ {
+ return pingTarget;
+ }
+
+ /**
+ * Set the ping target. Set the target to be pinged when the corresponding website changes.
+ *
+ * @param pingtarget the target to be pinged.
+ * @ejb:persistent-field
+ */
+ public void setPingTarget(PingTargetData pingtarget)
+ {
+ this.pingTarget = pingtarget;
+ }
+
+ /**
+ * @see Object#equals(Object)
+ */
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof AutoPingData)) return false;
+
+ final AutoPingData autoPingData = (AutoPingData)o;
+
+ if (id != null ? !id.equals(autoPingData.getId()) : autoPingData.getId() != null) return false;
+ if (pingTarget != null ? !pingTarget.equals(autoPingData.getPingTarget()) : autoPingData.getPingTarget() != null) return false;
+ if (website != null ? !website.equals(autoPingData.getWebsite()) : autoPingData.getWebsite() != null) return false;
+
+ return true;
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return (id != null ? id.hashCode() : 0);
+ }
+
+ /**
+ * Generate a string form of the object appropriate for logging or debugging.
+ * @return a string form of the object appropriate for logging or debugging.
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return "AutoPingData{" +
+ "id='" + id + "'" +
+ ", pingTarget=" + pingTarget +
+ ", website= " + (website == null ? "null" : "{id='" + website.getId() +"'} ") +
+ "}";
+ }
+}
Added: incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkComparator.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkComparator.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkComparator.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkComparator.java Mon May 1 15:23:02 2006
@@ -0,0 +1,50 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.pojos;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+public class BookmarkComparator implements Comparator, Serializable
+{
+ static final long serialVersionUID = 4009699640952161148L;
+
+ public int compare(Object val1, Object val2)
+ throws ClassCastException
+ {
+ BookmarkData bd1 = (BookmarkData)val1;
+ BookmarkData bd2 = (BookmarkData)val2;
+ int priority1 = bd1.getPriority().intValue();
+ int priority2 = bd2.getPriority().intValue();
+
+ if (priority1 > priority2)
+ {
+ return 1;
+ }
+ else if (priority1 < priority2)
+ {
+ return -1;
+ }
+
+ // if priorities are the same, return
+ // results of String.compareTo()
+ return bd1.getName().compareTo(bd2.getName());
+
+ }
+
+}
Added: incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java Mon May 1 15:23:02 2006
@@ -0,0 +1,455 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.pojos;
+
+import org.apache.roller.RollerException;
+import org.apache.roller.model.BookmarkManager;
+import org.apache.roller.model.Roller;
+import org.apache.roller.model.RollerFactory;
+
+import java.io.Serializable;
+
+/**
+ * <p>Represents a single URL in a user's favorite web-bookmarks collection.
+ * Don't construct one of these yourself, instead use the create method in
+ * the your BookmarkManager implementation.</p>
+ *
+ * @ejb:bean name="BookmarkData"
+ *
+ * @struts.form include-all="true"
+ * extends="org.apache.struts.validator.ValidatorForm"
+ *
+ * @hibernate.class lazy="false" table="bookmark"
+ * @hibernate.cache usage="read-write"
+ */
+public class BookmarkData extends PersistentObject
+ implements Serializable, Comparable
+{
+ static final long serialVersionUID = 2315131256728236003L;
+
+ private FolderData folder;
+
+ private String id = null;
+ private String name;
+ private String description;
+ private String url;
+ private Integer weight;
+ private Integer priority;
+ private String image;
+ private String feedUrl;
+
+ private BookmarkManager bookmarkManager = null;
+
+ //----------------------------------------------------------- Constructors
+
+ /** Default constructor, for use in form beans only. */
+ public BookmarkData()
+ {
+ }
+
+ public BookmarkData(
+ FolderData parent,
+ String name,
+ String desc,
+ String url,
+ String feedUrl,
+ Integer weight,
+ Integer priority,
+ String image)
+ {
+ this.folder = parent;
+ this.name = name;
+ this.description = desc;
+ this.url = url;
+ this.feedUrl = feedUrl;
+ this.weight = weight;
+ this.priority = priority;
+ this.image = image;
+ }
+
+ /** For use by BookmarkManager implementations only. */
+ public BookmarkData(BookmarkManager bmgr)
+ {
+ bookmarkManager = bmgr;
+ }
+
+ //------------------------------------------------------------- Attributes
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.id column="id"
+ * generator-class="uuid.hex" unsaved-value="null"
+ */
+ public String getId()
+ {
+ return this.id;
+ }
+
+ /** @ejb:persistent-field */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * Name of bookmark.
+ *
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @struts.validator type="required" msgkey="errors.required"
+ * @struts.validator-args arg0resource="bookmarkForm.name"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.property column="name" non-null="true" unique="false"
+ */
+ public String getName()
+ {
+ return this.name;
+ }
+
+ /** @ejb:persistent-field */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Description of bookmark.
+ *
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.property column="description" non-null="true" unique="false"
+ */
+ public String getDescription()
+ {
+ return this.description;
+ }
+
+ /** @ejb:persistent-field */
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ /**
+ * URL of bookmark.
+ *
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.property column="url" non-null="true" unique="false"
+ */
+ public String getUrl()
+ {
+ return this.url;
+ }
+
+ /** @ejb:persistent-field */
+ public void setUrl(String url)
+ {
+ this.url = url;
+ }
+
+ /**
+ * Weight indicates prominence of link
+ *
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @struts.validator type="required" msgkey="errors.required"
+ * @struts.validator type="integer" msgkey="errors.integer"
+ * @struts.validator-args arg0resource="bookmarkForm.weight"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.property column="weight" non-null="true" unique="false"
+ */
+ public java.lang.Integer getWeight()
+ {
+ return this.weight;
+ }
+
+ /** @ejb:persistent-field */
+ public void setWeight(java.lang.Integer weight)
+ {
+ this.weight = weight;
+ }
+
+ /**
+ * Priority determines order of display
+ *
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @struts.validator type="required" msgkey="errors.required"
+ * @struts.validator type="integer" msgkey="errors.integer"
+ * @struts.validator-args arg0resource="bookmarkForm.priority"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.property column="priority" non-null="true" unique="false"
+ */
+ public java.lang.Integer getPriority()
+ {
+ return this.priority;
+ }
+
+ /** @ejb:persistent-field */
+ public void setPriority(java.lang.Integer priority)
+ {
+ this.priority = priority;
+ }
+
+ /**
+ * @ejb:persistent-field
+ *
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @hibernate.property column="image" non-null="true" unique="false"
+ */
+ public String getImage()
+ {
+ return this.image;
+ }
+
+ /** @ejb:persistent-field */
+ public void setImage(String image)
+ {
+ this.image = image;
+ }
+
+ /**
+ * @ejb:persistent-field
+ *
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @hibernate.property column="feedurl" non-null="true" unique="false"
+ */
+ public String getFeedUrl()
+ {
+ return this.feedUrl;
+ }
+
+ /** @ejb:persistent-field */
+ public void setFeedUrl(String feedUrl)
+ {
+ this.feedUrl = feedUrl;
+ }
+
+ //---------------------------------------------------------- Relationships
+
+ /**
+ * @roller.wrapPojoMethod type="pojo"
+ * @ejb:persistent-field
+ * @hibernate.many-to-one column="folderid" cascade="none" not-null="true"
+ */
+ public org.apache.roller.pojos.FolderData getFolder()
+ {
+ return this.folder;
+ }
+
+ /** @ejb:persistent-field */
+ public void setFolder(org.apache.roller.pojos.FolderData folder)
+ {
+ this.folder = folder;
+ }
+
+ //------------------------------------------------------- Good citizenship
+
+ public String toString()
+ {
+ StringBuffer str = new StringBuffer("{");
+
+ str.append("id=" + id + " " + "name=" + name + " " + "description=" +
+ description + " " + "url=" + url + " " + "weight=" +
+ weight + " " + "priority=" + priority + " " + "folderId=" +
+ "image=" + image + " " + "feedUrl=" +
+ feedUrl);
+ str.append('}');
+
+ return (str.toString());
+ }
+
+ public boolean equals(Object pOther)
+ {
+ if (pOther instanceof BookmarkData)
+ {
+ BookmarkData lTest = (BookmarkData) pOther;
+ boolean lEquals = true;
+
+ if (this.id == null)
+ {
+ lEquals = lEquals && (lTest.getId() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.id.equals(lTest.getId());
+ }
+
+ if (this.name == null)
+ {
+ lEquals = lEquals && (lTest.getName() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.name.equals(lTest.getName());
+ }
+
+ if (this.description == null)
+ {
+ lEquals = lEquals && (lTest.getDescription() == null);
+ }
+ else
+ {
+ lEquals = lEquals &&
+ this.description.equals(lTest.getDescription());
+ }
+
+ if (this.url == null)
+ {
+ lEquals = lEquals && (lTest.getUrl() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.url.equals(lTest.getUrl());
+ }
+
+ if (this.weight == null)
+ {
+ lEquals = lEquals && (lTest.getWeight() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.weight.equals(lTest.getWeight());
+ }
+
+ if (this.priority == null)
+ {
+ lEquals = lEquals && (lTest.getPriority() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.priority.equals(lTest.getPriority());
+ }
+
+// if (this.mFolder == null)
+// {
+// lEquals = lEquals && (lTest.mFolder == null);
+// }
+// else
+// {
+// lEquals = lEquals && this.mFolder.equals(lTest.mFolder);
+// }
+//
+ if (this.image == null)
+ {
+ lEquals = lEquals && (lTest.getImage() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.image.equals(lTest.getImage());
+ }
+
+ if (this.feedUrl == null)
+ {
+ lEquals = lEquals && (lTest.getFeedUrl() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.feedUrl.equals(lTest.getFeedUrl());
+ }
+
+ return lEquals;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ int result = 17;
+ result = (37 * result) +
+ ((this.id != null) ? this.id.hashCode() : 0);
+ result = (37 * result) +
+ ((this.name != null) ? this.name.hashCode() : 0);
+ result = (37 * result) +
+ ((this.description != null) ? this.description.hashCode() : 0);
+ result = (37 * result) +
+ ((this.url != null) ? this.url.hashCode() : 0);
+ result = (37 * result) +
+ ((this.weight != null) ? this.weight.hashCode() : 0);
+ result = (37 * result) +
+ ((this.priority != null) ? this.priority.hashCode() : 0);
+ result = (37 * result) +
+ ((this.folder != null) ? this.folder.hashCode() : 0);
+ result = (37 * result) +
+ ((this.image != null) ? this.image.hashCode() : 0);
+ result = (37 * result) +
+ ((this.feedUrl != null) ? this.feedUrl.hashCode() : 0);
+
+ return result;
+ }
+
+ /**
+ * Setter is needed in RollerImpl.storePersistentObject()
+ */
+ public void setData(org.apache.roller.pojos.PersistentObject otherData)
+ {
+ BookmarkData other = (BookmarkData)otherData;
+ this.id = other.getId();
+ this.name = other.getName();
+ this.description = other.getDescription();
+ this.url = other.getUrl();
+ this.weight = other.getWeight();
+ this.priority = other.getPriority();
+ this.folder = other.getFolder();
+ this.image = other.getImage();
+ this.feedUrl = other.getUrl();
+ }
+
+ /**
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object o)
+ {
+ return bookmarkComparator.compare(this, o);
+ }
+
+ private BookmarkComparator bookmarkComparator = new BookmarkComparator();
+
+ /**
+ * @param impl
+ */
+ public void setBookmarkManager(BookmarkManager bmgr)
+ {
+ bookmarkManager = bmgr;
+ }
+
+ public WebsiteData getWebsite()
+ {
+ return this.folder.getWebsite();
+ }
+
+}
\ No newline at end of file
Added: incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java Mon May 1 15:23:02 2006
@@ -0,0 +1,362 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.pojos;
+
+import java.sql.Timestamp;
+import org.apache.roller.util.PojoUtil;
+
+/**
+ * Weblogentry Comment bean.
+ * @author Lance Lavandowska
+ *
+ * @ejb:bean name="CommentData"
+ * @struts.form include-all="true"
+ *
+ * @hibernate.class lazy="false" table="roller_comment"
+ * @hibernate.cache usage="read-write"
+ */
+public class CommentData extends org.apache.roller.pojos.PersistentObject
+ implements java.io.Serializable
+{
+ public static final long serialVersionUID = -6668122596726478462L;
+
+ private String id = null;
+ private String name = null;
+ private String email = null;
+ private String url = null;
+ private String content = null;
+ private Timestamp postTime = null;
+ private Boolean spam = Boolean.FALSE;
+ private Boolean notify = Boolean.FALSE;
+ private String remoteHost = null;
+ private Boolean pending = null;
+ private Boolean approved = null;
+
+ private WeblogEntryData weblogEntry = null;
+
+
+ public CommentData()
+ {
+ spam = Boolean.FALSE;
+ }
+
+ public CommentData(java.lang.String id, WeblogEntryData entry,
+ java.lang.String name, java.lang.String email,
+ java.lang.String url, java.lang.String content,
+ java.sql.Timestamp postTime,
+ Boolean spam, Boolean notify,
+ Boolean pending, Boolean approved)
+ {
+ this.id = id;
+ this.name = name;
+ this.email = email;
+ this.url = url;
+ this.content = content;
+ this.postTime = postTime;
+ this.spam = spam;
+ this.notify = notify;
+ this.pending = pending;
+ this.approved = approved;
+
+ weblogEntry = entry;
+ }
+
+ public CommentData(CommentData otherData)
+ {
+ this.setData(otherData);
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.id column="id"
+ * generator-class="uuid.hex" unsaved-value="null"
+ */
+ public java.lang.String getId()
+ {
+ return this.id;
+ }
+
+ /** @ejb:persistent-field */
+ public void setId(java.lang.String id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="pojo"
+ * @ejb:persistent-field
+ * @hibernate.many-to-one column="entryid" cascade="none" not-null="true"
+ */
+ public WeblogEntryData getWeblogEntry()
+ {
+ return weblogEntry;
+ }
+
+ /** @ejb:persistent-field */
+ public void setWeblogEntry(WeblogEntryData entry)
+ {
+ weblogEntry = entry;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="name" non-null="true" unique="false"
+ */
+ public java.lang.String getName()
+ {
+ return this.name;
+ }
+
+ /** @ejb:persistent-field */
+ public void setName(java.lang.String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Email
+ *
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="email" non-null="true" unique="false"
+ */
+ public java.lang.String getEmail()
+ {
+ return this.email;
+ }
+
+ /** @ejb:persistent-field */
+ public void setEmail(java.lang.String email)
+ {
+ this.email = email;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="url" non-null="true" unique="false"
+ */
+ public java.lang.String getUrl()
+ {
+ return this.url;
+ }
+
+ /** @ejb:persistent-field */
+ public void setUrl(java.lang.String url)
+ {
+ this.url = url;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="content" non-null="true" unique="false"
+ */
+ public java.lang.String getContent()
+ {
+ return this.content;
+ }
+
+ /** @ejb:persistent-field */
+ public void setContent(java.lang.String content)
+ {
+ this.content = content;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="posttime" non-null="true" unique="false"
+ */
+ public java.sql.Timestamp getPostTime()
+ {
+ return this.postTime;
+ }
+
+ /** @ejb:persistent-field */
+ public void setPostTime(java.sql.Timestamp postTime)
+ {
+ this.postTime = postTime;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="spam" non-null="false" unique="false"
+ */
+ public Boolean getSpam()
+ {
+ return this.spam;
+ }
+
+ /** @ejb:persistent-field */
+ public void setSpam(Boolean spam)
+ {
+ this.spam = spam;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="notify" non-null="false" unique="false"
+ */
+ public Boolean getNotify()
+ {
+ return this.notify;
+ }
+
+ /** @ejb:persistent-field */
+ public void setNotify(Boolean notify)
+ {
+ this.notify = notify;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="pending" non-null="false" unique="false"
+ */
+ public Boolean getPending()
+ {
+ return this.pending;
+ }
+
+ /** @ejb:persistent-field */
+ public void setPending(Boolean pending)
+ {
+ this.pending = pending;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="approved" non-null="false" unique="false"
+ */
+ public Boolean getApproved()
+ {
+ return this.approved;
+ }
+
+ /** @ejb:persistent-field */
+ public void setApproved(Boolean approved)
+ {
+ this.approved = approved;
+ }
+
+ /**
+ * @ejb:persistent-field
+ */
+ public void setRemoteHost(String remoteHost) {
+ this.remoteHost = remoteHost;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="remotehost" non-null="true" unique="false"
+ */
+ public String getRemoteHost() {
+ return this.remoteHost;
+ }
+
+ public String toString()
+ {
+ StringBuffer str = new StringBuffer("{");
+
+ str.append("id=" + id + " " +
+ "name=" + name + " " +
+ "email=" + email + " " +
+ "url=" + url + " " +
+ "content=" + content + " " +
+ "postTime=" + postTime + " " +
+ "spam=" + spam +
+ "notify=" + notify +
+ "pending" + pending +
+ "approved" + approved);
+ str.append('}');
+
+ return (str.toString());
+ }
+
+ public boolean equals(Object pOther)
+ {
+ if (pOther instanceof CommentData)
+ {
+ CommentData lTest = (CommentData) pOther;
+ boolean lEquals = true;
+
+ lEquals = PojoUtil.equals(lEquals, this.id, lTest.getId());
+ lEquals = PojoUtil.equals(lEquals, this.weblogEntry, lTest.getWeblogEntry());
+ lEquals = PojoUtil.equals(lEquals, this.name, lTest.getName());
+ lEquals = PojoUtil.equals(lEquals, this.email, lTest.getEmail());
+ lEquals = PojoUtil.equals(lEquals, this.url, lTest.getUrl());
+ lEquals = PojoUtil.equals(lEquals, this.content, lTest.getContent());
+ lEquals = PojoUtil.equals(lEquals, this.postTime, lTest.getPostTime());
+ lEquals = PojoUtil.equals(lEquals, this.spam, lTest.getSpam());
+ lEquals = PojoUtil.equals(lEquals, this.notify, lTest.getNotify());
+ lEquals = PojoUtil.equals(lEquals, this.pending, lTest.getPending());
+ lEquals = PojoUtil.equals(lEquals, this.approved, lTest.getApproved());
+ return lEquals;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ int result = 17;
+ result = PojoUtil.addHashCode(result, this.id);
+ result = PojoUtil.addHashCode(result, this.weblogEntry);
+ result = PojoUtil.addHashCode(result, this.name);
+ result = PojoUtil.addHashCode(result, this.email);
+ result = PojoUtil.addHashCode(result, this.url);
+ result = PojoUtil.addHashCode(result, this.content);
+ result = PojoUtil.addHashCode(result, this.postTime);
+ result = PojoUtil.addHashCode(result, this.spam);
+ result = PojoUtil.addHashCode(result, this.notify);
+ result = PojoUtil.addHashCode(result, this.pending);
+ result = PojoUtil.addHashCode(result, this.approved);
+
+ return result;
+ }
+
+ /**
+ * Setter is needed in RollerImpl.storePersistentObject()
+ */
+ public void setData(org.apache.roller.pojos.PersistentObject otherData)
+ {
+ CommentData otherComment = (CommentData) otherData;
+
+ this.id = otherComment.getId();
+ this.weblogEntry = otherComment.getWeblogEntry();
+ this.name = otherComment.getName();
+ this.email = otherComment.getEmail();
+ this.url = otherComment.getUrl();
+ this.content = otherComment.getContent();
+ this.postTime = otherComment.getPostTime();
+ this.spam = otherComment.getSpam();
+ this.notify = otherComment.getNotify();
+ this.pending = otherComment.getPending();
+ this.approved = otherComment.getApproved();
+ }
+
+}
\ No newline at end of file
Added: incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java Mon May 1 15:23:02 2006
@@ -0,0 +1,129 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.pojos;
+/**
+ * @author David M Johnson
+ * @ejb:bean name="EntryAttribute"
+ * @hibernate.class lazy="false" table="entryattribute"
+ * @hibernate.cache usage="read-write"
+ */
+public class EntryAttributeData extends PersistentObject implements java.lang.Comparable
+{
+ private String id;
+ private WeblogEntryData entry;
+ private String name;
+ private String value;
+
+ public EntryAttributeData()
+ {
+ }
+
+ public EntryAttributeData(
+ String id,
+ WeblogEntryData entry,
+ String name,
+ String value)
+ {
+ this.id = id;
+ this.entry = entry;
+ this.name = name;
+ this.value = value;
+ }
+
+ public EntryAttributeData(EntryAttributeData otherData)
+ {
+ setData(otherData);
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.id column="id"
+ * generator-class="uuid.hex" unsaved-value="null"
+ */
+ public java.lang.String getId()
+ {
+ return this.id;
+ }
+ /** @ejb:persistent-field */
+ public void setId(java.lang.String id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * Setter is needed in RollerImpl.storePersistentObject()
+ */
+ public void setData(org.apache.roller.pojos.PersistentObject otherData)
+ {
+ this.id = otherData.getId();
+ this.entry = ((EntryAttributeData) otherData).getEntry();
+ this.name = ((EntryAttributeData) otherData).getName();
+ this.value = ((EntryAttributeData) otherData).getValue();
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="pojo"
+ * @ejb:persistent-field
+ * @hibernate.many-to-one column="entryid" cascade="none" not-null="true"
+ */
+ public WeblogEntryData getEntry()
+ {
+ return entry;
+ }
+ /** @ejb:persistent-field */
+ public void setEntry(WeblogEntryData entry)
+ {
+ this.entry = entry;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="name" non-null="true" unique="false"
+ */
+ public String getName()
+ {
+ return name;
+ }
+ /** @ejb:persistent-field */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ * @ejb:persistent-field
+ * @hibernate.property column="value" non-null="true" unique="false"
+ */
+ public String getValue()
+ {
+ return value;
+ }
+ /** @ejb:persistent-field */
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public int compareTo(Object o) {
+ EntryAttributeData att = (EntryAttributeData)o;
+ return getName().compareTo(att.getName());
+ }
+}
Added: incubator/roller/trunk/src/org/apache/roller/pojos/FolderAssoc.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/FolderAssoc.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/FolderAssoc.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/FolderAssoc.java Mon May 1 15:23:02 2006
@@ -0,0 +1,152 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.pojos;
+
+
+/**
+ * @author David M Johnson
+ *
+ * @ejb:bean name="FolderAssoc"
+ * @hibernate.class lazy="false" table="folderassoc"
+ * @hibernate.cache usage="read-write"
+ */
+public class FolderAssoc extends PersistentObject
+ implements Assoc
+{
+ static final long serialVersionUID = 882325251670705915L;
+ public static final String PARENT = "PARENT";
+ public static final String GRANDPARENT = "GRANDPARENT";
+
+ private String id;
+ private FolderData folder;
+ private FolderData ancestor;
+ private java.lang.String relation;
+
+ public FolderAssoc()
+ {
+ }
+
+ public FolderAssoc(
+ String id,
+ FolderData folder,
+ FolderData ancestor,
+ String relation)
+ {
+ this.id = id;
+ this.folder = folder;
+ this.ancestor = ancestor;
+ this.relation = relation;
+ }
+
+ public FolderAssoc(FolderAssoc otherData)
+ {
+ setData(otherData);
+ }
+
+ /**
+ * @ejb:persistent-field
+ * @hibernate.id column="id"
+ * generator-class="uuid.hex" unsaved-value="null"
+ */
+ public java.lang.String getId()
+ {
+ return this.id;
+ }
+ /** @ejb:persistent-field */
+ public void setId(java.lang.String id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * Setter is needed in RollerImpl.storePersistentObject()
+ */
+ public void setData(org.apache.roller.pojos.PersistentObject otherData)
+ {
+ this.id = otherData.getId();
+ this.folder = ((FolderAssoc)otherData).getFolder();
+ this.ancestor = ((FolderAssoc)otherData).getAncestorFolder();
+ this.relation = ((FolderAssoc)otherData).getRelation();
+ }
+
+ /**
+ * @ejb:persistent-field
+ * @hibernate.many-to-one column="ancestorid" cascade="none"
+ */
+ public FolderData getAncestorFolder()
+ {
+ return ancestor;
+ }
+
+ /** @ejb:persistent-field */
+ public void setAncestorFolder(FolderData data)
+ {
+ ancestor = data;
+ }
+
+ /**
+ * @ejb:persistent-field
+ * @hibernate.many-to-one column="folderid" cascade="none" not-null="true"
+ */
+ public FolderData getFolder()
+ {
+ return folder;
+ }
+
+ /** @ejb:persistent-field */
+ public void setFolder(FolderData data)
+ {
+ folder = data;
+ }
+
+ /**
+ * @ejb:persistent-field
+ * @hibernate.property column="relation" non-null="true" unique="false"
+ */
+ public java.lang.String getRelation()
+ {
+ return relation;
+ }
+
+ /** @ejb:persistent-field */
+ public void setRelation(java.lang.String string)
+ {
+ relation = string;
+ }
+
+ public HierarchicalPersistentObject getObject()
+ {
+ return getFolder();
+ }
+
+ public void setObject(HierarchicalPersistentObject hpo)
+ {
+ setFolder((FolderData)hpo);
+ }
+
+ public HierarchicalPersistentObject getAncestor()
+ {
+ return getAncestorFolder();
+ }
+
+ public void setAncestor(HierarchicalPersistentObject hpo)
+ {
+ setAncestorFolder((FolderData)hpo);
+ }
+
+}
Added: incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java Mon May 1 15:23:02 2006
@@ -0,0 +1,521 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.pojos;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.roller.RollerException;
+import org.apache.roller.model.BookmarkManager;
+import org.apache.roller.model.RollerFactory;
+
+/**
+ * <p>Folder that holds Bookmarks and other Folders. A Roller Website has a
+ * set of Folders (there is no one root folder) and each Folder may contain
+ * Folders or Bookmarks. Don't construct one of these yourself, instead use
+ * the create method in your BookmarkManager implementation.</p>
+ *
+ * @struts.form include-all="true"
+ * extends="org.apache.struts.validator.ValidatorForm"
+ * @ejb:bean name="FolderData"
+ *
+ * @hibernate.class lazy="false" table="folder"
+ * @hibernate.cache usage="read-write"
+ */
+public class FolderData extends HierarchicalPersistentObject
+ implements Serializable, Comparable
+{
+ static final long serialVersionUID = -6272468884763861944L;
+
+ private Set bookmarks = new TreeSet();
+ private List folders = null;
+ private WebsiteData website;
+
+ private String id;
+ private String name;
+ private String description;
+ private String path;
+
+ //----------------------------------------------------------- Constructors
+
+ /** For use by BookmarkManager implementations only. */
+ public FolderData()
+ {
+ }
+
+ public FolderData(
+ FolderData parent,
+ String name,
+ String desc,
+ WebsiteData website)
+ {
+ mNewParent = parent;
+ this.name = name;
+ this.description = desc;
+ this.website = website;
+ }
+
+ public void setData(org.apache.roller.pojos.PersistentObject otherData)
+ {
+ mNewParent = ((FolderData) otherData).mNewParent;
+ this.id = ((FolderData) otherData).getId();
+ this.name = ((FolderData) otherData).getName();
+ this.description = ((FolderData) otherData).getDescription();
+ this.website = ((FolderData) otherData).getWebsite();
+ this.setBookmarks(((FolderData) otherData).getBookmarks());
+ }
+
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAssocClass()
+ */
+ public Class getAssocClass()
+ {
+ return FolderAssoc.class;
+ }
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getObjectPropertyName()
+ *
+ * @roller.wrapPojoMethod type="simple"
+ */
+ public String getObjectPropertyName()
+ {
+ return "folder";
+ }
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAncestorPropertyName()
+ *
+ * @roller.wrapPojoMethod type="simple"
+ */
+ public String getAncestorPropertyName()
+ {
+ return "ancestorFolder";
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ */
+ public boolean isInUse()
+ {
+ try
+ {
+ return RollerFactory.getRoller().getBookmarkManager().isFolderInUse(this);
+ }
+ catch (RollerException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ */
+ public boolean descendentOf(FolderData ancestor)
+ throws RollerException
+ {
+ return RollerFactory.getRoller().getBookmarkManager().isDescendentOf(this, ancestor);
+ }
+
+ //------------------------------------------------------------- Attributes
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.id column="id"
+ * generator-class="uuid.hex" unsaved-value="null"
+ */
+ public String getId()
+ {
+ return this.id;
+ }
+
+ /** @ejb:persistent-field */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @struts.validator type="required" msgkey="errors.required"
+ * @struts.validator type="mask" msgkey="errors.noslashes"
+ * @struts.validator-var name="mask" value="${noslashes}"
+ * @struts.validator-args arg0resource="folderForm.name"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.property column="name" non-null="true" unique="false"
+ */
+ public String getName()
+ {
+ return this.name;
+ }
+
+ /** @ejb:persistent-field */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Description
+ *
+ * @roller.wrapPojoMethod type="simple"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.property column="description" non-null="true" unique="false"
+ */
+ public String getDescription()
+ {
+ return this.description;
+ }
+
+ /** @ejb:persistent-field */
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ //---------------------------------------------------------- Relationships
+
+ /**
+ * Get path to this bookmark folder.
+ *
+ * @roller.wrapPojoMethod type="simple"
+ */
+ public String getPath() throws RollerException
+ {
+ if (mNewParent != null)
+ {
+ throw new RollerException(
+ "Folder has a new parent and must be saved before getPath() will work");
+ }
+
+ if (null == path)
+ {
+ path = RollerFactory.getRoller().getBookmarkManager().getPath(this);
+ }
+ return path;
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="pojo"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
+ */
+ public WebsiteData getWebsite()
+ {
+ return website;
+ }
+
+ /** @ejb:persistent-field */
+ public void setWebsite( WebsiteData website )
+ {
+ this.website = website;
+ }
+
+ /**
+ * Return parent category, or null if category is root of hierarchy.
+ *
+ * @roller.wrapPojoMethod type="pojo"
+ */
+ public FolderData getParent() throws RollerException
+ {
+ if (mNewParent != null)
+ {
+ // Category has new parent, so return that
+ return (FolderData)mNewParent;
+ }
+ else if (getParentAssoc() != null)
+ {
+ // Return parent found in database
+ return ((FolderAssoc)getParentAssoc()).getAncestorFolder();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /** Set parent category, database will be updated when object is saved. */
+ public void setParent(HierarchicalPersistentObject parent)
+ {
+ mNewParent = parent;
+ }
+
+ /**
+ * Query to get child categories of this category.
+ *
+ * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.pojos.FolderData"
+ */
+ public List getFolders() throws RollerException
+ {
+ if (folders == null)
+ {
+ folders = new LinkedList();
+ List childAssocs = getChildAssocs();
+ Iterator childIter = childAssocs.iterator();
+ while (childIter.hasNext())
+ {
+ FolderAssoc assoc =
+ (FolderAssoc) childIter.next();
+ folders.add(assoc.getFolder());
+ }
+ }
+ return folders;
+ }
+
+ //------------------------------------------------------ Bookmark children
+
+ /**
+ * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.pojos.BookmarkData"
+ *
+ * @ejb:persistent-field
+ *
+ * @hibernate.set lazy="true" order-by="name" inverse="true" cascade="all-delete-orphan"
+ * @hibernate.collection-key column="folderid"
+ * @hibernate.collection-one-to-many class="org.apache.roller.pojos.BookmarkData"
+ */
+ public Set getBookmarks()
+ {
+ return this.bookmarks;
+ }
+
+ // this is private to force the use of add/remove bookmark methods.
+ private void setBookmarks(Set bookmarks)
+ {
+ this.bookmarks = bookmarks;
+ }
+
+ /** Store bookmark and add to folder */
+ public void addBookmark(BookmarkData bookmark) throws RollerException
+ {
+ bookmark.setFolder(this);
+ getBookmarks().add(bookmark);
+ }
+
+ /** Remove boomkark from folder */
+ public void removeBookmark(BookmarkData bookmark)
+ {
+ getBookmarks().remove(bookmark);
+ }
+
+ /**
+ * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.pojos.BookmarkData"
+ *
+ * @param subfolders
+ */
+ public List retrieveBookmarks(boolean subfolders) throws RollerException
+ {
+ BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
+ return bmgr.getBookmarks(this, subfolders);
+ }
+
+ /**
+ * Move all bookmarks that exist in this folder and all
+ * subfolders of this folder to a single new folder.
+ */
+ public void moveContents(FolderData dest) throws RollerException
+ {
+ Iterator entries = retrieveBookmarks(true).iterator();
+ while (entries.hasNext())
+ {
+ BookmarkData bookmark = (BookmarkData) entries.next();
+
+ // just add bookmarks to new folder
+ // this breaks the old folder/bkmrk relationship
+ // so it's not necessary to explicitly remove
+ dest.addBookmark(bookmark);
+ }
+ }
+
+ //------------------------------------------------------------------------
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#createAssoc(
+ * org.apache.roller.pojos.HierarchicalPersistentObject,
+ * org.apache.roller.pojos.HierarchicalPersistentObject, java.lang.String)
+ */
+ public Assoc createAssoc(
+ HierarchicalPersistentObject object,
+ HierarchicalPersistentObject associatedObject,
+ String relation) throws RollerException
+ {
+ return new FolderAssoc(
+ null,
+ (FolderData)object,
+ (FolderData)associatedObject,
+ relation);
+ }
+
+ //------------------------------------------------------- Good citizenship
+
+ public String toString()
+ {
+ StringBuffer str = new StringBuffer("{");
+ str.append(
+ "bookmarks=" + bookmarks + " "
+ + "id=" + id + " "
+ + "name=" + name + " "
+ + "description=" + description);
+ str.append('}');
+ return (str.toString());
+ }
+
+ public boolean equals(Object pOther)
+ {
+ if (pOther instanceof FolderData)
+ {
+ FolderData lTest = (FolderData) pOther;
+ boolean lEquals = true;
+
+// if (this.bookmarks == null)
+// {
+// lEquals = lEquals && (lTest.bookmarks == null);
+// }
+// else
+// {
+// lEquals = lEquals && this.bookmarks.equals(lTest.bookmarks);
+// }
+
+ if (this.id == null)
+ {
+ lEquals = lEquals && (lTest.getId() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.id.equals(lTest.getId());
+ }
+
+ if (this.name == null)
+ {
+ lEquals = lEquals && (lTest.getName() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.name.equals(lTest.getName());
+ }
+
+ if (this.description == null)
+ {
+ lEquals = lEquals && (lTest.getDescription() == null);
+ }
+ else
+ {
+ lEquals = lEquals &&
+ this.description.equals(lTest.getDescription());
+ }
+
+ if (this.website == null)
+ {
+ lEquals = lEquals && (lTest.getWebsite() == null);
+ }
+ else
+ {
+ lEquals = lEquals && this.website.equals(lTest.getWebsite());
+ }
+
+ return lEquals;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ int result = 17;
+
+ result = (37 * result) +
+ ((this.id != null) ? this.id.hashCode() : 0);
+ result = (37 * result) +
+ ((this.name != null) ? this.name.hashCode() : 0);
+ result = (37 * result) +
+ ((this.description != null) ? this.description.hashCode() : 0);
+ result = (37 * result) +
+ ((this.website != null) ? this.website.hashCode() : 0);
+
+ return result;
+ }
+
+ /**
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object o)
+ {
+ FolderData other = (FolderData)o;
+ return getName().compareTo(other.getName());
+ }
+
+ /** TODO: fix Struts form generation template so this is not needed. */
+ public void setAssocClassName(String dummy) {};
+ /** TODO: fix Struts form generation template so this is not needed. */
+ public void setObjectPropertyName(String dummy) {};
+ /** TODO: fix Struts form generation template so this is not needed. */
+ public void setAncestorPropertyName(String dummy) {};
+ /** TODO: fix formbean generation so this is not needed. */
+ public void setPath(String string) {}
+ /** TODO: fix formbean generation so this is not needed. */
+ public void setInUse(boolean flag) {}
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getParentAssoc()
+ */
+ public Assoc getParentAssoc() throws RollerException
+ {
+ return RollerFactory.getRoller().getBookmarkManager().getFolderParentAssoc(this);
+ }
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getChildAssocs()
+ */
+ public List getChildAssocs() throws RollerException
+ {
+ return RollerFactory.getRoller().getBookmarkManager().getFolderChildAssocs(this);
+ }
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAllDescendentAssocs()
+ */
+ public List getAllDescendentAssocs() throws RollerException
+ {
+ return RollerFactory.getRoller().getBookmarkManager().getAllFolderDecscendentAssocs(this);
+ }
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAncestorAssocs()
+ */
+ public List getAncestorAssocs() throws RollerException
+ {
+ return RollerFactory.getRoller().getBookmarkManager().getFolderAncestorAssocs(this);
+ }
+
+}
Added: incubator/roller/trunk/src/org/apache/roller/pojos/HierarchicalPersistentObject.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/HierarchicalPersistentObject.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/HierarchicalPersistentObject.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/HierarchicalPersistentObject.java Mon May 1 15:23:02 2006
@@ -0,0 +1,72 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Created on Jan 13, 2004
+ */
+package org.apache.roller.pojos;
+
+import org.apache.roller.RollerException;
+import java.util.List;
+
+/**
+ * Abstract base class for hierarchical persistent objects. Provides generic
+ * implementations of save and remove that know how to handle parents, children,
+ * and descendents.
+ *
+ * @author David M Johnson
+ */
+public abstract class HierarchicalPersistentObject extends PersistentObject
+{
+ HierarchicalPersistentObject mNewParent = null;
+
+ /** Create an association between object and ancestor. */
+ public abstract Assoc createAssoc(
+ HierarchicalPersistentObject object,
+ HierarchicalPersistentObject ancestor,
+ String relation ) throws RollerException;
+
+ /** Name of association class which must implement Assoc. */
+ public abstract Class getAssocClass();
+
+ /** Name of object propery in association class */
+ public abstract String getObjectPropertyName();
+
+ /** Name of ancestor propery in association class */
+ public abstract String getAncestorPropertyName();
+
+ /** Set new parent - invalidates getPath() until object is saved(). */
+ public abstract void setParent(HierarchicalPersistentObject parent);
+
+ public abstract Assoc getParentAssoc() throws RollerException;
+
+ public abstract List getChildAssocs() throws RollerException;
+
+ public abstract List getAllDescendentAssocs() throws RollerException;
+
+ public abstract List getAncestorAssocs() throws RollerException;
+
+ /** Returns true if this object is in use and should not be deleted */
+ public abstract boolean isInUse() throws RollerException;
+
+ /** Should be needed only be manager objects */
+ public HierarchicalPersistentObject getNewParent()
+ {
+ return mNewParent;
+ }
+
+}
Added: incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java Mon May 1 15:23:02 2006
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.roller.pojos;
+
+import java.util.Date;
+
+/**
+ * Records change that a user has made to an object.
+ * @ejb:bean name="ObjectAuditData"
+ * @struts.form include-all="true"
+ * @hibernate.class lazy="false" table="roller_audit_log"
+ *
+ * @author Dave Johnson
+ */
+public class ObjectAuditData extends PersistentObject
+{
+ private String id; // primary key
+ private String userId; // user that made change
+ private String objectId; // id of associated object, if any
+ private String objectClass; // name of associated object class (e.g. WeblogEntryData)
+ private String comment; // description of change
+ private Date changeTime; // time that change was made
+
+ public void setData(PersistentObject vo)
+ {
+ }
+
+ /**
+ * @ejb:persistent-field
+ * @hibernate.id column="id"
+ * generator-class="uuid.hex" unsaved-value="null"
+ */
+ public String getId()
+ {
+ return id;
+ }
+ /** @ejb:persistent-field */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+ /**
+ * @ejb:persistent-field
+ * @hibernate.property column="change_time" non-null="true" unique="false"
+ */
+ public Date getChangeTime()
+ {
+ return changeTime;
+ }
+ /** @ejb:persistent-field */
+ public void setChangeTime(Date changeTime)
+ {
+ this.changeTime = changeTime;
+ }
+ /**
+ * @ejb:persistent-field
+ * @hibernate.property column="comment_text" non-null="true" unique="false"
+ */
+ public String getComment()
+ {
+ return comment;
+ }
+ /** @ejb:persistent-field */
+ public void setComment(String comment)
+ {
+ this.comment = comment;
+ }
+ /**
+ * @ejb:persistent-field
+ * @hibernate.property column="object_class" non-null="true" unique="false"
+ */
+ public String getObjectClass()
+ {
+ return objectClass;
+ }
+ /** @ejb:persistent-field */
+ public void setObjectClass(String objectClass)
+ {
+ this.objectClass = objectClass;
+ }
+ /**
+ * @ejb:persistent-field
+ * @hibernate.property column="object_id" non-null="true" unique="false"
+ */
+ public String getObjectId()
+ {
+ return objectId;
+ }
+ /** @ejb:persistent-field */
+ public void setObjectId(String objectId)
+ {
+ this.objectId = objectId;
+ }
+ /**
+ * @ejb:persistent-field
+ * @hibernate.property column="user_id" non-null="true" unique="false"
+ */
+ public String getUserId()
+ {
+ return userId;
+ }
+ /** @ejb:persistent-field */
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+}
Added: incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java Mon May 1 15:23:02 2006
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.roller.pojos;
+
+/**
+ * Represents a user's permissions within a website.
+ *
+ * @ejb:bean name="PermissionsData"
+ * @struts.form include-all="true"
+ * @hibernate.class lazy="false" table="roller_user_permissions"
+ * @hibernate.cache usage="read-write"
+ *
+ * @author Dave Johnson
+ */
+public class PermissionsData extends PersistentObject
+{
+ private String id = null;
+ private WebsiteData website = null;
+ private UserData user = null;
+ private boolean pending = true;
+ 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 */
+ public PermissionsData()
+ {
+ }
+
+ /**
+ * Check for specific permission.
+ */
+ public boolean has(short priv)
+ {
+ return (getPermissionMask() & priv) == priv;
+ }
+ /**
+ * @ejb:persistent-field
+ * @hibernate.id column="id"
+ * generator-class="uuid.hex" unsaved-value="null"
+ */
+ public String getId()
+ {
+ return id;
+ }
+ /** @ejb:persistent-field */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+ /**
+ * @hibernate.many-to-one column="website_id" cascade="none" not-null="false"
+ */
+ public WebsiteData getWebsite()
+ {
+ return website;
+ }
+ public void setWebsite(WebsiteData website)
+ {
+ this.website = website;
+ }
+ /**
+ * @hibernate.many-to-one column="user_id" cascade="none" not-null="false"
+ */
+ public UserData getUser()
+ {
+ return user;
+ }
+ public void setUser(UserData user)
+ {
+ this.user = user;
+ }
+ /**
+ * Bit mask that encodes user's permissions in website.
+ * @ejb:persistent-field
+ * @hibernate.property column="permission_mask" non-null="true" unique="false"
+ */
+ public short getPermissionMask()
+ {
+ return permissionMask;
+ }
+ /** @ejb:persistent-field */
+ public void setPermissionMask(short permissionMask)
+ {
+ this.permissionMask = permissionMask;
+ }
+ /**
+ * True if user has been invited to join site but has not yet accepted.
+ * And false if user is member of website.
+ * @ejb:persistent-field
+ * @hibernate.property column="pending" non-null="true" unique="false"
+ */
+ public boolean isPending()
+ {
+ return pending;
+ }
+ /** @ejb:persistent-field */
+ public void setPending(boolean pending)
+ {
+ this.pending = pending;
+ }
+ /**
+ * Set data from other object (no-op).
+ */
+ public void setData(PersistentObject vo)
+ {
+ // no-op
+ }
+}
Added: incubator/roller/trunk/src/org/apache/roller/pojos/PersistentObject.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PersistentObject.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PersistentObject.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PersistentObject.java Mon May 1 15:23:02 2006
@@ -0,0 +1,67 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
+package org.apache.roller.pojos;
+
+import java.io.Serializable;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+import org.apache.roller.RollerException;
+
+
+/**
+ * Base class for all of Roller's persistent objects.
+ */
+public abstract class PersistentObject implements Serializable {
+
+
+ /**
+ * All persistent objects require an identifier.
+ */
+ public abstract String getId();
+
+
+ public abstract void setId( String id );
+
+
+ /**
+ * Load data based on data from another object.
+ */
+ public abstract void setData(PersistentObject obj);
+
+
+ public boolean equals(Object o) {
+ return EqualsBuilder.reflectionEquals(this, o);
+ }
+
+
+ // TODO: how efficient is this?
+ public String toString() {
+ try {
+ // this may throw an exception if called by a thread that
+ return ToStringBuilder.reflectionToString(
+ this, ToStringStyle.MULTI_LINE_STYLE);
+ } catch (Throwable e) {
+ // alternative toString() implementation used in case of exception
+ return getClass().getName() + ":" + getId();
+ }
+ }
+
+}
+
Added: incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java Mon May 1 15:23:02 2006
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.pojos;
+
+import java.io.Serializable;
+
+/**
+ * Ping Category Restriction. An instance of this class relates an auto ping configuration {@link AutoPingData} to a
+ * specific weblog category {@link WeblogCategoryData}. When one or more instances of this class are present for a
+ * given auto ping configuration, it means that pings should only go out for changes to the categories specified by those
+ * instances. If no instances of this class are present for a given auto ping configuration, it means that the ping
+ * configuration is not restricted by category, so pings should go out for changes in any category.
+ *
+ * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
+ * @ejb:bean name="AutoPingData"
+ * @hibernate.class lazy="false" table="pingcategory"
+ * @hibernate.cache usage="read-write"
+ */
+public class PingCategoryRestrictionData extends PersistentObject implements Serializable
+{
+ private String id;
+ private AutoPingData autoPing;
+ private WeblogCategoryData weblogCategory;
+
+ static final long serialVersionUID = 2261280579491859418L;
+
+ /**
+ * Default constructor. Leaves all fields null. Required for bean compliance.
+ */
+ public PingCategoryRestrictionData()
+ {
+ }
+
+ /**
+ * Constructor
+ *
+ * @param id unique id of this object
+ * @param autoPing auto ping configuration being restricted
+ * @param weblogCategory weblog category to which this auto ping configuration is restricted
+ */
+ public PingCategoryRestrictionData(String id, AutoPingData autoPing, WeblogCategoryData weblogCategory)
+ {
+ this.id = id;
+ this.autoPing = autoPing;
+ this.weblogCategory = weblogCategory;
+ }
+
+ /**
+ * Setter needed by RollerImpl.storePersistentObject()
+ */
+ public void setData(PersistentObject vo)
+ {
+ PingCategoryRestrictionData other = (PingCategoryRestrictionData)vo;
+ id = other.getId();
+ autoPing = other.getAutoping();
+ weblogCategory = other.getWeblogCategory();
+ }
+
+ /**
+ * Get the unique id (primary key) of this object.
+ *
+ * @return the unique id of this object. -- struts.validator type="required" msgkey="errors.required"
+ * @ejb:persistent-field
+ * @hibernate.id column="id" generator-class="uuid.hex" unsaved-value="null"
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+ /**
+ * Set the unique id (primary key) of this object
+ *
+ * @param id
+ * @ejb:persistent-field
+ */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * Get the auto ping configuration to which this category restriction applies.
+ *
+ * @return the auto ping configuration to which this category restriction applies.
+ * @ejb:persistent-field
+ * @hibernate.many-to-one column="autopingid" cascade="none" not-null="true"
+ */
+ public AutoPingData getAutoping()
+ {
+ return autoPing;
+ }
+
+ /**
+ * Set the auto ping configuration to which this category restriction applies.
+ *
+ * @param autoPing the auto ping configuration to which this category restriction applies.
+ * @ejb:persistent-field
+ */
+ public void setAutoping(AutoPingData autoPing)
+ {
+ this.autoPing = autoPing;
+ }
+
+ /**
+ * Get the weblog category. Get the weblog category to which pings should be restricted.
+ *
+ * @return the weblog category to which pings should be restricted.
+ * @ejb:persistent-field
+ * @hibernate.many-to-one column="weblogcategoryid" cascade="none" not-null="true"
+ */
+ public WeblogCategoryData getWeblogCategory()
+ {
+ return weblogCategory;
+ }
+
+ /**
+ * Set the ping target. Set the target to be pinged when the corresponding website changes.
+ *
+ * @param weblogCategory the weblog category to which pings should be restricted.
+ * @ejb:persistent-field
+ */
+ public void setWeblogCategory(WeblogCategoryData weblogCategory)
+ {
+ this.weblogCategory = weblogCategory;
+ }
+
+ /**
+ * @see Object#equals(Object)
+ */
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (!(o instanceof PingCategoryRestrictionData)) return false;
+
+ final PingCategoryRestrictionData pingCategoryRestrictionData = (PingCategoryRestrictionData)o;
+
+ if (id != null ? !id.equals(pingCategoryRestrictionData.getId()) : pingCategoryRestrictionData.getId() != null) return false;
+ if (autoPing != null ? !autoPing.equals(pingCategoryRestrictionData.getAutoping()) : pingCategoryRestrictionData.getAutoping() != null) return false;
+ if (weblogCategory != null ? !weblogCategory.equals(pingCategoryRestrictionData.getWeblogCategory()) : pingCategoryRestrictionData.getWeblogCategory() != null) return false;
+
+ return true;
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return (id != null ? id.hashCode() : 0);
+ }
+}
\ No newline at end of file