cancel
Showing results for 
Search instead for 
Did you mean: 

problem on vesionig

antoneav
Champ in-the-making
Champ in-the-making
Hi, I have a small problem, if you put a document on the properties I have Alfresco and septum as version 0.1 of the document I have I would be 1.0. The problem is that I need to set the document must be versioned (Utils.createNamedValue ("{} http://www.alfresco.org/model/content/1.0 autoVersion", "true") how do I get as an initial version 1.0 . this is the code I wrote:
NamedValue[] contentProps = new NamedValue[8];
contentProps[0] = Utils.createNamedValue(Constants.PROP_NAME,
documentName);
contentProps[1] = Utils.createNamedValue(Constants.PROP_CONTENT,
contentString);
// dataCreation= "2005-09-16T17:01:03.456+01:00";
contentProps[2] = Utils.createNamedValue(Constants.PROP_CREATED, it.opera21.migration.Utils.convertToAlfrescoDateFormatFromShare(metadati.getCreation_date()));

contentProps[3] = Utils.createNamedValue(PROP_MODIFIED, it.opera21.migration.Utils.convertToAlfrescoDateFormatFromShare(metadati.getCreation_date()));

contentProps[4] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, metadati.getTitle());

contentProps[5] = Utils.createNamedValue(Constants.PROP_TITLE, metadati.getTitle());

contentProps[6] = Utils.createNamedValue(PROP_AUTHOR, metadati.getReport());

contentProps[7] = Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}autoVersion", "true");

CML cml1 = new CML();
CMLCreate create2 = new CMLCreate(null, parentReference, null,
null, null, Constants.TYPE_CONTENT, contentProps);
cml1.setCreate(new CMLCreate[] { create2 });
UpdateResult[] result;
result = WebServiceFactory.getRepositoryService().update(cml1);

I tried to add this piece of code but the result is always the same as I do start to have a verion 1.0?
contentProps[17] = Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}initialVersion", "true");
contentProps[18] = Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}versionType", "MAJOR");
contentProps[19] = Utils.createNamedValue("{http://www.alfresco.org/model/content/1.0}versionLabel", "1.0");
1 REPLY 1

mitpatoliya
Star Collaborator
Star Collaborator
could you try following way.
first just allowversion true.
update the content.
Then again update the content with the cm:versionLabel as 1.0

Not sure but this may work as when we do from UI.
Initially we allow versioning then while editing it will update the new version.