View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   
6   package com.hack23.cia.service.dao;
7   
8   import java.util.List;
9   
10  import com.hack23.cia.model.application.impl.common.AbstractActionEvent;
11  
12  /***
13   * The Class EventDAOImpl.
14   */
15  public class EventDAOImpl extends
16          GenericHibernateDAO<AbstractActionEvent, Long> implements EventDAO {
17  
18      /***
19       * Instantiates a new event dao impl.
20       */
21      public EventDAOImpl() {
22          super(AbstractActionEvent.class);
23      }
24  
25      /*
26       * (non-Javadoc)
27       * 
28       * @see com.hack23.cia.service.dao.UserDAO#getActionEventHistory()
29       */
30      @SuppressWarnings("unchecked")
31  	@Override
32      public final List getActionEventHistory() {
33          return this
34                  .getHibernateTemplate()
35                  .find(
36                          "select hour(event.createdDate),count(*) from AbstractActionEvent event group by hour(createdDate)"); //$NON-NLS-1$
37      }
38  
39      /*
40       * (non-Javadoc)
41       * 
42       * @see com.hack23.cia.service.dao.UserDAO#getResponseTimeHistory()
43       */
44      @Override
45  	@SuppressWarnings("unchecked")
46  	public final List getResponseTimeHistory() {
47          return this
48                  .getHibernateTemplate()
49                  .find(
50                          "select hour(event.createdDate),avg(event.executionTime),min(event.executionTime),max(event.executionTime) from AbstractActionEvent event group by hour(createdDate)"); //$NON-NLS-1$
51      }
52  
53  }