Skip to content

Instantly share code, notes, and snippets.

@bmvakili
Created November 28, 2015 14:32
Show Gist options
  • Save bmvakili/a4b79b137de73b871e8a to your computer and use it in GitHub Desktop.
Save bmvakili/a4b79b137de73b871e8a to your computer and use it in GitHub Desktop.
Get Liferay DDL Records for a user
import java.io.PrintStream;
import java.util.List;
import com.liferay.portal.kernel.dao.orm.Criterion;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portlet.dynamicdatalists.model.DDLRecord;
import com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalServiceUtil;
Long userId = 50785l;
DynamicQuery dynamicQuery = DDLRecordLocalServiceUtil.dynamicQuery();
Criterion criterion = PropertyFactoryUtil.forName("userId").eq(userId);
dynamicQuery.add(criterion);
List records = DDLRecordLocalServiceUtil.dynamicQuery(dynamicQuery);
for (DDLRecord record : records) {
out.println(record);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment