use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class AdminPortletDataHandler method getKBArticleActionableDynamicQuery.
protected ActionableDynamicQuery getKBArticleActionableDynamicQuery(final PortletDataContext portletDataContext) throws Exception {
return new KBArticleExportActionableDynamicQuery(portletDataContext) {
@Override
protected void addCriteria(DynamicQuery dynamicQuery) {
super.addCriteria(dynamicQuery);
OrderFactoryUtil.addOrderByComparator(dynamicQuery, new KBArticleVersionComparator(true));
}
};
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-blade-samples by liferay.
the class FooLocalServiceBaseImpl method getExportActionableDynamicQuery.
@Override
public ExportActionableDynamicQuery getExportActionableDynamicQuery(final PortletDataContext portletDataContext) {
final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
@Override
public long performCount() throws PortalException {
ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
StagedModelType stagedModelType = getStagedModelType();
long modelAdditionCount = super.performCount();
manifestSummary.addModelAdditionCount(stagedModelType, modelAdditionCount);
long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext, stagedModelType);
manifestSummary.addModelDeletionCount(stagedModelType, modelDeletionCount);
return modelAdditionCount;
}
};
initActionableDynamicQuery(exportActionableDynamicQuery);
exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
@Override
public void addCriteria(DynamicQuery dynamicQuery) {
portletDataContext.addDateRangeCriteria(dynamicQuery, "modifiedDate");
}
});
exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<Foo>() {
@Override
public void performAction(Foo foo) throws PortalException {
StagedModelDataHandlerUtil.exportStagedModel(portletDataContext, foo);
}
});
exportActionableDynamicQuery.setStagedModelType(new StagedModelType(PortalUtil.getClassNameId(Foo.class.getName())));
return exportActionableDynamicQuery;
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-blade-samples by liferay.
the class FooPersistenceTest method testDynamicQueryByPrimaryKeyExisting.
@Test
public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
Foo newFoo = addFoo();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Foo.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("fooId", newFoo.getFooId()));
List<Foo> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
Foo existingFoo = result.get(0);
Assert.assertEquals(existingFoo, newFoo);
}
Aggregations