Author: agilliland
Date: Fri Apr 14 17:55:22 2006
New Revision: 394236
URL: http://svn.apache.org/viewcvs?rev=394236&view=rev
Log:
implementing business keyed equals() and hasCode() methods.
changing to true bidirectional parent/child relationship where entries are
strictly tied to the lifecycle of the subscription they are under.
Modified:
incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetEntryData.java
incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetSubscriptionData.java
Modified:
incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetEntryData.java
URL:
http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetEntryData.java?rev=394236&r1=394235&r2=394236&view=diff
==============================================================================
---
incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetEntryData.java
(original)
+++
incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetEntryData.java
Fri Apr 14 17:55:22 2006
@@ -209,7 +209,7 @@
this.categoriesString = categoriesString;
}
/**
- * @hibernate.many-to-one column="subscription_id" cascade="save-update"
not-null="true"
+ * @hibernate.many-to-one column="subscription_id" cascade="none"
not-null="true"
*/
public PlanetSubscriptionData getSubscription()
{
@@ -376,6 +376,20 @@
PlanetEntryData other = (PlanetEntryData)o;
return getPermalink().compareTo(other.getPermalink());
}
+
+ public boolean equals(Object other) {
+
+ if(this == other) return true;
+ if(!(other instanceof PlanetEntryData)) return false;
+
+ final PlanetEntryData that = (PlanetEntryData) other;
+ return this.permalink.equals(that.getPermalink());
+ }
+
+ public int hashCode() {
+ return this.permalink.hashCode();
+ }
+
public void setData(PersistentObject vo)
{
}
Modified:
incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetSubscriptionData.java
URL:
http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetSubscriptionData.java?rev=394236&r1=394235&r2=394236&view=diff
==============================================================================
---
incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetSubscriptionData.java
(original)
+++
incubator/roller/branches/roller-newbackend/src/org/roller/pojos/PlanetSubscriptionData.java
Fri Apr 14 17:55:22 2006
@@ -88,16 +88,15 @@
this.id = id;
}
/**
- * @hibernate.bag lazy="true" inverse="true" cascade="delete"
+ * @hibernate.bag lazy="true" inverse="true" cascade="all-delete-orphan"
* @hibernate.collection-key column="subscription_id"
- * @hibernate.collection-one-to-many
- * class="org.roller.pojos.PlanetEntryData"
+ * @hibernate.collection-one-to-many
class="org.roller.pojos.PlanetEntryData"
*/
public List getEntries()
{
return entries;
}
- public void setEntries(List entries)
+ private void setEntries(List entries)
{
this.entries = entries;
}
@@ -195,18 +194,31 @@
return getFeedUrl().compareTo(other.getFeedUrl());
}
+ public boolean equals(Object other) {
+
+ if(this == other) return true;
+ if(!(other instanceof PlanetSubscriptionData)) return false;
+
+ final PlanetSubscriptionData that = (PlanetSubscriptionData) other;
+ return this.feedUrl.equals(that.getFeedUrl());
+ }
+
+ public int hashCode() {
+ return this.feedUrl.hashCode();
+ }
+
public void addEntry(PlanetEntryData entry)
{
- entries.add(entry);
+ this.getEntries().add(entry);
}
public void addEntries(Collection newEntries)
{
- entries.addAll(newEntries);
+ this.getEntries().addAll(newEntries);
}
public void purgeEntries()
{
- entries.clear();
+ this.getEntries().clear();
}
}