protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) { actionableDynamicQuery.setBaseLocalService( com.liferay.chat.service.StatusLocalServiceUtil.getService()); actionableDynamicQuery.setClassLoader(getClassLoader()); actionableDynamicQuery.setModelClass(Status.class); actionableDynamicQuery.setPrimaryKeyPropertyName("statusId"); }
@Override public ActionableDynamicQuery getActionableDynamicQuery() { ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery(); actionableDynamicQuery.setBaseLocalService( com.liferay.chat.service.StatusLocalServiceUtil.getService()); actionableDynamicQuery.setClassLoader(getClassLoader()); actionableDynamicQuery.setModelClass(Status.class); actionableDynamicQuery.setPrimaryKeyPropertyName("statusId"); return actionableDynamicQuery; }
@Test public void testActionableDynamicQuery() throws Exception { final IntegerWrapper count = new IntegerWrapper(); ActionableDynamicQuery actionableDynamicQuery = StatusLocalServiceUtil.getActionableDynamicQuery(); actionableDynamicQuery.setPerformActionMethod( new ActionableDynamicQuery.PerformActionMethod<Status>() { @Override public void performAction(Status status) { Assert.assertNotNull(status); count.increment(); } }); actionableDynamicQuery.performActions(); Assert.assertEquals(count.getValue(), _persistence.countAll()); }