Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
How to get ComponentModel of a RuntimeComponent?
Crsb
Hi,
Trying to parse all page components in runtime from an external. I can get the list of the components in the page by getting the page from RequestContext.
[html]
Collection comps = context.getPage().getComponents();
[/html]
But I am not sure how to work with RuntimeComponent to get the ComponentModel. any ideas? any javadocs for this piece?
I am doing this to get the list of DCRs the component has.
also, it looks like .getPage() from type RequestContext is deprecated, anyone knows what it was replaced with? what are we supposed to use to work with a page in runtime?
this is in TS/LS 7.1 Patch 1.
Find more posts tagged with
Comments
AlexC
Given RequestContext context:
context.getThisComponent() is the current component
context.getThisComponentModel() is the current component's current model
Crsb
That would get me the ComponentModel for the component that called the code (current component). is there way to get the same data for all components in the page?
AlexC
No, the components are isolated to prevent clobbering and creating difficult to debug problems.
Crsb
That make sense, But now I am curious, what would be a case or cases where you would use this code, because it gets me RuntimeComponent objects in a page, but i don't know how to parse it, I can only get component'name and ID from it.
[html]
Collection comps = context.getPage().getComponents();
[/html]
AlexC
RuntimeComponent is all you can get from that, the actual component tree is cached and not available to the component being executed. As a general rule, components cannot access other components and if you find some transient way of doing it, it may cause intermittent problems and is not supported.