View Javadoc

1   /*
2    * Copyright 2015 Data Archiving and Networked Services (an institute of
3    * Koninklijke Nederlandse Akademie van Wetenschappen), King's College London,
4    * Georg-August-Universitaet Goettingen Stiftung Oeffentlichen Rechts
5    *
6    * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
7    * the European Commission - subsequent versions of the EUPL (the "Licence");
8    * You may not use this work except in compliance with the Licence.
9    * You may obtain a copy of the Licence at:
10   *
11   * https://joinup.ec.europa.eu/software/page/eupl
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the Licence is distributed on an "AS IS" basis,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the Licence for the specific language governing
17   * permissions and limitations under the Licence.
18   */
19  
20  package eu.ehri.project.acl;
21  
22  import com.tinkerpop.blueprints.Vertex;
23  import eu.ehri.project.definitions.Entities;
24  import eu.ehri.project.models.PermissionGrant;
25  import eu.ehri.project.models.base.Accessible;
26  import eu.ehri.project.models.base.Entity;
27  import eu.ehri.project.models.base.PermissionScope;
28  
29  import java.util.Collection;
30  import java.util.Collections;
31  
32  /**
33   * Singleton class representing the system scope for
34   * permissions and ID namespaces.
35   */
36  public enum SystemScope implements PermissionScope {
37  
38      INSTANCE;
39  
40      /**
41       * Obtain the shared instance of SystemScope.
42       *
43       * @return The global SystemScope instance
44       */
45      public static PermissionScope getInstance() {
46          return INSTANCE;
47      }
48  
49      @Override
50      public <T extends Entity> T as(Class<T> cls) {
51          throw new UnsupportedOperationException();
52      }
53  
54      @Override
55      public String getId() {
56          return Entities.SYSTEM;
57      }
58  
59      @Override
60      public String getType() {
61          return Entities.SYSTEM;
62      }
63  
64      @Override
65      public String getIdentifier() {
66          return Entities.SYSTEM;
67      }
68  
69      @Override
70      public Vertex asVertex() {
71          return null;
72      }
73  
74      @Override
75      public Iterable<PermissionGrant> getPermissionGrants() {
76          return Collections.emptyList();
77      }
78  
79      public Iterable<PermissionScope> getPermissionScopes() {
80          return Collections.emptyList();
81      }
82  
83      @Override
84      public Iterable<Accessible> getContainedItems() {
85          return Collections.emptyList();
86      }
87  
88      @Override
89      public Iterable<Accessible> getAllContainedItems() {
90          return Collections.emptyList();
91      }
92  
93      @Override
94      public Collection<String> idPath() {
95          return Collections.emptyList();
96      }
97  
98      @Override
99      public <T> T getProperty(String key) {
100         return null;
101     }
102 
103     @Override
104     public <T> T getProperty(Enum<?> key) {
105         return null;
106     }
107 
108     @Override
109     public java.util.Set<String> getPropertyKeys() {
110         return Collections.emptySet();
111     }
112 }