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.mylasta.direction.sponsor;
17  
18  import java.util.TimeZone;
19  
20  import org.dbflute.optional.OptionalObject;
21  import org.dbflute.optional.OptionalThing;
22  import org.dbflute.util.DfTypeUtil;
23  import org.lastaflute.web.ruts.process.ActionRuntime;
24  import org.lastaflute.web.servlet.request.RequestManager;
25  import org.lastaflute.web.servlet.request.UserTimeZoneProcessProvider;
26  
27  /**
28   * The provider of user time-zone process.
29   *
30   * @author jflute
31   */
32  public class FessUserTimeZoneProcessProvider implements UserTimeZoneProcessProvider {
33  
34      public static final TimeZone centralTimeZone = TimeZone.getDefault();
35  
36      @Override
37      public boolean isUseTimeZoneHandling() {
38          return false;
39      }
40  
41      @Override
42      public boolean isAcceptCookieTimeZone() {
43          return false;
44      }
45  
46      @Override
47      public OptionalThing<TimeZone> findBusinessTimeZone(final ActionRuntime runtimeMeta, final RequestManager requestManager) {
48          return OptionalObject.empty();
49      }
50  
51      @Override
52      public TimeZone getRequestedTimeZone(final RequestManager requestManager) { // not null
53          return centralTimeZone; // you can change it if you like
54      }
55  
56      @Override
57      public String toString() {
58          final StringBuilder sb = new StringBuilder();
59          sb.append(DfTypeUtil.toClassTitle(this));
60          sb.append(":{useTimeZoneHandling=").append(isUseTimeZoneHandling());
61          sb.append(", acceptCookieTimeZone=").append(isAcceptCookieTimeZone());
62          sb.append("}@").append(Integer.toHexString(hashCode()));
63          return sb.toString();
64      }
65  }