[Hippo-cms7-user] Creating new documents in an updater

Adolfo Benedetti adolfo.benedetti at gmail.com
Wed Dec 5 12:10:19 CET 2012


Hi Declan,

This works for me;

....
            Calendar now = GregorianCalendar.getInstance();

portalConfigurationFile.setProperty("hippostdpubwf:lastModificationDate",
now);

portalConfigurationFile.setProperty("hippostdpubwf:creationDate", now);
            portalConfigurationFile.setProperty("hippostdpubwf:createdBy",
"admin");

portalConfigurationFile.setProperty("hippostdpubwf:lastModifiedBy",
"admin");
......

--
Adolfo Benedetti


2012/12/5 Rek, Declan <declan.rek at capgemini.com>

> For the record: It's throwing errors on the "lastModifiedBy" property,
> which is a String, not one of the Date properties. But I get the idea..
> I indeed have relaxed document types, so now I am using the ValueFactory
> as Frank suggested but still no luck :-(
> My code now looks like this:
>
> myDocument.addMixin("hippo:harddocument");
> myDocument.addMixin("hippotranslation:translated");
>
> myDocument.setProperty("hippotranslation:locale",node.getSession().getValueFactory().createValue("nl"));
>
> myDocument.setProperty("hippotranslation:id",node.getSession().getValueFactory().createValue(someUuid));
>
> myDocument.setProperty("hippostdpubwf:creationDate",node.getSession().getValueFactory().createValue(Calendar.getInstance()));
>
> myDocument.setProperty("hippostdpubwf:createdBy",node.getSession().getValueFactory().createValue("admin"));
>
> myDocument.setProperty("hippostdpubwf:lastModifiedBy",node.getSession().getValueFactory().createValue("admin"));
>
> myDocument.setProperty("hippostdpubwf:lastModificationDate",node.getSession().getValueFactory().createValue(Calendar.getInstance()));
>
> myDocument.setProperty("hippostdpubwf:publicationDate",node.getSession().getValueFactory().createValue(Calendar.getInstance()));
>
> This still gives me errors on the "lastModifiedBy" property.
> I also tried:
> myDocument.setProperty("hippostdpubwf:creationDate","2012-11-27T12:15:21.377+01:00",
> PropertyType.DATE);
> myDocument.setProperty("hippostdpubwf:lastModifiedBy","admin",
> PropertyType.STRING);
>
> Any other suggestions?
>
> Thanks,
>
> Declan
>
> ________________________________________
> Van: hippo-cms7-user-bounces at lists.onehippo.org [
> hippo-cms7-user-bounces at lists.onehippo.org] namens Wouter Danes [
> Wouter.Danes at hinttech.com]
> Verzonden: woensdag 5 december 2012 10:06
> To: Hippo CMS 7 implementation list
> Onderwerp: Re: [Hippo-cms7-user] Creating new documents in an updater
>
> Yes, that's probably it, had this one before.
> It might create a String instead of a Date property.
>
> -----Original Message-----
> From: hippo-cms7-user-bounces at lists.onehippo.org [mailto:
> hippo-cms7-user-bounces at lists.onehippo.org] On Behalf Of Frank van
> Lankvelt
> Sent: dinsdag 4 december 2012 21:17
> To: Hippo CMS 7 implementation list
> Cc: Hippo CMS7 user list
> Subject: Re: [Hippo-cms7-user] Creating new documents in an updater
>
> are you using relaxed document types?  Then there is the possibility that
> the wrong property definition is used to store the lastModificationDate.
> You could try using the ValueFactory to create a Value object of the
> correct type.
>
> cheers, Frank
>
> On Tue, Dec 4, 2012 at 6:54 PM, drek <declan.rek at capgemini.com> wrote:
> > Hi guys,
> >
> > I'm trying to create new documents in an updater. Once I've created
> > one of the new documents the logging gives me errors. It states that
> > some mandatory field is missing. So one by one I've added the
> > mandatory fields, solving each error message. except for the
> > lastModifiedBy property. The updater keeps giving me the error:
> > "mandatory property
> > {http://www.onehippo.org/jcr/hippostdpubwf/nt/1.0}lastModifiedBy does
> > not exist". While I am very sure that I've added the property. Below is
> a piece of my code:
> >
> > myDocument.addMixin("hippo:harddocument");
> > myDocument.addMixin("hippotranslation:translated");
> >
> > myDocument.setProperty("hippotranslation:locale","nl");
> > myDocument.setProperty("hippotranslation:id", someUuid);
> > myDocument.setProperty("hippostdpubwf:creationDate","2012-11-27T12:15:
> > 21.377+01:00");
> > myDocument.setProperty("hippostdpubwf:createdBy","admin");
> > myDocument.setProperty("hippostdpubwf:lastModifiedBy","admin");
> > myDocument.setProperty("hippostdpubwf:lastModificationDate","2012-11-2
> > 7T12:15:21.377+01:00");
> > myDocument.setProperty("hippostdpubwf:publicationDate","2012-11-27T12:
> > 15:21.377+01:00");
> >
> > I understand that I am trying to create documents not using the
> > standard workflow, but assumed this was possible. Now I am starting to
> > doubt if this is even possible.
> > Is this the correct way to create documents in an updater? If no, how
> > should I tackle this issue?
> > Why does he keep buggin' me about the lastModifiedBy property, while
> > all other errors were solved by adding the property?
> >
> > Thanks in advance,
> >
> > Declan
> >
> >
> >
> > --
> > View this message in context:
> > http://hippo.2275632.n2.nabble.com/Creating-new-documents-in-an-update
> > r-tp7579895.html Sent from the Hippo CMS 7 mailing list archive at
> > Nabble.com.
> > _______________________________________________
> > Hippo-cms7-user mailing list and forums
> > http://www.onehippo.org/cms7/support/forums.html
>
>
>
> --
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam Boston - 1 Broadway,
> Cambridge, MA 02142
>
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
> www.onehippo.com
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient, you
> are not authorized to read, print, retain, copy, disseminate, distribute,
> or use this message or any part thereof. If you receive this message in
> error, please notify the sender immediately and delete all copies of this
> message.
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onehippo.org/pipermail/hippo-cms7-user/attachments/20121205/bb219ac8/attachment.htm>


More information about the Hippo-cms7-user mailing list