This project has retired. For details please refer to its Attic page.
Permission xref
View Javadoc

1   package org.apache.archiva.redback.rest.api.model;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  import javax.xml.bind.annotation.XmlRootElement;
22  import java.io.Serializable;
23  
24  /**
25   * @author Olivier Lamy
26   * @since 1.4
27   */
28  @XmlRootElement( name = "permission" )
29  public class Permission
30      implements Serializable
31  {
32      private String name;
33  
34      private String description;
35  
36      private Operation operation;
37  
38      private Resource resource;
39  
40      private boolean permanent;
41  
42      public Permission()
43      {
44          // no op
45      }
46  
47      public Permission( org.apache.archiva.redback.rbac.Permission permission )
48      {
49          this.name = permission.getName();
50          this.description = permission.getDescription();
51          this.operation = permission.getOperation() == null ? null : new Operation( permission.getOperation() );
52          this.resource = permission.getResource() == null ? null : new Resource( permission.getResource() );
53          this.permanent = permission.isPermanent();
54      }
55  
56      public String getName()
57      {
58          return name;
59      }
60  
61      public void setName( String name )
62      {
63          this.name = name;
64      }
65  
66      public Operation getOperation()
67      {
68          return operation;
69      }
70  
71      public void setOperation( Operation operation )
72      {
73          this.operation = operation;
74      }
75  
76      public Resource getResource()
77      {
78          return resource;
79      }
80  
81      public void setResource( Resource resource )
82      {
83          this.resource = resource;
84      }
85  
86      @Override
87      public String toString()
88      {
89          final StringBuilder sb = new StringBuilder();
90          sb.append( "Permission" );
91          sb.append( "{name='" ).append( name ).append( '\'' );
92          sb.append( ", description='" ).append( description ).append( '\'' );
93          sb.append( ", operation=" ).append( operation );
94          sb.append( ", resource=" ).append( resource );
95          sb.append( ", permanent=" ).append( permanent );
96          sb.append( '}' );
97          return sb.toString();
98      }
99  }