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