cancel
Showing results for 
Search instead for 
Did you mean: 

problème de conversion de NodeRef

huberd
Champ in-the-making
Champ in-the-making
Bonjour,

à ce jour je récupère le nodeRef de mon Workflow comme ceci :
public class Maclasse extends JBPMSpringActionHandler { 

   private static final long serialVersionUID = 5L;

   private static final Logger logger = Logger.getLogger(Maclasse.class);
      
   private BeanFactory factory;
   private ServiceRegistry services;   
   private NodeService nodeService;
   private AuthorityDAO authorityDAO;
   private PermissionService permissionService;
   private OwnableService ownableService;
            
      
   @Override
   protected void initialiseHandler(BeanFactory factory) {
      this.factory = factory;
      services = (ServiceRegistry)this.factory.getBean(ServiceRegistry.SERVICE_REGISTRY);
      authorityDAO = (AuthorityDAO)this.factory.getBean("authorityDAO");
      nodeService = (NodeService)this.factory.getBean("nodeService");
      permissionService = (PermissionService)this.factory.getBean("permissionService");
      ownableService = (OwnableService)this.factory.getBean("ownableService");
   }

   public void execute(ExecutionContext executionContext) throws Exception {
try {
         Object res = executionContext.getContextInstance().getVariable("bpm_package");
         if(res == null) {
            //never enters here
            logger.fatal("bpm_package is null");
            return;
         }

         final NodeRef nodeRef = ((JBPMNode) res).getNodeRef();   
         if(nodeRef == null) {
            //never enters here
            logger.fatal("NodeRef is null");
            return;
         }

….

La nodeRef du Workflow a été récupéré à partir de la variable bpm_package qui a été récupérée de la manière suivante :
Object res = executionContext.getContextInstance().getVariable("bpm_package");

Le type retourné est de type Object. La valeur retournée par la variable bpm_package est celle-ci :
Node Type: {http://www.alfresco.org/model/content/1.0}systemfolder, Node Aspects: [{http://www.alfresco.org/model/content/1.0}auditable, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/bpm/1.0}workflowPackage]

A partir de ce résultat, je récupère le nodeRef correspondant comme suit :
final NodeRef nodeRef = ((JBPMNode) res).getNodeRef();

Maitenant comment faire la même chose mais en sens inverse pour pouvoir à partir d'un nodeRef, obtenir la valeur de type Object que je pourrai injecter dans la variable
bpm_context par exemple.

Merci pour votre aide précieuse.
1 REPLY 1

huberd
Champ in-the-making
Champ in-the-making
Je relance le sujet au cas où, car là je pèche séverrement.
Merci par avance pour votre aide.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.