rsanchez
2014-12-11 36edce38f6b17f73322fa38404d6e01818a44fd2
securis/src/main/java/net/curisit/securis/db/License.java
....@@ -384,6 +384,17 @@
384384 }
385385 }
386386
387
+ public static License findLicenseByCode(String code, EntityManager em) throws SeCurisServiceException {
388
+ TypedQuery<License> query = em.createNamedQuery("license-by-code", License.class);
389
+ query.setParameter("code", code);
390
+ try {
391
+ return query.getSingleResult();
392
+ } catch (NoResultException e) {
393
+ // There is no license for request data
394
+ return null;
395
+ }
396
+ }
397
+
387398 public Integer getCodeSuffix() {
388399 return codeSuffix;
389400 }