Examples of ParentEntity


Examples of org.apache.isis.core.tck.dom.refs.ParentEntity

    }

    @Test
    public void recreateObject_homogeneousCollectionPreserved() throws Exception {
        recreatedAdapter = mementoForEpc1.recreateObject();
        final ParentEntity recreatedObject = (ParentEntity)recreatedAdapter.getObject();
        final List<SimpleEntity> homogenousCollection = recreatedObject.getHomogeneousCollection();
        assertNotNull(homogenousCollection);
       
        assertThat(homogenousCollection.size(), is(2));
        assertThat(homogenousCollection.get(0).getName(), is("Fred"));
        assertThat(homogenousCollection.get(1).getName(), is("Harry"));
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.ParentEntity

    }

    @Test
    public void recreateObject_heterogeneousCollectionPreserved() throws Exception {
        recreatedAdapter = mementoForEpc1.recreateObject();
        final ParentEntity recreatedObject = (ParentEntity)recreatedAdapter.getObject();
        final List<BaseEntity> hetrogenousCollection = recreatedObject.getHeterogeneousCollection();
        assertNotNull(hetrogenousCollection);
       
        assertThat(hetrogenousCollection.size(), is(2));
        final SimpleEntity firstObj = (SimpleEntity)hetrogenousCollection.get(0);
        assertThat(firstObj.getName(), is("Fred"));
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.ParentEntity

       
        final SimpleEntity epv = iswf.fixtures.smpl1;
        epv.setName("Fred Smith");
        epv.setDate(new Date(110, 2, 8, 13, 32));
       
        final ParentEntity epc = iswf.fixtures.prnt1;
        epc.getHomogeneousCollection().add(iswf.fixtures.smpl1);
        epc.getHomogeneousCollection().add(iswf.fixtures.smpl2);
        service.save(epc);

        final Set<Object> savedObjects = service.allSavedObjects();
        Assert.assertEquals(3, savedObjects.size());
    }
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.ParentEntity

        createEntity("parent 4");
        createEntity("parent 5");
    }

    private ParentEntity createEntity(final String name) {
        final ParentEntity parent = parentEntityRepository.newEntity(name);
        parent.newChild("child 1");
        parent.newChild("child 2");
        return parent;
    }
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.ParentEntity

        final ObjectAdapter readObject = objectReader.load(reader2, versionCreator, dataEncrypter);
        assertEquals(oid5, readObject.getOid());
        assertEquals(ResolveState.RESOLVED, readObject.getResolveState());

        final ParentEntity pojo = (ParentEntity) readObject.getObject();
        final List<SimpleEntity> collection2 = pojo.getHomogeneousCollection();
        assertEquals(2, collection2.size());

        assertThat(collection2.get(0), CoreMatchers.instanceOf(SimpleEntity.class));
        assertThat(collection2.get(1), CoreMatchers.instanceOf(SimpleEntity.class));
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.ParentEntity

    }

    @Test
    public void recreateObject_heterogeneousCollectionPreserved() throws Exception {
        recreatedAdapter = mementoForEpc1.recreateObject();
        final ParentEntity recreatedObject = (ParentEntity)recreatedAdapter.getObject();
        final List<BaseEntity> hetrogenousCollection = recreatedObject.getHeterogeneousCollection();
        assertNotNull(hetrogenousCollection);
       
        assertThat(hetrogenousCollection.size(), is(2));
        final SimpleEntity firstObj = (SimpleEntity)hetrogenousCollection.get(0);
        assertThat(firstObj.getName(), is("Fred"));
View Full Code Here

Examples of org.apache.isis.core.tck.dom.refs.ParentEntity

    }

    @Test
    public void recreateObject_homogeneousCollectionPreserved() throws Exception {
        recreatedAdapter = mementoForEpc1.recreateObject();
        final ParentEntity recreatedObject = (ParentEntity)recreatedAdapter.getObject();
        final List<SimpleEntity> homogenousCollection = recreatedObject.getHomogeneousCollection();
        assertNotNull(homogenousCollection);
       
        assertThat(homogenousCollection.size(), is(2));
        assertThat(homogenousCollection.get(0).getName(), is("Fred"));
        assertThat(homogenousCollection.get(1).getName(), is("Harry"));
View Full Code Here

Examples of org.apache.isis.tck.dom.assocs.ParentEntity

        return allInstances(ParentEntity.class);
    }

    @Override
    public ParentEntity newEntity(final String name) {
        final ParentEntity entity = newTransientInstance(ParentEntity.class);
        entity.setName(name);
        persist(entity);
        return entity;
    }
