Last active
May 22, 2021 01:02
-
-
Save doug1n/320ba1b2f226f7240f8f71de0c2a6083 to your computer and use it in GitHub Desktop.
"Mover" aquivo utilizando apenas docAPI e fluigAPI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Clona um documento, salva em uma pasta especifica e deleta o documento clonado | |
* Retorna o código do documento clonado | |
*/ | |
function moverDocumento(documentoId, versaoDocumento, pastaDestinoId) { | |
var phisicalFile = docAPI.copyDocumentToUploadArea(documentoId, versaoDocumento)[0]; | |
var docDto = docAPI.newDocumentDto(); | |
docDto.setDocumentId(0); | |
docDto.setDocumentTypeId(""); | |
docDto.setDocumentDescription(phisicalFile); | |
docDto.setParentDocumentId(parseInt(pastaDestinoId)); | |
var attachArray = new java.util.ArrayList(); | |
var mainAttach = docAPI.newAttachment(); | |
mainAttach.setFileName(phisicalFile); | |
mainAttach.setPrincipal(true); | |
mainAttach.setAttach(false); | |
attachArray.add(mainAttach); | |
var doc = docAPI.createDocument(docDto, attachArray, null, null, null); | |
fluigAPI.getDocumentService().deleteDocument(documentoId); | |
return doc.getDocumentId(); | |
} |
BielPinto
commented
May 22, 2021
via email
OPA, então eu uso esse tipo de consulta tbm no Banco , como te falei eu consigo mover(recortar ) o documento porém ajustar as permissão ainda não ,vou seguir estudando o fluig , se eu encontrar alguma pistar aviso aqui , valeu pela ajuda !
…________________________________
De: Douglas Gomes ***@***.***>
Enviado: sexta-feira, 21 de maio de 2021 19:14
Para: doug1n ***@***.***>
Cc: BielPinto ***@***.***>; Comment ***@***.***>
Assunto: Re: doug1n/fluigMoverDocumento.js
@doug1n commented on this gist.
________________________________
Bom, creio que não há possibilidade de mover o documento sem apaga-lo.
Caso você tenha acesso ao banco de dados e saiba oq está fazendo, pode se aventurar na tabela DOCUMENTO.
SELECT NR_DOCUMENTO, NR_VERSAO, COD_UUID, NR_ACESSOS, TP_DOCUMENTO, NM_ARQUIVO_FISICO, NM_ARQUIVOS_RELACIONADOS, NUM_TAM_ARQ_FISIC, COD_MIME_TYPE, DS_PRINCIPAL_DOCUMENTO, NR_DOCUMENTO_PAI, VERSAO_ATIVA FROM DOCUMENTO WHERE TP_DOCUMENTO IN (1, 2) ORDER BY NR_DOCUMENTO;
O NR_DOCUMENTO é o ID do arquivo no GED e NR_DOCUMENTO_PAI é o ID da pasta pai do arquivo.
Faça um teste antes no servidor de homologação.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://gist.github.com/320ba1b2f226f7240f8f71de0c2a6083#gistcomment-3752462>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJF6PMQV6I2BNCUGE7APSHDTO3EL5ANCNFSM45J2QTIQ>.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment