04-27-2010 12:38 PM
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)
04-29-2010 10:29 AM
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
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.