| .. | .. |
|---|
| 9 | 9 | import javax.inject.Inject; |
|---|
| 10 | 10 | import javax.persistence.EntityManager; |
|---|
| 11 | 11 | import javax.persistence.TypedQuery; |
|---|
| 12 | | -import javax.transaction.Transactional; |
|---|
| 13 | 12 | import javax.ws.rs.Consumes; |
|---|
| 14 | 13 | import javax.ws.rs.DELETE; |
|---|
| 15 | 14 | import javax.ws.rs.FormParam; |
|---|
| .. | .. |
|---|
| 35 | 34 | import net.curisit.securis.db.PackMetadata; |
|---|
| 36 | 35 | import net.curisit.securis.db.PackStatus; |
|---|
| 37 | 36 | import net.curisit.securis.db.User; |
|---|
| 37 | +import net.curisit.securis.ioc.EnsureTransaction; |
|---|
| 38 | 38 | import net.curisit.securis.security.BasicSecurityContext; |
|---|
| 39 | 39 | import net.curisit.securis.security.Securable; |
|---|
| 40 | 40 | import net.curisit.securis.services.exception.SeCurisServiceException; |
|---|
| .. | .. |
|---|
| 60 | 60 | @Inject |
|---|
| 61 | 61 | TokenHelper tokenHelper; |
|---|
| 62 | 62 | |
|---|
| 63 | | - @Inject |
|---|
| 63 | + @Context |
|---|
| 64 | 64 | EntityManager em; |
|---|
| 65 | 65 | |
|---|
| 66 | 66 | @Inject |
|---|
| .. | .. |
|---|
| 143 | 143 | @Produces({ |
|---|
| 144 | 144 | MediaType.APPLICATION_JSON |
|---|
| 145 | 145 | }) |
|---|
| 146 | | - @Transactional |
|---|
| 146 | + @EnsureTransaction |
|---|
| 147 | 147 | public Response create(Pack pack, @Context BasicSecurityContext bsc) throws SeCurisServiceException { |
|---|
| 148 | 148 | LOG.info("Creating new pack"); |
|---|
| 149 | 149 | // EntityManager em = emProvider.get(); |
|---|
| .. | .. |
|---|
| 239 | 239 | @PUT |
|---|
| 240 | 240 | @POST |
|---|
| 241 | 241 | @Path("/{packId}") |
|---|
| 242 | | - @Transactional |
|---|
| 242 | + @EnsureTransaction |
|---|
| 243 | 243 | @Securable |
|---|
| 244 | 244 | @RolesAllowed(BasicSecurityContext.ROL_ADMIN) |
|---|
| 245 | 245 | @Consumes(MediaType.APPLICATION_JSON) |
|---|
| .. | .. |
|---|
| 267 | 267 | currentPack.setCode(pack.getCode()); |
|---|
| 268 | 268 | currentPack.setComments(pack.getComments()); |
|---|
| 269 | 269 | currentPack.setNumLicenses(pack.getNumLicenses()); |
|---|
| 270 | + currentPack.setPreactivationValidPeriod(pack.getPreactivationValidPeriod()); |
|---|
| 271 | + currentPack.setRenewValidPeriod(pack.getRenewValidPeriod()); |
|---|
| 270 | 272 | |
|---|
| 271 | 273 | Set<PackMetadata> newMD = pack.getMetadata(); |
|---|
| 272 | 274 | for (PackMetadata currentMd : currentPack.getMetadata()) { |
|---|
| .. | .. |
|---|
| 294 | 296 | |
|---|
| 295 | 297 | @POST |
|---|
| 296 | 298 | @Path("/{packId}/activate") |
|---|
| 297 | | - @Transactional |
|---|
| 299 | + @EnsureTransaction |
|---|
| 298 | 300 | @Securable |
|---|
| 299 | 301 | @RolesAllowed(BasicSecurityContext.ROL_ADMIN) |
|---|
| 300 | 302 | @Consumes(MediaType.APPLICATION_JSON) |
|---|
| .. | .. |
|---|
| 320 | 322 | |
|---|
| 321 | 323 | @POST |
|---|
| 322 | 324 | @Path("/{packId}/putonhold") |
|---|
| 323 | | - @Transactional |
|---|
| 325 | + @EnsureTransaction |
|---|
| 324 | 326 | @Securable |
|---|
| 325 | 327 | @RolesAllowed(BasicSecurityContext.ROL_ADMIN) |
|---|
| 326 | 328 | @Consumes(MediaType.APPLICATION_JSON) |
|---|
| .. | .. |
|---|
| 346 | 348 | |
|---|
| 347 | 349 | @POST |
|---|
| 348 | 350 | @Path("/{packId}/cancel") |
|---|
| 349 | | - @Transactional |
|---|
| 351 | + @EnsureTransaction |
|---|
| 350 | 352 | @Securable |
|---|
| 351 | 353 | @RolesAllowed(BasicSecurityContext.ROL_ADMIN) |
|---|
| 352 | 354 | @Consumes(MediaType.APPLICATION_JSON) |
|---|
| .. | .. |
|---|
| 393 | 395 | @Path("/{packId}") |
|---|
| 394 | 396 | @Securable |
|---|
| 395 | 397 | @RolesAllowed(BasicSecurityContext.ROL_ADMIN) |
|---|
| 396 | | - @Transactional |
|---|
| 398 | + @EnsureTransaction |
|---|
| 397 | 399 | @Produces({ |
|---|
| 398 | 400 | MediaType.APPLICATION_JSON |
|---|
| 399 | 401 | }) |
|---|