View Full Code Here

Examples of org.apache.isis.tck.dom.assocs.ParentEntity

        createEntity("parent 4");
        createEntity("parent 5");
    }

    private ParentEntity createEntity(final String name) {
        final ParentEntity parent = parentEntityRepository.newEntity(name);
        parent.newChild("child 1");
        parent.newChild("child 2");
        return parent;
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.manytomany.sametable.ParentEntity

                + "parent_id integer, child1_id integer NULL, child2_id integer NULL)")
        .executeUpdate();
    em.getTransaction().commit();
    em.clear();

    ParentEntity p1 = new ParentEntity("parent_1");
    ParentEntity p2 = new ParentEntity("parent_2");

    Child1Entity c1_1 = new Child1Entity("child1_1");
    Child1Entity c1_2 = new Child1Entity("child1_2");

    Child2Entity c2_1 = new Child2Entity("child2_1");
    Child2Entity c2_2 = new Child2Entity("child2_2");

    // Revision 1
    em.getTransaction().begin();

    em.persist(p1);
    em.persist(p2);
    em.persist(c1_1);
    em.persist(c1_2);
    em.persist(c2_1);
    em.persist(c2_2);

    em.getTransaction().commit();
    em.clear();

    // Revision 2 - (p1: c1_1, p2: c2_1)

    em.getTransaction().begin();

    p1 = em.find(ParentEntity.class, p1.getId());
    p2 = em.find(ParentEntity.class, p2.getId());
    c1_1 = em.find(Child1Entity.class, c1_1.getId());
    c2_1 = em.find(Child2Entity.class, c2_1.getId());

    p1.getChildren1().add(c1_1);
    p2.getChildren2().add(c2_1);

    em.getTransaction().commit();
    em.clear();

    // Revision 3 - (p1: c1_1, c1_2, c2_2, p2: c1_1, c2_1)
    em.getTransaction().begin();

    p1 = em.find(ParentEntity.class, p1.getId());
    p2 = em.find(ParentEntity.class, p2.getId());
    c1_1 = em.find(Child1Entity.class, c1_1.getId());
    c1_2 = em.find(Child1Entity.class, c1_2.getId());
    c2_2 = em.find(Child2Entity.class, c2_2.getId());

    p1.getChildren1().add(c1_2);
    p1.getChildren2().add(c2_2);

    p2.getChildren1().add(c1_1);

    em.getTransaction().commit();
    em.clear();

    // Revision 4 - (p1: c1_2, c2_2, p2: c1_1, c2_1, c2_2)
    em.getTransaction().begin();

    p1 = em.find(ParentEntity.class, p1.getId());
    p2 = em.find(ParentEntity.class, p2.getId());
    c1_1 = em.find(Child1Entity.class, c1_1.getId());
    c2_2 = em.find(Child2Entity.class, c2_2.getId());

    p1.getChildren1().remove(c1_1);
    p2.getChildren2().add(c2_2);

    em.getTransaction().commit();
    em.clear();

    // Revision 5 - (p1: c2_2, p2: c1_1, c2_1)
    em.getTransaction().begin();

    p1 = em.find(ParentEntity.class, p1.getId());
    p2 = em.find(ParentEntity.class, p2.getId());
    c1_2 = em.find(Child1Entity.class, c1_2.getId());
    c2_2 = em.find(Child2Entity.class, c2_2.getId());

    c2_2.getParents().remove(p2);
    c1_2.getParents().remove(p1);

    em.getTransaction().commit();
    em.clear();

    //

    p1_id = p1.getId();
    p2_id = p2.getId();
    c1_1_id = c1_1.getId();
    c1_2_id = c1_2.getId();
    c2_1_id = c2_1.getId();
    c2_2_id = c2_2.getId();
View Full Code Here
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.