View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.common.lib.search;
20  
21  import java.util.Arrays;
22  import java.util.Optional;
23  
24  public enum SpecialAttr {
25  
26      /**
27       * Applies to users, groups and any objects.
28       */
29      NULL("$null"),
30      /**
31       * Applies to any objects.
32       */
33      TYPE("$type"),
34      /**
35       * Applies to users, groups and any objects.
36       */
37      AUX_CLASSES("$auxClasses"),
38      /**
39       * Applies to users, groups and any objects.
40       */
41      RESOURCES("$resources"),
42      /**
43       * Applies to users and any objects.
44       */
45      GROUPS("$groups"),
46      /**
47       * Applies to users and any objects.
48       */
49      RELATIONSHIPS("$relationships"),
50      /**
51       * Applies to users and any objects.
52       */
53      RELATIONSHIP_TYPES("$relationshipTypes"),
54      /**
55       * Applies to users.
56       */
57      ROLES("$roles"),
58      /**
59       * Applies to users.
60       */
61      PRIVILEGES("$privileges"),
62      /**
63       * Applies to users, groups and any objects.
64       */
65      DYNREALMS("$dynRealms"),
66      /**
67       * Applies to groups.
68       */
69      MEMBER("$member");
70  
71      private final String literal;
72  
73      SpecialAttr(final String literal) {
74          this.literal = literal;
75      }
76  
77      @Override
78      public String toString() {
79          return literal;
80      }
81  
82      public static Optional<SpecialAttr> fromString(final String value) {
83          return Arrays.stream(values()).filter(specialAttr -> specialAttr.literal.equals(value)).findFirst();
84      }
85  }