View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.example.demo.info;
21  
22  import javax.servlet.http.HttpSession;
23  import java.io.Serializable;
24  import java.util.Date;
25  
26  public class Activity implements Serializable {
27  
28    private String sessionId;
29  
30    private Date creationDate;
31  
32    private int jsfRequest;
33  
34    private int ajaxRequest;
35  
36    public Activity(final HttpSession session) {
37      this.sessionId = session.getId();
38      this.creationDate = new Date(session.getCreationTime());
39    }
40  
41    public void executeJsfRequest() {
42      jsfRequest++;
43    }
44  
45    public void executeAjaxRequest() {
46        ajaxRequest++;
47    }
48  
49    public String getSessionId() {
50      return sessionId;
51    }
52  
53    public void setSessionId(final String sessionId) {
54      this.sessionId = sessionId;
55    }
56  
57    public Date getCreationDate() {
58      return creationDate;
59    }
60  
61    public void setCreationDate(final Date creationDate) {
62      this.creationDate = creationDate;
63    }
64  
65    public int getJsfRequest() {
66      return jsfRequest;
67    }
68  
69    public void setJsfRequest(final int jsfRequest) {
70      this.jsfRequest = jsfRequest;
71    }
72  
73    public int getAjaxRequest() {
74      return ajaxRequest;
75    }
76  
77    public void setAjaxRequest(final int ajaxRequest) {
78      this.ajaxRequest = ajaxRequest;
79    }
80  }