rsanchez
2014-12-11 36edce38f6b17f73322fa38404d6e01818a44fd2
securis/src/main/java/net/curisit/securis/services/PackResource.java
....@@ -203,13 +203,6 @@
203203 return packs > 0;
204204 }
205205
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
-
213206 /**
214207 *
215208 * @return The next available code suffix in pack for license code
....@@ -227,7 +220,7 @@
227220 if (packId == null) {
228221 throw new SeCurisServiceException(ErrorCodes.INVALID_DATA, "The pack code is mandatory");
229222 }
230
- Integer codeSuffix = getNextCodeSuffix(packId, em);
223
+ Integer codeSuffix = licenseHelper.getNextCodeSuffix(packId, em);
231224 Pack pack = em.find(Pack.class, packId);
232225 ;
233226