1 package hero.entity; 2 3 import hero.interfaces.BnAgentLocal; 4 import hero.interfaces.BnAgentLocalHome; 5 import hero.interfaces.BnEdgeLocal; 6 import hero.interfaces.BnEdgeLocalHome; 7 import hero.interfaces.BnNodeLocal; 8 import hero.interfaces.BnNodeLocalHome; 9 import hero.interfaces.BnProjectLightValue; 10 import hero.interfaces.BnProjectLocal; 11 import hero.interfaces.BnProjectConfigLocal; 12 import hero.interfaces.BnProjectLocalHome; 13 import hero.interfaces.BnProjectPK; 14 import hero.interfaces.BnProjectValue; 15 import hero.interfaces.InvalidValueException; 16 import hero.interfaces.SequenceGenerator; 17 import hero.interfaces.SequenceGeneratorHome; 18 import hero.interfaces.SequenceGeneratorLocal; 19 import hero.interfaces.SequenceGeneratorLocalHome; 20 import hero.interfaces.SequenceGeneratorUtil; 21 import hero.util.HeroException; 22 import hero.util.values.BonitaProjectValue; 23 24 import java.rmi.RemoteException ; 25 import java.util.Date ; 26 import java.util.Collection ; 27 28 import javax.ejb.CreateException ; 29 import javax.ejb.EJBException ; 30 import javax.ejb.EntityBean ; 31 import javax.ejb.EntityContext ; 32 import javax.ejb.FinderException ; 33 import javax.ejb.RemoveException ; 34 import javax.naming.NamingException ; 35 36 import org.apache.log4j.Category; 37 38 128 public abstract class BnProjectBean implements EntityBean { 129 130 private static final Category log = Category.getInstance(BnProjectBean.class); 137 public EntityContext mContext; 138 139 140 144 160 public abstract String getId(); 161 162 168 public abstract void setId(String pId); 169 170 182 183 public abstract String getParent(); 184 185 192 public abstract void setParent(String parent); 193 194 206 public abstract String getName(); 207 208 214 public abstract void setName(String pName); 215 216 227 228 public abstract String getStatus(); 229 230 237 public abstract void setStatus(String status); 238 239 250 251 public abstract String getType(); 252 253 260 public abstract void setType(String type); 261 262 273 public abstract String getCreator(); 274 275 281 public abstract void setCreator(String pCreator); 282 283 293 public abstract int getState(); 294 295 302 public abstract void setState(int pState); 303 304 310 public abstract BonitaProjectValue getModel(); 311 312 317 public abstract void setModel(BonitaProjectValue v); 318 319 328 public abstract BnProjectConfigLocal getBnProjectConfig(); 329 330 337 public abstract void setBnProjectConfig( BnProjectConfigLocal config); 338 339 355 public abstract Collection getBnNodes(); 356 357 364 public abstract void setBnNodes(Collection pNodes); 365 366 382 public abstract Collection getBnEdges(); 383 384 391 public abstract void setBnEdges(Collection pEdges); 392 393 409 public abstract Collection getBnAgents(); 410 411 418 public abstract void setBnAgents(Collection pAgents); 419 420 436 public abstract Collection getBnAgentEdges(); 437 438 445 public abstract void setBnAgentEdges(Collection pAgentEdges); 446 447 466 public abstract Collection getBnUsers(); 467 468 476 public abstract void setBnUsers(Collection pUsers); 477 478 497 public abstract Collection getBnRoles(); 498 499 507 public abstract void setBnRoles(Collection pRoles); 508 509 516 public abstract Date getCreationDate(); 517 518 526 public abstract void setCreationDate(Date pDate); 527 528 537 public abstract Date getEndDate(); 538 539 545 public abstract void setEndDate(Date pDate); 546 547 553 public BnNodeLocal getBnNode(String nodeName) throws HeroException { 554 BnNodeLocalHome nodehome; 555 BnNodeLocal node; 556 try { 557 nodehome = hero.interfaces.BnNodeUtil.getLocalHome(); 558 } catch (javax.naming.NamingException be) { 559 throw new HeroException(be.getMessage()); 560 } 561 try { 562 node = nodehome.findByName(nodeName, this.getId()); 563 } catch (FinderException fe) { 564 throw new HeroException("No BnNode with this name"); 565 } 566 567 return node; 568 } 569 570 576 public BnAgentLocal getBnAgent(String agentName) throws HeroException { 577 BnAgentLocalHome agenthome; 578 BnAgentLocal agent; 579 try { 580 agenthome = hero.interfaces.BnAgentUtil.getLocalHome(); 581 } catch (javax.naming.NamingException be) { 582 throw new HeroException(be.getMessage()); 583 } 584 try { 585 agent = agenthome.findByName(agentName, this.getId()); 586 } catch (FinderException fe) { 587 throw new HeroException("No BnAgent with this name"); 588 } 589 return agent; 590 } 591 592 598 public BnEdgeLocal getBnEdge(String edgeName) throws HeroException { 599 BnEdgeLocalHome edgehome; 600 BnEdgeLocal edge; 601 try { 602 edgehome = hero.interfaces.BnEdgeUtil.getLocalHome(); 603 } catch (javax.naming.NamingException be) { 604 throw new HeroException(be.getMessage()); 605 } 606 try { 607 edge = edgehome.findByName(edgeName, this.getId()); 608 } catch (FinderException fe) { 609 throw new HeroException("No BnEdge with this name"); 610 } 611 612 return edge; 613 } 614 615 632 public abstract Collection getBnProperties(); 633 634 640 public abstract void setBnProperties(Collection pPrp); 641 642 643 660 public abstract Collection getBnIterations(); 661 662 668 public abstract void setBnIterations(Collection ite); 669 670 687 public abstract Collection getBnHooks(); 688 689 695 public abstract void setBnHooks(Collection pHooks); 696 697 715 public abstract Collection getBnInterHooks(); 716 717 723 public abstract void setBnInterHooks(Collection pHooks); 724 725 729 public abstract BnProjectValue getBnProjectValue(); 730 731 735 public abstract BnProjectLightValue getBnProjectLightValue(); 736 737 741 public abstract void setBnProjectValue(BnProjectValue v); 742 743 744 745 749 764 public BnProjectPK ejbCreate() 765 throws InvalidValueException, EJBException , CreateException { 766 this.setId(hero.interfaces.BnProjectUtil.generateGUID(this)); 768 769 return null; 771 } 772 773 787 public BnProjectPK ejbCreate(String pName, String creator) 788 throws InvalidValueException, EJBException , CreateException { 789 log.debug("ejbCreate: pName=" + pName + " creator=" + creator); 790 BnProjectLocalHome projecthome; 791 BnProjectLocal project; 792 793 try { 794 projecthome = hero.interfaces.BnProjectUtil.getLocalHome(); 795 } catch (javax.naming.NamingException be) { 796 throw new CreateException (be.getMessage()); 797 } 798 try { 799 project = projecthome.findByName(pName); 800 throw new CreateException ("BnProject " + pName + " already exist"); 801 } catch (FinderException fe) { 802 this.setId(hero.interfaces.BnAgentUtil.generateGUID(this)); 803 804 try{ 805 SequenceGeneratorHome sgHome = SequenceGeneratorUtil.getHome(); 806 SequenceGenerator sg = sgHome.create(); 807 808 this.setId(new Integer (sg.getNextNumber("BnProject")).toString()); 809 810 if (pName.matches(".*_instance.*")) 811 this.setName(pName+this.getId()); 812 else 813 this.setName(pName); 814 this.setCreator(creator); 815 816 }catch ( NamingException ne ) { 817 throw new CreateException ( "Naming lookup failure: " + ne.getMessage() ); 818 }catch ( RemoteException re ) { 819 throw new CreateException (re.getMessage() ); 820 } 821 } 822 823 return null; 825 } 826 827 public void setEntityContext(EntityContext lContext) { 828 mContext = lContext; 829 } 830 831 public void unsetEntityContext() { 832 mContext = null; 833 } 834 835 public void ejbActivate() { 836 } 837 838 public void ejbPassivate() { 839 } 840 841 public void ejbLoad() { 842 } 843 844 public void ejbStore() { 845 } 846 847 public void ejbRemove() throws RemoveException { 848 } 849 } 850 | Popular Tags |