On the start page we have a container with page links. In the
corresponding box we are trying to display fields of the container, where
the linked page originally comes from.
We get the original container like this:
public static JahiaContainer getSourceContainer(int linkedPageID,
ParamBean jParams) throws JahiaException
{
ContentPage cPage = ContentPage.getPage(linkedPageID, false);
ContentPageField cPageField =
(ContentPageField)cPage.getParent(jParams
.getUser(), jParams.getEntryLoadRequest(), ParamBean.NORMAL);
if (cPageField == null)
{
// try to get the active
EntryLoadRequest lRequest = new EntryLoadRequest(
EntryLoadRequest.ACTIVE_WORKFLOW_STATE, 0, jParams
.getEntryLoadRequest().getLocales());
cPageField = (ContentPageField)cPage.getParent(jParams.getUser(),
lRequest, ParamBean.NORMAL);
}
if (cPageField != null)
{
ContentContainer cContainer =
(ContentContainer)cPageField.getParent(
jParams.getUser(), jParams.getEntryLoadRequest(),
ParamBean.NORMAL);
sourceContainer = cContainer.getJahiaContainer(jParams, jParams
.getEntryLoadRequest());
}
return (sourceContainer);
}
Is there a way to optimize the following:
1.) cPage.getParent always results in a DB-call and does not use any
caches
2.) cContainer.getJahiaContainer internally calls
JahiaContainersBaseService.loadContainer(int, int, ParamBean,
EntryLoadRequest), which again calls
return loadContainer(ctnid, loadFlag, jParams, loadVersion,
new Hashtable(), new Hashtable(), new
Hashtable());
So the last three parameters passing caches are always empty caches. If I
am trying to load the container twice it does not make use of these
caches.
3.) The source container has 39 fields, but I am interested only in 3
fields, which I want to display. When accessing the first field all other
fields are loaded and checked for access rights. Is there an elegant way
to really only read those 3 fields?
Greetings,
Benjamin
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.