⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reviewcontroller.java

📁 J2EE & Tomcat books published by hope
💻 JAVA
字号:
/* */package org.impact.stars.control.ejb;import java.rmi.RemoteException;import javax.naming.InitialContext;import javax.naming.NamingException;import javax.ejb.CreateException;import javax.ejb.DuplicateKeyException;import javax.ejb.FinderException;import javax.ejb.EJBException;import org.impact.stars.util.Debug;import org.impact.stars.util.JNDINames;import org.impact.stars.util.EJBUtil;import org.impact.stars.util.EJBKeys;import org.impact.stars.perspectivemd.review.ejb.ReviewLocal;import org.impact.stars.perspectivemd.review.ejb.ReviewLocalHome;import org.impact.stars.organizationmd.profilemgr.ejb.ProfileMgrLocal;import org.impact.stars.organizationmd.profilemgr.ejb.ProfileMgrLocalHome;import org.impact.stars.control.event.ReviewEvent;import org.impact.stars.control.event.StarsEvent;import org.impact.stars.control.exceptions.StarsEventException;import org.impact.stars.perspectivemd.review.exceptions.ReviewAppException;import org.impact.stars.control.exceptions.StarsAppException;public class ReviewController extends StateControllerSupport {        public void perform(StarsEvent event) throws StarsEventException {        ReviewEvent pe = (ReviewEvent)event;                switch (pe.getActionType()) {            case ReviewEvent.CREATE_REVIEW_DATA: {                Debug.println("ReviewController (ejb): CREATE_REVIEW_DATA event");                try {                    ReviewLocalHome home = EJBUtil.getReviewLocalHome();                    ReviewLocal cpt = home.create(pe.getReviewID(), pe.getPerspectiveID(),                            pe.getConceptID(), pe.getReviewerID(), pe.getReviewtime(),  pe.getConflictRatio(),                            pe.getRpurpose(), pe.getRcontext(), pe.getRcontent(), pe.getOverall());                    Debug.println("ReviewController: created Review Review for " + pe.getReviewID());                } catch (CreateException cre) {                    Debug.println(cre.toString());                    throw new StarsAppException("Unable to create a new Review for " + pe.getReviewID() + " at this time");                }  catch (javax.naming.NamingException nme) {                    Debug.println(nme.toString());                    throw new EJBException("Irrecoverable error creating Review: " + pe);                }            } break;            case ReviewEvent.UPDATE_REVIEW_DATA: {                Debug.println("ReviewController (ejb): UPDATE_PERSPECTIVE event");                try {                    Debug.println("ReviewController (ejb): updating Review Review for " + pe.getReviewID());                    ReviewLocalHome home = EJBUtil.getReviewLocalHome();                    ReviewLocal cpt = home.findByPrimaryKey(pe.getReviewID());                    cpt.updateReview(pe.getReviewtime(),  pe.getConflictRatio(),                            pe.getRpurpose(), pe.getRcontext(), pe.getRcontent(), pe.getOverall());                } catch (javax.ejb.FinderException fde) {                    Debug.println(fde.toString());                                        throw new StarsAppException("Unable to find an Review/profile with Review id : " + pe.getReviewID());                } catch (javax.ejb.NoSuchEntityException nee) {                    Debug.println(nee.toString());                                        throw new StarsAppException("Unable to find an Review/profile with Review id : " + pe.getReviewID());                } catch (javax.naming.NamingException nme) {                    Debug.println("ReviewController naming exception: " + nme);                    throw new EJBException("Irrecoverable error while updating Review : " + nme);                }            } break;            case ReviewEvent.DELETE_REVIEW: {                Debug.println("ReviewController (ejb): DELETE_PERSPECTIVE event");                try {                    Debug.println("ReviewController (ejb): deleting Review Review for " + pe.getReviewID());                    ReviewLocalHome home = EJBUtil.getReviewLocalHome();                    ReviewLocal psp = home.findByPrimaryKey(pe.getReviewID());                    psp.remove();                }catch (javax.ejb.FinderException fe) {                    throw new StarsAppException("Unable to find an Review/profile with Review id : " + pe.getReviewID());                } catch (javax.ejb.RemoveException rme) {                    throw new StarsAppException("Unable to remove an Review/profile with Review id : " + pe.getReviewID());                } catch (javax.naming.NamingException nme) {                    Debug.println("ReviewController naming exception: " + nme);                    throw new EJBException("Irrecoverable error while updating Review : " + nme);                }            } break;            default:                Debug.print("Error: not implemented yet");                break;        }    }}

⌨️ 快捷键说明

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