Enterprise Java and UML 2nd Edition PHẦN 4

30 RecordTimeWorkflowSessionBean { /** Answers a reference to the newly created Activity bean. */ public RecordTimeWorkflow create(String username) throws RemoteException, CreateException; } is the implementation class for the RecordTimeWorkflow session bean. Most of this code should be somewhere between familiar and monotonous, by this point. However, there is one new wrinkle, as the ejbCreate method finds a User entity bean based on the username parameter. This bean reference is kept for the duration of the stateful session. The RecordTimeWorkflow session bean wraps the data for a timecard into a custom TimecardDTO object. package ; import import import import import import import import. | 30 RecordTimeWorkflowSessionBean Answers a reference to the newly created Activity bean. public RecordTimeWorkflow create String username throws RemoteException CreateException is the implementation class for the RecordTimeWorkflow session bean. Most of this code should be somewhere between familiar and monotonous by this point. However there is one new wrinkle as the ejbCreate method finds a User entity bean based on the username parameter. This bean reference is kept for the duration of the stateful session. The RecordTimeWorkflow session bean wraps the data for a timecard into a custom TimecardDTO object. package import . import . import . import import . import . import . import . import . The RecordTimeWorkflow allows client objects to record their time. RecordTimeWorkflowBean is the actual session bean implementation. public class RecordTimeWorkflowBean extends BasicSessionBean private UserLocal user public void ejbCreate String username throws CreateException try creating RecordTimeWorkflowBean with user - n username Context initialContext getInitialContext UserLocalHome userHome UserLocalHome EjbReferenceNames. n USER_HOME Collection users username Iterator userIterator RecordTimeWorkflowSessionBean 31 if UserLocal done creating RecordTimeWorkflowBean with user - username catch NamingException e throw new CreateException User Bean Not Found catch FinderException e throw new CreateException User username Not Found public void ejbPostCreate String username .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
476    18    1    29-11-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.