02-28-2007 10:58 PM
public void testSearchAPI() {
try {
AuthenticationUtils.startSession(USERNAME, PASSWORD);
} catch (AuthenticationFault authenticationFault) {
authenticationFault.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
Query query = new Query(Constants.QUERY_LANG_LUCENE, "TEXT:Da*");
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
try {
QueryResult queryResult = repositoryService.query(STORE, query, true);
Assert.assertNotNull("queryResult should not be null", queryResult);
String querySession = queryResult.getQuerySession();
Assert.assertNotNull("querySession should not be null", querySession);
ResultSet resultSet = queryResult.getResultSet();
Assert.assertNotNull("The result set should not be null", resultSet);
System.out.println("number of results" + resultSet.getRows().length);
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
int i=0;
for (ResultSetRow row : resultSet.getRows()) {
Reference ref = new Reference();
ref.setUuid(row.getNode().getId());
ref.setStore(STORE);
// Read the newly added content from the respository
Content[] readResult = new Content[0];
try {
readResult = contentService.read(new Predicate(new Reference[]{ref}, STORE, null), Constants.PROP_CONTENT);
} catch (RemoteException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
Content content = readResult[0];
System.out.println("content url " + content.getUrl());
ContentFormat format =content.getFormat();
System.out.println("format is"+format.getMimetype());
if(format.getMimetype().equals("application/pdf")){
ContentUtils.copyContentToFile(content, new File("/home/dcrossma/Desktop/doc"+ ++i +".pdf"));
row.getNode().
}
}
} catch (RemoteException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
} finally {
// End the session
AuthenticationUtils.endSession();
}
}
03-01-2007 01:24 AM
Query query = new Query(Constants.QUERY_LANG_LUCENE, "+@\\{csg.model\\}proponent:\"test\" AND (TYPE:\"{http://www.alfresco.org/model/content/1.0}folder\")");
06-08-2007 04:56 AM
String strQuery= "+@{cice.salaprensa.model}fuente:Load";
Query query = new Query(Constants.QUERY_LANG_LUCENE, strQuery);
QueryResult rootChildren = repositoryService.query(STORE, query, true);
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString:
faultActor:
faultNode:
faultDetail:
{http://www.alfresco.org/ws/service/repository/1.0}RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>Failed to parse query: +@{cice.salaprensa.model}fuente:Load</ns1:message>
{http://xml.apache.org/axis/}exceptionName:org.alfresco.repo.webservice.repository.RepositoryFault
{http://xml.apache.org/axis/}stackTrace:
at org.alfresco.repo.webservice.repository.RepositoryWebService.query(RepositoryWebService.java:233)
at sun.reflect.GeneratedMethodAccessor612.invoke(Unknown Source)
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.