Package org.apache.isis.runtimes.dflt.runtime.persistence.query

Examples of org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryFindByTitle


        assertEquals(originalAdapter.getObject(), retrievedObject.getObject());
    }

    public void testGetInstancesWhenEmpty() throws Exception {
        final ObjectSpecification spec = system.getSpecification(TestPojo.class);
        final ObjectAdapter[] instances = store.getInstances(new PersistenceQueryFindByTitle(spec, "title"));
        assertEquals(0, instances.length);
    }
View Full Code Here


    public void testGetInstancesByTitle() throws Exception {
        addObjectToStoreAndDiscardAdapters();

        final ObjectSpecification specification = originalAdapter.getSpecification();
        final ObjectAdapter[] retrievedInstance = store.getInstances(new PersistenceQueryFindByTitle(specification, "le STR"));
        assertEquals(1, retrievedInstance.length);
        assertNotSame(originalAdapter, retrievedInstance[0]);
        assertSame(originalAdapter.getObject(), retrievedInstance[0].getObject());
    }
View Full Code Here

    }

    public void testSaveInstance() throws Exception {

        final ObjectSpecification specification = object.getSpecification();
        ObjectAdapter[] retrievedInstance = store.getInstances(new PersistenceQueryFindByTitle(specification, "changed"));
        assertEquals(0, retrievedInstance.length);

        ((TestProxyAdapter) object).setupTitleString("changed title");
        final PersistenceCommand command = store.createSaveObjectCommand(object);
        assertEquals(object, command.onObject());
        store.execute(Collections.<PersistenceCommand> singletonList(command));

        resetIdentityMap();

        retrievedInstance = store.getInstances(new PersistenceQueryFindByTitle(specification, "changed"));
        assertEquals(1, retrievedInstance.length);
        assertNotSame(object, retrievedInstance[0]);
    }
View Full Code Here

            return new PersistenceQueryFindAllInstances(noSpec);
        }
        if (query instanceof QueryFindByTitle) {
            final QueryFindByTitle<?> queryByTitle = (QueryFindByTitle<?>) query;
            final String title = queryByTitle.getTitle();
            return new PersistenceQueryFindByTitle(noSpec, title);
        }
        if (query instanceof QueryFindByPattern) {
            final QueryFindByPattern<?> queryByPattern = (QueryFindByPattern<?>) query;
            final Object pattern = queryByPattern.getPattern();
            final ObjectAdapter patternAdapter = getAdapterManager().adapterFor(pattern);
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 PersistenceQueryFindByTitle.class;
    }

    @Override
    public PersistenceQueryData encode(final PersistenceQuery persistenceQuery) {
        final PersistenceQueryFindByTitle queryByTitle = downcast(persistenceQuery);
        return new PersistenceQueryFindByTitleData(persistenceQuery.getSpecification(), queryByTitle.getTitle());
    }
View Full Code Here

    }

    @Override
    protected PersistenceQuery doDecode(final ObjectSpecification specification, final PersistenceQueryData persistenceQueryData) {
        final String title = (downcast(persistenceQueryData)).getTitle();
        return new PersistenceQueryFindByTitle(specification, title);
    }
View Full Code Here

        return PersistenceQueryFindByTitle.class;
    }

    @Override
    public PersistenceQueryData encode(final PersistenceQuery persistenceQuery) {
        final PersistenceQueryFindByTitle queryByTitle = downcast(persistenceQuery);
        return new PersistenceQueryFindByTitleData(persistenceQuery.getSpecification(), queryByTitle.getTitle());
    }
View Full Code Here

    @Override
    protected PersistenceQuery doDecode(final ObjectSpecification specification,
        final PersistenceQueryData persistenceQueryData) {
        final String title = (downcast(persistenceQueryData)).getTitle();
        return new PersistenceQueryFindByTitle(specification, title);
    }
View Full Code Here

        assertEquals(originalAdapter.getObject(), retrievedObject.getObject());
    }

    public void testGetInstancesWhenEmpty() throws Exception {
        final ObjectSpecification spec = system.getSpecification(TestPojo.class);
        final ObjectAdapter[] instances = store.getInstances(new PersistenceQueryFindByTitle(spec, "title"));
        assertEquals(0, instances.length);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.runtimes.dflt.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.