I wanted to know how to define a property in a custom model in order to set its updatability to "oncreate". If I use the "protected" tag, it will set the updatability to "readonly", and this is not the behaviour I am looking for.
All properties (even protected ones) can always be modified. In the core there is technically nothing to limit the property editability to either "oncreate" or "readonly". Only some APIs, e.g. CMIS, may have some special mapping that supports "readonly" - unfortunately you did not specify what kind of APIs you are using where you saw that "readonly".
But long story short: There is no such thin as "oncreate" updatability in Alfresco, and even "readonly" is just a fancy result of API mapping, but not really a thing in the core of Alfresco.
We are using Apache OpenCmis 1.1.0, and we connect to Alfresco using AtomPub.
At some point in the initial loading of our software, OpenCmis queries Alfresco using an AtomPub call and gets an XML description of the model. In that XML structure, our custom property is described like this (now it shows as "readwrite" because we removed the "protected = true" definition from the model):
So yes, there is a mix of hard-coding and mapping involved. The value comes from Alfresco, not OpenCMIS. But Alfresco hard-codes the "oncreate" updateability of cmisbjectTypeId and "maps" the protected=true flag to the updateability of "readonly". This is all done in order to be as near as possible to the CMIS interface specification as possible with regards to the end-user / client meaning of "protected". But technically speaking, internally in Alfresco, the protected flag has no special meaning.