Package com.pre.service.base

Source Code of com.pre.service.base.DivisionManagerService

package com.pre.service.base;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

import com.pre.entity.base.Division;
import com.pre.service.exception.PREEJBServiceException;
import com.pre.session.base.DivisionManager;

/**
* Session Bean implementation class DivisionManagerService
*/
@WebService
@Stateless
public class DivisionManagerService {


  @EJB
  private DivisionManager manager;

  /**
   * Default constructor.
   */
  public DivisionManagerService() {
  }

  @WebMethod
  public void create(@WebParam(name="code") String code) throws PREEJBServiceException{
    try{
      Division d=new Division();
      d.setCode(code);
      manager.create(d);
    }catch (Exception e) {
      throw new PREEJBServiceException(e.getMessage());
    }
  }

  @WebMethod
  public long findByCode(@WebParam(name="code") String code) throws PREEJBServiceException{
    List<Division> ds=manager.findByCode(code);
    if(ds.isEmpty()){
      throw new PREEJBServiceException("No such division code=["+code+"]");
    }
    return ds.get(0).getId();
  }
 
 
 

}
TOP

Related Classes of com.pre.service.base.DivisionManagerService

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.