Searching for a review created with a specific review templateThe following code shows how to search for reviews that are initiated with a specific review template named 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 initiated with review template named
//"SOP-1-1"
filterTO.setTemplateName("SOP-1-1");
// 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