View Javadoc

1   /**
2    * This file Copyright (c) 2013 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.audit;
35  
36  import info.magnolia.jcr.decoration.ContentDecoratorPropertyWrapper;
37  
38  import java.io.InputStream;
39  import java.math.BigDecimal;
40  import java.util.Calendar;
41  
42  import javax.jcr.Binary;
43  import javax.jcr.Node;
44  import javax.jcr.Property;
45  import javax.jcr.RepositoryException;
46  import javax.jcr.Value;
47  import javax.jcr.ValueFormatException;
48  import javax.jcr.lock.LockException;
49  import javax.jcr.nodetype.ConstraintViolationException;
50  import javax.jcr.version.VersionException;
51  
52  /**
53   * A Property wrapper implementation which inform
54   * Magnolia audit logging content decorator {@link info.magnolia.audit.MgnlAuditLoggingContentDecorator} about modify action on the property parent node.
55   */
56  public class MgnlAuditLoggingContentDecoratorPropertyWrapper extends ContentDecoratorPropertyWrapper<MgnlAuditLoggingContentDecorator> {
57  
58      public MgnlAuditLoggingContentDecoratorPropertyWrapper(Property property, MgnlAuditLoggingContentDecorator contentDecorator) {
59          super(property, contentDecorator);
60      }
61  
62      @Override
63      public void setValue(Value value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
64          super.setValue(value);
65          getContentDecorator().logActionModify(getParent());
66      }
67  
68      @Override
69      public void setValue(Value[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
70          super.setValue(values);
71          getContentDecorator().logActionModify(getParent());
72      }
73  
74      @Override
75      public void setValue(String value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
76          super.setValue(value);
77          getContentDecorator().logActionModify(getParent());
78      }
79  
80      @Override
81      public void setValue(String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
82          super.setValue(values);
83          getContentDecorator().logActionModify(getParent());
84      }
85  
86      @Override
87      public void setValue(InputStream value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
88          super.setValue(value);
89  
90          getContentDecorator().logActionModify(getParent());
91      }
92  
93      @Override
94      public void setValue(Binary value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
95          super.setValue(value);
96          getContentDecorator().logActionModify(getParent());
97      }
98  
99      @Override
100     public void setValue(long value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
101         super.setValue(value);
102         getContentDecorator().logActionModify(getParent());
103     }
104 
105     @Override
106     public void setValue(double value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
107         super.setValue(value);
108         getContentDecorator().logActionModify(getParent());
109     }
110 
111     @Override
112     public void setValue(BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
113         super.setValue(value);
114         getContentDecorator().logActionModify(getParent());
115     }
116 
117     @Override
118     public void setValue(Calendar value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
119         super.setValue(value);
120         getContentDecorator().logActionModify(getParent());
121     }
122 
123     @Override
124     public void setValue(boolean value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
125         super.setValue(value);
126         getContentDecorator().logActionModify(getParent());
127     }
128 
129     @Override
130     public void setValue(Node value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
131         super.setValue(value);
132         getContentDecorator().logActionModify(getParent());
133     }
134 
135 }