1 22 23 package org.jboss.ejb3.test.jacc; 24 25 import javax.annotation.security.RolesAllowed; 26 import javax.annotation.security.PermitAll; 27 import javax.ejb.Remote ; 28 import javax.persistence.EntityManager; 29 import javax.persistence.PersistenceContext; 30 31 import org.jboss.annotation.security.SecurityDomain; 32 import org.jboss.annotation.ejb.AspectDomain; 33 34 39 @javax.ejb.Stateless 40 @Remote (Stateless.class) 41 @SecurityDomain ("other") 42 public class StatelessBean implements Stateless 44 { 45 @PersistenceContext 48 EntityManager em; 49 50 @PermitAll 51 public int unchecked(int i) 52 { 53 System.out.println("stateless unchecked"); 54 return i; 55 } 56 57 @RolesAllowed ("allowed") 58 public int checked(int i) 59 { 60 System.out.println("stateless checked"); 61 return i; 62 } 63 64 @PermitAll 65 public AllEntity insertAllEntity() 66 { 67 AllEntity e = new AllEntity(); 68 e.val = "x"; 69 em.persist(e); 70 return e; 71 } 72 73 @PermitAll 74 public AllEntity readAllEntity(int key) 75 { 76 AllEntity e = em.find(AllEntity.class, key); 77 return e; 78 } 79 80 @PermitAll 81 public void updateAllEntity(AllEntity e) 82 { 83 em.merge(e); 84 } 85 86 @PermitAll 87 public void deleteAllEntity(AllEntity e) 88 { 89 em.remove(e); 90 } 91 92 @PermitAll 93 public StarEntity insertStarEntity() 94 { 95 StarEntity e = new StarEntity(); 96 e.val = "x"; 97 em.persist(e); 98 return e; 99 } 100 101 @PermitAll 102 public StarEntity readStarEntity(int key) 103 { 104 StarEntity e = em.find(StarEntity.class, key); 105 return e; 106 } 107 108 @PermitAll 109 public void updateStarEntity(StarEntity e) 110 { 111 em.merge(e); 112 } 113 114 @PermitAll 115 public void deleteStarEntity(StarEntity e) 116 { 117 em.remove(e); 118 } 119 120 121 @PermitAll 122 public SomeEntity insertSomeEntity() 123 { 124 SomeEntity e = new SomeEntity(); 125 e.val = "x"; 126 em.persist(e); 127 return e; 128 } 129 130 @PermitAll 131 public SomeEntity readSomeEntity(int key) 132 { 133 SomeEntity e = em.find(SomeEntity.class, key); 134 return e; 135 } 136 137 @PermitAll 138 public void updateSomeEntity(SomeEntity e) 139 { 140 em.merge(e); 141 } 142 143 @PermitAll 144 public void deleteSomeEntity(SomeEntity e) 145 { 146 em.remove(e); 147 } 148 } 149 | Popular Tags |