| .. | .. |
|---|
| 6 | 6 | |
|---|
| 7 | 7 | import javax.inject.Inject; |
|---|
| 8 | 8 | import javax.persistence.EntityManager; |
|---|
| 9 | | -import javax.transaction.Transactional; |
|---|
| 10 | 9 | import javax.ws.rs.Consumes; |
|---|
| 11 | 10 | import javax.ws.rs.GET; |
|---|
| 12 | 11 | import javax.ws.rs.HeaderParam; |
|---|
| .. | .. |
|---|
| 30 | 29 | import net.curisit.securis.db.LicenseStatus; |
|---|
| 31 | 30 | import net.curisit.securis.db.Pack; |
|---|
| 32 | 31 | import net.curisit.securis.db.User; |
|---|
| 32 | +import net.curisit.securis.ioc.EnsureTransaction; |
|---|
| 33 | 33 | import net.curisit.securis.security.BasicSecurityContext; |
|---|
| 34 | 34 | import net.curisit.securis.security.Securable; |
|---|
| 35 | 35 | import net.curisit.securis.services.exception.SeCurisServiceException; |
|---|
| .. | .. |
|---|
| 61 | 61 | @Inject |
|---|
| 62 | 62 | private LicenseHelper licenseHelper; |
|---|
| 63 | 63 | |
|---|
| 64 | | - @Inject |
|---|
| 64 | + @Context |
|---|
| 65 | 65 | EntityManager em; |
|---|
| 66 | 66 | |
|---|
| 67 | 67 | @Inject |
|---|
| .. | .. |
|---|
| 118 | 118 | @Produces({ |
|---|
| 119 | 119 | MediaType.APPLICATION_JSON |
|---|
| 120 | 120 | }) |
|---|
| 121 | | - @Transactional |
|---|
| 121 | + @EnsureTransaction |
|---|
| 122 | 122 | public Response createFromRequest(RequestBean request, @HeaderParam(LicenseManager.HEADER_LICENSE_NAME_OR_REFERENCE) String nameOrReference, |
|---|
| 123 | 123 | @HeaderParam(LicenseManager.HEADER_LICENSE_EMAIL) String userEmail) throws IOException, SeCurisServiceException, SeCurisException { |
|---|
| 124 | 124 | LOG.info("Request to get license: {}", request); |
|---|
| .. | .. |
|---|
| 144 | 144 | @Produces({ |
|---|
| 145 | 145 | MediaType.APPLICATION_JSON |
|---|
| 146 | 146 | }) |
|---|
| 147 | | - @Transactional |
|---|
| 147 | + @EnsureTransaction |
|---|
| 148 | 148 | @SuppressWarnings("unchecked") |
|---|
| 149 | 149 | public Response createFromRequestFile(MultipartFormDataInput mpfdi, |
|---|
| 150 | 150 | @HeaderParam(LicenseManager.HEADER_LICENSE_NAME_OR_REFERENCE) String nameOrReference, |
|---|
| .. | .. |
|---|
| 178 | 178 | @Produces({ |
|---|
| 179 | 179 | MediaType.APPLICATION_JSON |
|---|
| 180 | 180 | }) |
|---|
| 181 | | - @Transactional |
|---|
| 181 | + @EnsureTransaction |
|---|
| 182 | 182 | public Response renewFromPreviousLicense(LicenseBean previousLic, @Context BasicSecurityContext bsc) throws IOException, SeCurisServiceException, |
|---|
| 183 | 183 | SeCurisException { |
|---|
| 184 | 184 | LOG.info("Renew license: {}", previousLic); |
|---|
| .. | .. |
|---|
| 216 | 216 | @Produces({ |
|---|
| 217 | 217 | MediaType.APPLICATION_JSON |
|---|
| 218 | 218 | }) |
|---|
| 219 | | - @Transactional |
|---|
| 219 | + @EnsureTransaction |
|---|
| 220 | 220 | public Response validate(LicenseBean currentLic, @Context BasicSecurityContext bsc) throws IOException, SeCurisServiceException, SeCurisException { |
|---|
| 221 | 221 | LOG.info("Validate license: {}", currentLic); |
|---|
| 222 | 222 | |
|---|
| .. | .. |
|---|
| 252 | 252 | @Produces({ |
|---|
| 253 | 253 | MediaType.APPLICATION_JSON |
|---|
| 254 | 254 | }) |
|---|
| 255 | | - @Transactional |
|---|
| 255 | + @EnsureTransaction |
|---|
| 256 | 256 | @SuppressWarnings("unchecked") |
|---|
| 257 | 257 | public Response renewFromLicenseFile(MultipartFormDataInput mpfdi, @Context BasicSecurityContext bsc) throws IOException, |
|---|
| 258 | 258 | SeCurisServiceException, SeCurisException { |
|---|