Hi,
I tried to copy a container from a container list to another with the following code which I found on the mailing list...
my_container_list.setIsContainersLoaded(false);
FieldsChangeEventListener listener = new FieldsChangeEventListener();
JahiaContainer test_container = new JahiaContainer(0,jParams.getJahiaID(),my_page_id_value,my_container_list.getID(),0,my_container_list.getAclID(),my_container_list.getctndefid(),0,2);
ServicesRegistry.getInstance().getJahiaContainersService().saveContainerInfo(test_container,my_container_list.getID(), my_container_list.getAclID(),jParams);
test_container.setLanguageCode("EN");
test_container.fieldsStructureCheck(jParams);
test_container.getField("my_creator").setValue(user.getUsername());
listener.notifyChange(test_container.getField("my_creator").getID());
test_container.getField("my_id").setValue("9999999999");
listener.notifyChange(test_container.getField("my_id").getID());
JahiaContainer test_container = new JahiaContainer(0,jParams.getJahiaID(),my_page_id_value,my_container_list.getID(),0,my_container_list.getAclID(),my_container_list.getctndefid(),0,2);
ServicesRegistry.getInstance().getJahiaContainersService().saveContainerInfo(test_container,my_container_list.getID(), my_container_list.getAclID(),jParams);
test_container.setLanguageCode("EN");
test_container.fieldsStructureCheck(jParams);
test_container.getField("my_creator").setValue(user.getUsername());
listener.notifyChange(test_container.getField("my_creator").getID());
test_container.getField("my_id").setValue("9999999999");
listener.notifyChange(test_container.getField("my_id").getID());
test_container.getField("my_hit").setValue("0");
listener.notifyChange(test_container.getField("my_hit").getID());
my_container_list.addContainer(test_container);
ServicesRegistry.getInstance().getJahiaContainersService().saveContainer(test_container, my_container_list.getID(),jParams);
listener.notifyChange(test_container.getField("my_hit").getID());
my_container_list.addContainer(test_container);
ServicesRegistry.getInstance().getJahiaContainersService().saveContainer(test_container, my_container_list.getID(),jParams);
There is no problem during the creation. The problem appears when I try to update the container : the update of the fields has no effect!! The values of the fields remain the same as before the update!! I found out in the database that I have a duplicated table. I think that's why the update doesn't work... When I change the language code :
test_container.setLanguageCode("Shared");
I don't have the problem because the two tables are different (they don't have the same language code...)
But I can't find what is wrong with the container copy!! Did I do something wrong??!
Any help would be *very* appreciated ;-)
Thanks in advance,
Sylvie
Cr�ez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
Cr�ez votre Yahoo! Mail
Le nouveau Yahoo! Messenger est arriv� ! D�couvrez toutes les nouveaut�s pour dialoguer instantan�ment avec vos amis. T�l�chargez GRATUITEMENT ici !
