Foros de discusión

Liferay 6.2: addFileEntry generates draft

Ignacio Santos Alonso, modificado hace 9 años.

Liferay 6.2: addFileEntry generates draft

Junior Member Mensajes: 50 Fecha de incorporación: 12/02/13 Mensajes recientes
I'm adding documents to my Liferay 6.2 instance using the following code:


String contentType = MimeTypesUtil.getContentType(archivo);
		serviceContext.setAttribute("contentType", contentType);
		String extension = com.liferay.portal.kernel.util.FileUtil.getExtension(archivo.getName());
		serviceContext.setAttribute("extension", extension);

		DLFileEntry docLR = DLFileEntryLocalServiceUtil.addFileEntry( 
			getUserId(),
			groupId,
			groupId, //repositoryId
			idCarpetaPadre, //folderId
			getNombre(), //name
			contentType, //mimeType
			getNombre(), //title
			"", //description
			"", //changeLog
			0, //fileEntryTypeId
			null, //fieldsMap			
			archivo,
			new FileInputStream(archivo),
			archivo.length(),
			serviceContext);


but all the docs are created as drafts, unlike those that you can create manually.

Why is this and how can I correct this issue?

Thanks.
thumbnail
Shinn Lok, modificado hace 9 años.

RE: Liferay 6.2: addFileEntry generates draft

Junior Member Mensajes: 89 Fecha de incorporación: 14/01/11 Mensajes recientes
You can either call WorkflowHandlerRegistryUtil#startWorkflowInstance after or use DLAppLocalServiceUtil#addFileEntry instead of DLFileEntryLocalServiceUtil#addFileEntry
Ignacio Santos Alonso, modificado hace 9 años.

RE: Liferay 6.2: addFileEntry generates draft

Junior Member Mensajes: 50 Fecha de incorporación: 12/02/13 Mensajes recientes
Thank you very much Shinn, working fine now, DLAppLocalServiceUtil.addFileEntry did the trick!