Package com.cin.ejb.statisticsejb

Source Code of com.cin.ejb.statisticsejb.StatisticsEJB

package com.cin.ejb.statisticsejb;

import java.util.logging.Level;

import javax.ejb.Stateless;

import com.cin.dto.GenericRequest;
import com.cin.dto.GenericResponse;
import com.cin.ejb.transactionejb.TransactionRemote;
import com.cin.exceptions.PersistenceException;
import com.cin.jndi.lookup.EJBLookup;
import com.cin.log.EventLogger;
import com.cin.service.StatisticsService;

/**
* Session Bean implementation class StatisticsEJB
*/
@Stateless(mappedName = "StatisticsEJB")
public class StatisticsEJB implements StatisticsEJBRemote {

  static StatisticsService aStatsService;
    /**
     * Default constructor.
     */
    public StatisticsEJB() {
       
    }
    static TransactionRemote aRemote;
    static {
     
      try {
        aRemote = EJBLookup.getInstance().getTransactionEJB();
      }
      catch(Exception pException) {
        EventLogger.getInstance().log(Level.SEVERE, pException.getMessage());
      }
      aStatsService = new StatisticsService();
    }
    public GenericResponse calculateAverageWeeklyWage(GenericRequest pRequest)  {
     
      GenericResponse aResponse = new GenericResponse();
      try {
      aResponse = aStatsService.calculateWeeklyWage(pRequest.getStatistics());
      aResponse.setResponseStatus(true);
      }
      catch(PersistenceException pException) {
       
        aResponse.setErrorMessage(pException.getMessage());
      }
  
      return aResponse;
    }
   
    public GenericResponse calculateAverageIncome(GenericRequest pRequest) {
      GenericResponse aResponse = new GenericResponse();
      try {
      aResponse = aStatsService.calculateAverageIncome(pRequest.getStatistics());
      }
      catch(PersistenceException pException) {
       
        aResponse.setErrorMessage(pException.getMessage());
      }
      return aResponse;
    }
}
TOP

Related Classes of com.cin.ejb.statisticsejb.StatisticsEJB

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.