View Javadoc

1   /*
2    * Copyright (c) 2001 - 2005 ivata limited.
3    * All rights reserved.
4    * -----------------------------------------------------------------------------
5    * ivata masks may be redistributed under the GNU General Public
6    * License as published by the Free Software Foundation;
7    * version 2 of the License.
8    *
9    * These programs are free software; you can redistribute them and/or
10   * modify them under the terms of the GNU General Public License
11   * as published by the Free Software Foundation; version 2 of the License.
12   *
13   * These programs are distributed in the hope that they will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16   *
17   * See the GNU General Public License in the file LICENSE.txt for more
18   * details.
19   *
20   * If you would like a copy of the GNU General Public License write to
21   *
22   * Free Software Foundation, Inc.
23   * 59 Temple Place - Suite 330
24   * Boston, MA 02111-1307, USA.
25   *
26   *
27   * To arrange commercial support and licensing, contact ivata at
28   *                  http://www.ivata.com/contact.jsp
29   * -----------------------------------------------------------------------------
30   * $Log: DefaultPersistenceRights.java,v $
31   * Revision 1.3  2005/04/09 18:04:15  colinmacleod
32   * Changed copyright text to GPL v2 explicitly.
33   *
34   * Revision 1.2  2005/03/10 10:22:19  colinmacleod
35   * Now implements Serializable.
36   *
37   * Revision 1.1  2005/01/19 12:36:09  colinmacleod
38   * Added field-level rights interface and default implementation.
39   *
40   * -----------------------------------------------------------------------------
41   */
42  package com.ivata.mask.persistence.right;
43  
44  import java.io.Serializable;
45  
46  import com.ivata.mask.valueobject.ValueObject;
47  
48  /***
49   * This default implementation of persistence rights always return
50   * <code>true</code>, to let you do everything!
51   *
52   * @since ivata masks 0.5 (2005-01-14)
53   * @author Colin MacLeod
54   * <a href="mailto:colin.macleod@ivata.com">colin.macleod@ivata.com</a>
55   * @version $Revision: 1.3 $
56   */
57  
58  public class DefaultPersistenceRights implements PersistenceRights, Serializable {
59      /***
60       * Refer to {@link PersistenceRights#canAdd}.
61       *
62       * @param valueObjectClassParam Refer to {@link PersistenceRights#canAdd}.
63       * @param userName Refer to {@link PersistenceRights#canAdd}.
64       * @return always returns <code>true</code>.
65       */
66      public boolean canAdd(final String userName,
67              final Class valueObjectClassParam) {
68          return true;
69      }
70  
71      /***
72       * Refer to {@link PersistenceRights#canAmend}.
73       * @param valueObjectParam Refer to {@link PersistenceRights#canAmend}.
74       * @param userNameParam Refer to {@link PersistenceRights#canAmend}.
75       *
76       * @return always returns <code>true</code>.
77       */
78      public boolean canAmend(final String userNameParam,
79              final ValueObject valueObjectParam) {
80          return true;
81      }
82  
83      /***
84       * Refer to {@link PersistenceRights#canAmend(String,
85       * ValueObject, String)}.
86       * @param userNameParam Refer to
87       * {@link PersistenceRights#canAmend(String,
88       * ValueObject, String)}.
89       * @param valueObjectParam Refer to
90       * {@link PersistenceRights#canAmend(String,
91       * ValueObject, String)}.
92       * @param fieldNameParam Refer to
93       * {@link PersistenceRights#canAmend(String,
94       * ValueObject, String)}.
95       * @return always returns <code>true</code>.
96       */
97      public boolean canAmend(final String userNameParam,
98              final ValueObject valueObjectParam, final String fieldNameParam) {
99          return true;
100     }
101 
102     /***
103      * Refer to {@link PersistenceRights#canRemove}.
104      * @param userNameParam Refer to {@link PersistenceRights#canRemove}.
105      * @param valueObjectParam Refer to {@link PersistenceRights#canRemove}.
106      *
107      * @return always returns <code>true</code>.
108      */
109     public boolean canRemove(final String userNameParam,
110             final ValueObject valueObjectParam) {
111         return true;
112     }
113 }