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

📄 perspectivecontroller.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.perspective.ejb.PerspectiveLocal;import org.impact.stars.perspectivemd.perspective.ejb.PerspectiveLocalHome;import org.impact.stars.organizationmd.profilemgr.ejb.ProfileMgrLocal;import org.impact.stars.organizationmd.profilemgr.ejb.ProfileMgrLocalHome;import org.impact.stars.control.event.PerspectiveEvent;import org.impact.stars.control.event.StarsEvent;import org.impact.stars.control.exceptions.StarsEventException;import org.impact.stars.perspectivemd.perspective.exceptions.PerspectiveAppException;import org.impact.stars.control.exceptions.StarsAppException;public class PerspectiveController extends StateControllerSupport {        public void perform(StarsEvent event) throws StarsEventException {        PerspectiveEvent pe = (PerspectiveEvent)event;                switch (pe.getActionType()) {            case PerspectiveEvent.CREATE_PERSPECTIVE_DATA: {                Debug.println("PerspectiveController (ejb): CREATE_PERSPECTIVE_DATA event");                try {                    PerspectiveLocalHome home = EJBUtil.getPerspectiveLocalHome();                    PerspectiveLocal cpt = home.create(pe.getPerspectiveID(), pe.getName(), pe.getConceptID(),                    pe.getStakeholderID(), pe.getDeclaretime(), pe.getProjectID(),                    pe.getPurpose(), pe.getContext(), pe.getContent());                    System.out.println("pe. stakeholder" + pe.getStakeholderID());                    Debug.println("PerspectiveController: created Perspective Perspective for " + pe.getPerspectiveID());                } catch (CreateException cre) {                    Debug.println(cre.toString());                    throw new StarsAppException("Unable to create a new Perspective for " + pe.getPerspectiveID() + " at this time");                }  catch (javax.naming.NamingException nme) {                    Debug.println(nme.toString());                    throw new EJBException("Irrecoverable error creating Perspective: " + pe);                }            } break;            case PerspectiveEvent.UPDATE_PERSPECTIVE_DATA: {                Debug.println("PerspectiveController (ejb): UPDATE_PERSPECTIVE event");                try {                    Debug.println("PerspectiveController (ejb): updating Perspective Perspective for " + pe.getPerspectiveID());                    PerspectiveLocalHome home = EJBUtil.getPerspectiveLocalHome();                    PerspectiveLocal cpt = home.findByPrimaryKey(pe.getPerspectiveID());                    cpt.updatePerspective(pe.getName(), pe.getConceptID(),                    pe.getStakeholderID(), pe.getDeclaretime(), pe.getProjectID(),                    pe.getPurpose(), pe.getContext(), pe.getContent());                } catch (javax.ejb.FinderException fde) {                    Debug.println(fde.toString());                                        throw new StarsAppException("Unable to find an Perspective/profile with Perspective id : " + pe.getPerspectiveID());                } catch (javax.ejb.NoSuchEntityException nee) {                    Debug.println(nee.toString());                                        throw new StarsAppException("Unable to find an Perspective/profile with Perspective id : " + pe.getPerspectiveID());                } catch (javax.naming.NamingException nme) {                    Debug.println("PerspectiveController naming exception: " + nme);                    throw new EJBException("Irrecoverable error while updating Perspective : " + nme);                }            } break;            case PerspectiveEvent.DELETE_PERSPECTIVE: {                Debug.println("PerspectiveController (ejb): DELETE_PERSPECTIVE event");                try {                    Debug.println("PerspectiveController (ejb): deleting Perspective Perspective for " + pe.getPerspectiveID());                    PerspectiveLocalHome home = EJBUtil.getPerspectiveLocalHome();                    PerspectiveLocal psp = home.findByPrimaryKey(pe.getPerspectiveID());                    psp.remove();                }catch (javax.ejb.FinderException fe) {                    throw new StarsAppException("Unable to find an Perspective/profile with Perspective id : " + pe.getPerspectiveID());                } catch (javax.ejb.RemoveException rme) {                    throw new StarsAppException("Unable to remove an Perspective/profile with Perspective id : " + pe.getPerspectiveID());                } catch (javax.naming.NamingException nme) {                    Debug.println("PerspectiveController naming exception: " + nme);                    throw new EJBException("Irrecoverable error while updating Perspective : " + nme);                }            } break;            default:                Debug.print("Error: not implemented yet");                break;        }    }}

⌨️ 快捷键说明

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