1
22
23 package com.liferay.portlet.expando.service.impl;
24
25 import com.liferay.portal.PortalException;
26 import com.liferay.portal.SystemException;
27 import com.liferay.portal.util.PortalUtil;
28 import com.liferay.portlet.expando.model.ExpandoRow;
29 import com.liferay.portlet.expando.model.ExpandoTableConstants;
30 import com.liferay.portlet.expando.service.base.ExpandoRowLocalServiceBaseImpl;
31
32 import java.util.List;
33
34
40 public class ExpandoRowLocalServiceImpl extends ExpandoRowLocalServiceBaseImpl {
41
42 public ExpandoRow addRow(long tableId)
43 throws PortalException, SystemException {
44
45 long rowId = counterLocalService.increment();
46
47 ExpandoRow row = expandoRowPersistence.create(rowId);
48
49 row.setTableId(tableId);
50
51 expandoRowPersistence.update(row, false);
52
53 return row;
54 }
55
56 public void deleteRow(long rowId)
57 throws PortalException, SystemException {
58
59
61 expandoValueLocalService.deleteRowValues(rowId);
62
63
65 expandoRowPersistence.remove(rowId);
66 }
67
68 public List<ExpandoRow> getDefaultTableRows(
69 String className, int begin, int end)
70 throws SystemException {
71
72 long classNameId = PortalUtil.getClassNameId(className);
73
74 return getDefaultTableRows(classNameId, begin, end);
75 }
76
77 public List<ExpandoRow> getDefaultTableRows(
78 long classNameId, int begin, int end)
79 throws SystemException {
80
81 return expandoRowFinder.findByTC_TN(
82 classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME, begin, end);
83 }
84
85 public int getDefaultTableRowsCount(String className)
86 throws SystemException {
87
88 long classNameId = PortalUtil.getClassNameId(className);
89
90 return getDefaultTableRowsCount(classNameId);
91 }
92
93 public int getDefaultTableRowsCount(long classNameId)
94 throws SystemException {
95
96 return expandoRowFinder.countByTC_TN(
97 classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME);
98 }
99
100 public List<ExpandoRow> getRows(long tableId, int begin, int end)
101 throws SystemException {
102
103 return expandoRowPersistence.findByTableId(tableId, begin, end);
104 }
105
106 public List<ExpandoRow> getRows(
107 String className, String tableName, int begin, int end)
108 throws SystemException {
109
110 long classNameId = PortalUtil.getClassNameId(className);
111
112 return getRows(classNameId, tableName, begin, end);
113 }
114
115 public List<ExpandoRow> getRows(
116 long classNameId, String tableName, int begin, int end)
117 throws SystemException {
118
119 return expandoRowFinder.findByTC_TN(
120 classNameId, tableName, begin, end);
121 }
122
123 public int getRowsCount(long tableId) throws SystemException {
124 return expandoRowPersistence.countByTableId(tableId);
125 }
126
127 public int getRowsCount(String className, String tableName)
128 throws SystemException {
129
130 long classNameId = PortalUtil.getClassNameId(className);
131
132 return getRowsCount(classNameId, tableName);
133 }
134
135 public int getRowsCount(long classNameId, String tableName)
136 throws SystemException {
137
138 return expandoRowFinder.countByTC_TN(classNameId, tableName);
139 }
140
141 }