1
14
15 package com.liferay.portal.service.persistence;
16
17 import com.liferay.portal.kernel.dao.orm.QueryPos;
18 import com.liferay.portal.kernel.dao.orm.SQLQuery;
19 import com.liferay.portal.kernel.dao.orm.Session;
20 import com.liferay.portal.kernel.exception.SystemException;
21 import com.liferay.portal.model.PortletPreferences;
22 import com.liferay.portal.model.impl.PortletPreferencesImpl;
23 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
24 import com.liferay.util.dao.orm.CustomSQLUtil;
25
26 import java.util.List;
27
28
34 public class PortletPreferencesFinderImpl
35 extends BasePersistenceImpl<PortletPreferences>
36 implements PortletPreferencesFinder {
37
38 public static String FIND_BY_PORTLETID =
39 PortletPreferencesFinder.class.getName() + ".findByPortletId";
40
41 public List<PortletPreferences> findByPortletId(String portletId)
42 throws SystemException {
43
44 Session session = null;
45
46 try {
47 session = openSession();
48
49 String sql = CustomSQLUtil.get(FIND_BY_PORTLETID);
50
51 SQLQuery q = session.createSQLQuery(sql);
52
53 q.addEntity("PortletPreferences", PortletPreferencesImpl.class);
54
55 QueryPos qPos = QueryPos.getInstance(q);
56
57 qPos.add(portletId);
58
59 return q.list();
60 }
61 catch (Exception e) {
62 throw new SystemException(e);
63 }
64 finally {
65 closeSession(session);
66 }
67 }
68
69 }