08-21-2009 11:09 AM
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService("http://localhost:8080/alfresco/api");
Query query = new Query(Constants.QUERY_LANG_LUCENE, "@cm\\:name:'MyContent'");
QueryResult queryResult = repositoryService.query(STORE, query, false);
// Display the results
ResultSet resultSet = queryResult.getResultSet();
ResultSetRow[] rows = resultSet.getRows();
if (rows == null)
System.out.println("No query results found.");
else {
for (ResultSetRow row : rows) {
System.out.println("UID: "+ row.getNode().getId());
System.out.println("Type: "+ row.getNode().getType());
NamedValue[] values = row.getColumns();
System.out.println("Properties: ");
for (NamedValue col : values) {
System.out.println("\tName: " + col.getName());
System.out.println("\tValue: " + col.getValue());
}
}
String firstResultId = rows[0].getNode().getId();
Reference reference = new Reference(STORE, firstResultId, null);
Node[] a = repositoryService.get(new Predicate(new Reference[]{reference}, STORE, null));
for(int i=0;i<a[0].getProperties().length;i++) {
if(a[0].getProperties(i).getName().equalsIgnoreCase("{http://www.alfresco.org/model/content/1.0}content"))
System.out.println(a[0].getProperties(i).getValue());
}
}
private static ContentData getContentData(ServiceRegistry registry, String nodeId, StoreRef storeRef) {
NodeRef nodeRef = new NodeRef(storeRef, nodeId);
// retrieve the Content Property (represented as a ContentData object in Alfresco)
NodeService nodeService = registry.getNodeService();
return (ContentData)nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT);
}
StoreRef storeRef = new StoreRef(STORE.getScheme(), STORE.getAddress());
08-23-2009 11:11 AM
08-24-2009 03:28 PM
08-27-2009 01:55 PM
08-27-2009 04:09 PM
08-27-2009 04:54 PM
08-27-2009 06:14 PM
08-28-2009 09:27 AM
10-01-2009 10:11 PM
10-04-2009 12:38 AM
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.