1 package org.objectweb.jonas.jtests.beans.relation.tier; 2 3 import javax.ejb.SessionContext ; 4 import javax.naming.NamingException ; 5 import javax.ejb.CreateException ; 6 import javax.ejb.FinderException ; 7 import javax.ejb.EJBException ; 8 import javax.ejb.RemoveException ; 9 10 import java.rmi.RemoteException ; 11 import java.util.ArrayList ; 12 import java.util.Collection ; 13 import java.util.Iterator ; 14 15 public class TestFacadeBean { 16 17 private SessionContext _ctx; 18 19 protected int nbMaxLignes = 20; 20 21 protected TierLocalHome getTierLocalHome() throws NamingException { 23 return TierUtil.getLocalHome(); 24 } 25 26 public TierValue create(TierValue value) throws CreateException , RemoteException , FinderException , NamingException { 27 return getTierLocalHome().create(value).getTierValue(); 28 } 29 30 public TierValue findTierByKey(java.lang.Integer pk) throws FinderException , RemoteException , NamingException { 31 return getTierLocalHome().findByPrimaryKey(pk).getTierValue(); 32 } 33 34 public TiephyValue getTiephyValueOfTier(java.lang.Integer pk) throws FinderException , NamingException , 35 RemoteException { 36 return getTierLocalHome().findByPrimaryKey(pk).getTiephyValue(); 37 } 38 39 public TiemorValue getTiemorValueOfTier(java.lang.Integer pk) throws FinderException , NamingException , 40 RemoteException { 41 return getTierLocalHome().findByPrimaryKey(pk).getTiemorValue(); 42 } 43 44 public void update(TierValue value) throws FinderException , NamingException , RemoteException { 45 getTierLocalHome().findByPrimaryKey(value.getPrimaryKey()).update(value); 46 } 47 48 public java.util.Collection tierfindByTiemorOrTiephy(java.lang.String nom) throws FinderException , RemoteException , 49 NamingException { 50 Collection col = getTierLocalHome().findByTiemorOrTiephy(nom); 51 Iterator ite = col.iterator(); 52 TierLocal tl = null; 53 ArrayList al = new ArrayList (); 54 int page = 0; 55 while (ite.hasNext()) { 56 tl = (TierLocal) ite.next(); 57 if (page < nbMaxLignes) 58 al.add(tl.getTierValue()); 59 else 60 al.add(tl.getPrimaryKey()); 61 page++; 62 } 63 return al; 64 } 65 66 public void removeTier(java.lang.Integer pk) throws FinderException , NamingException , EJBException , RemoveException { 67 try { 68 getTierLocalHome().findByPrimaryKey(pk).remove(); 69 } catch (EJBException e) { 70 e.printStackTrace(); 72 } catch (RemoveException e) { 73 e.printStackTrace(); 75 } catch (FinderException e) { 76 e.printStackTrace(); 78 } catch (NamingException e) { 79 e.printStackTrace(); 81 } 82 } 83 84 public java.util.Collection getTierValueWithCollectionPK(Collection pks) throws RemoteException , FinderException , 85 NamingException { 86 ArrayList al = new ArrayList (); 87 Iterator ite = pks.iterator(); 88 java.lang.Integer pk = null; 89 while (ite.hasNext()) { 90 pk = (java.lang.Integer ) ite.next(); 91 al.add(findTierByKey(pk)); 92 } 93 return al; 94 } 95 96 public void ejbCreate() throws CreateException { 97 } 98 99 public void setSessionContext(SessionContext ctx) { 100 _ctx = ctx; 101 } 102 103 public void ejbActivate() { 104 } 105 106 public void ejbPassivate() { 107 } 108 109 public void unsetSessionContext() { 110 } 111 112 public void ejbRemove() { 113 } 114 115 } | Popular Tags |