cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing document type property

ericnk
Champ on-the-rise
Champ on-the-rise
Hi,

I'm currently developing a workflow in which I need to identify the document type of each document in the workflow document package (bpm_package) so that I may deposit each document where it goes in the repository at the conclusion of the workflow.  Is there a wiki page that lists the document properties available?  More specifically, is the document type available as a document property?  I look forward to any suggestions or comments.  Thank you.

Regards,

Eric
4 REPLIES 4

mitpatoliya
Star Collaborator
Star Collaborator
Actually there is no straight links or view where you can see the content type of document.
There is one template in the alfresco called doc_info.ftl, if you attach this template to your document and see it via custom view you will be able to see all the properties along with the content type.
Else you can change the web-client-config-custom.xml to show the content type along with all other properties in document detail page.

ericnk
Champ on-the-rise
Champ on-the-rise
Thank you for your reply.  I'm not sure I made myself clear.  I will try again.  The workflow I'm developing works with custom document types, i.e.  mydomainSmiley TongueurchaseOrder.  This custom type is what I need to identify in the workflow package (bpm_package).  For example.. 


  <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
     <script>
        for (var i = 0; i < bpm_package.children.length; i++) {
            if (bpm_package.children[i].properties["cm:type"] == "mydomain:purchaseOrder")
                 bpm_package.children[i].move(bpm_context.childByNamePath("Purchase Orders"));
            if (bpm_package.children[i].properties["cm:type"] == "mydomain:check")
                 bpm_package.children[i].move(bpm_context.childByNamePath("Checks"));
            ….
        }
     </script>
  </action>

An extensive search through the alfresco wiki and documentation yielded cm:name, cm:type and sys:name as some of the properties available in the default content model.  Will any of these properties identify the custom type?  Is the information in the doc_info.ftl template you mentioned previously, available through the javascript API?  I look forward to and appreciate any replies on this subject.  Thank you.

Regards,

Eric

mitpatoliya
Star Collaborator
Star Collaborator
Hi Eric,
Actually the one which you are using right now is i.e. ["cm:type"] is a property of the dublincore aspect so that will not be helpful to you.
You need to check the API's of document object.
So try something like document.type which will returns you the fully qualified type QName then you need to convert that to string and then check you conditions.
Refer :http://wiki.alfresco.com/wiki/3.4_JavaScript_API

ericnk
Champ on-the-rise
Champ on-the-rise
Thank you for your reply.  Can you give me an example of what you're referring to using document.type?  Perhaps something within a beanshell or javascript statment.  The javascript api wiki page is a little bit vague on the specifics of how to retrieve the type.  The "document.type" statement implies a reference to a single document, i.e. bpm_package.children[0] .  But, what about multiple documents?  Can the type identification (qname) be retrieved as follows?



for (var i = 0; i &lt; bpm_package.length; i++) {
     var type;
     type = bpm_package.children[i].type;
     System.out.println(type);
}


I look forward to your reply.  Thank you.

Regards,

Eric