cancel
Showing results for 
Search instead for 
Did you mean: 

change custom type

fedemori
Champ in-the-making
Champ in-the-making
Hi,
is possible to change the content type of a content from a custom type to another? What is the WS method?
The content types are defined in two different xml files.

<code>
<property name="models">
            <list>
                <value>alfresco/extension/customModel1.xml</value>
                <value>alfresco/extension/customModel2.xml</value>
            </list>
        </property>
<code>
5 REPLIES 5

romschn
Star Collaborator
Star Collaborator
Could you please elaborate more on your requirement?

fedemori
Champ in-the-making
Champ in-the-making
I have some files saved on Alfresco with a custom model x. This custom model x have some properties.
I have to update these files with a new custom model y that has some other properties and the two custom models are configurated in two different xml files.

romschn
Star Collaborator
Star Collaborator
If I understand correctly then - you have a content type A defined (for example - employee having properties as empid, empjoiningdate)  and there are few contents created in alfresco with this type.
Now, you want to define a new content type B (for example - revisedemployee having properties as empid, empjoiningdate, emplocation, empdepartment). Now, you want to have type A content type to have applied all the properties from type B. Do you want to have all the existing contents to become now of type B and hence type A should not be active. Is that correct?

mrogers
Star Contributor
Star Contributor
You can specialize the node to a subclass.  However in general you can't change the type of a node since it makes no sense. 

AFAIK there is no web service method to change the type of a node.

kaynezhang
World-Class Innovator
World-Class Innovator
In fact alfresco provide the method(setType()) to change type of a node in public service api,but it is not exposed as webservice.
And this mothod should be used with caution since calling it changes the type of the node and thus implies a different set of aspects, properties and associations.  It is the calling codes responsibility to ensure that the node is in a approriate state after changing the type.

If your old type and new type have most properties aspects and associations in common ,you can give it a try.
Otherwise you 'd better iterate every node you want to change type ,create a node with new type ,copy properties/apsects/associations from old node to new node ,then delete old node.