Fórumok

service.xml Collection

ild i, módosítva 12 év-val korábban

service.xml Collection

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2011.12.12. Legújabb bejegyzések
The table has three columns: id,userId,status
example

id______userId_______status
1_______100_________1_________true
2_______200_________2_________true
3_______200_________1_________false
4_______200_________2_________true
5_______100_________1_________true
6_______200_________1_________false
7_______300_________1_________false
8_______300_________2_________true


How to make a collection of service.xml, to get the results userId == 100 with any status, otherwise only the status of two ?
thumbnail
David H Nebinger, módosítva 12 év-val korábban

RE: service.xml Collection

Liferay Legend Bejegyzések: 14914 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Define two finders, one that does the userId match. After service rebuild, create a method in the package.service.impl.MyServiceLocalServiceImpl class to return a collection using just the two statuses and re-run service builder.
ild i, módosítva 12 év-val korábban

RE: service.xml Collection

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2011.12.12. Legújabb bejegyzések
<entity name="Rlist" local-service="true" remote-service="true">
<column name="Id" type="long" primary="true" />
<column name="userId" type="long"></column>
<column name="status" type="int" />

<finder name="S" return-type="Collection">
<finder-column name="status" />
</finder>
<finder name="I" return-type="Collection">
<finder-column name="Id" />
</finder>
<finder name="U" return-type="Collection">
<finder-column name="userId" />
</finder>
</entity>

MyServiceLocalServiceImpl

	public List<rlist> getStatus(int status, int start,
			int end, OrderByComparator orderByComparator) throws SystemException{
				return rlistPersistence.findByS(status, start, end, orderByComparator);
	}
	
	public int getStatusCount(int status) throws SystemException{
		return rlistPersistence.countByS(status);
	}
	
	public List<rlist> getuserid(long userId, int start,
			int end, OrderByComparator orderByComparator) throws SystemException{
			
			return rlistPersistence.findByU(userId, start, end, orderByComparator);
	}
	
	public int getuserCount(int status) throws SystemException{
		return rlistPersistence.countU(status);
	}</rlist></rlist>
ild i, módosítva 12 év-val korábban

RE: service.xml Collection

Regular Member Bejegyzések: 158 Csatlakozás dátuma: 2011.12.12. Legújabb bejegyzések
JSP



<liferay-ui:search-container searchcontainer="<%= new RISSearch(renderRequest, iteratorURL) %>">

	<liferay-ui:search-container-results results="<%= RlistServiceUtil.getStatus(2, searchContainer.getStart(), searchContainer.getEnd(), searchContainer.getOrderByComparator()) %>" total="<%= RlistServiceUtil.getStatusCount(2) %>" />

????
</liferay-ui:search-container>