# HG changeset patch # User Raimund Renkert # Date 1371211785 -7200 # Node ID 301260b80acb09833ac8ef290760335019b51960 # Parent 8e3ced604792e23508e20a32d7bd6c57d5fe84a4 New manager for LZusatzWert objects. diff -r 8e3ced604792 -r 301260b80acb src/main/java/de/intevation/lada/manage/LZusatzwertManager.java --- /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); + } +}