001    /*
002     * Copyright (c) 2009 The openGion Project.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013     * either express or implied. See the License for the specific language
014     * governing permissions and limitations under the License.
015     */
016    package org.opengion.hayabusa.common;
017    
018    import java.io.Serializable;
019    import java.sql.Connection;
020    import java.sql.PreparedStatement;
021    import java.sql.SQLException;
022    import java.util.ArrayList;
023    import java.util.Arrays;
024    import java.util.Comparator;
025    import java.util.HashMap;
026    import java.util.List;
027    import java.util.Map;
028    import java.util.Locale;
029    
030    import javax.servlet.http.HttpSession;
031    
032    import org.opengion.fukurou.db.ConnectionFactory;
033    import org.opengion.fukurou.util.Cleanable;
034    import org.opengion.fukurou.util.Closer;
035    import org.opengion.fukurou.util.LogWriter;
036    import org.opengion.fukurou.db.DBSimpleTable;
037    
038    /**
039     * Webアプリケーション全体で使用して?オブジェクト類?ト?タルの管?ラスです?
040     *
041     * SystemManager は?
042     *
043     *              session オブジェクト?管?アクセス?開放
044     *
045     * の作業を行います?
046     *
047     * 上記?クラス(staticメソ?)へのアクセスは、もちろん直接呼び出して
048     * 操作することも可能ですが、サーバ?のクリーンシャ??ン時やセ?ョンの
049     * 開放時?初期化??ど、ある種の統合的なトリガを受けて?係するクラスに
050     * イベントを伝えるよ?することで、Webアプリケーションサーバ?との?取り?
051     * ??管?る目?作?されて?す?
052     *
053     * @og.group 初期?
054     *
055     * @version  4.0
056     * @author   Kazuhiko Hasegawa
057     * @since    JDK5.0,
058     */
059    public final class SystemManager {
060            // 3.1.0.0 (2003/03/20) Hashtable を使用して??で?同期でも構わな??を?HashMap に置換え?
061            private static final Map<String,UserSummary> map = new HashMap<String,UserSummary>( HybsSystem.BUFFER_MIDDLE );
062    
063            /** 4.0.0 (2005/01/31) Cleanable インターフェースを実?たオブジェクトを管?ます?  */
064            private static final List<Cleanable> clearList = new ArrayList<Cleanable>() ;
065    
066            /** 4.3.6.2 (2009/04/15) Context終?のみclear()され?Cleanable ブジェクトを管?ます?  */
067            private static final List<Cleanable> contextClearList = new ArrayList<Cleanable>() ;
068    
069            // 4.1.0.0 (2008/01/11) GE12クリア用
070            // 4.3.6.6 (2009/05/15) ENGINE_INFOは削除しな?
071            /** エンジン個別(SYSTEM_ID='個別' KBSAKU='0' CONTXT_PATH='自身')パラメータの?削除のクエリー       {@value}        */
072            private static final String DEL_SYS = "DELETE FROM GE12 WHERE SYSTEM_ID=? AND KBSAKU='0' AND CONTXT_PATH=? AND PARAM_ID != 'ENGINE_INFO'";
073    
074            /**
075             *  ?ォルトコンストラクターをprivateにして?
076             *  オブジェクト?生?をさせな??する?
077             *
078             */
079            private SystemManager() {
080            }
081    
082            /**
083             * session を記録します?
084             *
085             * 管??権限で、強制ログアウトさせる場合などに、使用します?
086             * Servlet 2.1 では、HttpSessio#getSessionContext() より取り出した
087             * HttpSessionContextのgetSession(java.lang.String sessionId) で
088             * すべての session を取り?せました?Deprecated になりました?
089             * セキュリ?ー上?好ましくな???す?で,注意して使用してください?
090             * common\session_init.jsp より登録しま?
091             *
092             * @og.rev 5.5.9.1 (2012/12/07) セ?ョン作?時に、規定?キーでセ?ョンIDを保存しておく?
093             *
094             * @param   session Httpセ?ョン
095             */
096            public static void addSession( final HttpSession session ) {
097                    String sessionID = session.getId();
098    
099                    UserSummary userInfo = (UserSummary)session.getAttribute( HybsSystem.USERINFO_KEY );
100                    if( userInfo != null ) {
101                            synchronized( map ) {
102                                    map.put( sessionID,userInfo );
103                            }
104                            session.setAttribute( HybsSystem.SESSION_KEY, sessionID );              // 5.5.9.1 (2012/12/07) セ?ョンIDを保?
105                    }
106            }
107    
108            /**
109             * session を削除します?
110             *
111             * 管??権限で、強制ログアウトさせる場合などに、使用します?
112             * Servlet 2.1 では、HttpSessio#getSessionContext() より取り出した
113             * HttpSessionContextのgetSession(java.lang.String sessionId) で
114             * すべての session を取り?せました?Deprecated になりました?
115             * セキュリ?ー上?好ましくな???す?で,注意して使用してください?
116             *
117             * @og.rev 5.5.9.1 (2012/12/07) セ?ョン作?時に登録した規定?キーで userInfo を削除します?
118             * @og.rev 5.6.6.0 (2013/07/05) セ?ョンの Attribute に SESSION_KEY で登録して? sessionID も削除します?
119             *
120             * @param   session Httpセ?ョン
121             */
122    //      public static void removeSession( final String sessionID ) {
123            public static void removeSession( final HttpSession session ) {
124    
125                    String sessionID = (String)session.getAttribute( HybsSystem.SESSION_KEY );      // 5.5.9.1 (2012/12/07) セ?ョンIDを取り??
126    
127                    // 5.6.6.0 (2013/07/05) userInfo の map からの削除とuserInfo の clear を簡??
128                    synchronized( map ) {
129                            UserSummary userInfo = map.remove( sessionID );
130                            if( userInfo != null ) { userInfo.clear(); }
131                    }
132    
133    //              final UserSummary userInfo ;
134    //              synchronized( map ) {
135    //                      userInfo = map.remove( sessionID );
136    //              }
137    //              if( userInfo != null ) { userInfo.clear(); }
138    
139                    // 5.6.6.0 (2013/07/05) セ?ョンの Attribute に SESSION_KEY で登録して? sessionID も削除します?
140                    session.removeAttribute( HybsSystem.USERINFO_KEY );
141                    session.removeAttribute( HybsSystem.SESSION_KEY );
142            }
143    
144            /**
145             * すべてのシス?にログイン中のUserSummary オブジェクトを取得します?
146             *
147             * キーは、UserSummary の Attribute も含めた値が使用できます?
148             * 引数のキーは、?部で大?に変換された?ち、?部キーとして使用されます?
149             *
150             * @og.rev 4.0.0.0 (2005/01/31) ?ロジ?大?更
151             * @og.rev 5.6.6.0 (2013/07/05) Comparator の作り方を?簡?します?キーの??も増やします?
152             *
153             * @param   key ソートするキー?を指?
154             * @param   direction ソートする方向[true:??/false:降?]
155             *
156             * @return      ログイン中のオブジェク?
157             */
158            public static UserSummary[] getRunningUserSummary( final String key,final boolean direction ) {
159                    final UserSummary[] users ;
160                    synchronized( map ) {
161                            users = map.values().toArray( new UserSummary[map.size()] );
162                    }
163    
164                    if( key != null ) {
165    //                      Comparator<UserSummary> comp = getUserSummaryComparator( key,direction );
166                            Comparator<UserSummary> comp = new ATTRI_Comparator( key.toUpperCase( Locale.JAPAN ),direction );
167                            Arrays.sort( users,comp );
168                    }
169    
170                    return users ;
171            }
172    
173            /**
174             * シス?にログイン中の、すべてのセ?ョン数を?取得します?
175             *
176             * ちなみに、不正な??タが存在した場合?、ここでMapから削除しておきます?
177             *
178             * @og.rev 4.0.0.0 (2005/01/31) 新規作?
179             *
180             * @return ログイン中の有効なすべてのセ?ョン数
181             */
182            public static int getRunningCount() {
183                    final int rtnSize;
184                    synchronized( map ) {
185                            String[] keys = map.keySet().toArray( new String[map.size()] );
186                            for( int i=0; i<keys.length; i++ ) {
187                                    if( map.get( keys[i] ) == null ) {
188                                            map.remove( keys[i] );
189                                    }
190                            }
191                            rtnSize = map.size() ;
192                    }
193    
194                    return rtnSize;
195            }
196    
197            /**
198             * contextDestroyed 時に、すべてのセ?ョンを?invalidate()します?
199             * <del>永続化セ?ョン(SESSIONS.ser)対?/del>
200             * 注意:キャ?ュで?管?て?セ?ョンが?すべて無効化されてしま?す?
201             * よって、?部にセ?ョンを管?なくなったため?invalidate() もできません?
202             * 不?合が出るかもしれません?
203             *
204             * @og.rev 3.5.2.1 (2003/10/27) 新規作?
205             * @og.rev 4.0.0.0 (2005/01/31) セ?ョン ?UserSummary に変更
206             */
207            static void sessionDestroyed() {
208                    final UserSummary[] users ;
209                    synchronized( map ) {
210                            users = map.values().toArray( new UserSummary[map.size()] );
211                            map.clear();
212                    }
213    
214                    for( int i=0; i<users.length; i++ ) {
215                            users[i].clear();
216                    }
217                    System.out.println( "  [" + users.length + "] Session Destroyed " );
218            }
219    
220            /**
221             * 初期化したいオブジェクトを登録します?
222             * オブジェクト?、Cleanable インターフェースを実?ておく?があります?
223             * 実際に、clear() する場合?、ここで登録した全てのオブジェクト? clear()
224             * メソ?が呼び出されます?
225             *
226             * @og.rev 4.0.0.0 (2005/01/31) 新規作?
227             * @og.rev 4.3.6.2 (2009/04/15) コン?スト終?のみのclear()対?
228             *
229             * @param obj インターフェースの実?
230             */
231            public static void addCleanable( final Cleanable obj ) {
232    //              synchronized( clearList ) {
233    //                      clearList.add( obj );
234    //              }
235                    addCleanable( obj, false );
236            }
237    
238            /**
239             * 初期化したいオブジェクトを登録します?
240             * オブジェクト?、Cleanable インターフェースを実?ておく?があります?
241             * 実際に、clear() する場合?、ここで登録した全てのオブジェクト? clear()
242             * メソ?が呼び出されます?
243             *
244             * @og.rev 4.0.0.0 (2005/01/31) 新規作?
245             * @og.rev 4.3.6.2 (2009/04/15) コン?スト終?のみのclear()対?
246             *
247             * @param obj インターフェースの実?
248             * @param flag trueの場合?コン?スト停止時?みclear()を呼び出?
249             */
250            public static void addCleanable( final Cleanable obj, final boolean flag ) {
251                    if( flag ) {
252                            synchronized( contextClearList ) {
253                                    contextClearList.add( obj );
254                            }
255                    }
256                    else {
257                             synchronized( clearList ) {
258                                    clearList.add( obj );
259                             }
260                    }
261            }
262    
263            /**
264             * addCleanable( final Cleanable ) で登録したすべてのオブジェクトを初期化します?
265             * 処??、Cleanable インターフェースの clear()メソ?を?次呼び出します?
266             *
267             * @og.rev 4.0.0.0 (2005/01/31) 新規作?
268             * @og.rev 4.3.6.2 (2009/04/15) コン?スト終?のみのclear()対?
269             *
270             * @param       flag 完?終?に、true
271             */
272            public static void allClear( final boolean flag ) {
273                    final Cleanable[] clr ;
274                    synchronized( clearList ) {
275                            clr = clearList.toArray( new Cleanable[clearList.size()] );
276                            if( flag ) { clearList.clear() ; }              // contextDestroyed の場合?み実?
277                    }
278                    // 登録の??で処?て?ます?
279                    for( int i=clr.length-1; i>=0; i-- ) {
280                            clr[i].clear();
281                    }
282    
283                    // コン?スト停止時?みclear()
284                    if( flag ) {
285                            final Cleanable[] clr2 ;
286                            synchronized( contextClearList ) {
287                                    clr2 = contextClearList.toArray( new Cleanable[contextClearList.size()] );
288                                    contextClearList.clear();
289                            }
290                            // 登録の??で処?て?ます?
291                            for( int i=clr2.length-1; i>=0; i-- ) {
292                                    clr2[i].clear();
293                            }
294                    }
295            }
296    
297            /**
298             * GE12からCONTXT PATHをhost:port/context/で登録して?物を削除します?
299             * (web.xmlにTOMCAT_PORTを指定した?合に上記CONTEXT_PATHで登録されま?
300             *
301             * @og.rev 4.1.0.0 (2007/12/26) 新規作?
302             * @og.rev 5.5.4.5 (2012/07/27) 初期起動時のDB接続?は、RESOURCE_DBID とする?
303             */
304            protected static void clearGE12() {
305                    String HOST_URL                 = HybsSystem.sys( "HOST_URL" );
306                    String RESOURCE_DBID    = HybsSystem.sys( "RESOURCE_DBID" );    // 5.5.4.5 (2012/07/27) 初期起動時のDB接続?
307                    if( HOST_URL != null && !"**".equals( HOST_URL ) ) {
308                            Connection connection = null;
309                            PreparedStatement pstmt = null;
310                            try {
311    //                              connection = ConnectionFactory.connection( null, null );
312                                    connection = ConnectionFactory.connection( RESOURCE_DBID, null );       // 5.5.4.5 (2012/07/27) 初期起動時のDB接続?は、RESOURCE_DBID とする?
313                                    pstmt = connection.prepareStatement( DEL_SYS );
314                                    pstmt.setString( 1, HybsSystem.sys( "SYSTEM_ID" ) );
315                                    pstmt.setString( 2, HOST_URL );
316                                    int delCnt = pstmt.executeUpdate();
317                                    connection.commit();
318                                    System.out.println( HOST_URL + " DELETE FROM GE12[" + delCnt + "]" );
319                            } catch (HybsSystemException e) {
320                                    LogWriter.log( e );
321                            } catch (SQLException e) {
322                                    Closer.rollback( connection );
323                                    LogWriter.log( e );
324                            }
325                            finally {
326                                    Closer.stmtClose( pstmt );
327                                    ConnectionFactory.close( connection, null );
328                            }
329                    }
330            }
331    
332            /**
333             * soffice.binをkillする処?callします?
334             *
335             * @og.rev 4.3.0.0 (2008/07/18) 新規作?
336             * @og.rev 5.2.2.0 (2010/11/01) 循環参?解消?ため、SystemManager から ProcessFactory へ移?
337             */
338    //      protected static void sofficeKill() {
339    //              System.out.println("Kill all soffice.bin");
340    //              ProcessFactory.kill();
341    //      }
342    
343            // deleteGUIAccessInfo() メソ?でしか使用しな??定数宣?
344            private static final int C_DEL_SYSTEM_ID                = 0;
345            private static final int C_DEL_DYSET                    = 1;
346    
347            /**
348             * アクセス統計テーブル(GE15)の再編成を行います?
349             * ??タの保存期間につ?は、シス?リソースのACCESS_TOKEI_ALIVE_DAYSで?します?
350             * ??タの作?された日時を基準として、上記?期間よりも古?ータは、物?除されます?
351             * ACCESS_TOKEI_ALIVE_DAYSが指定されて???合???タの削除は行われません?
352             *
353             * @og.rev 5.0.2.0 (2009/11/01) 新規作?
354             * @og.rev 5.5.5.1 (2012/08/07) リソース系DBID 付け忘れ対?
355             */
356            protected static void deleteGUIAccessInfo() {
357                    String aliveDays = HybsSystem.sys( "ACCESS_TOKEI_ALIVE_DAYS" );
358                    if( aliveDays == null || aliveDays.length() == 0 ) {
359                            return;
360                    }
361                    String delBaseDate = HybsSystem.getDate( HybsSystem.getDate( "yyyyMMdd" ), -1 * Integer.valueOf( aliveDays ) );
362    
363                    String[] names = new String[] { "SYSTEM_ID","DYSET" };
364                    String[] values = new String[names.length];
365                    values[C_DEL_SYSTEM_ID          ] = HybsSystem.sys( "SYSTEM_ID" );
366                    values[C_DEL_DYSET                      ] = delBaseDate + "000000";
367    
368                    String RESOURCE_DBID    = HybsSystem.sys( "RESOURCE_DBID" );    // 5.5.5.1 (2012/08/07) リソース系DBID 付け忘れ対?
369                    DBSimpleTable dbTable = new DBSimpleTable( names );
370                    dbTable.setApplicationInfo( null );
371                    dbTable.setConnectionID( RESOURCE_DBID );       // 5.5.5.1 (2012/08/07)
372                    dbTable.setTable( "GE15" );
373                    dbTable.setWhere( "SYSTEM_ID = [SYSTEM_ID] and DYSET <= [DYSET]" );
374    
375                    boolean okFlag = false;
376                    try {
377                            dbTable.startDelete();
378                            dbTable.execute( values );
379                            okFlag = true;
380                    }
381                    catch (SQLException ex) {
382                            LogWriter.log( "  アクセス統計テーブル削除時にエラーが発生しました" );
383                            LogWriter.log( ex.getMessage() );
384                    }
385                    finally {
386                            int cnt = dbTable.close( okFlag );
387                            System.out.println();
388                            System.out.println( "  アクセス統計テーブルから、[" + cnt + "]件、削除しました? );
389                    }
390            }
391    
392            /**
393             * UserSummary の??キーに対応した?目をソートす?Comparator を返します?
394             *
395             * キーは、JNAME,ID,IPADDRESS,LOGINTIME の?のどれかです?
396             *
397             * @og.rev 3.8.5.3 (2006/08/07) 新規追?
398             * @og.rev 5.6.6.0 (2013/07/05) Comparator の作り方を?簡?します?そ?ため、??
399             *
400             * @param       key     ソートするキー?を指?
401             * @param       direction       ソートする方向[true:??/false:降?]
402             *
403             * @return  ??キーに対応した?目をソートす?Comparator
404             */
405    //      public static Comparator<UserSummary> getUserSummaryComparator( final String key,final boolean direction ) {
406    //              if( "JNAME,ID,ROLES,IPADDRESS,LOGINTIME".indexOf( key ) < 0 ) {
407    //                      String errMsg = "ソートキーには、JNAME,ID,ROLES,IPADDRESS,LOGINTIME 以外??できません?
408    //                                              + " Key=" + key ;
409    //                      throw new HybsSystemException( errMsg );
410    //              }
411    //
412    //              Comparator<UserSummary> comp = null;
413    //
414    //              if( "JNAME".equals( key ) ) {
415    //                      comp = new JNAME_Comparator( direction );
416    //              }
417    //              else if( "ID".equals( key ) ) {
418    //                      comp = new ID_Comparator( direction );
419    //              }
420    //              else if( "ROLES".equals( key ) ) {
421    //                      comp = new ROLES_Comparator( direction );
422    //              }
423    //              else if( "IPADDRESS".equals( key ) ) {
424    //                      comp = new IPADDRESS_Comparator( direction );
425    //              }
426    //              else if( "LOGINTIME".equals( key ) ) {
427    //                      comp = new LOGINTIME_Comparator( direction );
428    //              }
429    //
430    //              return comp ;
431    //      }
432    
433            /**
434             * UserSummary の Attribute で比??Comparator ?クラスの定義?
435             *
436             * key が?Attribute のキーになりますが、使用するのは、大?化してからです?
437             *
438             * @og.rev 5.6.6.0 (2013/07/05) 新規追?
439             */
440            private static final class ATTRI_Comparator implements Comparator<UserSummary>, Serializable {
441                    private static final long serialVersionUID = 5660 ;             // 5.6.6.0 (2013/07/05)
442                    private final String  key  ;
443                    private final boolean direct ;
444    
445                    /**
446                     * ソート?方向を引数にとるコンストラクタ?
447                     *
448                     * @og.rev 5.6.6.0 (2013/07/05) 新規追?
449                     *
450                     * @param       direction       ソート?方向[true:??/false:降?]
451                     */
452                    public ATTRI_Comparator( final String key,final boolean direction ) {
453                            this.key = key;
454                            direct   = direction;
455                    }
456    
457                    /**
458                     * getAttribute 比?ソ?
459                     * インタフェース Comparable の 実?す?
460                     *
461                     * キーとして、getAttribute( String ) の取得結果を使用する為、null もあり得ます?そ?場合?equals 整合?は取れませんが?
462                     * 処?しては、正常に動作するよ?しておきます?つまり?null はもっとも小さ??とし?比?象がともに null の
463                     * 場合?、同じと判断します?
464                     *
465                     * @og.rev 5.6.6.0 (2013/07/05) 新規追?
466                     *
467                     * @param o1 比?象の??のオブジェク?
468                     * @param o2 比?象の 2 番目のオブジェク?
469                     * @return      ??の引数?2 番目の引数より小さ??合???整数、両方が等し??合? 0、最初?引数?2 番目の引数より大きい場合?正の整数
470                     */
471                    public int compare( final UserSummary o1, final UserSummary o2 ) {
472                            String key1 = o1.getAttribute( key );
473                            String key2 = o2.getAttribute( key );
474    
475                            int rtn ;
476                            if( key1 == null && key2 == null )      { rtn =  0; }
477                            else if( key1 == null )                         { rtn = -1; }
478                            else if( key2 == null )                         { rtn =  1; }
479                            else                                                            { rtn = key1.compareTo( key2 ) ; }
480    
481                            return ( direct ) ? rtn : -rtn;                 // マイナス 0 が気になるが、まあ?良しとする?
482                    }
483            }
484    
485    //      /**
486    //       * JNAME で比??Comparator ?クラスの定義?
487    //       *
488    //       * @og.rev 4.0.0.0 (2006/09/31) 新規追?
489    //       * @og.rev 5.6.6.0 (2013/07/05) ATTRI_Comparator に統合?ため、?
490    //       */
491    //      private static final class JNAME_Comparator implements Comparator<UserSummary>, Serializable {
492    //              private static final long serialVersionUID = 4000 ;     // 4.0.0 (2006/09/31)
493    //              private final boolean direct ;
494    //
495    //              /**
496    //               * ソート?方向を引数にとるコンストラクタ?
497    //               *
498    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
499    //               *
500    //               * @param       direction       ソート?方向[true:??/false:降?]
501    //               */
502    //              public JNAME_Comparator( final boolean direction ) {
503    //                      direct = direction;
504    //              }
505    //
506    //              /**
507    //               * getJname 比?ソ?
508    //               * インタフェース Comparable の 実?す?
509    //               *
510    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
511    //               *
512    //               * @param o1 比?象の??のオブジェク?
513    //               * @param o2 比?象の 2 番目のオブジェク?
514    //               * @return      ??の引数?2 番目の引数より小さ??合???整数、両方が等し??合? 0、最初?引数?2 番目の引数より大きい場合?正の整数
515    //               */
516    //              public int compare( final UserSummary o1, final UserSummary o2 ) {
517    //                      String key1 = o1.getJname();
518    //                      String key2 = o2.getJname();
519    //                      return ( direct ) ? key1.compareTo( key2 ) : key2.compareTo( key1 );
520    //              }
521    //      }
522    //
523    //      /**
524    //       * ID で比??Comparator ?クラスの定義?
525    //       *
526    //       * @og.rev 4.0.0.0 (2006/09/31) 新規追?
527    //       * @og.rev 5.6.6.0 (2013/07/05) ATTRI_Comparator に統合?ため、?
528    //       */
529    //      private static final class ID_Comparator implements Comparator<UserSummary>, Serializable {
530    //              private static final long serialVersionUID = 4000 ;     // 4.0.0 (2006/09/31)
531    //              private final boolean direct ;
532    //
533    //              /**
534    //               * ソート?方向を引数にとるコンストラクタ?
535    //               *
536    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
537    //               *
538    //               * @param       direction       ソート?方向[true:??/false:降?]
539    //               */
540    //              public ID_Comparator( final boolean direction ) {
541    //                      direct = direction;
542    //              }
543    //
544    //              /**
545    //               * getUserID 比?ソ?
546    //               * インタフェース Comparable の 実?す?
547    //               *
548    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
549    //               *
550    //               * @param o1 比?象の??のオブジェク?
551    //               * @param o2 比?象の 2 番目のオブジェク?
552    //               * @return      ??の引数?2 番目の引数より小さ??合???整数、両方が等し??合? 0、最初?引数?2 番目の引数より大きい場合?正の整数
553    //               */
554    //              public int compare( final UserSummary o1, final UserSummary o2 ) {
555    //                      String key1 = o1.getUserID();
556    //                      String key2 = o2.getUserID();
557    //                      return ( direct ) ? key1.compareTo( key2 ) : key2.compareTo( key1 );
558    //              }
559    //      }
560    //
561    //      /**
562    //       * ROLES で比??Comparator ?クラスの定義?
563    //       *
564    //       * @og.rev 4.0.0.0 (2006/09/31) 新規追?
565    //       * @og.rev 5.6.6.0 (2013/07/05) ATTRI_Comparator に統合?ため、?
566    //       */
567    //      private static final class ROLES_Comparator implements Comparator<UserSummary>, Serializable {
568    //              private static final long serialVersionUID = 4000 ;     // 4.0.0 (2006/09/31)
569    //              private final boolean direct ;
570    //
571    //              /**
572    //               * ソート?方向を引数にとるコンストラクタ?
573    //               *
574    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
575    //               *
576    //               * @param       direction       ソート?方向[true:??/false:降?]
577    //               */
578    //              public ROLES_Comparator( final boolean direction ) {
579    //                      direct = direction;
580    //              }
581    //
582    //              /**
583    //               * getRoles 比?ソ?
584    //               * インタフェース Comparable の 実?す?
585    //               *
586    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
587    //               *
588    //               * @param o1 比?象の??のオブジェク?
589    //               * @param o2 比?象の 2 番目のオブジェク?
590    //               * @return      ??の引数?2 番目の引数より小さ??合???整数、両方が等し??合? 0、最初?引数?2 番目の引数より大きい場合?正の整数
591    //               */
592    //              public int compare( final UserSummary o1, final UserSummary o2 ) {
593    //                      String key1 = o1.getRoles();
594    //                      String key2 = o2.getRoles();
595    //                      return ( direct ) ? key1.compareTo( key2 ) : key2.compareTo( key1 );
596    //              }
597    //      }
598    //
599    //      /**
600    //       * IPADDRESS で比??Comparator ?クラスの定義?
601    //       *
602    //       * @og.rev 4.0.0.0 (2006/09/31) 新規追?
603    //       * @og.rev 5.6.6.0 (2013/07/05) ATTRI_Comparator に統合?ため、?
604    //       */
605    //      private static final class IPADDRESS_Comparator implements Comparator<UserSummary>, Serializable {
606    //              private static final long serialVersionUID = 4000 ;     // 4.0.0 (2006/09/31)
607    //              private final boolean direct ;
608    //
609    //              /**
610    //               * ソート?方向を引数にとるコンストラクタ?
611    //               *
612    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
613    //               *
614    //               * @param       direction       ソート?方向[true:??/false:降?]
615    //               */
616    //              public IPADDRESS_Comparator( final boolean direction ) {
617    //                      direct = direction;
618    //              }
619    //
620    //              /**
621    //               * getIPAddress 比?ソ?
622    //               * インタフェース Comparable の 実?す?
623    //               *
624    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
625    //               *
626    //               * @param o1 比?象の??のオブジェク?
627    //               * @param o2 比?象の 2 番目のオブジェク?
628    //               * @return      ??の引数?2 番目の引数より小さ??合???整数、両方が等し??合? 0、最初?引数?2 番目の引数より大きい場合?正の整数
629    //               */
630    //              public int compare( final UserSummary o1, final UserSummary o2 ) {
631    //                      String key1 = o1.getIPAddress();
632    //                      String key2 = o2.getIPAddress();
633    //                      return ( direct ) ? key1.compareTo( key2 ) : key2.compareTo( key1 );
634    //              }
635    //      }
636    //
637    //      /**
638    //       * LOGINTIME で比??Comparator ?クラスの定義?
639    //       *
640    //       * @og.rev 4.0.0.0 (2006/09/31) 新規追?
641    //       * @og.rev 5.6.6.0 (2013/07/05) ATTRI_Comparator に統合?ため、?
642    //       */
643    //      private static final class LOGINTIME_Comparator implements Comparator<UserSummary>, Serializable {
644    //              private static final long serialVersionUID = 4000 ;     // 4.0.0 (2006/09/31)
645    //              private final boolean direct ;
646    //
647    //              /**
648    //               * ソート?方向を引数にとるコンストラクタ?
649    //               *
650    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
651    //               *
652    //               * @param       direction       ソート?方向[true:??/false:降?]
653    //               */
654    //              public LOGINTIME_Comparator( final boolean direction ) {
655    //                      direct = direction;
656    //              }
657    //
658    //              /**
659    //               * getLoginTime 比?ソ?
660    //               * インタフェース Comparable の 実?す?
661    //               *
662    //               * @og.rev 4.0.0.0 (2006/09/31) 新規追?
663    //               *
664    //               * @param o1 比?象の??のオブジェク?
665    //               * @param o2 比?象の 2 番目のオブジェク?
666    //               * @return      ??の引数?2 番目の引数より小さ??合???整数、両方が等し??合? 0、最初?引数?2 番目の引数より大きい場合?正の整数
667    //               */
668    //              public int compare( final UserSummary o1, final UserSummary o2 ) {
669    //                      long key1 = o1.getLoginTime();
670    //                      long key2 = o2.getLoginTime();
671    //                      int rtn = (direct) ? 1:-1 ;
672    //                      return ( key1 == key2 ) ? 0 : (key1 < key2) ? rtn : -rtn ;
673    //              }
674    //      }
675    }