]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
366ce9bf9154da005a3ffd7bae8b75e85ac92db2
[tmp/jakarta-migration.git] /
1 /**
2  *  This document is a part of the source code and related artifacts
3  *  for CollectionSpace, an open source collections management system
4  *  for museums and related institutions:
5
6  *  http://www.collectionspace.org
7  *  http://wiki.collectionspace.org
8
9  *  Copyright 2009 University of California at Berkeley
10
11  *  Licensed under the Educational Community License (ECL), Version 2.0.
12  *  You may not use this file except in compliance with this License.
13
14  *  You may obtain a copy of the ECL 2.0 License at
15
16  *  https://source.collectionspace.org/collection-space/LICENSE.txt
17
18  *  Unless required by applicable law or agreed to in writing, software
19  *  distributed under the License is distributed on an "AS IS" BASIS,
20  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  *  See the License for the specific language governing permissions and
22  *  limitations under the License.
23  */
24 package org.collectionspace.services.authorization;
25
26 /**
27  * CSpaceResourceImpl abstract resource implementation
28  * @author 
29  */
30 public abstract class CSpaceResourceImpl implements CSpaceResource {
31
32     private String id;
33     private TYPE type;
34
35     public CSpaceResourceImpl() {
36     }
37
38     public CSpaceResourceImpl(String id, TYPE type) {
39         if (id == null || id.isEmpty() || type == null) {
40             throw new IllegalArgumentException("id and/or type cannot be null or empty");
41         }
42         this.id = id;
43         this.type = type;
44     }
45
46     @Override
47     public String getId() {
48         return id;
49     }
50
51     @Override
52     public TYPE getType() {
53         return type;
54     }
55
56     @Override
57     public abstract CSpaceAction getAction();
58
59     @Override
60     public String toString() {
61         StringBuilder builder = new StringBuilder();
62         builder.append("CSpaceResourceImpl [");
63         builder.append("id=");
64         builder.append(id);
65         builder.append(", type=");
66         builder.append(type);
67         builder.append("]");
68         return builder.toString();
69     }
70
71     
72 }