Fórum

service.xml Collection

ild i, modificado 12 Anos atrás.

service.xml Collection

Regular Member Postagens: 158 Data de Entrada: 12/12/11 Postagens Recentes
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, modificado 12 Anos atrás.

RE: service.xml Collection

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
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, modificado 12 Anos atrás.

RE: service.xml Collection

Regular Member Postagens: 158 Data de Entrada: 12/12/11 Postagens Recentes
<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, modificado 12 Anos atrás.

RE: service.xml Collection

Regular Member Postagens: 158 Data de Entrada: 12/12/11 Postagens Recentes
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>