use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class ClubPersistenceTest method testDynamicQueryByPrimaryKeyMissing.
@Test
public void testDynamicQueryByPrimaryKeyMissing() throws Exception {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Club.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("clubId", RandomTestUtil.nextLong()));
List<Club> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(0, result.size());
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class RosterMemberPersistenceTest method testDynamicQueryByPrimaryKeyExisting.
@Test
public void testDynamicQueryByPrimaryKeyExisting() throws Exception {
RosterMember newRosterMember = addRosterMember();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RosterMember.class, _dynamicQueryClassLoader);
dynamicQuery.add(RestrictionsFactoryUtil.eq("rosterMemberId", newRosterMember.getRosterMemberId()));
List<RosterMember> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
RosterMember existingRosterMember = result.get(0);
Assert.assertEquals(existingRosterMember, newRosterMember);
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class RosterPersistenceTest method testDynamicQueryByProjectionMissing.
@Test
public void testDynamicQueryByProjectionMissing() throws Exception {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Roster.class, _dynamicQueryClassLoader);
dynamicQuery.setProjection(ProjectionFactoryUtil.property("rosterId"));
dynamicQuery.add(RestrictionsFactoryUtil.in("rosterId", new Object[] { RandomTestUtil.nextLong() }));
List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(0, result.size());
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class RosterPersistenceTest method testDynamicQueryByProjectionExisting.
@Test
public void testDynamicQueryByProjectionExisting() throws Exception {
Roster newRoster = addRoster();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Roster.class, _dynamicQueryClassLoader);
dynamicQuery.setProjection(ProjectionFactoryUtil.property("rosterId"));
Object newRosterId = newRoster.getRosterId();
dynamicQuery.add(RestrictionsFactoryUtil.in("rosterId", new Object[] { newRosterId }));
List<Object> result = _persistence.findWithDynamicQuery(dynamicQuery);
Assert.assertEquals(1, result.size());
Object existingRosterId = result.get(0);
Assert.assertEquals(existingRosterId, newRosterId);
}
use of com.liferay.portal.kernel.dao.orm.DynamicQuery in project liferay-ide by liferay.
the class SongIndexer method reindexEntries.
protected void reindexEntries(long companyId) throws PortalException, SystemException {
final Collection<Document> documents = new ArrayList<Document>();
ActionableDynamicQuery actionableDynamicQuery = new SongActionableDynamicQuery() {
@Override
protected void addCriteria(DynamicQuery dynamicQuery) {
}
@Override
protected void performAction(Object object) throws PortalException {
Song song = (Song) object;
Document document = getDocument(song);
documents.add(document);
}
};
actionableDynamicQuery.setCompanyId(companyId);
actionableDynamicQuery.performActions();
SearchEngineUtil.updateDocuments(getSearchEngineId(), companyId, documents);
}
Aggregations