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 2009/07/05 19:04:51 UTC
svn commit: r791278 - in /roller/trunk/apps/weblogger/src/java:
META-INF/persistence.xml org/apache/roller/weblogger/pojos/AutoPing.java
org/apache/roller/weblogger/pojos/AutoPing.orm.xml
Author: snoopdave
Date: Sun Jul 5 17:04:51 2009
New Revision: 791278
URL: http://svn.apache.org/viewvc?rev=791278&view=rev
Log:
Moving from XML mapping files to JPA annotations. 1 down, 26 more to go.
See also http://issues.apache.org/jira/browse/ROL-1556
Removed:
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/AutoPing.orm.xml
Modified:
roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/AutoPing.java
Modified: roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml?rev=791278&r1=791277&r2=791278&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml (original)
+++ roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml Sun Jul 5 17:04:51 2009
@@ -6,7 +6,6 @@
<jta-data-source>java:comp/env/jdbc/rollerdb</jta-data-source>
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
-->
- <mapping-file>org/apache/roller/weblogger/pojos/AutoPing.orm.xml </mapping-file>
<mapping-file>org/apache/roller/weblogger/pojos/WeblogBookmark.orm.xml </mapping-file>
<mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryComment.orm.xml </mapping-file>
<mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryAttribute.orm.xml </mapping-file>
@@ -32,7 +31,10 @@
<mapping-file>org/apache/roller/weblogger/pojos/OAuthAccessorRecord.orm.xml </mapping-file>
<mapping-file>org/apache/roller/weblogger/pojos/MediaFile.orm.xml </mapping-file>
<mapping-file>org/apache/roller/weblogger/pojos/MediaFileTag.orm.xml </mapping-file>
- <mapping-file>org/apache/roller/weblogger/pojos/MediaFileDirectory.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/weblogger/pojos/MediaFileDirectory.orm.xml </mapping-file>
+
+ <class>org.apache.roller.weblogger.pojos.AutoPing</class>
+
</persistence-unit>
</persistence>
Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/AutoPing.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/AutoPing.java?rev=791278&r1=791277&r2=791278&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/AutoPing.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/AutoPing.java Sun Jul 5 17:04:51 2009
@@ -19,21 +19,52 @@
package org.apache.roller.weblogger.pojos;
import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.roller.util.UUIDGenerator;
/**
- * 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.
- *
+ * 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>
*/
+@Entity
+@Table(name="autoping")
+@NamedQueries({
+ @NamedQuery(name="AutoPing.getAll",
+ query="SELECT a FROM AutoPing a"),
+
+ @NamedQuery(name="AutoPing.getByPingTarget",
+ query="SELECT a FROM AutoPing a WHERE a.pingTarget = ?1"),
+
+ @NamedQuery(name="AutoPing.getByWebsite",
+ query="SELECT a FROM AutoPing a WHERE a.website = ?1"),
+
+ @NamedQuery(name="AutoPing.removeByPingTarget",
+ query="DELETE FROM AutoPing a WHERE a.pingTarget = ?1"),
+
+ @NamedQuery(name="AutoPing.removeByPingTarget&Website",
+ query="DELETE FROM AutoPing a WHERE a.pingTarget = ?1 AND a.website = ?2"),
+
+ @NamedQuery(name="AutoPing.removeAll",
+ query="DELETE FROM AutoPing a")
+})
public class AutoPing implements Serializable {
-
+
private String id = UUIDGenerator.generateUUID();
private PingTarget pingTarget = null;
private Weblog website = null;
@@ -42,14 +73,13 @@
/**
- * Default constructor. Leaves all fields null. Required for bean compliance.
+ * Default constructor leaves all fields null. Required for bean compliance.
*/
public AutoPing() {
}
/**
* 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
@@ -62,16 +92,16 @@
/**
* Get the unique id (primary key) of this object.
- *
* @return the unique id of this object.
*/
+ @Id
+ @Column(nullable=false,updatable=false)
public String getId() {
return id;
}
/**
* Set the unique id (primary key) of this object
- *
* @param id
*/
public void setId(String id) {
@@ -81,19 +111,19 @@
}
/**
- * Get the website. Get the website whose changes should result in a ping to the ping target specified by this
- * object.
- *
+ * Get the website. Get the website whose changes should result in a ping
+ * to the ping target specified by this object.
* @return the website.
*/
+ @ManyToOne
+ @JoinColumn(name="websiteid",insertable=true,nullable=true,updatable=true)
public Weblog getWebsite() {
return website;
}
/**
- * Set the website. Set the website whose changes should result in a ping to the ping target specified by this
- * object.
- *
+ * 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.
*/
public void setWebsite(Weblog website) {
@@ -101,17 +131,19 @@
}
/**
- * Get the ping target. Get the target to be pinged when the corresponding website changes.
- *
+ * Get the ping target. Get the target to be pinged when the
+ * corresponding website changes.
* @return the target to be pinged.
*/
+ @ManyToOne
+ @JoinColumn(name="pingtargetid",insertable=true,nullable=true,updatable=true)
public PingTarget getPingTarget() {
return pingTarget;
}
/**
- * Set the ping target. Set the target to be pinged when the corresponding website changes.
- *
+ * Set the ping target. Set the target to be pinged when the
+ * corresponding website changes.
* @param pingtarget the target to be pinged.
*/
public void setPingTarget(PingTarget pingtarget) {