on 03-21-2006 8:27 PM
Hello,
Can I use the PCD API to do any of the following:
1. search for all iviews that use the appintegrator par file
2. search for all iviews that use a specific system in the portal SLD
I highly appreciate anyones help. Thanks!
Roaa
Hi Roaa,
You can search for all iViews based on the app integrator application, like so:
-
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.PERSISTENCY_ASPECT);
env.put(Context.SECURITY_PRINCIPAL, request.getUser());
InitialContext iCtx = null;
String roleID = "pcd:portal_content/MyFolder";
try{
iCtx = new InitialContext(env);
IPcdContext attrSet = (IPcdContext) iCtx.lookup(roleID);
PcdSearchControls cons1 = new PcdSearchControls();
cons1.setReturningObjFlag(true);
cons1.setSearchScope(PcdSearchControls.SUBTREE_SCOPE);
NamingEnumeration ne1 = attrSet.search("", "(com.sap.portal.private.iview.PropertiesUrl=pcd:com.sap.portal.system/applications/com.sap.portal.appintegrator.sap/components/Generic)", cons1);
}
catch{}
-
Hope this helps.
Daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Roaa,
The code:
We create a Hashtable of information to tell JNDI (and eventually PCD) what type of lookup we are going to do:
--(1) Lookup in PCD
--(2) Return a generic PCD object (IPcdContext)
--(3) The user, because the lookup requires permissions
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Constants.REQUESTED_ASPECT, IPcdAttribute.PERSISTENCY_ASPECT);
env.put(Context.SECURITY_PRINCIPAL, request.getUser());
InitialContext iCtx = null;
PCD address of the object we want
String roleID = "pcd:portal_content/MyFolder";
Do lookup:
try{
iCtx = new InitialContext(env);
IPcdContext attrSet = (IPcdContext) iCtx.lookup(roleID);
Set some objects that will let us search for other objects within the context we just looked up. Check the PCD Javadocs for more info.
PcdSearchControls cons1 = new PcdSearchControls();
cons1.setReturningObjFlag(true);
cons1.setSearchScope(PcdSearchControls.SUBTREE_SCOPE);
Search the context, and return a NamingEnumeration of objects. The objects depend on the Aspect we defined above. IPcdAttribute.PERSISTENCY_ASPECT returns IPcdContext objects; SEMANTIC_ASPECT would return the corresponding semantic object -- IiView for an iView, IPage for a page, and so forth
NamingEnumeration ne1 = attrSet.search("", "(com.sap.portal.private.iview.PropertiesUrl=pcd:com.sap.portal.system/applications/com.sap.portal.appintegrator.sap/components/Generic)", cons1);
}
catch{}
There is some documentation about doing lookups to find semantic objects at http://help.sap.com/saphelp_nw04/helpdata/en/70/4aa042a5deb611e10000000a155106/frameset.htm.
Check the PCD Javadocs for documentation about the PCD -- there is no other documentation on PCD.
Hope this helps.
Daniel
Hi Roaa Bahran,
Class cast Exception is because you dont have the entry in your portalapp.xml
Add like this..in ur portalapp.xml..
<application-config>
<property name="startup" value="true"/>
<property name="SharingReference" value="htmlb,com.sap.portal.pcd.glservice,com.sap.portal.pcmbuilderservice,usermanagement" />
<property name="ServicesReference" value="com.sap.portal.ivs.api_iview, com.sap.portal.ivs.api_landscape"/>
</application-config>
Let me know if you need more help on this.
Hope it helps.
Regards,
Karthick K Eswaran
Hi Rui,
thanks. I do this, but in my WebDynpro application this coding:
Object pcdObject = InitialCtx.lookup(strPcdLookupPath);
IPcdContext iPcdObject = (IPcdContext)pcdObject;
throw an ClassCastException.
I the debugger i see that the pcdObject is of Type
com.sapportals.portal.pcd.gl.PcdGlDeltaLink
.
What can i do do solve this problem ?
Thanks.
Best regards
André
Hi Sandeep,
i was not able to solve this problem... So it was a hard desission but i have to kick out the webdynpro and created a pure portal-component with an jsp-iView. Much more time to spend on the UI as in WD but the date we have to be finish with our application comes closer and closer.
What's confusing me ist, that in a "normal" portal-application there is no classcast-Exception within the same code....
Best regards,
André
Sorry for my "test" above.
I have also problems with "Looking Up Objects" in my Portal Application (http://help.sap.com/saphelp_nw04/helpdata/en/1f/ec5c42da4de92ce10000000a1550b0/content.htm). I get a ClassCastException (IiView - AttributeSetiView). I am using SAP NetWeaver 2004 SP16 (Java TrialVersion). What is the solution?
My portalapp.xml:
<?xml version="1.0" encoding="utf-8"?>
<application>
<application-config>
<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
<property name="startup" value="true"/>
<property name="SharingReference" value="htmlb,com.sap.portal.pcd.glservice,com.sap.portal.pcmbuilderservice,usermanagement" />
<property name="ServicesReference" value="com.sap.portal.ivs.api_iview, com.sap.portal.ivs.api_landscape"/>
</application-config>
<components>
<component name="FirstPage">
<component-config>
<property name="ClassName" value="procwp.FirstPage"/>
<property name="ComponentType" value="jspnative"/>
<property name="JSP" value="pagelet/FirstPage.jsp"/>
<property name="ResourceBundleName" value="firstPage"/>
</component-config>
<component-profile/>
</component>
</components>
<services/>
</application>
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
test
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3057">This blog</a> describes a mechanism for displaying the details of a system in a tree structure, which could help you with part 2 of your question.
For part 1, you could try to use the multiple property replacement function to search for iViews that contain the current value pcd:com.sap.portal.system/applications/com.sap.portal.appintegrator.sap/components/Generic. You will need to pretend to be changing the contents - stop before you actually do the change...
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.