Author: sohil.shah(a)jboss.com
Date: 2008-02-05 01:44:48 -0500 (Tue, 05 Feb 2008)
New Revision: 9765
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateAndVersionCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateCommand.java
Log:
JBPORTAL-1801 - CMS content shows incorrect 'Created' and 'Modified'
timestamps
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateAndVersionCommand.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateAndVersionCommand.java 2008-02-05
06:12:30 UTC (rev 9764)
+++
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateAndVersionCommand.java 2008-02-05
06:44:48 UTC (rev 9765)
@@ -58,12 +58,14 @@
Node contentNode =
(Node)context.getSession().getItem(mFile.getContent().getBasePath());
contentNode.checkout();
+ DateValue timestamp = new DateValue(Calendar.getInstance());
+
contentNode.setProperty("portalcms:description",
mFile.getContent().getDescription());
contentNode.setProperty("portalcms:title",
mFile.getContent().getTitle());
contentNode.setProperty("portalcms:language",
mFile.getContent().getLocale().getLanguage());
contentNode.setProperty("jcr:encoding", "UTF-8");
contentNode.setProperty("jcr:data", new
BinaryValue(mFile.getContent().getBytes()));
- contentNode.setProperty("jcr:lastModified", new
DateValue(Calendar.getInstance()));
+ contentNode.setProperty("jcr:lastModified", timestamp);
if (mFile.getContent().getMimeType() != null)
{
@@ -87,6 +89,11 @@
//make a new version live version
Node versionNode =
(Node)context.getSession().getItem(mFile.getContent().getBasePath());
VersionUtil.createVersion(versionNode, this.bMakeLive);
+
+ //Update the lastModified Property of the FileNode of this content
+ Node fileNode = (Node)context.getSession().getItem(mFile.getBasePath());
+ fileNode.setProperty("jcr:lastModified", timestamp);
+ fileNode.save();
}
catch (Exception e)
{
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateCommand.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateCommand.java 2008-02-05
06:12:30 UTC (rev 9764)
+++
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/FileUpdateCommand.java 2008-02-05
06:44:48 UTC (rev 9765)
@@ -55,13 +55,15 @@
{
Node contentNode =
(Node)context.getSession().getItem(mFile.getContent().getBasePath());
contentNode.checkout();
+
+ DateValue timestamp = new DateValue(Calendar.getInstance());
contentNode.setProperty("portalcms:description",
mFile.getContent().getDescription());
contentNode.setProperty("portalcms:title",
mFile.getContent().getTitle());
contentNode.setProperty("portalcms:language",
mFile.getContent().getLocale().getLanguage());
contentNode.setProperty("jcr:encoding", "UTF-8");
contentNode.setProperty("jcr:data", new
BinaryValue(mFile.getContent().getBytes()));
- contentNode.setProperty("jcr:lastModified", new
DateValue(Calendar.getInstance()));
+ contentNode.setProperty("jcr:lastModified", timestamp);
if (mFile.getContent().getMimeType() != null)
{
@@ -81,6 +83,11 @@
}
}
contentNode.save();
+
+ //Update the lastModified Property of the FileNode of this content
+ Node fileNode = (Node)context.getSession().getItem(mFile.getBasePath());
+ fileNode.setProperty("jcr:lastModified", timestamp);
+ fileNode.save();
}
catch (Exception e)
{
Show replies by date