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.config.exentity;
17  
18  import java.util.Arrays;
19  import java.util.Date;
20  
21  import org.codelibs.fess.es.config.bsentity.BsAccessToken;
22  
23  /**
24   * @author ESFlute (using FreeGen)
25   */
26  public class AccessToken extends BsAccessToken {
27  
28      private static final long serialVersionUID = 1L;
29  
30      public String getId() {
31          return asDocMeta().id();
32      }
33  
34      public void setId(final String id) {
35          asDocMeta().id(id);
36      }
37  
38      public Long getVersionNo() {
39          return asDocMeta().version();
40      }
41  
42      public void setVersionNo(final Long version) {
43          asDocMeta().version(version);
44      }
45  
46      public Date getExpires() {
47          if (getExpiredTime() == null) {
48              return null;
49          }
50          return new Date(getExpiredTime());
51      }
52  
53      public void setExpires(final Date date) {
54          setExpiredTime(date != null ? date.getTime() : null);
55      }
56  
57      @Override
58      public String toString() {
59          return "AccessToken [name=" + name + ", token=" + token + ", permissions=" + Arrays.toString(permissions) + ", parameterName="
60                  + parameterName + ", createdBy=" + createdBy + ", createdTime=" + createdTime + ", updatedBy=" + updatedBy
61                  + ", updatedTime=" + updatedTime + ", docMeta=" + docMeta + "]";
62      }
63  
64  }