com.evasion.plugin.donation.DonationManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Plugin-Donation Show documentation
Show all versions of Plugin-Donation Show documentation
Gestion des donnations au profit d'une association
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.evasion.plugin.donation;
import com.evasion.entity.Don;
import com.evasion.entity.Person;
import com.evasion.exception.PersistenceViolationException;
import com.evasion.ejb.local.DonationManagerLocal;
import com.evasion.ejb.remote.DonationManagerRemote;
import javax.persistence.EntityManager;
/**
*
* @author sebastien.glon
*/
public class DonationManager implements DonationManagerLocal, DonationManagerRemote {
private EntityManager em;
public DonationManager(EntityManager em) {
this.em = em;
}
@Override
public Long savePromesse(Person p, Long l, String d) throws PersistenceViolationException {
if (l ==null || l<=0L) {
throw new IllegalArgumentException("le montant ne peut etre null ou <=0");
}
Don don = new Don(p, l, d);
try {
em.persist(don);
em.flush();
return don.getId();
} catch (Exception e) {
throw new PersistenceViolationException("Save promesse en Echec", e);
}
}
@Override
public void validDon(Long l) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy