1 8 9 package org.roller.presentation.weblog.actions; 10 11 import org.apache.commons.logging.Log; 12 import org.apache.commons.logging.LogFactory; 13 import org.roller.RollerException; 14 import org.roller.model.PingTargetManager; 15 import org.roller.pojos.PingTargetData; 16 import org.roller.presentation.RollerRequest; 17 import org.roller.config.PingConfig; 18 import org.roller.presentation.forms.PingTargetForm; 19 20 import javax.servlet.http.HttpServletRequest ; 21 import java.util.List ; 22 import java.util.Collections ; 23 24 32 public class CustomPingTargetsAction 33 extends BasePingTargetsAction 34 { 35 private static Log mLogger = 36 LogFactory.getFactory().getInstance(CustomPingTargetsAction.class); 37 38 39 public CustomPingTargetsAction() { 40 super(); 41 } 42 43 protected Log getLogger() { 44 return mLogger; 45 } 46 47 52 protected List getPingTargets(RollerRequest rreq) throws RollerException 53 { 54 HttpServletRequest req = rreq.getRequest(); 55 PingTargetManager pingTargetMgr = rreq.getRoller().getPingTargetManager(); 56 57 Boolean allowCustomTargets = new Boolean (!PingConfig.getDisallowCustomTargets()); 58 req.setAttribute("allowCustomTargets", allowCustomTargets); 59 60 List customPingTargets = allowCustomTargets.booleanValue() ? 61 pingTargetMgr.getCustomPingTargets(rreq.getWebsite()) : Collections.EMPTY_LIST; 62 63 return customPingTargets; 64 } 65 66 69 protected PingTargetData createPingTarget(RollerRequest rreq, PingTargetForm pingTargetForm) 70 throws RollerException 71 { 72 PingTargetManager pingTargetMgr = rreq.getRoller().getPingTargetManager(); 73 return pingTargetMgr.createCustomPingTarget( 74 pingTargetForm.getName(), pingTargetForm.getPingUrl(), rreq.getWebsite()); 75 } 76 77 78 81 protected boolean hasRequiredRights(RollerRequest rreq) throws RollerException 82 { 83 return (rreq.isUserAuthorizedToEdit() && !PingConfig.getDisallowCustomTargets()); 84 } 85 } 86 | Popular Tags |