cancel
Showing results for 
Search instead for 
Did you mean: 

set default mimetype at custom content type

michaelp
Confirmed Champ
Confirmed Champ
Hi there,

For our custom document type (lets say
custom:type
we want to set a custom mimetype as default mimetype (lets say
application/custommimetype
if a document is created as
custom:type
. For this I tried to override the parent type's property
<default>application/custommimetype</default>
mimetype for both
cmis:contentStreamMimetype
(in case our parent type is
cmis:document
) and
cm:content.mimetype
(in case our parent type is
cm:content
.

For example:



   <imports>
      <!– Import Alfresco Dictionary Model Definition –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
      <!– Import Alfresco Content Domain Model Definition –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
      <!– Import Alfresco Repository System Model Definition –>
      <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
      <!– Import Alfresco Share Data List Model Definition –>
      <import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl" />
      <!– Import Alfresco CMIS Model Definition –>
      <import uri="http://www.alfresco.org/model/cmis/1.0/cs01" prefix="cmis" />
   </imports>
   
   […]

      <type name="custom:type">
         <title>Custom Type</title>
         <parent>cm:content</parent> //or <parent>cmis:document</parent>
         <properties>
            <property name="custom:property">
               <title>Custom Property</title>
               <type>d:text</type>
               <mandatory>true</mandatory>
               <multiple>false</multiple>
            </property>
         </properties>
         <overrides>
            <property name="cm:content.mimetype"> //or <property name="cmis:contentStreamMimeType">
               <mandatory>true</mandatory>
               <default>application/custommimetype</default>
            </property>
         </overrides>
      </type>


The errors are always something like "…mimtype… unknown!" "…cmis… unknown!" or "…cmis:… does not exist!" or "…mimetype… of cmis does not exist!" (no imports are missing)

I also tried to use the type mapping descriped here: https://wiki.alfresco.com/wiki/CMIS_Model_Mapping#Meta_Model_Mapping

Without any success on many attemps I have to ask now you specialists: is this even possible?

We want this so Workdesk later can handle documents of this custom mimetype in a special way.

Thanky you for all your answers!
Best regards,
Michael
1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator
Hello,

cm:content.mimetype is NOT a property you can override. It is a meta-property, that means it is a derived value from an actual property, cm:content in this case. You also can NOT override cmis:contentStreamMimeType because that property does not exist on the Alfresco persistence layer. It is only used in the mapping of the Alfresco data model to the CMIS domain model. The mimetype of the content referenced by the property cm:content is mapped as cmis:contentStreamMimeType.

In general, it is bad practice to hijack a (meta-)property such as mimetype because it WILL break other functionality, specifically all the "open with" / "edit online" / "edit inline" actions that clients may provide. If you must handle documents in a special way, why not "just" use the custom document type you already seem to have?

Regards
Axel