12-08-2006 07:57 AM
12-10-2006 11:06 PM
07-03-2013 04:00 AM
12-11-2006 01:04 PM
12-12-2006 02:36 AM
public List<Document> getElements(String Id){
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
Reference reference = new Reference(STORE, Id, null);
List<Document> results = new LinkedList<Document>();
QueryResult childrenQueryResult;
try {
childrenQueryResult = repositoryService.queryChildren(reference);
ResultSet childrenResultSet = childrenQueryResult.getResultSet();
ResultSetRow[] rows = childrenResultSet.getRows();
if (rows != null)
{
// Si entramos aquÃ, es que tiene hijos.
// Obtenemos la información de cada fila y vamos construyendo la lista.
for(ResultSetRow row : rows)
{
String nodeId = row.getNode().getId();
Document contentResult = new Document(nodeId);
this.fillDocument(contentResult, row);
results.add(contentResult);
}
}
} catch (RepositoryFault e) {
System.out.println("Datos no encontrados.");
} catch (RemoteException e) {
System.out.println("Error de servicio remoto.");
}
return results;
}
public List<String> getMetadata(String Id){
List<String> lista = new LinkedList<String>();
Node nodo = getNode(Id);
String[] aspects = nodo.getAspects();
for (int i = 0; i < aspects.length; i++) {
lista.add(aspects[i]);
}
return lista;
}
protected Node getNode(String uuid){
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
Node myNode = null;
Reference reference = new Reference(STORE, uuid, null);
Predicate predicate = new Predicate(new Reference[]{reference}, null, null);
Node[] nodes;
try {
nodes = repositoryService.get(predicate);
// Obtenemos el nodo.
myNode = nodes[0];
} catch (RepositoryFault e) {
System.out.println("Datos no encontrados.");
} catch (RemoteException e) {
System.out.println("Error de servicio remoto.");
}
return myNode;
}
public String getData(String Id){
String result = null;
try {
// Obtener el servicio adecuado.
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
// Construimos la Referencia en base a su UUID.
Node nodo = this.getNode(Id);
Reference ref = nodo.getReference();
// Leemos del repositorio el elemento.
Content[] readResult = contentService.read(
new Predicate(new Reference[]{ref}, STORE, null),
Constants.PROP_CONTENT);
Content content = readResult[0];
// Obtenemos el contenido a partir de su URL y se muestra.
System.out.println(ContentUtils.getContentAsString(content));
result = ContentUtils.getContentAsString(content);
} catch (ContentFault e) {
System.out.println("No se ha podido leer el fichero.");
} catch (RemoteException e) {
System.out.println("Error de servicio.");
}
return result;
}
01-09-2007 03:29 PM
01-22-2008 09:39 AM
//String dir = "/app:company_home/cmCMCOE/cm:COE1/";
String path = dir+"*[@cm:name="" + fileName + ""]";
Reference reference = new Reference(storeRef, null, path);
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
10-16-2008 11:29 AM
I'm using a class Document to store information about nodes, so ignore this part of code.
Get the children of an specific folder (given its UUID)
public List<Document> getElements(String Id){
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
Reference reference = new Reference(STORE, Id, null);
List<Document> results = new LinkedList<Document>();
QueryResult childrenQueryResult;
try {
childrenQueryResult = repositoryService.queryChildren(reference);
ResultSet childrenResultSet = childrenQueryResult.getResultSet();
ResultSetRow[] rows = childrenResultSet.getRows();
if (rows != null)
{
// Si entramos aquÃ, es que tiene hijos.
// Obtenemos la información de cada fila y vamos construyendo la lista.
for(ResultSetRow row : rows)
{
String nodeId = row.getNode().getId();
Document contentResult = new Document(nodeId);
this.fillDocument(contentResult, row);
results.add(contentResult);
}
}
} catch (RepositoryFault e) {
System.out.println("Datos no encontrados.");
} catch (RemoteException e) {
System.out.println("Error de servicio remoto.");
}
return results;
}
Get metadata of a file / folder, given its UUID:
public List<String> getMetadata(String Id){
List<String> lista = new LinkedList<String>();
Node nodo = getNode(Id);
String[] aspects = nodo.getAspects();
for (int i = 0; i < aspects.length; i++) {
lista.add(aspects[i]);
}
return lista;
}
Auxiliary function to get a node given its UUID
protected Node getNode(String uuid){
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
Node myNode = null;
Reference reference = new Reference(STORE, uuid, null);
Predicate predicate = new Predicate(new Reference[]{reference}, null, null);
Node[] nodes;
try {
nodes = repositoryService.get(predicate);
// Obtenemos el nodo.
myNode = nodes[0];
} catch (RepositoryFault e) {
System.out.println("Datos no encontrados.");
} catch (RemoteException e) {
System.out.println("Error de servicio remoto.");
}
return myNode;
}
Getting the content of a text file (I suposse it works with any file, you obtain the content as a String)
public String getData(String Id){
String result = null;
try {
// Obtener el servicio adecuado.
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
// Construimos la Referencia en base a su UUID.
Node nodo = this.getNode(Id);
Reference ref = nodo.getReference();
// Leemos del repositorio el elemento.
Content[] readResult = contentService.read(
new Predicate(new Reference[]{ref}, STORE, null),
Constants.PROP_CONTENT);
Content content = readResult[0];
// Obtenemos el contenido a partir de su URL y se muestra.
System.out.println(ContentUtils.getContentAsString(content));
result = ContentUtils.getContentAsString(content);
} catch (ContentFault e) {
System.out.println("No se ha podido leer el fichero.");
} catch (RemoteException e) {
System.out.println("Error de servicio.");
}
return result;
}
Hope it helps you.
01-08-2010 11:21 AM
Content[] readResult = contentService.read(
new Predicate(new Reference[]{reference}, storeRef, null),
Constants.PROP_CONTENT);
Content contentRef = readResult[0];
// Get the ticket URL as above and the downloadURL here points to the url where the content is present.
System.out.println("contentRef.getUrl() : " + contentRef.getUrl());
String ticketURL = "?ticket=" + ticket;
downloadURL = contentRef.getUrl() + ticketURL;
01-13-2010 12:12 PM
downloadURL = URLDecoder.decode(contentRef.getUrl(),"UTF-8") + ticketURL;
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.