use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testActionableDynamicQuery.
@Test
public void testActionableDynamicQuery() throws Exception {
final IntegerWrapper count = new IntegerWrapper();
ActionableDynamicQuery actionableDynamicQuery = FooLocalServiceUtil.getActionableDynamicQuery();
actionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Foo>() {
@Override
public void performAction(Foo foo) {
Assert.assertNotNull(foo);
count.increment();
}
});
actionableDynamicQuery.performActions();
Assert.assertEquals(count.getValue(), _persistence.countAll());
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist.
@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereAllPrimaryKeysExist() throws Exception {
Foo newFoo1 = addFoo();
Foo newFoo2 = addFoo();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newFoo1.getPrimaryKey());
primaryKeys.add(newFoo2.getPrimaryKey());
Map<Serializable, Foo> foos = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(2, foos.size());
Assert.assertEquals(newFoo1, foos.get(newFoo1.getPrimaryKey()));
Assert.assertEquals(newFoo2, foos.get(newFoo2.getPrimaryKey()));
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testFetchByPrimaryKeysWithOnePrimaryKey.
@Test
public void testFetchByPrimaryKeysWithOnePrimaryKey() throws Exception {
Foo newFoo = addFoo();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newFoo.getPrimaryKey());
Map<Serializable, Foo> foos = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(1, foos.size());
Assert.assertEquals(newFoo, foos.get(newFoo.getPrimaryKey()));
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testFindByPrimaryKeyExisting.
@Test
public void testFindByPrimaryKeyExisting() throws Exception {
Foo newFoo = addFoo();
Foo existingFoo = _persistence.findByPrimaryKey(newFoo.getPrimaryKey());
Assert.assertEquals(existingFoo, newFoo);
}
use of com.liferay.blade.basic.model.Foo in project liferay-blade-samples by liferay.
the class FooModelImpl method equals.
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Foo)) {
return false;
}
Foo foo = (Foo) obj;
long primaryKey = foo.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
} else {
return false;
}
}
Aggregations