Obtener nodos de un espacio (Post en obras)

Sacare tiempo para comentar el codigo y explicar un poco mejor este post

private ResultSetRow[] search() throws RepositoryFault, RemoteException{

List<ContentResult> results = new ArrayList<ContentResult>();

String path = “/app:company_home/*[@cm:name=\""+ "Asociaciones" + "\"]/”;

RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();

Reference reference = new Reference(STORE, null, path);

QueryResult query = repositoryService.queryChildren(reference);

ResultSetRow[] rows = query.getResultSet().getRows();

return rows;

}

Para utilizar los servicios web de alfresco es necesario autenticarse antes de lanzar el cliente de dicho servicio:

AuthenticationUtils.startSession(“user”, “pass”);

AuthenticationUtils.endSession();

Una vez que tenemos todo el contenido podemos obtener las propiedades de cada elemento.

if (rows != null){

for(ResultSetRow row : rows){

String nodeId = row.getNode().getId();

for (NamedValue namedValue : row.getColumns()){

if(namedValue.getName().endsWith(Constants.PROP_NAME)== true){

String name = namedValue.getValue();

}

}

}

}

Propiedades que podemos recuperar:

namedValue.getName().endsWith(Constants.PROP_CREATED)

namedValue.getName().endsWith(Constants.PROP_NAME)

namedValue.getName().endsWith(Constants.PROP_DESCRIPTION)

namedValue.getName().endsWith(Constants.PROP_CONTENT)

Deja un comentario

Fill in your details below or click an icon to log in:

Logo de WordPress.com

You are commenting using your WordPress.com account. Log Out / Cambiar )

Twitter picture

You are commenting using your Twitter account. Log Out / Cambiar )

Facebook photo

You are commenting using your Facebook account. Log Out / Cambiar )

Connecting to %s

Seguir

Get every new post delivered to your Inbox.