View Javadoc
1   /*
2    * Copyright 2012-2021 CodeLibs Project and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.codelibs.fess.es.user.exentity;
17  
18  import java.util.HashMap;
19  import java.util.Map;
20  
21  import org.codelibs.fess.es.user.bsentity.BsGroup;
22  
23  /**
24   * @author FreeGen
25   */
26  public class Group extends BsGroup {
27  
28      private static final long serialVersionUID = 1L;
29  
30      private Map<String, String> attributes;
31  
32      public Long getVersionNo() {
33          return asDocMeta().version();
34      }
35  
36      public void setVersionNo(final Long version) {
37          asDocMeta().version(version);
38      }
39  
40      public String getId() {
41          return asDocMeta().id();
42      }
43  
44      public void setId(final String id) {
45          asDocMeta().id(id);
46      }
47  
48      @Override
49      public String toString() {
50          return "Group [name=" + name + "]";
51      }
52  
53      public Map<String, String> getAttributes() {
54          return attributes;
55      }
56  
57      public void setAttributes(final Map<String, String> attributes) {
58          this.attributes = attributes;
59      }
60  
61      @Override
62      public Map<String, Object> toSource() {
63          final Map<String, Object> sourceMap = new HashMap<>();
64          if (name != null) {
65              sourceMap.put("name", name);
66          }
67          if (attributes != null) {
68              sourceMap.putAll(attributes);
69          }
70          return sourceMap;
71      }
72  }