cancel
Showing results for 
Search instead for 
Did you mean: 

Portal Application to read and delete folders from PCD

Former Member
0 Kudos

Hello Experts,

I don't no why, but today I was coping some folders and iViews in the Portal Content Manager. I think accidentally, I paste a folder in it self and the portal started to coping recursively in it self. So I have now thousands of folders and I could not delete them. The Portal Content Manager and the PCD get me a timeout, when doing this. So I started to delete the recursive tree of folders from the last element with, PCD but I get an Internal Error and can not find any explanations. My problem seems related to this post PCD Inspector mass copy error - recursively copy infinitely, but there is no solution mentioned.

My last chance is to write my own portal application to delete these folders. But here I stuck to identify if an PCD-Object is a folder and to get his children. By now I have the following code


Hashtable<String, Object> env = new Hashtable<String, Object>();

env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);

env.put(Context.SECURITY_PRINCIPAL, request.getUser());

env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.PERSISTENCY_ASPECT);

     

InitialContext ictx = null;

try {

     ictx = new InitialContext(env);

         

     Stack<IPcdContext> folders = new Stack<IPcdContext>();

     IPcdContext myPcdContext = (IPcdContext) ictx.lookup(PCD_ROOT);

     folders.push(myPcdContext);

     while(!folders.empty()) {

          IPcdContext fl = folders.peek();

          // how to test if fl is an folder and how to get his children and test them?

          // how can I later delete them?

   }

} catch (NamingException e) {}

In the official API I could not find any suitable information.

I am open for other suggestions, too.

Thanks and Best Regards,

Thomas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thomas, in fact you can get this information by looking up PCD properties, this could help you on this:

I have done this similar tasks already on my own, but dont remember the property, could be com.sap.portal.pcd.gl.ObjectClass. Do a search in the JavaDoc. And: do yourself a favour and write helper classes for PCD access


cheers

Former Member
0 Kudos

Thanks for your fast answer, but this approach I used already and solve only the Problem get the type of an PCD-Object. But on this way, I can not get the children object, if it is a folder. These information are not accessible via attributes.

-->Update:

But if it is an folder, I take this as root and search in it for folders and so on. I thought their will be an object orientated concept, that present me the PCD-Objects as tree structure with access to its nodes.

<--

My coding stile is really rudimentary. What is your advise for a HelperClassInterface?

Best Regards,

Thomas

Former Member
0 Kudos

Thomas, Im in hurry actually, but I will take a look to my old source this afternoon and give you a clue. The PCD API is the most disgusting Portal API imho, due different views on PCD objects, so you are right, such tasks are not that rudimentary they could look like at the first sight.

cheers

Former Member
0 Kudos

Thomas, I took a short look to my stuff and its pretty much like:

Portal - SAP Library

It was the initial documentation I read before have started the development, as far I remember

Pay special attention to:


The object class

com.sap.portal.pcd.gl.GlContext

indicates a folder object, which does not have a special object provider. All other values specify a semantic object.

Due my source there should be also a distinction between role folder and pcd folder, I guess you are talking about pcd folders.

What is your advise for a HelperClassInterface?

It depends, but for PCD what I tryed to do was to deliver an all-inclusive view to PCD objects, independent from used aspect and technical details. This overhead is probably not necessary. Also, to enrich it with methods I have missed in the PCD API, like getting a quick context.

cheers

Former Member
0 Kudos

Hello Lawrence,

thanks for your advises. I read the article but could not find any idea, how I can delete a PCD object.

But it isn't still necessary. Our Problem will be solved by SAP support, cause they have a special tool for this situation. So I stop development at this point.

best regards

0 Kudos

Hello Thomas,

In those rare cases where redundant trees that are recursive are created, the correct approach is to open a message to SAP support, to fix it.

Especially if the recursive tree was created using the Portal Content Catalog standard operation (copy-paste), and not in a customized code.

Depending on how the tree is complicated, PCD Inspector may help, but in most of the cases it is just not enough.

Writing code to unbind the whole sub-tree is also problematic, as it might harm the PCD if not written correctly, or cause out of memory.


For that reason a support tool was developed, to inspect and edit the data in the PCD on the technical level of the persistence layer, and can be used for such cases. In the new versions (such as 7.3) the tool is provided as part of the installation. In older versions it should be installed.

SAP support does not provide information about this tool as without detailed technical knowledge about the PCD persistence changing data can destroy the portal content.


So..... just open a ticket


Thanks & regards,

Michal Zilcha-Lang

Former Member
0 Kudos

Michal, thank you for your assistance on this. Indeed:

SAP support does not provide information about this tool as without detailed technical knowledge about the PCD persistence changing data can destroy the portal content.

I dont like this statement at all I dont have this problem actually, but I would like to be able to help our customers on time instead a call: open an OSS always means a delay of days till week due my experience. Could you please spend us some clues what the tool is and how this one works? I promise to do some experiments on my local EP VM before I will confront our customers with it. Thanks,

cheers

0 Kudos

Hi Lawrence,

  1. Unfortunately I don't have a good answer for you

This is an internal support tool meant for SAP support only.

I think that PCD Inspector is a powerful tool that can be used for such cases, and for that tool there is also a documentation.

  1. PCD Inspector may also harm the portal, and therefore should be used only by experts (like you ), who understand the whole structure of the different infrastructure layers, and the implications when changing content though it.

That is the reason why there is a warning before starting using PCD Inspector:

PCD Inspector Support Tool Warning

You are starting the PCD Inspector. Please read the following warning:

*

The PCD Inspector is a powerful tool for working with PCD content. It was designed for specialists who are aware of the implications resulting from modifications to PCD content (e.g. deleting an object or modifying object properties).

*

If you use the PCD Inspector to modify PCD content, you should be very careful because you might easily damage your portal. In this case you will probably not be able to recover your data or perform a rollback.

In order to continue, confirm that you are famliar enough with the concept of the PCD so that you will not harm the system while using this tool.

I know that you already know that, but I am writing it for those who might read our discussion in the future

(BTW, the issue in this discussion was solved using PCD Inspector)

Thanks & regards,

Michal

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Thomas,

Did you try using the PCD Tools also for removing the objects. this is a quite lean and fast tool for playing around the PCD. there you should be able to clean up and delete your folders.

Just add role pcd:portal_content/com.sap.portal.pcd.admintools.pcd_inspector/pcd_inspector_role to your user an you should get there.

We often use this tool also for adding custom properties to PCD objects.

regards

Former Member
0 Kudos

Hi Sven,

due Thomas initial post he is familary to the PCD inspector, seems not be of use... I guess what could be also of use is a run of the PCD consistency tool....

cheers

Former Member
0 Kudos

Hi Sven,

yes I tried this, but I think the tree is to deep for it, because try removing it with the PCD inspector couldn't manage this task. So I try to remove the folders from bottom up.

I will have a look at the consistency tool.

regards