Custom content type with mimetype constraint

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2014 03:06 PM
Hi,
I'm having trouble getting my head around this. Is it possible to create a custom type which has constraints on the mimetype of the content. For example, a content type which can only have "application/pdf" as its content mimetype? I realize this can be accomplished at the application-level during content creation, but I am curious if the model could enforce this.
Any hints would be appreciated.
Carlos S. Zamudio
I'm having trouble getting my head around this. Is it possible to create a custom type which has constraints on the mimetype of the content. For example, a content type which can only have "application/pdf" as its content mimetype? I realize this can be accomplished at the application-level during content creation, but I am curious if the model could enforce this.
Any hints would be appreciated.
Carlos S. Zamudio
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2014 04:05 AM
I'am afraid there is no such feature in model level.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 08:52 AM
Hi Carlos,
it should be possible to add a constraint in the model, e.g.
(not having my dev environment at hand – the syntax may be slightly incorrect, but you should get the idea)
BUT: mime type is typically something managed by the system, so you'll have to check whether this will provide you with what you need:
<ul>
<li>if mime type is not PDF, the system should not let you change type into your content type foo:bar
<li>if content type of the object is foo:bar, the system should not let you change the mime type to anything other than PDF
<li>there may be other cases that need consideration…
</ul>
it should be possible to add a constraint in the model, e.g.
<type name="foo:bar"> <parent name="cm:content"/> <overrides> <property cm:mimrtype> <constraints> <constraint type="REGEX"> <property name="expression" value="application/pdf"> </c onstraint> </constraints> </property> </overrides></type>
(not having my dev environment at hand – the syntax may be slightly incorrect, but you should get the idea)
BUT: mime type is typically something managed by the system, so you'll have to check whether this will provide you with what you need:
<ul>
<li>if mime type is not PDF, the system should not let you change type into your content type foo:bar
<li>if content type of the object is foo:bar, the system should not let you change the mime type to anything other than PDF
<li>there may be other cases that need consideration…
</ul>

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 07:39 AM
Thanks for the suggestion. I tried something similar, but I'll experiment with different forms of the property name and if I find something that works, I'll post it. Cheers.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 10:56 AM
I don't think iPirat'solution will work,because:
"cm:mimetype" is not a property of "cm:cotent type" and the overrided logic will not work on it.
Correct me if I'm wrong
"cm:mimetype" is not a property of "cm:cotent type" and the overrided logic will not work on it.
Correct me if I'm wrong
