AnsweredAssumed Answered

problem with reference path

Question asked by cibermon on Apr 29, 2010
I've done a checkout on a node and it has created a working copy in the same folder.

I have stored the path identifier and the original node

this is the original node path:

"/{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/content/1.0}Notin/{http://www.alfresco.org/model/content/1.0}ESCRITUR.doc"

and I want to read the contents of the node working copy or a way to access your ID and so to read it.

I tried putting in the path property of the target reference included in the predicate of the function read, assuming that is what it is called and I have the original route, but it does not work.

I have also tried buscanlo with a query, without success.

Certainly the user has successfully executed on checkout if you have the reference to the copy, but another user who wants to do a checkout will not get anything because you will not get to do a checkout, so that the user has to find that reference to the copy.


I show you some code that is somewhat clearer:


     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

If anyone can help me I would be grateful.


A greeting.

Outcomes