problemas con el path de Reference

cancel
Showing results for 
Search instead for 
Did you mean: 
cibermon
Member II

problemas con el path de Reference

Buenas tardes, tengo un problema los path:

tengo lo siguiente:
1. Una referencia de un nodo objetivo
2. Sé que cuando hago un checkout de un nodo objetivo, me genera una copia en el mismo space que el nodo objetivo.

Luego no deberia ser complicado hacer la operación read


Tengo este codigo:


            referencia = New AlfrescoContentWebService.Reference
            referencia.store = dao.StoreContentService


            If identificadorNodoCopia Is Nothing Then

                For Each columnElement As AlfrescoRepositoryWebService.NamedValue In nodoPrincipal.columns
                    If columnElement.name.Contains("path") Then
                        referencia.path = """" + columnElement.value.Substring(0, columnElement.value.LastIndexOf("}") + 1) + _
                            Nombre.Substring(0, Nombre.IndexOf(".")) + " " + "(Working Copy)" + Nombre.Substring(Nombre.IndexOf(".")) + """"

                    End If
                Next
            Else
                referencia.uuid = identificadorNodoCopia
            End If



            Dim predicado As AlfrescoContentWebService.Predicate = _
                New AlfrescoContentWebService.Predicate()

            predicado.Items = New Object() {referencia}

           predicado.Items = New Object() {referencia}

            Dim contents As AlfrescoContentWebService.Content()


            contents = servicioContent.read(predicado, "{http://www.alfresco.org/model/content/1.0}content")


            Dim content As AlfrescoContentWebService.Content
            content = contents(0)



Pero siempre me da el error que me falta la raiz, y ya no sé que es lo que estoy haciendo mal.

Si alguien me puede ayudar …. Gracias de antemano.

Saludos.
1 Reply
cibermon
Member II

Re: problemas con el path de Reference

Os voy a especificar un poco mas la idea que estoy buscando y el problema que estoy teniendo.



He realizado un checkout sobre un nodo y me ha generado una copa de trabajo en la misma carpeta.

Tengo almacenado el identificador y el path del nodo original

esta es la ruta del nodo original:

"/{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/content/1...."

y quiero leer el contenido del nodo copia de trabajo o alguna manera de acceder a su identificador y asi poder leerlo.

He probado poniendo en la propiedad path del objetivo reference incluido en el predicate de la funcion read, partiendo de que se como se llama y tengo la ruta del original, pero no me funciona.

Tambien he probado a buscanlo con una query, sin exito.

Ciertamente el usuario que ha ejecutado en checkout con éxito si tiene la referencia a la copia, pero otro usuario que quiera hacer un checkout no va obtener nada porque no va a conseguir hacer un checkout, por lo que ese usuario tiene que buscar esa referencia a la copia.


Os muestro algo de código para que se quede algo más claro:



  
 Public Overrides Sub Abrir() Implements IModelo.Abrir

            If Descargar() Then
                'Especificamos el nombre del fichero para que luego pueda poder abrirlo
                nombreDocumento = RUTA_DESCARGA + Nombre
                MyBase.Abrir()
            End If

    End Sub

Private Function Descargar() As Boolean
            Dim referencia As AlfrescoContentWebService.Reference

            Try

                check = CheckOut()

                referencia = New AlfrescoContentWebService.Reference
                referencia.store = dao.StoreContentService


                If identificadorNodoCopia Is Nothing Then
                    'TODO esta parte todavia no funciona
                    For Each columnElement As AlfrescoRepositoryWebService.NamedValue In element.columns
                        If columnElement.name.Contains("path") Then
                            referencia.path = """" + columnElement.value.Substring(0, columnElement.value.LastIndexOf("}") + 1) + _
                                Nombre.Substring(0, Nombre.IndexOf(".")) + " " + "(Working Copy)" + Nombre.Substring(Nombre.IndexOf(".")) + """"

                        End If
                    Next
                Else
                    referencia.uuid = identificadorNodoCopia
                End If



                Dim predicado As AlfrescoContentWebService.Predicate = _
                    New AlfrescoContentWebService.Predicate()

                predicado.Items = New Object() {referencia}

                Dim contents As AlfrescoContentWebService.Content()


                contents = dao.servicioContent.read(predicado, ElementosRepositorioCollectionAlfresco.CONTENT_DOCUMENTO)


                Dim content As AlfrescoContentWebService.Content
                content = contents(0)


                Dim token As Microsoft.Web.Services3.Security.Tokens.UsernameToken

                token = dao.servicioContent.GetClientCredential(Of Microsoft.Web.Services3.Security.Tokens.UsernameToken)()

                Dim url As String

                url = content.url + "?ticket=" + token.Password

                FicheroUtil.Download(url, RUTA_DESCARGA + Nombre)

                Return True
              
            Catch ex As Exception
                Formateadores.Logger.EscribirException("Error al leer el contexto de Alfresco <Abrir> ", ex)
                Return False
            End Try
          

        End Function

Private Function CheckOut() As Boolean


            'Create the reference for the node selected
            Dim reference As AlfrescoAuthoringWebService.Reference
            reference = New AlfrescoAuthoringWebService.Reference()

            reference.store = dao.StoreAuthoringService
            reference.uuid = identificadorPrincipal

            'Lets try to check out
            Dim predicate As AlfrescoAuthoringWebService.Predicate
            predicate = New AlfrescoAuthoringWebService.Predicate()
            predicate.Items = New Object() {reference}

            Dim result As AlfrescoAuthoringWebService.CheckoutResult
            Dim resultEstatus As AlfrescoAuthoringWebService.LockStatus()

            Try
                resultEstatus = dao.servicioAutorizacion.getLockStatus(predicate)
                If Not resultEstatus(0).lockTypeSpecified Then
                    result = dao.servicioAutorizacion.checkout(predicate, Nothing)
                    identificadorNodoCopia = result.workingCopies(0).uuid
                    Return True
                Else
                    Formateadores.Logger.Escribir("Recurso bloqueado por " + resultEstatus(0).lockOwner)
                    Return False
                End If
            Catch ex As Exception
                Return False
            End Try



        End Function

Private check As Boolean = False
        Private element As AlfrescoRepositoryWebService.ResultSetRow
        Private dao As ElementosRepositorioCollectionAlfresco
        Private identificadorPrincipal As String
        Private identificadorNodoCopia As String

       Friend WriteOnly Property identificadorNodoWorkingCopy() As String
            Set(ByVal value As String)
                identificadorNodoCopia = value
            End Set
        End Property

        Public Sub New(ByVal elemento As AlfrescoRepositoryWebService.ResultSetRow, _
                       ByVal dao As ElementosRepositorioCollectionAlfresco)
            MyBase.New("")
            Me.element = elemento
            Me.nombreDocumento = Nombre
            Me.dao = dao
            Me.identificadorPrincipal = Me.element.node.id
        End Sub

Si alguien me puede ayudar le estaría muy agradecido.


Un saludo.