<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Modify dc:created in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/modify-dc-created/m-p/318165#M5166</link>
    <description>&lt;P&gt;I know this may sound weird to some people but it would be very handy for me for debugging during development. I would like to artificially "age" a document in steps of 1 year. It would allow me to do test code which responds to the age of a document. I have made a very simple client side thing to modify the dc:created field of the document. The field is changed but it seems the change never gets persisted to the database since it's goes back to its original value after a short while (some cache expires?).&lt;/P&gt;
&lt;P&gt;The code I use to modify the creation date is the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;public void debugAgeDocument1Year() throws ClientException {
    DocumentModel doc;
    GregorianCalendar created;

    coreSession = navigationContext.getOrCreateDocumentManager();
    doc = navigationContext.getCurrentDocument();

    created = (GregorianCalendar) doc.getPropertyValue("dc:created");
    created.add(GregorianCalendar.YEAR, -1);
    doc.setPropertyValue("dc:created", created);
    coreSession.saveDocument(doc);
    coreSession.save();
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the change never gets persistent in the underlying PostgreSQL database. Alternate approches and pointers to relevant documentation would be appreciated.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Dec 2011 18:40:57 GMT</pubDate>
    <dc:creator>fdgonthier_</dc:creator>
    <dc:date>2011-12-12T18:40:57Z</dc:date>
    <item>
      <title>Modify dc:created</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/modify-dc-created/m-p/318165#M5166</link>
      <description>&lt;P&gt;I know this may sound weird to some people but it would be very handy for me for debugging during development. I would like to artificially "age" a document in steps of 1 year. It would allow me to do test code which responds to the age of a document. I have made a very simple client side thing to modify the dc:created field of the document. The field is changed but it seems the change never gets persisted to the database since it's goes back to its original value after a short while (some cache expires?).&lt;/P&gt;
&lt;P&gt;The code I use to modify the creation date is the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;public void debugAgeDocument1Year() throws ClientException {
    DocumentModel doc;
    GregorianCalendar created;

    coreSession = navigationContext.getOrCreateDocumentManager();
    doc = navigationContext.getCurrentDocument();

    created = (GregorianCalendar) doc.getPropertyValue("dc:created");
    created.add(GregorianCalendar.YEAR, -1);
    doc.setPropertyValue("dc:created", created);
    coreSession.saveDocument(doc);
    coreSession.save();
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the change never gets persistent in the underlying PostgreSQL database. Alternate approches and pointers to relevant documentation would be appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2011 18:40:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/modify-dc-created/m-p/318165#M5166</guid>
      <dc:creator>fdgonthier_</dc:creator>
      <dc:date>2011-12-12T18:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Modify dc:created</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/modify-dc-created/m-p/318166#M5167</link>
      <description>&lt;P&gt;It doesn't sound wierd at all (at least to me :-). The only way I have found to achieve what you are asking is to override the dublincore logic provided in the Nuxeo base (DublinCoreListener.java found in the nuxeo-platform-dublincore package). Nuxeo recommends not doing this, but personally I see the need for it (as do clients looking to preserve original creation). Testing I think is another good reason.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2011 20:08:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/modify-dc-created/m-p/318166#M5167</guid>
      <dc:creator>bruce_Grant</dc:creator>
      <dc:date>2011-12-12T20:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Modify dc:created</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/modify-dc-created/m-p/318167#M5168</link>
      <description>&lt;P&gt;Your answer brings more question. I have looked at DublinCoreStorageService and it doesn't seem to do anything different than what my small function does. That is simply set the dc&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2011 20:16:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/modify-dc-created/m-p/318167#M5168</guid>
      <dc:creator>fdgonthier_</dc:creator>
      <dc:date>2011-12-12T20:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Modify dc:created</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/modify-dc-created/m-p/318168#M5169</link>
      <description>&lt;P&gt;This is shameful, but turns out a bug in my configuration made Nuxeo use Derby instead of PostgreSQL and that's why I did not see any commits done on the PostgreSQL. The question still kinda stands because the commit in question still did not get saved in all situations. Since I care little for Derby, I will first switch the config to PostgreSQL and see if the problem can be reproduced.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2011 02:18:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/modify-dc-created/m-p/318168#M5169</guid>
      <dc:creator>fdgonthier_</dc:creator>
      <dc:date>2011-12-13T02:18:55Z</dc:date>
    </item>
  </channel>
</rss>

