AnsweredAssumed Answered

Retrieve Content via Web Service API

Question asked by gis-olli on Aug 24, 2007
Latest reply on Dec 20, 2007 by robertoroberto
Hello, i have a question in context to the Web Service API. I have added some properties to the content model. Now i search for this properties with a java client, using the API, e.g.:

Query query1 = new Query(Constants.QUERY_LANG_LUCENE, "+@\\{http\\://www.alfresco.org/model/content/1.0\\}MyProperty1:\'Value1\" AND +@\\{http\\://www.alfresco.org/model/content/1.0\\}MyProperty2:\'Value2\" AND (TYPE:\"{http://www.alfresco.org/model/content/1.0}content\")");

QueryResult queryResult = repositoryService.query(STORE, query1, true);

This query is ok, i get some Results. Now my Question, how can i get this documents, my query returns? I used the code examples from the Web Service API:

// Display the results
ResultSet resultSet = queryResult.getResultSet();
ResultSetRow[] rows = resultSet.getRows();
if (rows == null)
{
System.out.println("No query results found.");
}
else
{
System.out.println("Results from query:");
outputResultSet(rows);

// Get the id of the first result
String firstResultId = rows[0].getNode().getId();
Reference reference = new Reference(STORE, firstResultId, null);

// Get the parent(s) of the first result
QueryResult parentQueryResult = repositoryService.queryParents(reference);

// Get the parent of the first result
ResultSet parentResultSet = parentQueryResult.getResultSet();
ResultSetRow[] parentRows = parentResultSet.getRows();
if (parentRows == null)
{
System.out.println("No query results found.");
}
else
{
System.out.println("Results from parent query:");
outputResultSet(parentRows);

// Return the first parent (we can use in other samples)
String firstParentId = parentRows[0].getNode().getId();
parentReference = new Reference(STORE, firstParentId, null);
}
}

Can i get the Documents as java file objects or something else? Can anyone post an example?  Thx …

Outcomes