AnsweredAssumed Answered

Check if a node is deleted

Question asked by cviaud on Apr 14, 2009
Latest reply on May 26, 2009 by rogier.oudshoorn
In Alfresco, I have a fonctionnality that creates contents. Say it is an "assembly" generated from several files. This file is an XML instance, and I also create an HTML file called "simulation". This file is associated with the "assembly" in the model.

In my application's lifecycle, when I move the "assembly" file, I have to move the "simulation" associated file. For retrieving the associated file's NodeRef , il use the following code :


   public static NodeRef getAssociatedSimulationNodeRef(NodeRef sourceNodeRef, NodeService nodeService) throws SimulationFileNotFoundException {
      // Get the specific association
      List<AssociationRef> simulationAssociationRefList = nodeService.getTargetAssocs(sourceNodeRef, IFwsModel.PROP_RELATED_SIMULATION);

      // Check that the association exist
      if (simulationAssociationRefList.isEmpty() ) {
         // No association found
         throw new SimulationFileNotFoundException();
      }
      
      // Get the associated reference
      NodeRef simulationNodeRef = simulationAssociationRefList.get(0).getTargetRef();
      
      // Check that the associated file already exist
      if (! nodeService.exists(simulationNodeRef)) {
         // The node doesn't exist anymore
         throw new SimulationFileNotFoundException();
      }

      return simulationNodeRef;
   }


For some reasons, the "simulation" file may latter be missing. It can have been deleted.

My problem is that when the "simulation" file has been deleted, I still have a reference to the node. It seems to be archived by Alfresco. So, I always have a reference to a node, but I can't manipulate this node. Anyway, I don't want to manipulate it. I would like to know how I can get the information that the node has been deleted.

I've tryed to add some code checking for the node status, but I get errors (acegi security issues).

Hi, i've carrefully searched accross the forum, but I haven't find my problem. Hope someone can help me.

I use Alfresco Lab 3 on Windows XP.

Outcomes