1 22 package org.jboss.test.cmp2.enums.ejb; 23 24 import java.util.Collection ; 25 import java.util.List ; 26 import java.util.ArrayList ; 27 import java.util.Iterator ; 28 import javax.ejb.SessionBean ; 29 import javax.ejb.SessionContext ; 30 import javax.ejb.CreateException ; 31 32 41 public class FacadeSessionBean 42 implements SessionBean 43 { 44 46 49 public ColorEnum getColorForId(IDClass id) 50 throws Exception 51 { 52 ChildLocal child = ChildUtil.getLocalHome().findByPrimaryKey(id); 53 return child.getColor(); 54 } 55 56 59 public AnimalEnum getAnimalForId(IDClass id) 60 throws Exception 61 { 62 ChildLocal child = ChildUtil.getLocalHome().findByPrimaryKey(id); 63 return child.getAnimal(); 64 } 65 66 69 public void setColor(IDClass id, ColorEnum color) 70 throws Exception 71 { 72 ChildLocal child = ChildUtil.getLocalHome().findByPrimaryKey(id); 73 child.setColor(color); 74 } 75 76 79 public void setAnimal(IDClass id, AnimalEnum animal) 80 throws Exception 81 { 82 ChildLocal child = ChildUtil.getLocalHome().findByPrimaryKey(id); 83 child.setAnimal(animal); 84 } 85 86 89 public void createChild(IDClass childId) 90 throws Exception 91 { 92 ChildUtil.getLocalHome().create(childId); 93 } 94 95 98 public void removeChild(IDClass childId) 99 throws Exception 100 { 101 ChildUtil.getLocalHome().remove(childId); 102 } 103 104 107 public IDClass findByColor(ColorEnum color) 108 throws Exception 109 { 110 ChildLocal child = ChildUtil.getLocalHome().findByColor(color); 111 return child.getId(); 112 } 113 114 117 public IDClass findAndOrderByColor(ColorEnum color) 118 throws Exception 119 { 120 ChildLocal child = ChildUtil.getLocalHome().findAndOrderByColor(color); 121 return child.getId(); 122 } 123 124 127 public IDClass findByColorDeclaredSql(ColorEnum color) 128 throws Exception 129 { 130 ChildLocal child = ChildUtil.getLocalHome().findByColorDeclaredSql(color); 131 return child.getId(); 132 } 133 134 137 public List findLowColor(ColorEnum color) 138 throws Exception 139 { 140 Collection children = ChildUtil.getLocalHome().findLowColor(color); 141 List ids = new ArrayList (children.size()); 142 for(Iterator i = children.iterator(); i.hasNext();) 143 { 144 ChildLocal child = (ChildLocal)i.next(); 145 ids.add(child.getId()); 146 } 147 return ids; 148 } 149 150 152 156 public void ejbCreate() throws CreateException 157 { 158 } 159 160 public void ejbActivate() 161 { 162 } 163 164 public void ejbPassivate() 165 { 166 } 167 168 public void ejbRemove() 169 { 170 } 171 172 public void setSessionContext(SessionContext ctx) 173 { 174 } 175 } 176 | Popular Tags |