schedulerbean.java

来自「100多M的J2EE培训内容」· Java 代码 · 共 225 行

JAVA
225
字号
package com.borland.training.meetings.sessions;import javax.ejb.*;import java.util.*;public class SchedulerBean implements SessionBean {  private SessionContext sessionContext;  private RoomManager roomManager;  private MeetingManager meetingManager;  private AttendeeManager attendeeManager;  private RoomValueFactory roomValueFactory;  private MeetingValueFactory meetingValueFactory;  private AttendeeValueFactory attendeeValueFactory;  public void ejbCreate() throws CreateException {    try {      roomManager = RoomManager.getInstance();      meetingManager = MeetingManager.getInstance();      attendeeManager = AttendeeManager.getInstance();      roomValueFactory = RoomValueFactory.getInstance();      meetingValueFactory = MeetingValueFactory.getInstance();      attendeeValueFactory = AttendeeValueFactory.getInstance();    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void ejbRemove() {  }  public void setSessionContext(SessionContext sessionContext) {    this.sessionContext = sessionContext;  }  public void ejbActivate() {  }  public void ejbPassivate() {  }  public String createRoom(RoomValue roomValue) {    try {      String name = roomManager.createRoom(roomValue);      return name;    }    catch(Exception e) {      throw new EJBException(e);    }  }  public RoomValue findRoom(String name) {    try {      return roomValueFactory.getRoom(name);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public Collection findAllRooms() {    try {      return roomValueFactory.getAllRooms();    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void updateRoom(RoomValue roomValue) {    try {      roomManager.updateRoom(roomValue);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void removeRoom(String name) {    try {      roomManager.removeRoom(name);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void removeAllRooms() {    try {      roomManager.removeAllRooms();    }    catch(Exception e) {      throw new EJBException(e);    }  }  public Long createMeeting(MeetingValue meetingValue) {    try {      Long id = meetingManager.createMeeting(meetingValue);      return id;    }    catch(Exception e) {      throw new EJBException(e);    }  }  public MeetingValue findMeeting(Long id) {    try {      return meetingValueFactory.getMeeting(id);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public Collection findMeetingsOfAttendee(Long id) {    try {      return meetingValueFactory.getMeetingsOfAttendee(id);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public Collection findAllMeetings() {    try {      return meetingValueFactory.getAllMeetings();    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void updateMeeting(MeetingValue meetingValue) {    try {      meetingManager.updateMeeting(meetingValue);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void removeMeeting(Long id) {    try {      meetingManager.removeMeeting(id);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void removeAllMeetings() {    try {      meetingManager.removeAllMeetings();    }    catch(Exception e) {      throw new EJBException(e);    }  }  public Long createAttendee(AttendeeValue attendeeValue) {    try {      return attendeeManager.createAttendee(attendeeValue);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public AttendeeValue findAttendee(Long id) {    try {      return attendeeValueFactory.getAttendee(id);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public Collection findAttendeesByName(String name) {    try {      return attendeeValueFactory.getAttendeesByName(name);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public Collection findAllAttendees() {    try {      return attendeeValueFactory.getAllAttendees();    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void updateAttendee(AttendeeValue attendeeValue) {    try {      attendeeManager.updateAttendee(attendeeValue);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void removeAttendee(Long id) {    try {      attendeeManager.removeAttendee(id);    }    catch(Exception e) {      throw new EJBException(e);    }  }  public void removeAllAttendees() {    try {      attendeeManager.removeAllAttendees();    }    catch(Exception e) {      throw new EJBException(e);    }  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?