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

📄 conflictcontroller.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.conflictmd.conflict.ejb.ConflictLocal;import org.impact.stars.conflictmd.conflict.ejb.ConflictLocalHome;import org.impact.stars.organizationmd.profilemgr.ejb.ProfileMgrLocal;import org.impact.stars.organizationmd.profilemgr.ejb.ProfileMgrLocalHome;import org.impact.stars.control.event.ConflictEvent;import org.impact.stars.control.event.StarsEvent;import org.impact.stars.control.exceptions.StarsEventException;import org.impact.stars.conflictmd.conflict.exceptions.ConflictAppException;import org.impact.stars.control.exceptions.StarsAppException;/*import org.impact.stars.control.exceptions.DuplicateAccountException;*/public class ConflictController extends StateControllerSupport {  public void perform(StarsEvent event) throws StarsEventException {        ConflictEvent ce = (ConflictEvent)event;        switch (ce.getActionType()) {        case ConflictEvent.CREATE_CONFLICT: {            Debug.println("ConflictController (ejb): CREATE_CONFLICT event");            try {               ConflictLocalHome home = EJBUtil.getConflictLocalHome();               ConflictLocal cpt = home.create(ce.getConflictID(), ce.getName(), ce.getDetectTime(),                             ce.getResolveTime(), ce.getScale(), ce.getType(), ce.getStatus(),                             ce.getPStakeholder(), ce.getStrategy(), ce.getDescription());               Debug.println("ConflictController: created Conflict Conflict for " + ce.getConflictID());            } catch (CreateException cre) {                throw new StarsAppException("Unable to create a new Conflict for " + ce.getConflictID() + " at this time");            }  catch (javax.naming.NamingException nme) {                throw new EJBException("Irrecoverable error creating Conflict: " + ce);            }        } break;          case ConflictEvent.UPDATE_CONFLICT: {            Debug.println("ConflictController (ejb): UPDATE_CONFLICT event");            try {               Debug.println("ConflictController (ejb): updating Conflict Conflict for " + ce.getConflictID());               ConflictLocalHome home = EJBUtil.getConflictLocalHome();               ConflictLocal cpt = home.findByPrimaryKey(ce.getConflictID());               cpt.updateConflict(ce.getName(), ce.getDetectTime(),                             ce.getResolveTime(), ce.getScale(), ce.getType(), ce.getStatus(),                             ce.getPStakeholder(), ce.getStrategy(), ce.getDescription());                           } catch (javax.ejb.FinderException fde) {                throw new StarsAppException("Unable to find an Conflict/profile with Conflict id : " + ce.getConflictID());            } catch (javax.ejb.NoSuchEntityException nee) {                throw new StarsAppException("Unable to find an Conflict/profile with Conflict id : " + ce.getConflictID());            } catch (javax.naming.NamingException nme) {                Debug.println("ConflictController naming exception: " + nme);                throw new EJBException("Irrecoverable error while updating Conflict : " + nme);            }        } break;        case ConflictEvent.DELETE_CONFLICT: {            Debug.println("ConflictController (ejb): DELETE_CONFLICT event");            try {               Debug.println("ConflictController (ejb): deleting Conflict Conflict for " + ce.getConflictID());               ConflictLocalHome home = EJBUtil.getConflictLocalHome();               ConflictLocal cpt = home.findByPrimaryKey(ce.getConflictID());               cpt.remove();                           }catch (javax.ejb.FinderException fe) {                throw new StarsAppException("Unable to find an Conflict/profile with Conflict id : " + ce.getConflictID());                         } catch (javax.ejb.RemoveException rme) {                throw new StarsAppException("Unable to remove an Conflict/profile with Conflict id : " + ce.getConflictID());            } catch (javax.naming.NamingException nme) {                Debug.println("ConflictController naming exception: " + nme);                throw new EJBException("Irrecoverable error while updating Conflict : " + nme);            }        } break;        default:            Debug.print("Error: not implemented yet");            break;        }  }}

⌨️ 快捷键说明

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