Show TOC

Procedure documentationDeleting Objects Locate this document in the navigation structure

 

This section describes how to delete a semantic object from the PCD.

Procedure

  1. Set the parameters for a JNDI lookup in the PCD.

    Syntax Syntax

    1. Hashtable env = new Hashtable();
      
      env.put(Context.INITIAL_CONTEXT_FACTORY,
          IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
      env.put(Context.SECURITY_PRINCIPAL, request.getUser());
      env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
      
    End of the code.
  2. Perform a lookup of the folder that contains the object that you want to delete.

    Syntax Syntax

    1. InitialContext iCtx = null;
      try
      {
          iCtx = new InitialContext(env);
      
          String folderName = "pcd:portal_content/myFolder";
          Context ctx = (Context)iCtx.lookup(folderName); 
      
      ...
      
    End of the code.
  3. Delete the object by unbinding the object from the folder that contains it. Use the atomic name of the object.

    Syntax Syntax

    1. ...
      
          String atomicName = "myObject";
          ctx.unbind(atomicName); 
      
      }       
      catch(NamingException e)
      {
      }
      
    End of the code.

You can instead perform an unbind directly on the initial context, and supply the full path to the object.