Change aspect property data type bug CMIS 1.1?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
elcamino
Active Member II

Change aspect property data type bug CMIS 1.1?

Hello

Alfresco Share v5.2.f
Alfresco Community v5.2.0
alfresco-community-installer-201707-win-x64.exe
.
1) I made a model, aspect & property in Alfresco Share (myModel >>> myAspect >>> some properties)
.
2) When creating properties I set the Data Types to d:int
3) Turns out now I need a d.text data type instead. So I deactivated the model & changed data type to d:text
4) now I used Share to go to the file, added the aspect & set the property value to "fgesgd" - to a random string
.
All fine so far.
.
Problem!
When you open up CMIS workbench & look at the properties (see the image in the attachment) then the type is still set to integer. And when you try to set the property programmatically you get a following error:
"Property 'sam:samCaseId' is a integer property. Expected type '<BigInteger, Byte, Short, Integer, Long>' but received a 'java.lang.String' property.",

.

I also tried to delete the property & create it anew with text data type, tried to delete the model & it still thinks it is an integer.

Hire is an example code I used to create new test file, add aspect & set property value to a string value:

Session cmisSession = alfrescoCmisSessionService.getSession();
Folder folder = (Folder) cmisSession.getObject("c86a2c67-8b4d-482d-98db-74a1b7ea7203");

Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.NAME, "testfile");
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");

Document doc = folder.createDocument(properties, null, null);

List<Object> aspects = doc.getProperty("cmis:secondaryObjectTypeIds").getValues();
aspects.add("P:sam:Metadata");
HashMap<String, Object> props = new HashMap<String, Object>();
props.put("cmis:secondaryObjectTypeIds", aspects);
doc.updateProperties(props);

properties.put("sam:samCaseId", "testvalue");

doc.updateProperties(properties);
 
1 Reply
afaust
Master

Re: Change aspect property data type bug CMIS 1.1?

The custom model manager is a playground tool not suitable for any serious use. It is good for some prototyping of models, but it is quite easy to shoot yourself in the foot, as you have done. Instead of using the model manager for custom models, I recommend using the proper data modelling approach.

From your description it sounds like you have not reenabled the model after switching to d:text. The likely reason why Alfresco treats the property as a text is that the old model configuration is still lingering in-memory. It may be overidden when you reactivate the model - provided you actually can. I am actually surprised you were able to deacivate the model at all after you had already used it - that should not have been possible unless you deleted every trace of its usage before (deleted the node and cleared the archive).