01-31-2007 01:43 PM
Predicate predicate = new Predicate(new Reference[] { reference },
null, null);
Node[] tabNode = WebServiceFactory.getRepositoryService().get(predicate);
Node node = tabNode[0];
NamedValue nv = new NamedValue("{http://zzz.zzzz.zz.zz/zzzz/model/1.0}publication_execution" , false, "my value", null);
node.setProperties(0,nv);
}
02-01-2007 07:45 AM
public void setMetadata(Strin name, Hashtable metadata){
Store store = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
// Start the session
try{
AuthenticationUtils.startSession("admin", "admin");
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
// Create a query object, looking for all items with alfresco in the name of text
Query query = new Query(Constants.QUERY_LANG_LUCENE, "@cm\\:title:\""+name+"\"") ;
// Execute the query
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
{
//Get the id of the first result
String firstResultId = rows[0].getNode().getId();
//get reference
Reference reference = new Reference(store, firstResultId, null);
Predicate predicate = new Predicate(new Reference[]{reference}, store, null);
Node[] nodes = WebServiceFactory.getRepositoryService().get(predicate);
//set new properties
NamedValue[] properties = new NamedValue[metadata.size()];
Enumeration keys = metadata.keys();
Enumeration values = metadata.elements();
for (int i = 0; i < metadata.size(); i++){
properties[i] = new NamedValue();
properties[i].setName("{http://www.alfresco.org/model/content/1.0}'+keys.nextElement());
properties[i].setValue(values.nextElement().toString());
properties[i].setIsMultiValue(false);
//System.out.println(properties[i].getName());
}
nodes[0].setProperties(properties);
CMLUpdate update = new CMLUpdate(properties,predicate,firstResultId);
CML cml = new CML();
cml.setUpdate(new CMLUpdate[]{update});
WebServiceFactory.getRepositoryService().update(cml);
}
}catch(DocumentManagementException e){
System.out.println(e.getMessage());
}catch(Exception e){
System.out.println(e.getMessage());
}
finally
{
// End the session
AuthenticationUtils.endSession();
}
}
02-01-2007 10:32 AM
CMLUpdate update = new CMLUpdate(tnv,predicate,uuid);
CML cml = new CML();
cml.setUpdate(new CMLUpdate[]{update});
WebServiceFactory.getRepositoryService().update(cml);
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.