View Javadoc
1   /*
2    * Copyright 2012-2025 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.opensearch.config.exentity;
17  
18  import java.util.Locale;
19  
20  import org.codelibs.fess.opensearch.config.bsentity.BsLabelType;
21  import org.codelibs.fess.util.ComponentUtil;
22  
23  /**
24   * @author FreeGen
25   */
26  public class LabelType extends BsLabelType {
27  
28      private static final long serialVersionUID = 1L;
29      private Locale locale;
30  
31      public String getId() {
32          return asDocMeta().id();
33      }
34  
35      public void setId(final String id) {
36          asDocMeta().id(id);
37      }
38  
39      public Long getVersionNo() {
40          return asDocMeta().version();
41      }
42  
43      public void setVersionNo(final Long version) {
44          asDocMeta().version(version);
45      }
46  
47      public Locale getLocale() {
48          if (locale == null) {
49              if (getValue() == null) {
50                  return Locale.ROOT;
51              }
52              locale = ComponentUtil.getFessConfig().getQueryLocaleFromName(getValue());
53          }
54          return locale;
55      }
56  
57      @Override
58      public String toString() {
59          return "LabelType [createdBy=" + createdBy + ", createdTime=" + createdTime + ", excludedPaths=" + excludedPaths
60                  + ", includedPaths=" + includedPaths + ", name=" + name + ", sortOrder=" + sortOrder + ", updatedBy=" + updatedBy
61                  + ", updatedTime=" + updatedTime + ", value=" + value + ", docMeta=" + docMeta + "]";
62      }
63  }