I have done this recently. I made a JSP that reads the source data and
puts it into a container on a specific page. Below, I've pasted the
parts of my JSP that handle insertion into a container:
//Step 1 - Get the container in which to insert data
JahiaContainerList containerList =
jData.containers().getAbsoluteContainerList("yourContainerListName",page
Id);
/* Step 2 - While iterating over your source data, create a new
container for each record */
JahiaContainer container = new JahiaContainer(0,
jParams.getJahiaID(), pageId, containerList.getID(),
0 /* rank */, containerList.getAclID(),
containerList.getctndefid(), 0, 2);
JahiaContainerDefinition containerDef = container.getDefinition();
ServicesRegistry.getInstance().getJahiaContainersService().
saveContainer(container, containerList.getID(), jData.params());
container.setLanguageCode(jData.params().getLocale().toString());
container.fieldsStructureCheck(jData.params());
/* Step 3 - Insert field values */
JahiaField cField = container.getField("someFieldInYourContainer");
cField.setValue(someValueFromSourceRecord);
cField.save(jParams);
A final word of caution: my import program took a lot of time to run,
longer than the timeout of some of the servers in between through which
traffic to my Jahia server is routed (a web server redirects traffic to
the application server in our environment, and the web server is
accessed through a proxy). I had to use a direct connection to the
application server, circumventing the go-betweens to give the JSP time
to run to completion. Also, I built in some flags in the JSP to prevent
an import being triggered accidentally.
Hope this helps implement your requirement.
Best regards,
Max.
-----Original Message-----
From: Richard Gate [mailto:[EMAIL PROTECTED]
Sent: dinsdag 27 maart 2007 10:14
To: [email protected]
Subject: [SPAM] - Manually creating containers through code
(programmatically) - Bayesian Filter detected spam
Hey all,
Is it possible to create container lists in code rather than through
popups etc.
We have a requirement to import an existing set of data from a none
Jahia site. I will be collecting this data through SQL statements. I
want to then create appropriate Jahia containers to represent this
data.
We also have a requirement to input data into a container holding one
bigtextfield via a form. This will also require the ability to
manaually
create container lists.
I look forward to your response.
Thanks,
Richard.
--
Richard Gate
Developer
Souk Digital
A Souk Group Company.
London Office
1st Floor,
Shaftesbury House,
151 Shaftesbury Avenue,
London WC2H 8AL
Tel: +44 (0) 20 7420 7880
Nottingham Office
High Pavement Business Centre,
3-5 High Pavement,
The Lace Market,
Nottingham.
NG1 1HF
Tel: +44 (0) 115 959 6455
Fax: +44 (0) 115 959 6456
www.soukdigital.com
Confidentiality: This e-mail and its attachments are intended for the
above named only and may be confidential. If they have come to you in
error you must take no action based on them, nor must you copy or show
them to anyone; please reply to this e-mail and highlight the error.
Security Warning: Please note that this e-mail has been created in the
knowledge that Internet e-mail is not a 100% secure communications
medium.
We advise that you understand and observe this lack of security when
e-
mailing us.
Viruses: Although we have taken steps to ensure that this e-mail and
attachments are free from any virus, we advise that in keeping with
good
computing practice the recipient should ensure they are actually virus
free.
From - Thu Oct 19 11:47:14 2006
X-Account-Key: account2
X-UIDL: A"Z!!afc!!=8'#!7b'"!
X-Mozilla-Status: 0009
X-Mozilla-Status2: 00000000
Return-Path: <developers-return-443-
[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 7867 invoked by alias); 19 Oct 2006 10:42:50 -0000
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
X-No-Archive: yes
Delivered-To: mailing list [EMAIL PROTECTED]
Received: (qmail 7863 invoked from network); 19 Oct 2006 10:42:49
-0000
Message-ID: <[EMAIL PROTECTED]>
Date: Thu, 19 Oct 2006 11:45:51 +0100
From: Nat Titman <[EMAIL PROTECTED]>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.0.7)
Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666
MIME-Version: 1.0
To: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Subject: [developers] Useful articles on accessibility and testing
X-UIDL: A"Z!!afc!!=8'#!7b'"!
Hi,
A couple of useful articles.
Accessibility for the Apathetic:
http://www.hacknot.info/hacknot/action/showEntry?eid=69
Testing:
http://www.hacknot.info/hacknot/action/showEntry?eid=68
Thanks,
Nat.
--
Nat Titman
Senior Developer
SOUK Digital
A SOUK Group Company.
http://www.soukdigital.com/
Nottingham Office
High Pavement Business Centre,
3-5 High Pavement,
The Lace Market,
Nottingham.
NG1 1HF
Tel: +44 (0) 115 959 6455
Fax: +44 (0) 115 959 6456
Direct: +44 (0) 115 959 6462
London Office
1st Floor,
Shaftesbury House,
151 Shaftesbury Avenue,
London WC2H 8AL
Tel: +44 (0) 20 7420 7880
Confidentiality: This e-mail and its attachments are intended for
the above named only and may be confidential. If they have come
to you in error you must take no action based on them, nor must
you copy or show them to anyone; please reply to this e-mail and
highlight the error.
Security Warning: Please note that this e-mail has been created
in the knowledge that Internet e-mail is not a 100% secure
communications medium. We advise that you understand and observe
this lack of security when e-mailing us.
Viruses: Although we have taken steps to ensure that this e-mail
and attachments are free from any virus, we advise that in keeping
with good computing practice the recipient should ensure they are
actually virus free.