Package org.apache.art

Examples of org.apache.art.PaintingInfo


        query.addPrefetch(Painting.TO_PAINTING_INFO_PROPERTY);
        List daos = ctxt.performQuery(query);
        assertTrue(!daos.isEmpty());
        for (Iterator it = daos.iterator(); it.hasNext();) {
            Painting p = (Painting) it.next();
            PaintingInfo pi = p.getToPaintingInfo();
            assertEquals("persistence state", PersistenceState.COMMITTED, p
                    .getPersistenceState());
            assertEquals("persistence state", PersistenceState.COMMITTED, pi
                    .getPersistenceState());
        }
    }
View Full Code Here


        DataContext ctxt = createDataContext();
        for (int i = 0; i < 10; i++) {
            Painting p = ctxt.newObject(Painting.class);
            p.setPaintingTitle("Painting title #" + i);
            p.setPaintingDescription("Painting desc #" + i);
            PaintingInfo pi = ctxt.newObject(PaintingInfo.class);
            pi.setTextReview("Review #" + i);
            p.setToPaintingInfo(pi);
        }
        ctxt.commitChanges();
    }
View Full Code Here

        ObjectContext childContext = context.createChildContext();

        Painting childMaster = childContext.newObject(Painting.class);
        childMaster.setPaintingTitle("Master");

        PaintingInfo childDetail1 = childContext.newObject(PaintingInfo.class);
        childDetail1.setTextReview("Detail1");
        childDetail1.setPainting(childMaster);

        try {
            childContext.commitChangesToParent();

            assertEquals(PersistenceState.COMMITTED, childMaster.getPersistenceState());
            assertEquals(PersistenceState.COMMITTED, childDetail1.getPersistenceState());

            Painting parentMaster = (Painting) context.getGraphManager().getNode(
                    childMaster.getObjectId());

            assertNotNull(parentMaster);
            assertEquals(PersistenceState.NEW, parentMaster.getPersistenceState());

            PaintingInfo parentDetail1 = (PaintingInfo) context
                    .getGraphManager()
                    .getNode(childDetail1.getObjectId());

            assertNotNull(parentDetail1);
            assertEquals(PersistenceState.NEW, parentDetail1.getPersistenceState());

            assertSame(parentMaster, parentDetail1.getPainting());
            assertSame(parentDetail1, parentMaster.getToPaintingInfo());
        }
        finally {
            unblockQueries();
        }
View Full Code Here

            // testing non-null to-one target
            Painting p2 = (Painting) results.get(1);
            Object o2 = p2.readPropertyDirectly(Painting.TO_PAINTING_INFO_PROPERTY);
            assertTrue(o2 instanceof PaintingInfo);
            PaintingInfo pi2 = (PaintingInfo) o2;
            assertEquals(PersistenceState.COMMITTED, pi2.getPersistenceState());
            assertEquals(DataObjectUtils.intPKForObject(p2), DataObjectUtils
                    .intPKForObject(pi2));

            // testing null to-one target
            Painting p4 = (Painting) results.get(3);
View Full Code Here

    public void testCascadeToOne() {
        // Painting toPaintingInfo
        Painting painting = (Painting) context.newObject("Painting");
        painting.setPaintingTitle("A Title");

        PaintingInfo info = (PaintingInfo) context.newObject("PaintingInfo");
        painting.setToPaintingInfo(info);

        // Must commit before deleting.. this relationship is dependent,
        // and everything must be committed for certain things to work.
        context.commitChanges();

        context.deleteObject(painting);

        // info must also be deleted
        assertEquals(PersistenceState.DELETED, info.getPersistenceState());
        assertNull(info.getPainting());
        assertNull(painting.getToPaintingInfo());
        context.commitChanges();
    }
View Full Code Here

        DataContext context = createDataContext();
        assertSame(getDomain(), context.getParentDataDomain());

        Painting p = context.newObject(Painting.class);
        p.setPaintingTitle("aaaa");
        PaintingInfo pi = context.newObject(PaintingInfo.class);
        pi.setPainting(p);
        context.commitChanges();

        context.invalidateObjects(Arrays.asList(p, pi));

        p.getPaintingTitle();
View Full Code Here

        p1.setPaintingTitle(paintingName);
        return p1;
    }

    protected PaintingInfo newPaintingInfo() {
        PaintingInfo p1 = (PaintingInfo) ctxt.newObject("PaintingInfo");
        p1.setTextReview(textReview);
        p1.setImageBlob(paintingImage);
        return p1;
    }
View Full Code Here

public class CayenneDataObjectRelTest extends CayenneDOTestBase {

    private void prepareNestedProperties() throws Exception {
        Artist a1 = super.newArtist();
        Painting p1 = super.newPainting();
        PaintingInfo pi1 = super.newPaintingInfo();
        Gallery g1 = super.newGallery();

        p1.setToArtist(a1);
        p1.setToPaintingInfo(pi1);
        p1.setToGallery(g1);
View Full Code Here

        // test chained calls to read relationships
        CaseDataFactory.createArtistWithPainting(artistName, new String[] {
            paintingName
        }, true);

        PaintingInfo pi1 = fetchPaintingInfo(paintingName);
        Painting p1 = pi1.getPainting();
        p1.getPaintingTitle();

        Artist a1 = p1.getToArtist();

        assertNotNull(a1);
View Full Code Here

        // needed to save without errors
        p1.setToArtist(a1);
        ctxt.commitChanges();
       
        PaintingInfo info = ctxt.newObject(PaintingInfo.class);
        info.setTextReview("XXX");
        p1.setToPaintingInfo(info);
       
        assertSame(info, p1.getToPaintingInfo());
       
        ctxt.rollbackChanges();
View Full Code Here

TOP

Related Classes of org.apache.art.PaintingInfo

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.