Mercurial > lada > lada-server
changeset 150:301260b80acb
New manager for LZusatzWert objects.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 14 Jun 2013 14:09:45 +0200 |
parents | 8e3ced604792 |
children | 7b1235c852a9 |
files | src/main/java/de/intevation/lada/manage/LZusatzwertManager.java |
diffstat | 1 files changed, 66 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/manage/LZusatzwertManager.java Fri Jun 14 14:09:45 2013 +0200 @@ -0,0 +1,66 @@ +package de.intevation.lada.manage; + +import javax.ejb.EJBTransactionRolledbackException; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.inject.Inject; +import javax.persistence.EntityExistsException; +import javax.persistence.EntityManager; +import javax.persistence.TransactionRequiredException; + +import de.intevation.lada.model.LZusatzWert; + + +public class LZusatzwertManager +{ + @Inject + private EntityManager em; + + /** + * Delete a LProbe object by id. + * + * @param id + * @throws Exception + */ + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public void delete(String id) throws Exception { + LZusatzWert zusatzwert = em.find(LZusatzWert.class, id); + em.remove(zusatzwert); + } + + /** + * Persist a new LProbe object in the database using the LProbeValidator. + * + * @param probe The new LProbe object. + * + * @throws EntityExistsException + * @throws IllegalArgumentException + * @throws TransactionRequiredException + */ + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public void create(LZusatzWert zusatzwert) + throws EntityExistsException, + IllegalArgumentException, + EJBTransactionRolledbackException, + TransactionRequiredException { + em.persist(zusatzwert); + } + + /** + * Updates a LProbe object in the database. + * + * @param probe The new LProbe object. + * + * @throws EntityExistsException + * @throws IllegalArgumentException + * @throws TransactionRequiredException + */ + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public void update(LZusatzWert zusatzwert) + throws EntityExistsException, + IllegalArgumentException, + EJBTransactionRolledbackException, + TransactionRequiredException { + em.merge(zusatzwert); + } +}