File Source: AutoPing.java
/*
P/P * Method: void readObject(ObjectInputStream)
*
* Preconditions:
* Param_1 != null
*
* Presumptions:
* init'ed(org.apache.openjpa.enhance.PersistenceCapable.DESERIALIZED)
*
* Postconditions:
* Param_0.pcDetachedState == org.apache.openjpa.enhance.PersistenceCapable.DESERIALIZED
* (soft) init'ed(Param_0.pcDetachedState)
*/
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */
18
19 package org.apache.roller.weblogger.pojos;
20
21 import java.io.Serializable;
22 import org.apache.commons.lang.builder.EqualsBuilder;
23 import org.apache.commons.lang.builder.HashCodeBuilder;
24 import org.apache.roller.util.UUIDGenerator;
25
26
27 /**
28 * Automatic ping configuration. An instance of this class relates a website and ping target; it indicates that the specified
29 * ping target should be pinged when the corresponding website is changed. Pinging can be restricted to changes to
30 * specific categories on the website by instances of the {@link PingCategoryRestrictionData} object. In the absence of
31 * any category restrictions, the ping target is pinged whenever the corresponding website changes.
32 *
33 * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
34 */
35 public class AutoPing implements Serializable {
36
37 private String id = UUIDGenerator.generateUUID();
38 private PingTarget pingTarget = null;
39 private Weblog website = null;
40
41 public static final long serialVersionUID = -9105985454111986435L;
42
43
44 /**
45 * Default constructor. Leaves all fields null. Required for bean compliance.
46 */
/*
P/P * Method: void org.apache.roller.weblogger.pojos.AutoPing()
*
* Postconditions:
* init'ed(this.id)
* this.pingTarget == null
* this.website == null
*/
47 public AutoPing() {
48 }
49
50 /**
51 * Constructor.
52 *
53 * @param id unique id (primary key) for this instance
54 * @param pingtarget ping target that should be pinged
55 * @param website website to which this configuration applies
56 */
/*
P/P * Method: void org.apache.roller.weblogger.pojos.AutoPing(String, PingTarget, Weblog)
*
* Postconditions:
* init'ed(this.id)
* this.pingTarget == pingtarget
* init'ed(this.pingTarget)
* this.website == website
* init'ed(this.website)
*/
57 public AutoPing(String id, PingTarget pingtarget, Weblog website) {
58 //this.id = id;
59 this.website = website;
60 this.pingTarget = pingtarget;
61 }
62
63 /**
64 * Get the unique id (primary key) of this object.
65 *
66 * @return the unique id of this object.
67 */
68 public String getId() {
/*
P/P * Method: String pcgetId()
*
* Preconditions:
* init'ed(this.id)
*
* Postconditions:
* return_value == this.id
* init'ed(return_value)
*/
69 return id;
70 }
71
72 /**
73 * Set the unique id (primary key) of this object
74 *
75 * @param id
76 */
77 public void setId(String id) {
78 // Form bean workaround: empty string is never a valid id
/*
P/P * Method: void pcsetId(String)
*
* Postconditions:
* this.id == One-of{old this.id, Param_1}
*
* Test Vectors:
* Param_1: Addr_Set{null}, Inverse{null}
* java.lang.String:length(...)@79: {1..232-1}, {0}
*/
79 if (id != null && id.trim().length() == 0) return;
80 this.id = id;
81 }
82
83 /**
84 * Get the website. Get the website whose changes should result in a ping to the ping target specified by this
85 * object.
86 *
87 * @return the website.
88 */
89 public Weblog getWebsite() {
/*
P/P * Method: Weblog pcgetWebsite()
*
* Preconditions:
* init'ed(this.website)
*
* Postconditions:
* return_value == this.website
* init'ed(return_value)
*/
90 return website;
91 }
92
93 /**
94 * Set the website. Set the website whose changes should result in a ping to the ping target specified by this
95 * object.
96 *
97 * @param website the website.
98 */
99 public void setWebsite(Weblog website) {
/*
P/P * Method: void pcsetWebsite(Weblog)
*
* Postconditions:
* this.website == Param_1
* init'ed(this.website)
*/
100 this.website = website;
101 }
102
103 /**
104 * Get the ping target. Get the target to be pinged when the corresponding website changes.
105 *
106 * @return the target to be pinged.
107 */
108 public PingTarget getPingTarget() {
/*
P/P * Method: PingTarget pcgetPingTarget()
*
* Preconditions:
* init'ed(this.pingTarget)
*
* Postconditions:
* return_value == this.pingTarget
* init'ed(return_value)
*/
109 return pingTarget;
110 }
111
112 /**
113 * Set the ping target. Set the target to be pinged when the corresponding website changes.
114 *
115 * @param pingtarget the target to be pinged.
116 */
117 public void setPingTarget(PingTarget pingtarget) {
/*
P/P * Method: void pcsetPingTarget(PingTarget)
*
* Postconditions:
* this.pingTarget == Param_1
* init'ed(this.pingTarget)
*/
118 this.pingTarget = pingtarget;
119 }
120
121 //------------------------------------------------------- Good citizenship
122
123 public String toString() {
/*
P/P * Method: String toString()
*
* Preconditions:
* init'ed(this.id)
*
* Postconditions:
* java.lang.StringBuffer:toString(...)._tainted == this.id._tainted
* init'ed(java.lang.StringBuffer:toString(...)._tainted)
* return_value == &java.lang.StringBuffer:toString(...)
*/
124 StringBuffer buf = new StringBuffer();
125 buf.append("{");
126 buf.append(this.id);
127 buf.append("}");
128 return buf.toString();
129 }
130
131 public boolean equals(Object other) {
/*
P/P * Method: bool equals(Object)
*
* Preconditions:
* (soft) init'ed(other.id)
* (soft) init'ed(other.pcStateManager)
* (soft) init'ed(other.pingTarget)
* (soft) init'ed(other.website)
* (soft) pcInheritedFieldCount <= 232-3
* (soft) init'ed(this.id)
* (soft) init'ed(this.pcStateManager)
* (soft) init'ed(this.pingTarget)
* (soft) init'ed(this.website)
*
* Presumptions:
* org.apache.commons.lang.builder.EqualsBuilder:append(...)@135 != null
*
* Postconditions:
* init'ed(return_value)
*
* Test Vectors:
* other == this: {0}, {1}
*/
132 if (other == this) return true;
133 if (other instanceof AutoPing != true) return false;
134 AutoPing o = (AutoPing)other;
135 return new EqualsBuilder()
136 .append(getId(), o.getId())
137 .append(getPingTarget(), o.getPingTarget())
138 .append(getWebsite(), o.getWebsite())
139 .isEquals();
140 }
141
142 public int hashCode() {
/*
P/P * Method: int hashCode()
*
* Preconditions:
* init'ed(this.id)
* init'ed(this.pcStateManager)
* (soft) init'ed(pcInheritedFieldCount)
*
* Presumptions:
* org.apache.commons.lang.builder.HashCodeBuilder:append(...)@143 != null
*
* Postconditions:
* init'ed(return_value)
*/
143 return new HashCodeBuilder().append(getId()).toHashCode();
144 }
145
146 }
+ 147 Other Messages
SofCheck Inspector Build Version : 2.18479
| AutoPing.java |
2009-Jan-02 14:25:22 |
| AutoPing.class |
2009-Sep-04 03:12:36 |