Hello,

I have a container list in a specific page called "Advanced search".

I have another page called "User Page", which creates by API a new
container in the "Advanced search page" container list. 

When I reboot Jahia, if I do not open the "Advanced Search" and I go
directly in "User Page".

The creation launches a null pointer exception: the new container does
not contain any fields.

So, the following line causes the error:

test_container.getField("astron_photo_gallery_creator").setValue(user.ge
tUsername());

If I open the page "Advanced Search", then the creation in "User page"
is working very well.

PLEASE HELP ME.
IT IS VERY VERY VERY URGENT.

Rgds



Here is the code of the "User Page":

<%@ include file="astron_photo_gallery_page_id.jsp"%>
<%@ include file="astron_photo_gallery_entities_declaration.jsp"%>
<%@ include file="astron_photo_gallery_entities_tools.jsp"%>
<%@ include file="astron_photo_gallery_declaration.jsp"%>

 
<%
/////////Initialisation of filters
ContainerFilterBean astron_photo_gallery_container_filter_bean_first =
new ContainerFilterBean("astron_photo_gallery_builder_name",
jParams.getEntryLoadRequest()); // with the field name
astron_photo_gallery_container_filter_bean_first.addClause(ContainerFilt
erBean.COMP_EQUAL,"");
Vector astron_photo_gallery_container_filter_bean_vector_first = new
Vector();
astron_photo_gallery_container_filter_bean_vector_first.add(astron_photo
_gallery_container_filter_bean_first);
ContainerFilters astron_photo_gallery_container_filter_beans_first = new
ContainerFilters(astron_photo_gallery_container_list_id,astron_photo_gal
lery_container_filter_bean_vector_first);
request.setAttribute("astron_photo_gallery_container_list_filter_handler
",astron_photo_gallery_container_filter_beans_first);
JahiaContainerList astron_photo_gallery_container_list =
jData.containers().getAbsoluteContainerList(
"astron_photo_gallery_container_list",astron_photo_gallery_page_id_value
);
astron_photo_gallery_container_list.setIsContainersLoaded(false);
%>

<%
if(request.getParameter("astron_photo_gallery_add")!=null)
{
 // VJ

ServicesRegistry.getInstance().getJahiaContainersService().loadContainer
List(astron_photo_gallery_container_list.getID(),LoadFlags.ALL);

 FieldsChangeEventListener listener = new FieldsChangeEventListener();
 JahiaContainer test_container = new
JahiaContainer(0,jParams.getJahiaID(),astron_photo_gallery_page_id_value
,astron_photo_gallery_container_list.getID(),0,astron_photo_gallery_cont
ainer_list.getAclID(),astron_photo_gallery_container_list.getctndefid(),
0,ContentObjectEntryState.WORKFLOW_STATE_START_STAGING);

ServicesRegistry.getInstance().getJahiaContainersService().saveContainer
Info(test_container,astron_photo_gallery_container_list.getID(),
astron_photo_gallery_container_list.getAclID(),jParams);
 test_container.setLanguageCode(jParams.getLocale().toString());
 test_container.fieldsStructureCheck(jParams);


System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
");
 System.out.println("BField loaded ou
pas:"+test_container.isFieldsLoaded() + "      container list loaded ou
pas:"+test_container.isContainerListsLoaded() + "     Nb fields" +
test_container.getNbFields());
 
 Enumeration e = test_container.getFields(); 
 
 while (e.hasMoreElements()){
  JahiaField jf = (JahiaField)e.nextElement();
  System.out.println("Field name:"+jf.getID());
 }
 

test_container.getField("astron_photo_gallery_creator").setValue(user.ge
tUsername());

listener.notifyChange(test_container.getField("astron_photo_gallery_crea
tor").getID());



_____________________________________________________________________
Un mot doux � envoyer? Une sortie cin� � organiser? Faites le en temps
r�el avec MSN Messenger! C'est gratuit!   http://ifrance.com/_reloc/m

_____________________________________________________________________
Envie de discuter en "live" avec vos amis ? T�l�charger MSN Messenger
http://www.ifrance.com/_reloc/m la 1�re messagerie instantan�e de France

Reply via email to