cancel
Showing results for 
Search instead for 
Did you mean: 

Change The Type of Document To a Custom Type

awonglk
Champ in-the-making
Champ in-the-making
Hi,

Is there an easy way to display the 'Type' (Not mimeytpe) of a Document in Properties?  The following apparently does not work:

  <config evaluator="node-type" condition="content">
     <property-sheet>
        <show-property name="name"/>
        <show-property name="mimetype" displayLabelId="mimetype" converter="org.alfresco.faces.MimeTypeConverter"/>
        <show-property name="title"/>
       <show-property name="type"/>
        <show-property name="description"/>
        <show-property name="size" displayLabelId="size" converter="org.alfresco.faces.ByteSizeConverter"/>
        <show-property name="creator"/>i
     </property-sheet>
  </config>


Specifically, I need to display the type of document in the property sheet of a document.

I am hoping to be able to change existing documents to a custom type that I defined. Do I have to use a script to do this?

Anthony
8 REPLIES 8

gavinc
Champ in-the-making
Champ in-the-making
The type of a document is not stored as a property which is why what you have attempted does not work.

You will need to add this to the details page explicitly to show this information.

If all you need to do is find out the type you can always login as admin and use the Node Browser on the Admin Console. This allows you to see all the low level details of nodes in the repository.

You can use "Run Action" to change the type of a node. Go to the document details page and select Run Action from the list of actions. As long as you have configured a list of custom types (in the specialise-types area of the Action Wizards config) you'll then be able to "specialise the type" of the node to one of your custom types (as long as it's a subtype of the current node's type).

Hope that helps.

awonglk
Champ in-the-making
Champ in-the-making
Thanks for your reply. What I need is an easy way to change the type completely. What I notice now is that files placed into the repository via CIFS defaults to the cm:content type. I need to be able to change the documents to a type I defined.

As you said, the "Specialise Type" action only works if the node is a subtype of the current node. This is not the case, and doesn't work.

What is the best way to go about changing types completely from one to another?

gavinc
Champ in-the-making
Champ in-the-making
If you need to set the type of a node being placed into a space then you can create a rule in the space to specialise the new node to the type you want, but again I think it will need to be a subtype of cm:content.

You can create other types of nodes as children but you'd need to implement a custom action handler to do that.

awonglk
Champ in-the-making
Champ in-the-making
Well.. I thought all custom types have to be a sub-type of "cm:content". This is my model:

      <type name="jt:taxinvoice">
         <title>Tax Invoices</title>
         <parent>cm:content</parent>
         <properties>
            <property name="jt:vendor">
               <title>Vendor</title>
               <type>d:text</type>
            </property>
            <property name="jt:invoicedate">
               <title>Invoice Date</title>
               <type>d:date</type>
            </property>
            <property name="jt:amount">
               <title>Amount</title>
               <type>d:float</type>
            </property>
        </properties>
      </type>

Doesn't the above mean that if I specialise any current node of "cm:content" type (by default), it should show the above custom-type as a 'specialised' type? It does not appear in the list when I run the "Specialize Type" action on any node.

Any ideas?

awonglk
Champ in-the-making
Champ in-the-making
Found the solution.. silly me. All I have to do is add the following in to my 'web-client-config-custom.xml':


   <config evaluator="string-compare" condition="Action Wizards">
      <specialise-types>
         <type name="jt:taxinvoice"/>
      </specialise-types>
   </config>

slothrop
Champ in-the-making
Champ in-the-making
The type of a document is not stored as a property which is why what you have attempted does not work.

You will need to add this to the details page explicitly to show this information.

If all you need to do is find out the type you can always login as admin and use the Node Browser on the Admin Console. This allows you to see all the low level details of nodes in the repository.

You can use "Run Action" to change the type of a node. Go to the document details page and select Run Action from the list of actions. As long as you have configured a list of custom types (in the specialise-types area of the Action Wizards config) you'll then be able to "specialise the type" of the node to one of your custom types (as long as it's a subtype of the current node's type).

Hope that helps.

Just to clarify: if I have two custom content types,
<type name="myns:submitted">
<parent>cm:content</parent>

</type>
and
<type name="myns:accepted">
<parent>cm:content</parent>

</type>
I will not be able to convert a node from the first type to the second when it is added to a space.

But if the types are defined as:
<type name="myns:submitted">
<parent>cm:content</parent>

</type>
and
<type name="myns:accepted">
<parent>myns:submitted</parent>

</type>
I will be able to convert from one type into the other?

gavinc
Champ in-the-making
Champ in-the-making
Correct

carry2web
Champ in-the-making
Champ in-the-making
We too are suprised to see that Alfreso hides/makes it so difficult to use/display such important information
See http://issues.alfresco.com/browse/AWC-1914 where I filed an Improvement request.