cancel
Showing results for 
Search instead for 
Did you mean: 

Datetime in Alfresco

spilby
Confirmed Champ
Confirmed Champ
Hi everyone,

I want to upload a custom property to Alfresco like this:

Utils.createNamedValue(Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, ArchivoConstants.BIRTHDAY_DATE), my_date);

But this property is a Datetime, not a String, and when I want to obtain this property give me a Java exception when I parse the date.

When I see in Alfresco Node Browser the created or modified dates of the nodes, these have the property type: {http://www.alfresco.org/model/dictionary/1.0}datetime. For example:

Name -> {http://www.alfresco.org/model/content/1.0}created   

Value -> Fri Nov 26 10:10:35 CET 2010

Property Type -> {http://www.alfresco.org/model/dictionary/1.0}datetime   

Value Type ->

But my properties have this Properties:

Name -> {http://www.alfresco.org/model/content/1.0}birthday_date   

Value -> Wed Dec 01 17:46:09 CET 2010
   
Property Type ->

Value Type -> {http://www.alfresco.org/model/cmis/1.0/cs01}id

What can I do tp upload the property type of datetime with a Java method? Like the createNamedValue or createQNameString.

Thanks!
1 REPLY 1

spilby
Confirmed Champ
Confirmed Champ
Well, I found the solution in other thread of the forum…

NamedValue[] properties = new NamedValue[]{
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "textProp"), "some text"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "intProp"), "12"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "longProp"), "1234567890"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "floatProp"), "12.345"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "doubleProp"), "12.345"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "dateProp"), "2005-09-16T00:00:00.000+00:00"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "datetimeProp"), "2005-09-16T17:01:03.456+01:00"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "booleanProp"), "false"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "qnameProp"), "{http://www.alfresco.org/model/webservicetestmodel/1.0}testProperties"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "noderefProp"), "workspace://SpacesStore/123123123"),
                    Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "textMultiProp"), new String[] {"firstValue", "secondValue", "thirdValue"}),