/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 *
 */

package com.xpn.xwiki.notify;

import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.doc.XWikiDocument;

@Deprecated
public class XWikiActionRule implements XWikiNotificationRule {
    private XWikiActionNotificationInterface target;
    private boolean preverify = false;
    private boolean postverify = true;

    public XWikiActionRule() {
    }

    public XWikiActionRule(XWikiActionNotificationInterface target) {
        setTarget(target);
    }

    public XWikiActionRule(XWikiActionNotificationInterface target, boolean pre, boolean post) {
        setTarget(target);
        setPreverify(pre);
        setPostverify(post);
    }

    public XWikiActionNotificationInterface getTarget() {
        return target;
    }

    public void setTarget(XWikiActionNotificationInterface target) {
        this.target = target;
    }

    public void verify(XWikiDocument newdoc, XWikiDocument olddoc, XWikiContext context) {
    }

    public void preverify(XWikiDocument newdoc, XWikiDocument olddoc, XWikiContext context) {
    }

    public void verify(XWikiDocument doc, String action, XWikiContext context) {
    	if(!isPostverify()) return;
        try {
            getTarget().notify(this, doc, action, context);
        } catch (Throwable e) {
            // Notification should never fail
            // Just report an error
            e.printStackTrace();
        }
    }

    public void preverify(XWikiDocument doc, String action, XWikiContext context) {
    	if(!isPreverify()) return;
        try {
            getTarget().notify(this, doc, action, context);
        } catch (Throwable e) {
            // Notification should never fail
            // Just report an error
            e.printStackTrace();
        }
    }

	public boolean isPostverify() {
		return postverify;
	}

	public void setPostverify(boolean postnotify) {
		this.postverify = postnotify;
	}

	public boolean isPreverify() {
		return preverify;
	}

	public void setPreverify(boolean prenotify) {
		this.preverify = prenotify;
	}

}
@@ -1071,17 +1071,17 @@
 tionRule
- 
+%0A
 %7B%0A    pr
@@ -1123,24 +1123,25 @@
 ace target;%0A
+%0A
     private 
@@ -1167,16 +1167,17 @@
  false;%0A
+%0A
     priv
@@ -1236,16 +1236,20 @@
 onRule()
+%0A   
  %7B%0A    %7D
@@ -1309,32 +1309,36 @@
 nterface target)
+%0A   
  %7B%0A        setTa
@@ -1452,16 +1452,20 @@
 an post)
+%0A   
  %7B%0A     
@@ -1604,16 +1604,20 @@
 Target()
+%0A   
  %7B%0A     
@@ -1626,16 +1626,21 @@
  return 
+this.
 target;%0A
@@ -1712,16 +1712,20 @@
  target)
+%0A   
  %7B%0A     
@@ -1836,32 +1836,36 @@
 Context context)
+%0A   
  %7B%0A    %7D%0A%0A    pu
@@ -1945,24 +1945,28 @@
 ext context)
+%0A   
  %7B%0A    %7D%0A%0A  
@@ -2037,34 +2037,42 @@
 ext context)
+%0A   
  %7B%0A    
-%09
+    
 if
+ 
 (!isPostveri
@@ -2068,32 +2068,44 @@
 !isPostverify())
+%0A           
  return;%0A       
@@ -2420,18 +2420,26 @@
 ext)
+%0A   
  %7B%0A    
+  
-%09
+  
 if
+ 
 (!is
@@ -2450,16 +2450,28 @@
 erify())
+%0A           
  return;
@@ -2709,17 +2709,20 @@
 %0A    %7D%0A%0A
-%09
+    
 public b
@@ -2742,28 +2742,43 @@
 verify()
- %7B%0A%09%09
+%0A    %7B%0A        
 return 
+this.
 postveri
@@ -2773,37 +2773,43 @@
 his.postverify;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public void setP
@@ -2833,29 +2833,39 @@
  postnotify)
- %7B%0A%09%09
+%0A    %7B%0A        
 this.postver
@@ -2878,29 +2878,35 @@
 postnotify;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public boole
@@ -2925,20 +2925,35 @@
 fy()
- %7B%0A%09%09
+%0A    %7B%0A        
 return 
+this.
 prev
@@ -2963,13 +2963,19 @@
 fy;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 publ
@@ -3017,13 +3017,23 @@
 ify)
- %7B%0A%09%09
+%0A    %7B%0A        
 this
@@ -3060,9 +3060,13 @@
 fy;%0A
-%09
+    
 %7D%0A%0A%7D
+%0A

Apply codestyle