| .. | .. |
|---|
| 203 | 203 | return packs > 0; |
|---|
| 204 | 204 | } |
|---|
| 205 | 205 | |
|---|
| 206 | | - private int getNextCodeSuffix(int packId, EntityManager em) { |
|---|
| 207 | | - TypedQuery<Integer> query = em.createNamedQuery("last-code-suffix-used-in-pack", Integer.class); |
|---|
| 208 | | - query.setParameter("packId", packId); |
|---|
| 209 | | - Integer lastCodeSuffix = query.getSingleResult(); |
|---|
| 210 | | - return lastCodeSuffix == null ? 1 : lastCodeSuffix + 1; |
|---|
| 211 | | - } |
|---|
| 212 | | - |
|---|
| 213 | 206 | /** |
|---|
| 214 | 207 | * |
|---|
| 215 | 208 | * @return The next available code suffix in pack for license code |
|---|
| .. | .. |
|---|
| 227 | 220 | if (packId == null) { |
|---|
| 228 | 221 | throw new SeCurisServiceException(ErrorCodes.INVALID_DATA, "The pack code is mandatory"); |
|---|
| 229 | 222 | } |
|---|
| 230 | | - Integer codeSuffix = getNextCodeSuffix(packId, em); |
|---|
| 223 | + Integer codeSuffix = licenseHelper.getNextCodeSuffix(packId, em); |
|---|
| 231 | 224 | Pack pack = em.find(Pack.class, packId); |
|---|
| 232 | 225 | ; |
|---|
| 233 | 226 | |
|---|