I try to create a new property said name new_modified which is the duplication of the property metadata - default:modiifed (cm_modified).
The only thing I change in the new property - new_,modified is switching the Type from "TimeStamp" to "Date". This work fine for changing the Date format.
But here is the problem:
Initially, I thought the "lastmodified" property renderer will automatically assign the current date value to the new_modified property (when I assign this property to a km resource/document, open & edit the document).
I decoded the source of lastmodified property renderer:
com.sapportals.wcm.control.util.PropertyRendererLastModified.
Here is the renderProperty method:
public Component renderProperty(IProperty property, IResource res, int maxLength) { PropertyType propType = null; TextView resultText = null; String result = null; try { <b>if(property == null) { property = res.getProperty(PropertyName.createLastModified());</b> if(property == null) { if(log.beDebug()) log.debugT("Could not retrieve Property <" + PropertyName.createLastModified() + "> for resource <" + res + ">"); return null; } } } catch(Exception e) { CatchBlockHandler.handle("PropertyRendererLastModified", "Exception", e, false, false); log.errorT("Caught exception when trying to render property <" + property + "> for resource <" + res + ">" + LoggingFormatter.extractCallstack(e)); return null; } propType = property.getType(); if(propType == PropertyType.DATE) result = DateFormatUtil.format(property, res.getContext()); else result = property.getStringValue(); if(result == null || result.length() == 0) { if(log.beDebug()) log.debugT("The property <" + PropertyName.createLastModified() + "> for resource <" + res + "> returned no value and will not be rendered."); return null; } resultText = new TextView("PropertyRendererLastModified"); if(is508Required()) resultText.setTooltip(PropertyRenderUtil.get508PropertyTooltip(property, result, res.getContext().getLocale())); else resultText.setTooltip(result); if(maxLength > 0 && result.length() > maxLength) result = result.substring(0, maxLength); resultText.setText(result); resultText.setWrapping(true); return resultText; }
Seems like they only assign the new modified value when the check that the property==null.
Isn't that this property renderer will set a new current Date value to new_modified property every time we edit the document?
If not, how do I set the new_modified to have the value of modified every time we edit the document.
Thanks for advise.
Regards,
Kent