Searching for reviews with a specific title
The following example searches for all reviews that start with
the text “Designs”.
package com.adobe.lces.mra; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Properties; import com.adobe.idp.Document; import com.adobe.idp.dsc.clientsdk.ServiceClientFactory; import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties; import com.adobe.livecycle.rca.client.ReviewCommentingAndApprovalServiceClient; import com.adobe.livecycle.rca.transfer.ReviewSearchFilterTO; import com.adobe.livecycle.rca.transfer.ReviewSearchFilterTO.Role; public class SearchReviewSample { public void searchReviews(){ try { ReviewSearchFilterTO filterTO = new ReviewSearchFilterTO(); // To search for reviews titled "Designs". Search appends // % wild card by default. filterTO.setName("Designs"); // By default search filter searches records of the caller only. // If you have RCA Administrator role, then search filter will //return records of other users as well. To restrict the search in that // case,you can set UmOid as shown below*/ filterTO.setUmOid(MRATestUtils.getPrincipal("DefaultDom","apink").getOid()); // You can search for reviews in particular state. e.g. the below given code searches for reviews that are either completed or are ongoing List<String> statusList = new ArrayList<String>(); statusList.add("ONGOING"); statusList.add("COMPLETED"); filterTO.setStatusFilterList(statusList); // Roles can be specified as given below if you want to restrict search on particular roles. filterTO.setRole(Role.APPROVER); filterTO.setRole(Role.REVIEWER); ServiceClientFactory serviceClientFactory = getServiceClientFactory(); ReviewCommentingAndApprovalServiceClient rcaClient = new ReviewCommentingAndApprovalServiceClient(serviceClientFactory); //Calling searchReviews() API Document searchResultDoc = rcaClient.searchReviews(filterTO); //Writing the result XML to file searchResultDoc.copyToFile(new File("C:/rca/SearchResult.xml")); }catch(Exception e){ e.printStackTrace(); } } private ServiceClientFactory getServiceClientFactory(){ Properties connectionProps = new Properties(); connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://localhost:1099"); connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL); connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss"); connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "apink"); connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password"); ServiceClientFactory serviceClientFactory = ServiceClientFactory.createInstance(connectionProps); return serviceClientFactory; } } |
|
// Ethnio survey code removed