cancel
Showing results for 
Search instead for 
Did you mean: 

Check if a node is deleted

cviaud
Champ in-the-making
Champ in-the-making
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.
3 REPLIES 3

shinichikudo
Champ in-the-making
Champ in-the-making
Thank you for providing us with the example code, and a brief explanation of the problem. However, we do not fully understand the problem you are experiencing Smiley Sad
simulation credit auto

vanesssa99
Champ in-the-making
Champ in-the-making
Thanks for  useful infor  Smiley Tongue


simulationcredit

rogier_oudshoor
Champ in-the-making
Champ in-the-making
An Alfresco reference has the form of STORE:ID. If the node doesn't exist in the regular store (spaceStore), you can create the valid reference in the Archive by replacing spareStore with archiveStore.