I have made a rule in the folder myFolder. this rule changes the document type and adds the aspect to all elements you add in this folder….
I have tested it on the Explore and it works fine… when I add a document with other document type Alfresco changes the document type and show me the metadata of the aspect……
But when I send a document from my Java application that doesn't work…
Folder micarpeta = (Folder) session.getObjectByPath("/myFolder");
…
Map<String, Object> contentProperties = new HashMap<String, Object>();
//commet: contentProperties.put(PropertyIds.OBJECT_TYPE_ID, "D:my:customType,P:my:myAspect");
contentProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
contentProperties.put(PropertyIds.NAME, name);
contentProperties.put("my:tittle","eclipse");
ContentStream contentStream = new ContentStreamImpl(miFichero.getAbsolutePath(), null, " image/jpeg",new ByteArrayInputStream(bytes));
Document newContent1 = micarpeta.createDocument(contentProperties, contentStream, null);
java.lang.IllegalArgumentException: Property 'my:tittle' is neither an object type property nor an aspect property!
if I remove the comment and I put the specific type it works fine and aspect it works fine
i know that in your own code it wouldn´t be necessary… but I would like to know to understand how it works….
thanks