File Source: CustomPingTargets.java
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.ui.struts2.editor;
20
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23 import org.apache.roller.weblogger.WebloggerException;
24 import org.apache.roller.weblogger.business.WebloggerFactory;
25 import org.apache.roller.weblogger.business.pings.PingTargetManager;
26 import org.apache.roller.weblogger.config.PingConfig;
27 import org.apache.roller.weblogger.pojos.WeblogPermission;
28 import org.apache.roller.weblogger.ui.struts2.common.PingTargetsBase;
29
30
31 /**
32 * Action for managing weblog custom ping targets.
33 */
34 public class CustomPingTargets extends PingTargetsBase {
35
/*
P/P * Method: org.apache.roller.weblogger.ui.struts2.editor.CustomPingTargets__static_init
*
* Postconditions:
* init'ed(log)
*/
36 private static Log log = LogFactory.getLog(CustomPingTargets.class);
37
38
/*
P/P * Method: void org.apache.roller.weblogger.ui.struts2.editor.CustomPingTargets()
*
* Presumptions:
* init'ed(org/apache/roller/weblogger/ui/struts2/common/PingTargetsBase.java.util.Collections.EMPTY_LIST)
*
* Postconditions:
* this.actionName == &"customPingTargets"
* this.desiredMenu == &"editor"
* this.pageTitle == &"customPingTargets.customPingTargets"
* this.pingTarget == null
* this.pingTargetId == null
* this.pingTargets == org/apache/roller/weblogger/ui/struts2/common/PingTargetsBase.java.util.Collections.EMPTY_LIST
* init'ed(this.pingTargets)
*/
39 public CustomPingTargets() {
40 this.actionName = "customPingTargets";
41 this.desiredMenu = "editor";
42 this.pageTitle = "customPingTargets.customPingTargets";
43 }
44
45
46 // no weblog required
47 public boolean isWeblogRequired() {
/*
P/P * Method: bool isWeblogRequired()
*
* Postconditions:
* return_value == 1
*/
48 return true;
49 }
50
51 public short requiredWeblogPermissions() {
/*
P/P * Method: short requiredWeblogPermissions()
*
* Presumptions:
* init'ed(org.apache.roller.weblogger.pojos.WeblogPermission.ADMIN)
*
* Postconditions:
* return_value == org.apache.roller.weblogger.pojos.WeblogPermission.ADMIN
* (soft) init'ed(return_value)
*/
52 return WeblogPermission.ADMIN;
53 }
54
55
56 protected Log getLogger() {
/*
P/P * Method: Log getLogger()
*
* Preconditions:
* init'ed(log)
*
* Postconditions:
* return_value == log
* init'ed(return_value)
*/
57 return log;
58 }
59
60
61 public void loadPingTargets() {
62
/*
P/P * Method: void loadPingTargets()
*
* Preconditions:
* (soft) log != null
*
* Presumptions:
* org.apache.roller.weblogger.business.Weblogger:getPingTargetManager(...)@64 != null
* org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@64 != null
*
* Postconditions:
* possibly_updated(this.pingTargets)
*
* Test Vectors:
* org.apache.roller.weblogger.config.PingConfig:getDisallowCustomTargets(...)@63: {1}, {0}
*/
63 if(!PingConfig.getDisallowCustomTargets()) try {
64 PingTargetManager pingTargetMgr = WebloggerFactory.getWeblogger().getPingTargetManager();
65 setPingTargets(pingTargetMgr.getCustomPingTargets(getActionWeblog()));
66 } catch (WebloggerException ex) {
67 log.error("Error loading common ping targets", ex);
68 // TODO: i18n
69 addError("Error loading common ping targets");
70 }
71 }
72
73 }
SofCheck Inspector Build Version : 2.18479
| CustomPingTargets.java |
2009-Jan-02 14:25:20 |
| CustomPingTargets.class |
2009-Sep-04 03:12:45 |