cancel
Showing results for 
Search instead for 
Did you mean: 

Set create date problem

mangar
Star Contributor
Star Contributor
I am trying to import files from a legacy system. I got all the directories and files to move fine, but I need to keep the original create date. I get it fine and use the ISODateFormat to format. Everything works with no errors, I go to alfresco and look at it, it has today's date! here is the relevant code:



           NamedValue createDateValue = Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}created", fileDate);
           NamedValue modDateValue = Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}modified", fileDate);
                           
            NamedValue[] contentProps = new NamedValue[] {createDateValue,modDateValue};

            // Construct CML statement to create test doc content node           
            CMLCreate createDoc = new CMLCreate("ref1", docParent, null, null, null, Constants.createQNameString(NAMESPACE, CONTENT_TYPE), contentProps);
            CML cml = new CML();
            cml.setCreate(new CMLCreate[] {createDoc});

like I said - no errors are being thrown, just today's date is being thrown.
3 REPLIES 3

hkır
Champ in-the-making
Champ in-the-making
I have a similar problem. While I can modify the description or name of a file I can't change the modifier/creator and modification/creation dates via web service client. Probably this is a design decision of alfresco architects.

mrogers
Star Contributor
Star Contributor
Yes it is.  cm:created is the date the file was created in alfresco, likewise for the modified fields.   Think about it.   If you could set a value for cm:modified then it would have to be overwritten as you tried to set it to something else  :?     There are a small set of "protected" properties that you can't modify directly since they are used by the system.

I think the ultimate solution may be to introduce another couple of date properties so we can distinguish between the date that the file was created in alfresco and for example what is shown in the CIFS interface.    The new values could be set without interfering with the functioning of alfresco.     There's at least one JIRA enhancement open with some thoughts on this.

mangar
Star Contributor
Star Contributor
OK, cool. I have added a my:fileCreateDate property to my:doc parent. I set that, make it searchable, and presto! Same thing.  Smiley Very Happy

Maybe there should be a cm:fileCreateDate ?  Anyone?