Show TOC

Deleting ObjectsLocate this document in the navigation structure

Use

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

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

                      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);
    
                   
  2. Perform a lookup of the folder that contains the object that you want to delete.

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

                      ...
     
        String atomicName = "myObject";
        ctx.unbind(atomicName); 
     
    }       
    catch(NamingException e)
    {
    }
    
                   

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