-
-
Save ffdesousa/6168c4a6b0df54a343519c17df04bd71 to your computer and use it in GitHub Desktop.
[Fluig] "Mover" aquivo utilizando apenas docAPI e fluigAPI
This file contains 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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment