Package org.spw.model

Examples of org.spw.model.Advertisement


        return (RequestBean1)getBean("RequestBean1");
    }
   
    public String buttonValidate_action() {
        Partnership partnership = getPartnership();
        Advertisement advertisement = getAdvertisement();
       
        advertisement.setPartnership(partnership);
       
        PartnershipController partnershipCtrl = new PartnershipController();
        partnership = partnershipCtrl.addAdvertisement(partnership, advertisement);
       
        setPartnership(partnership);
View Full Code Here


     * @param key The unique ID of the object
     * @return a advertisement if found, null otherwise
     */
    public Advertisement read(Long key) {
        EntityManager em = emf.createEntityManager();
        Advertisement retValue = null;
        try {
            retValue = em.find(Advertisement.class, key);
        } catch (Exception e) {
            Logger.getLogger(AdvertisementController.class.getName()).log(Level.SEVERE, "Error reading " + key, e);
            if (em.getTransaction().isActive())
View Full Code Here

     * Update an existing advertisement. If it's a new Advertisement, create it.
     * @param object The advertisement to update
     * @return the new object advertisement after the persistence operation
     */
    public Advertisement update(Advertisement object) {
        Advertisement result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            result = em.merge(object);
            em.getTransaction().commit();
View Full Code Here

     */
    public void delete(Advertisement object) {
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            Advertisement entity = em.find(Advertisement.class, object.getIdAdvertisement());
            em.remove(entity);
            em.getTransaction().commit();
        } catch (Exception e) {
            Logger.getLogger(AdvertisementController.class.getName()).log(Level.SEVERE, "Error deleting " + object, e);
            if (em.getTransaction().isActive())
View Full Code Here

     */
    public void testAddAdvertisement() {
        System.out.println("addAdvertisement");
       
        Partnership partnership = partnershipCtl.read(TEST_ID_ABC1);
        Advertisement advertisement = new Advertisement();
        advertisement.setDateAdvert(new Date());
        advertisement.setIdAdvertisement(TEST_ID_ABC1);
        advertisement.setNotes(getName());
       
        Partnership result = partnershipCtl.addAdvertisement(partnership, advertisement);
        assertNotNull(result);
        assertEquals(partnership, result);
        assertTrue(result.getAdvertisements().contains(advertisement));       
View Full Code Here

     */
    public void testRemoveAdvertisement() {
        System.out.println("removeAdvertisement");
       
        Partnership partnership = partnershipCtl.read(TEST_ID_ABC1);
        Advertisement advertisement = new Advertisement();
        advertisement.setDateAdvert(new Date());
        advertisement.setIdAdvertisement(TEST_ID_ABC1);
        advertisement.setNotes(getName());
       
        Partnership result = partnershipCtl.addAdvertisement(partnership, advertisement);
       
        result = partnershipCtl.removeAdvertisement(partnership, advertisement);
        assertFalse(result.getAdvertisements().contains(advertisement));
View Full Code Here

     * @param key The unique ID of the object
     * @return a advertisement if found, null otherwise
     */
    public Advertisement read(Long key) {
        EntityManager em = emf.createEntityManager();
        Advertisement retValue = null;
        try {
            retValue = em.find(Advertisement.class, key);
        } catch (Exception e) {
            Logger.getLogger(AdvertisementController.class.getName()).log(Level.SEVERE, "Error reading " + key, e);
            if (em.getTransaction().isActive())
View Full Code Here

     * Update an existing advertisement. If it's a new Advertisement, create it.
     * @param object The advertisement to update
     * @return the new object advertisement after the persistence operation
     */
    public Advertisement update(Advertisement object) {
        Advertisement result = null;
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            result = em.merge(object);
            em.getTransaction().commit();
View Full Code Here

     */
    public void delete(Advertisement object) {
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        try {
            Advertisement entity = em.find(Advertisement.class, object.getIdAdvertisement());
            em.remove(entity);
            em.getTransaction().commit();
        } catch (Exception e) {
            Logger.getLogger(AdvertisementController.class.getName()).log(Level.SEVERE, "Error deleting " + object, e);
            if (em.getTransaction().isActive())
View Full Code Here

        super(testName);
    }

    protected void setUp() throws Exception {
        AdvertisementController instance = new AdvertisementController();
        Advertisement ad = new Advertisement();
        ad.setIdAdvertisement(TEST_ID);
        ad.setDateAdvert(new Date());
        ad.setNotes(getName());
        instance.create(ad);
    }
View Full Code Here

TOP

Related Classes of org.spw.model.Advertisement

Copyright © 2018 www.massapicom. 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.