Example usage for com.liferay.portal.kernel.dao.orm RestrictionsFactoryUtil in

List of usage examples for com.liferay.portal.kernel.dao.orm RestrictionsFactoryUtil in

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.orm RestrictionsFactoryUtil in.

Prototype

public static Criterion in(String propertyName, Object[] values) 

Source Link

Usage

From source file:blade.servicebuilder.service.persistence.test.FooPersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    Foo newFoo = addFoo();/*w  w  w .  j av  a2s  . c  o m*/

    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Foo.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("fooId"));

    Object newFooId = newFoo.getFooId();

    dynamicQuery.add(RestrictionsFactoryUtil.in("fooId", new Object[] { newFooId }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingFooId = result.get(0);

    Assert.assertEquals(existingFooId, newFooId);
}

From source file:blade.servicebuilder.service.persistence.test.FooPersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Foo.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("fooId"));

    dynamicQuery.add(RestrictionsFactoryUtil.in("fooId", new Object[] { RandomTestUtil.nextLong() }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(0, result.size());
}

From source file:ch.inofix.referencemanager.service.persistence.test.ReferencePersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    Reference newReference = addReference();

    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Reference.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("referenceId"));

    Object newReferenceId = newReference.getReferenceId();

    dynamicQuery.add(RestrictionsFactoryUtil.in("referenceId", new Object[] { newReferenceId }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingReferenceId = result.get(0);

    Assert.assertEquals(existingReferenceId, newReferenceId);
}

From source file:ch.inofix.referencemanager.service.persistence.test.ReferencePersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Reference.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("referenceId"));

    dynamicQuery.add(RestrictionsFactoryUtil.in("referenceId", new Object[] { RandomTestUtil.nextLong() }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(0, result.size());
}

From source file:com.bemis.portal.customer.service.persistence.test.CustomerLocationPersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    CustomerLocation newCustomerLocation = addCustomerLocation();

    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(CustomerLocation.class,
            _dynamicQueryClassLoader);//w w  w.j  a  v  a  2  s. c  om

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("customerLocationId"));

    Object newCustomerLocationId = newCustomerLocation.getCustomerLocationId();

    dynamicQuery.add(RestrictionsFactoryUtil.in("customerLocationId", new Object[] { newCustomerLocationId }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingCustomerLocationId = result.get(0);

    Assert.assertEquals(existingCustomerLocationId, newCustomerLocationId);
}

From source file:com.bemis.portal.customer.service.persistence.test.CustomerLocationPersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(CustomerLocation.class,
            _dynamicQueryClassLoader);/*from   ww  w .  j av a 2 s .  co m*/

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("customerLocationId"));

    dynamicQuery
            .add(RestrictionsFactoryUtil.in("customerLocationId", new Object[] { RandomTestUtil.nextLong() }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(0, result.size());
}

From source file:com.bemis.portal.inventory.service.persistence.test.InventoryPersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    Inventory newInventory = addInventory();

    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Inventory.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("inventoryId"));

    Object newInventoryId = newInventory.getInventoryId();

    dynamicQuery.add(RestrictionsFactoryUtil.in("inventoryId", new Object[] { newInventoryId }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingInventoryId = result.get(0);

    Assert.assertEquals(existingInventoryId, newInventoryId);
}

From source file:com.bemis.portal.inventory.service.persistence.test.InventoryPersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Inventory.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("inventoryId"));

    dynamicQuery.add(RestrictionsFactoryUtil.in("inventoryId", new Object[] { RandomTestUtil.nextLong() }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(0, result.size());
}

From source file:com.bemis.portal.order.service.persistence.test.OrderPersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
    Order newOrder = addOrder();//  w  w  w. jav a 2 s . c om

    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Order.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("orderId"));

    Object newOrderId = newOrder.getOrderId();

    dynamicQuery.add(RestrictionsFactoryUtil.in("orderId", new Object[] { newOrderId }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(1, result.size());

    Object existingOrderId = result.get(0);

    Assert.assertEquals(existingOrderId, newOrderId);
}

From source file:com.bemis.portal.order.service.persistence.test.OrderPersistenceTest.java

License:Open Source License

@Test
public void testDynamicQueryByProjectionMissing() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Order.class, _dynamicQueryClassLoader);

    dynamicQuery.setProjection(ProjectionFactoryUtil.property("orderId"));

    dynamicQuery.add(RestrictionsFactoryUtil.in("orderId", new Object[] { RandomTestUtil.nextLong() }));

    List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);

    Assert.assertEquals(0, result.size());
}