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.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   * @author jflute
29   */
30  public class FessUserTimeZoneProcessProvider implements UserTimeZoneProcessProvider {
31  
32      public static final TimeZone centralTimeZone = TimeZone.getDefault();
33  
34      @Override
35      public boolean isUseTimeZoneHandling() {
36          return false;
37      }
38  
39      @Override
40      public boolean isAcceptCookieTimeZone() {
41          return false;
42      }
43  
44      @Override
45      public OptionalThing<TimeZone> findBusinessTimeZone(final ActionRuntime runtimeMeta, final RequestManager requestManager) {
46          return OptionalObject.empty();
47      }
48  
49      @Override
50      public TimeZone getRequestedTimeZone(final RequestManager requestManager) { // not null
51          return centralTimeZone; // you can change it if you like
52      }
53  
54      @Override
55      public String toString() {
56          final StringBuilder sb = new StringBuilder();
57          sb.append(DfTypeUtil.toClassTitle(this));
58          sb.append(":{useTimeZoneHandling=").append(isUseTimeZoneHandling());
59          sb.append(", acceptCookieTimeZone=").append(isAcceptCookieTimeZone());
60          sb.append("}@").append(Integer.toHexString(hashCode()));
61          return sb.toString();
62      }
63  }