SchedulerBean.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:5k
源码类别:
Java编程
开发平台:
Java
- 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);
- }
- }
- }