problème cast avec la classe ManageTaskDialog

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

problème cast avec la classe ManageTaskDialog

Salut,

  Voici le code source générant l'erreur :

 
CustomManageTaskDialog customManageTaskDialog = (CustomManageTaskDialog) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "ManageTaskDialog");

  Cette ligne me donne l'erreur suivante :

A system error happened during the operation: org.alfresco.web.bean.workflow.ManageTaskDialog cannot be cast to  …………  CustomManageTaskDialog

le code de la classe CustomManageTaskDialog

public class CustomManageTaskDialog extends ManageTaskDialog
{
…………………………

  
    }
Quelqu'un a-t-il une idée?
Merci pour vos réponses
10 Replies
jayjayecl
Active Member II

Re: problème cast avec la classe ManageTaskDialog

Réécrivez carrément ManageTaskDialog, sans l'étendre.
Enfin, surchargez l'implémentation du bean "ManageTaskDialog" (définition dans faces-config-beans.xml) en appelant votre classe CustomManageTaskDialog
arkantos
Member II

Re: problème cast avec la classe ManageTaskDialog

Bonjour Robel,

cela ne marche pas, je ne sais pas pour quoi le FacesHelper n'arrive pas à instancier ma classe Customizée. Peut-être par ce que je mets les beans jsf dans un fichier face-config.xml dans META-INF, du jar généré puisque je travaille avec des AMPs et je suis dans l'obligation de suivre cette démarche.
je ne veut rien changer au fichier faces-config-bean.xml interne d'alfresco .
jayjayecl
Active Member II

Re: problème cast avec la classe ManageTaskDialog

pourriez-vous fournir p^lus d'éléments :

Code source de toute la classe custom, du faces-config.xml, de l'appel au bean etc …
Structure du AMP
trace complète de l'erreur
?
arkantos
Member II

Re: problème cast avec la classe ManageTaskDialog

Maintenant le cast passe très bien, mais j'ai l'erreur suivante:

 

     12:52:16,873 ERROR [org.alfresco.web.ui.common.Utils] A system error happened during the operation: null
java.lang.NullPointerException
   at alfresco.module.gestionCourrier.gestionCourrierSortant.UI.managedBeanDialog.UpdateCourrierSortantDialog.finishImpl(Unknown Source)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:124)
   at org.alfresco.web.bean.dialog.BaseDialogBean$1.execute(BaseDialogBean.java:121)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
   at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.java:130)
   at org.alfresco.web.bean.dialog.DialogManager.finish(DialogManager.java:534)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
   at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
   at javax.faces.component.UICommand.broadcast(UICommand.java:109)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
   at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
   at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy186.doFilter(Unknown Source)
   at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:74)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:122)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy186.doFilter(Unknown Source)
   at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:88)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:619)

 

Code managedBean customManageTaskDialog du faces-config.xml; le même que celui de ManageTaskDialog dans faces-config-beans.xml

<managed-bean>
   
      <managed-bean-name>customManageTaskDialog</managed-bean-name>
      <managed-bean-class>alfresco.module.gestionCourrier.gestionCourrierSortant.UI.managedBeanDialog.CustomManageTaskDialog</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
         <property-name>nodeService</property-name>
         <value>#{NodeService}</value>
      </managed-property>
      <managed-property>
         <property-name>fileFolderService</property-name>
         <value>#{FileFolderService}</value>
      </managed-property>
      <managed-property>
         <property-name>searchService</property-name>
         <value>#{SearchService}</value>
      </managed-property>
      <managed-property>
         <property-name>navigator</property-name>
         <value>#{NavigationBean}</value>
      </managed-property>
      <managed-property>
         <property-name>browseBean</property-name>
         <value>#{BrowseBean}</value>
      </managed-property>
      <managed-property>
         <property-name>dictionaryService</property-name>
         <value>#{DictionaryService}</value>
      </managed-property>
      <managed-property>
         <property-name>namespaceService</property-name>
         <value>#{NamespaceService}</value>
      </managed-property>
      <managed-property>
         <property-name>workflowService</property-name>
         <value>#{WorkflowService}</value>
      </managed-property>
      <managed-property>
         <property-name>avmService</property-name>
         <value>#{AVMLockingAwareService}</value>
      </managed-property>
      <managed-property>
         <property-name>avmSyncService</property-name>
         <value>#{AVMSyncService}</value>
      </managed-property>
   </managed-bean>

Surcharge de ManageTaskDialog : Dans CustomManageTaskDialog j'ai ajouté la méthode suivante :

public void removePackageItem(String nodeRef)
      {
       
         System.out.println("CustomManageTaskDialog.removePackageItem => nodeRef= "+nodeRef);
         if (this.packageItemsToAdd != null && this.packageItemsToAdd.contains(nodeRef))
         {
            // remove the item from the added list if it was added in this dialog session
            this.packageItemsToAdd.remove(nodeRef);
           
            if (LOGGER.isDebugEnabled())
               LOGGER.debug("Removed item from the added list: " + nodeRef);
              System.out.println("Removed item from the added list: " + nodeRef);
         }
         else
         {
            // add the node to the list of items to remove
            if (this.packageItemsToRemove == null)
            {
               this.packageItemsToRemove = new ArrayList<String>(1);
            }
           
            this.packageItemsToRemove.add(nodeRef);
           
            if (LOGGER.isDebugEnabled())
               LOGGER.debug("Added item to the removed list: " + nodeRef);
            System.out.println("Added item to the removed list: " + nodeRef);
         }
        
         // reset the rich list so it re-renders
         this.packageItemsRichList.setValue(null);
      
      }      

et j'ai rendu la méthode updateResource comme public au lieu de protected

et Enfin le code d'appel de toute cette usine de traitement :


CustomManageTaskDialog customManageTaskDialog = (CustomManageTaskDialog ) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "CustomManageTaskDialog ");
      
            customManageTaskDialog.removePackageItem(nodeRef.toString());
       removeFile();
        
       customManageTaskDialog.updateResources();


Le problème c'est que je ne sais pas très bien comment supprimer un fichier du workflow et ajouter un autre à sa place en exploitant la classe CustomTaskManageDialog ??????????????


Merci pour le Help
jayjayecl
Active Member II

Re: problème cast avec la classe ManageTaskDialog

l'erreur est ici :

java.lang.NullPointerException
   at alfresco.module.gestionCourrier.gestionCourrierSortant.UI.managedBeanDialog.UpdateCourrierSortantDialog.finishImpl
arkantos
Member II

Re: problème cast avec la classe ManageTaskDialog

Le problème c'est que je ne sais pas très bien comment supprimer un fichier du workflow et ajouter un autre à sa place en exploitant la classe CustomTaskManageDialog ??????????????

c'est ça qui est vraiment mon problème maintenant , avez-vous une solution à me proposer
jayjayecl
Active Member II

Re: problème cast avec la classe ManageTaskDialog

pourriez-vous rappeler le besoin fonctionnel ?

merci
arkantos
Member II

Re: problème cast avec la classe ManageTaskDialog

Un courrier n'ayant pas été validé par la direction doit être modifié par la personne initiatrice du workflow. Et comment, en remplaçant le courrier rejeté par autre .
jayjayecl
Active Member II

Re: problème cast avec la classe ManageTaskDialog

overrider la property bpmPackageActionGroup dans le modèle de la tâche ne suffit pas ?