?? perspectivecontroller.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 + -