Mandar email como opción de menú

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

Mandar email como opción de menú

Hola!

Alguien sabe si  hay alguna forma de sacar la acción de enviar email a las acciones que salen en el documento? seria añadirla en esta parte de web-client-config.xml:

   <action-group id="document_browse_menu">                  
      ***
      </action-group>

Gracias!!
3 Replies
Highlighted
Member II

Re: Mandar email como opción de menú

Solucionado, al final he encontrado un post bastante util  :lol:
Highlighted
Active Member

Re: Mandar email como opción de menú

Animate a compartir el conocimento con nosotros  :wink:
Highlighted
Member II

Re: Mandar email como opción de menú

Pues la verdad es que mi intención era postear la solución cuando lo tuviese todo terminado pero al final no he conseguido nada  Smiley Sad , crei que si pero no…

Lo que he hecho hasta ahora ha sido crear un customDialog donde me sale un textbox para escribir una dirección de correo, éste es el código:

public class EnviarCorreoDialog extends BaseDialogBean{

    private String correo;

   protected String finishImpl(FacesContext context, String outcome) throws Exception
   {
      // get the space the action will apply to
        NodeRef nodeRef = this.browseBean.getActionSpace().getNodeRef();
       
        MailAttachActionExecuter maExecuter = new MailAttachActionExecuter();
        maExecuter.enviarEmail(nodeRef,this.correo);
        getNodeService().deleteNode(nodeRef);


      return outcome;
   }

El action MailAttachActionExecuter es el mismo que el que trae alfresco para mandar mails solo que está modificado para que envie adjuntos… la cosa es que despues de hacer mil pruebas, lo unico que he conseguido es que en la linea javaMailSender.send(mailPreparer); me de un nullpointer… supongo que es porque no puedo acceder a ese action de esta forma…

Después he intentado hacer lo siguiente en la jsp donde introduzco el email:


<a:actionLink id="some-id" value="My Webscript Action" image="/images/icons/view_properties.gif"
    actionListener="#{MailAttachActionExecuter.enviarEmail}"
    tooltip="Show my webscript in a dialog">
    <f:param name="correo" value="xxx@xxx.es"/>
     <f:param name="nodeRef" value="#{NavigationBean.currentNode.nodeRef}"/>
   
</a:actionLink>

Y entonces obtengo este error:


org.springframework.mail.MailPreparationException: Could not prepare mail; nest
d exception is org.alfresco.error.AlfrescoRuntimeException: Transaction must be
active and synchronization is required: Thread[http-8080-1,5,main]
Caused by: org.alfresco.error.AlfrescoRuntimeException: Transaction must be acti
ve and synchronization is required: Thread[http-8080-1,5,main]
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport.registerSyn
hronizations(AlfrescoTransactionSupport.java:432)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport.getSynchron
zation(AlfrescoTransactionSupport.java:416)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport.getResource
AlfrescoTransactionSupport.java:209)
        at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.get
lushData(DirtySessionMethodInterceptor.java:213)
        at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.inv
ke(DirtySessionMethodInterceptor.java:354)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynam
cAopProxy.java:204)
        at $Proxy2.getNodePair(Unknown Source)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.getNodePairNotNull(DbNod
ServiceImpl.java:153)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.hasAspect(DbNodeServiceI
pl.java:712)
        at sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflect
on(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJ
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceIntercep
or.invokeInternal(SingleEntryTransactionResourceInterceptor.java:154)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceIntercep
or.invoke(SingleEntryTransactionResourceInterceptor.java:138)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynam
cAopProxy.java:204)
        at $Proxy3.hasAspect(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflect
on(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJ
inpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTN
deServiceInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynam
cAopProxy.java:204)
        at $Proxy3.hasAspect(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvo
ationHandler.invoke(StoreRedirectorProxyFactory.java:221)
        at $Proxy4.hasAspect(Unknown Source)
        at org.alfresco.repo.node.MLPropertyInterceptor.getPivotNodeRef(MLPrope
tyInterceptor.java:324)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterc
ptor.java:164)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeR
fPropertyMethodInterceptor.java:203)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeR
fPropertyMethodInterceptor.java:203)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynam
cAopProxy.java:204)
        at $Proxy3.getProperty(Unknown Source)
        at org.alfresco.repo.content.RoutingContentService.getReader(RoutingCon
entService.java:317)
        at org.alfresco.repo.content.RoutingContentService.getReader(RoutingCon
entService.java:310)
        at es.sic.executer.MailAttachActionExecuter$1$1.getContentType(MailAtta
hActionExecuter.java:317)
        at javax.activation.DataHandler.getContentType(DataHandler.java:189)
        at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:110
)
        at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:863

        at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:2
9)
        at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:111
)
        at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1927)
        at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1908)
        at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMail
enderImpl.java:387)
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSe
derImpl.java:332)
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSe
derImpl.java:347)
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSe
derImpl.java:336)
        at es.sic.executer.MailAttachActionExecuter.enviarEmail(MailAttachActio
Executer.java:344)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.jav
:132)
        at javax.faces.component.UICommand.broadcast(UICommand.java:89)
        at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:
7)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:
71)
        at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(Invok
ApplicationExecutor.java:32)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImp
.java:95)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.jav
:70)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App
icationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(Application
ilterChain.java:206)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(Authentic
tionFilter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App
icationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(Application
ilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapper
alve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContext
alve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.
ava:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.
ava:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVa
ve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.ja
a:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.jav
:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proc
ss(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:4
7)
        at java.lang.Thread.run(Thread.java:619)



y así llevo desde ayer a la tarde…

Yo creo que tiene que haber una solución más facil Smiley Frustrated