|
Thank's for your answer. I read your code with attention. As I can see, I forgot to create the field instance ContentSmallTextField stTitle = ContentSmallTextField.createSmallText(....) for example. But I a another problem, this portion of code works well : / // Creating all needed services ServicesRegistry registry = ServicesRegistry.getInstance(); JahiaVersionService verService = registry.getJahiaVersionService(); JahiaContainersService contService = registry.getJahiaContainersService(); // Looking for my containerList... JahiaContainerList aList = jData.containers().getAbsoluteContainerList( "siteFlashes", jData.gui().getLevelID( 1 ) ); out.write("Container list : " + aList.toString() + "<br/>" ); out.write("Container list ID : " + aList.getID() + "<br/>"); // Creating in new container for my container list, and save it JahiaContainer newFlashCont = new JahiaContainer( 0, /* ID */ jData.params().getJahiaID(), /* JahiaID */ jData.params().getPageID(), /* PageID */ aList.getID(), /* ListID */ 0, /* rank */ aList.getAclID(), /* AclID */ aList.getctndefid(), /* Definition */ verService.getCurrentVersionID(), /* VersionID */ EntryLoadRequest.STAGING_WORKFLOW_STATE /* WorkflowState */ ); out.write("New flash : " + newFlashCont.toString() + "<br/>"); contService.saveContainer( newFlashCont, 0, jData.params() ); out.write("New flash is saved <br/>");/ But after, I try to access container definition and field définition... The Field definition is never found... / JahiaContainerDefinition ctnDef = newFlashCont.getDefinition(); out.write("Container definition : " + ((ctnDef==null)? "empty":ctnDef.toString()) + "<br/>" ); JahiaFieldDefinition fieldDef = ctnDef.findFieldInStructure( "title", jData.page().getPageTemplateID() ); out.write("Field definition : " +((fieldDef==null)? "empty":fieldDef.toString()) + "<br/>" );/ So my fieldDef variable is allways null. What's wrong ? Diego Rossi wrote: > Hi. These classes are for this use case: > > - xml data representing a product arrives from web service (source > ia as400); - xml data are transformed in a Product java object; - > java object (Product) becomes a contaner with 3 field (name small > text, description small text, product detail page JahiaPageField); > - in productDetailPage we create a BigTextField storing product > dimension, present in xml file obtained through web service; - > everything is created on the fly, nothing manually. > > I don't have much time for details, but maybe it can be useful for > what your are doing. Probably also a little more difficult than > your case as you already have a ParamBean, in a web service > scenario you must create it manually. > > it.mytria.portal.config.bo.Site is where we store static > information about where to build container and fields (template > name, page ids, virtual site ids, etc). It is inflated via xml at > jahia startup. If you want to give a look, you should start from > ProductPageBuilder.buildProductPage. > > Have a nice weekend, by. > > > > ________________________________ > > From: Sebastien Landeau [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 29, 2004 1:20 PM To: [EMAIL PROTECTED] > Subject: [API] Inserting new container in a containerlist, doesn't > work > > > > Hello, > > Context : > > > * Jahia Version : 4.0.4 build 5822 (bundle with packaged Tomcat) * > OS : Linux Fedora Core 2 * JDK : 1.4.2_05 * DB : mySQL > > > I'm trying to build a JSP page to dynamically insert a new > Container in a ContainerList (importing content from external > data). > > But it doesn"t work. IN attachment, my JSP page (a modification of > the simple template from the corporate samples). > > What is bad in it ?? > > > THank's a lot. > > |
smime.p7s
Description: S/MIME Cryptographic Signature
