NodeRef fileNodeRef = this.nodeService.createNode(
containerNodeRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, fileName),
ContentModel.TYPE_CONTENT,
props).getChildRef();
// get a writer for the content and put the file
ContentWriter writer = this.services.getContentService().getWriter(fileNodeRef, ContentModel.PROP_CONTENT, true);
// set the mimetype and encoding
writer.setMimetype(MimetypeMap.MIMETYPE_PDF);
writer.setEncoding(Charset.defaultCharset().name());
if (fileContent != null) {
writer.putContent(fileContent);
logger.info("Añadimos contenido al nuevo fichero pdf");
}
writer.putContent(fileContent);
2016-03-17 11:19:56,920 ERROR [repo.action.AsynchronousActionExecutionQueueImpl] [defaultAsyncAction2] Failed to execute asynchronous action: Action[ id=59f9246d-68b6-46b5-a5f8-beb9ffd0c401, node=null ]: 02170009 A value for the mandatory parameter script-ref has not been set on the rule item script
org.alfresco.service.cmr.rule.RuleServiceException: 02170009 A value for the mandatory parameter script-ref has not been set on the rule item script
at org.alfresco.repo.action.ParameterizedItemAbstractBase.checkMandatoryProperties(ParameterizedItemAbstractBase.java:173)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:240)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:838)
at org.alfresco.repo.action.executer.CompositeActionExecuter.executeImpl(CompositeActionExecuter.java:66)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:258)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:838)
at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:738)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:572)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:161)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy54.executeAction(Unknown Source)
at org.alfresco.repo.rule.RuleServiceImpl.executeAction(RuleServiceImpl.java:1250)
at org.alfresco.repo.rule.RuleServiceImpl.executeRule(RuleServiceImpl.java:1244)
at org.alfresco.repo.rule.RuleServiceImpl$3.doWork(RuleServiceImpl.java:1183)
at org.alfresco.repo.rule.RuleServiceImpl$3.doWork(RuleServiceImpl.java:1180)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548)
at org.alfresco.repo.rule.RuleServiceImpl.executePendingRule(RuleServiceImpl.java:1179)
at org.alfresco.repo.rule.RuleServiceImpl.executePendingRulesImpl(RuleServiceImpl.java:1119)
at org.alfresco.repo.rule.RuleServiceImpl.executePendingRules(RuleServiceImpl.java:1092)
at org.alfresco.repo.rule.RuleTransactionListener.beforeCommit(RuleTransactionListener.java:57)
at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:737)
at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.doBeforeCommit(AlfrescoTransactionSupport.java:717)
at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:683)
at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:927)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:474)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:323)
at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:437)
at org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:119)
at org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:88)
at org.alfresco.repo.tenant.TenantUtil$1.doWork(TenantUtil.java:62)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548)
at org.alfresco.repo.tenant.TenantUtil.runAsUserTenant(TenantUtil.java:58)
at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:440)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
try { … } catch (Throwable t) { … }
alrededor del writer.putContent(…)
para ver si está lanzando alguna excepción.
// set the mimetype and encoding
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.setEncoding("UTF-8");
if (fileContent != null) {
try {
logger.info("Añadimos contenido al nuevo fichero txt");
writer.putContent("hello!!!");
logger.info("Contenido añadido");
} catch (Exception e) {
logger.info("No se ha podido añadir contenido");
e.printStackTrace();
}
}
// set the mimetype and encoding
writer.setMimetype(MimetypeMap.MIMETYPE_PDF);
writer.setEncoding("UTF-8");
if (fileContent != null) {
try {
logger.info("Añadimos contenido al nuevo fichero pdf");
writer.putContent("hello!!!");
logger.info("Contenido añadido");
} catch (Exception e) {
logger.info("No se ha podido añadir contenido");
e.printStackTrace();
}
}
writer.setMimetype(MimetypeMap.MIMETYPE_PDF);
pdfaFile = TempFileProvider.createTempFile("pdfaFile", "." + PDF_EXTENSION);
…
// Update/Write content
ContentWriter writer = contentService.getWriter(targetNodeRef, ContentModel.PROP_CONTENT, true);
writer.setMimetype(MimetypeMap.MIMETYPE_PDF);
writer.putContent(pdfaFile);
fileContent
a disco para ver qué está llegando.
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.