Package org.apache.art

Examples of org.apache.art.Gallery


        p.setPaintingTitle("P1");

        Artist a = context.newObject(Artist.class);
        a.setArtistName("A1");

        Gallery g = context.newObject(Gallery.class);
        g.setGalleryName("G1");

        p.setToArtist(a);
        p.setToGallery(g);
        context.commitChanges();
View Full Code Here


        BeanValidationFailure failure = (BeanValidationFailure) failures.get(0);
        assertEquals(Exhibit.TO_GALLERY_PROPERTY, failure.getProperty());

        // fix the problem and see if it goes away
        Gallery gallery = context.newObject(Gallery.class);
        exhibit.setToGallery(gallery);
        result = new ValidationResult();
        exhibit.validateForSave(result);
        assertFalse("No failures expected: " + result, result.hasFailures());
    }
View Full Code Here

                assertTrue(expectedPaintingsNames.contains(p.getPaintingTitle()));
            }
            String artistName = (String) firstRow[1];
            assertEquals("A1", artistName);

            Gallery g1 = (Gallery) firstRow[2];
            assertEquals("gallery1", g1.getGalleryName());

            List exibits = g1.getExhibitArray();

            assertNotNull(exibits);
            assertFalse(((ValueHolder) exibits).isFault());
            assertEquals(2, exibits.size());

            Object[] secondRow = (Object[]) objects.get(1);
            a = (Artist) secondRow[0];
            assertEquals("A2", a.getArtistName());

            paintings = a.getPaintingArray();

            assertNotNull(paintings);
            assertFalse(((ValueHolder) paintings).isFault());
            assertEquals(1, paintings.size());

            expectedPaintingsNames = new ArrayList<String>();
            expectedPaintingsNames.add("P2");

            paintingsIterator = paintings.iterator();
            while (paintingsIterator.hasNext()) {
                Painting p = paintingsIterator.next();
                assertEquals(PersistenceState.COMMITTED, p.getPersistenceState());
                assertNotNull(p.getPaintingTitle());
                assertTrue(expectedPaintingsNames.contains(p.getPaintingTitle()));
            }
            artistName = (String) secondRow[1];
            assertEquals("A2", artistName);

            Gallery g2 = (Gallery) secondRow[2];
            assertEquals(g1, g2);
        }
        finally {
            unblockQueries();
        }
View Full Code Here

                assertTrue(expectedPaintingsNames.contains(p.getPaintingTitle()));
            }
            String artistName1 = (String) row[1];
            assertEquals("A1", artistName1);

            Gallery g1 = (Gallery) row[2];
            assertEquals("gallery1", g1.getGalleryName());

            List exibits = g1.getExhibitArray();

            assertNotNull(exibits);
            assertFalse(((ValueHolder) exibits).isFault());
            assertEquals(2, exibits.size());

            row = (Object[]) objects.get(1);

            assertEquals(a1, (Artist) row[0]);
            assertEquals(artistName1, row[1]);

            Gallery g2 = (Gallery) row[2];
            assertEquals("gallery2", g2.getGalleryName());

            exibits = g2.getExhibitArray();

            assertTrue(exibits.isEmpty());

            row = (Object[]) objects.get(2);
View Full Code Here

    public void testUnregisterThenRegister() throws Exception {
        DataContext context = createDataContext();

        // Create a gallery.
        Gallery g = context.newObject(Gallery.class);
        g.setGalleryName("Test Gallery");

        // Create an artist in the same context.
        Artist a = context.newObject(Artist.class);
        a.setArtistName("Test Artist");
View Full Code Here

        q.addPrefetch("exhibitArray.artistExhibitArray");

        List galleries = context.performQuery(q);
        assertEquals(1, galleries.size());

        Gallery g2 = (Gallery) galleries.get(0);

        // this relationship wasn't explicitly prefetched....
        Object list = g2.readPropertyDirectly("exhibitArray");
        assertTrue(list instanceof Fault);

        // however the target objects must be resolved
        ArtistExhibit ae1 = (ArtistExhibit) context.getGraphManager().getNode(oid1);
        ArtistExhibit ae2 = (ArtistExhibit) context.getGraphManager().getNode(oid2);
View Full Code Here

        q.addPrefetch("exhibitArray.artistExhibitArray");

        List galleries = context.performQuery(q);
        assertEquals(1, galleries.size());

        Gallery g2 = (Gallery) galleries.get(0);

        // this relationship should be resolved
        assertTrue(g2.readPropertyDirectly("exhibitArray") instanceof ValueHolder);
        List exhibits = (List) g2.readPropertyDirectly("exhibitArray");
        assertFalse(((ValueHolder) exhibits).isFault());
        assertEquals(1, exhibits.size());

        Exhibit e1 = (Exhibit) exhibits.get(0);
        assertEquals(PersistenceState.COMMITTED, e1.getPersistenceState());
View Full Code Here

        q.addPrefetch("exhibitArray.artistExhibitArray");

        List galleries = context.performQuery(q);
        assertEquals(1, galleries.size());

        Gallery g2 = (Gallery) galleries.get(0);

        // this relationship should be resolved
        assertTrue(g2.readPropertyDirectly("exhibitArray") instanceof ValueHolder);
        List exhibits = (List) g2.readPropertyDirectly("exhibitArray");
        assertFalse(((ValueHolder) exhibits).isFault());
        assertEquals(1, exhibits.size());

        Exhibit e1 = (Exhibit) exhibits.get(0);
        assertEquals(PersistenceState.COMMITTED, e1.getPersistenceState());
View Full Code Here

                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);

        List galleries = context.performQuery(q);
        assertEquals(1, galleries.size());

        Gallery g2 = (Gallery) galleries.get(0);

        // this relationship should be resolved
        assertTrue(g2.readPropertyDirectly("exhibitArray") instanceof ValueHolder);
        List exhibits = (List) g2.readPropertyDirectly("exhibitArray");
        assertFalse(((ValueHolder) exhibits).isFault());
        assertEquals(1, exhibits.size());

        Exhibit e1 = (Exhibit) exhibits.get(0);
        assertEquals(PersistenceState.COMMITTED, e1.getPersistenceState());
View Full Code Here

        ArcProperty toGallery = (ArcProperty) d.getProperty("toGallery");

        ObjectDiff diff = context.getObjectStore().registerDiff(p1.getObjectId(), null);
        assertFalse(DataRowUtils.isToOneTargetModified(toGallery, p1, diff));

        Gallery g1 = (Gallery) context.newObject("Gallery");
        g1.addToPaintingArray(p1);
        assertTrue(DataRowUtils.isToOneTargetModified(toGallery, p1, diff));
    }
View Full Code Here

TOP

Related Classes of org.apache.art.Gallery

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.