Package org.apache.isis.core.runtime.persistence.query

Examples of org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindByTitle


        assertEquals(epv2Adapter.getOid(), retrievedAdapter.getOid());
    }

    @Test
    public void getInstances_whenDoesNotExist() throws Exception {
        final List<ObjectAdapter> retrievedAdapters = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, epv2Adapter.titleString()));
        assertEquals(0, retrievedAdapters.size());
    }
View Full Code Here


        // given
        iswf.persist(iswf.fixtures.smpl2);
        iswf.bounceSystem();

        // when
        final List<ObjectAdapter> retrievedAdapters = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, epv2Adapter.titleString()));
       
        // then
        assertEquals(1, retrievedAdapters.size());
        final ObjectAdapter retrievedAdapter = retrievedAdapters.get(0);
View Full Code Here

        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(type);
        return findByTitle(spec, type, title);
    }

    public static List<Object> findByTitle(final ObjectSpecification spec, final Class<?> cls, final String title) {
        final PersistenceQuery criteria = new PersistenceQueryFindByTitle(spec, title);
        return findByPersistenceQuery(criteria, cls);
    }
View Full Code Here

            return new PersistenceQueryFindAllInstances(noSpec, queryFindAllInstances.getStart(), queryFindAllInstances.getCount());
        }
        if (query instanceof QueryFindByTitle) {
            final QueryFindByTitle<?> queryByTitle = (QueryFindByTitle<?>) query;
            final String title = queryByTitle.getTitle();
            return new PersistenceQueryFindByTitle(noSpec, title, queryByTitle.getStart(), queryByTitle.getCount());
        }
        if (query instanceof QueryFindByPattern) {
            final QueryFindByPattern<?> queryByPattern = (QueryFindByPattern<?>) query;
            final Object pattern = queryByPattern.getPattern();
            final ObjectAdapter patternAdapter = getAdapterManager().adapterFor(pattern);
View Full Code Here

        iswf.persist(epv2);

        iswf.bounceSystem();
       
        // when search for object
        List<ObjectAdapter> retrievedInstance = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, epv2Adapter.titleString()));
       
        // then find
        assertEquals(1, retrievedInstance.size());
        final ObjectAdapter retrievedAdapter = retrievedInstance.get(0);

        assertNotSame(epv2Adapter, retrievedAdapter);
        assertEquals(((SimpleEntity)epv2Adapter.getObject()).getName(), ((SimpleEntity)retrievedAdapter.getObject()).getName());
        assertEquals(epv2Adapter.getOid(), retrievedAdapter.getOid());

        // and when search for some other title
        retrievedInstance = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, "some other title"));
       
        // then don't find
        assertEquals(0, retrievedInstance.size());
    }
View Full Code Here

        epv.setName("changed");

        iswf.bounceSystem();

        // then found
        List<ObjectAdapter> retrievedInstance = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, adapter.titleString()));
        assertEquals(1, retrievedInstance.size());
       
        final ObjectAdapter retrievedAdapter = retrievedInstance.get(0);
        assertNotSame(adapter, retrievedAdapter);
        assertEquals(((SimpleEntity)adapter.getObject()).getName(), ((SimpleEntity)retrievedAdapter.getObject()).getName());
View Full Code Here

            return new PersistenceQueryFindAllInstances(noSpec, queryFindAllInstances.getStart(), queryFindAllInstances.getCount());
        }
        if (query instanceof QueryFindByTitle) {
            final QueryFindByTitle<?> queryByTitle = (QueryFindByTitle<?>) query;
            final String title = queryByTitle.getTitle();
            return new PersistenceQueryFindByTitle(noSpec, title, queryByTitle.getStart(), queryByTitle.getCount());
        }
        if (query instanceof QueryFindByPattern) {
            final QueryFindByPattern<?> queryByPattern = (QueryFindByPattern<?>) query;
            final Object pattern = queryByPattern.getPattern();
            final ObjectAdapter patternAdapter = getAdapterManager().adapterFor(pattern);
View Full Code Here

        assertEquals(epv2Adapter.getOid(), retrievedAdapter.getOid());
    }

    @Test
    public void getInstances_whenDoesNotExist() throws Exception {
        final List<ObjectAdapter> retrievedAdapters = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, epv2Adapter.titleString()));
        assertEquals(0, retrievedAdapters.size());
    }
View Full Code Here

        // given
        iswf.persist(iswf.fixtures.smpl2);
        iswf.bounceSystem();

        // when
        final List<ObjectAdapter> retrievedAdapters = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, epv2Adapter.titleString()));
       
        // then
        assertEquals(1, retrievedAdapters.size());
        final ObjectAdapter retrievedAdapter = retrievedAdapters.get(0);
View Full Code Here

        iswf.persist(epv2);

        iswf.bounceSystem();
       
        // when search for object
        List<ObjectAdapter> retrievedInstance = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, epv2Adapter.titleString()));
       
        // then find
        assertEquals(1, retrievedInstance.size());
        final ObjectAdapter retrievedAdapter = retrievedInstance.get(0);

        assertNotSame(epv2Adapter, retrievedAdapter);
        assertEquals(((SimpleEntity)epv2Adapter.getObject()).getName(), ((SimpleEntity)retrievedAdapter.getObject()).getName());
        assertEquals(epv2Adapter.getOid(), retrievedAdapter.getOid());

        // and when search for some other title
        retrievedInstance = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, "some other title"));
       
        // then don't find
        assertEquals(0, retrievedInstance.size());
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindByTitle

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.