Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
ildar sl
service.xml Collection
21 de Fevereiro de 2012 23:17
Resposta

ildar sl

Ranking: Junior Member

Mensagens: 94

Data de entrada: 12 de Dezembro de 2011

Mensagens 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 ?
David H Nebinger
RE: service.xml Collection
22 de Fevereiro de 2012 06:07
Resposta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensagens: 9453

Data de entrada: 1 de Setembro de 2006

Mensagens 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.
ildar sl
RE: service.xml Collection
24 de Fevereiro de 2012 02:09
Resposta

ildar sl

Ranking: Junior Member

Mensagens: 94

Data de entrada: 12 de Dezembro de 2011

Mensagens 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

 1    public List<Rlist> getStatus(int status, int start,
 2            int end, OrderByComparator orderByComparator) throws SystemException{
 3                return rlistPersistence.findByS(status, start, end, orderByComparator);
 4    }
 5   
 6    public int getStatusCount(int status) throws SystemException{
 7        return rlistPersistence.countByS(status);
 8    }
 9   
10    public List<Rlist> getuserid(long userId, int start,
11            int end, OrderByComparator orderByComparator) throws SystemException{
12            
13            return rlistPersistence.findByU(userId, start, end, orderByComparator);
14    }
15   
16    public int getuserCount(int status) throws SystemException{
17        return rlistPersistence.countU(status);
18    }
ildar sl
RE: service.xml Collection
24 de Fevereiro de 2012 02:14
Resposta

ildar sl

Ranking: Junior Member

Mensagens: 94

Data de entrada: 12 de Dezembro de 2011

Mensagens recentes

JSP


 1
 2<liferay-ui:search-container
 3    searchContainer="<%= new RISSearch(renderRequest, iteratorURL) %>"
 4>
 5
 6    <liferay-ui:search-container-results
 7        results="<%= RlistServiceUtil.getStatus(2, searchContainer.getStart(), searchContainer.getEnd(), searchContainer.getOrderByComparator()) %>"
 8        total="<%= RlistServiceUtil.getStatusCount(2) %>"
 9    />
10
11????