Package com.airhacks.workshops.business.registrations.boundary

Source Code of com.airhacks.workshops.business.registrations.boundary.Registrations

package com.airhacks.workshops.business.registrations.boundary;

import com.airhacks.workshops.business.registrations.control.VatCalculator;
import com.airhacks.workshops.business.registrations.entity.Registration;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
*
* @author airhacks.com
*/
@Stateless
public class Registrations {

    @PersistenceContext
    EntityManager em;

    @Inject
    VatCalculator priceCalculator;

    public Registration register(Registration request) {
        Registration registration = em.merge(request);
        registration.setCalculator(priceCalculator::calculateTotal);
        return registration;
    }

    public Registration find(int registrationId) {
        return this.em.find(Registration.class, registrationId);
    }

}
TOP

Related Classes of com.airhacks.workshops.business.registrations.boundary.Registrations

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.