cancel
Showing results for 
Search instead for 
Did you mean: 

API for Changing the content Type of Existing content

patil
Champ on-the-rise
Champ on-the-rise
Hi,

Is there any api available for changing the content type of the existing content?

i,e initially content will be of type cm:content that I have to change it to patil:cusromContent.


Thanks in Advance.
Patil
1 REPLY 1

patil
Champ on-the-rise
Champ on-the-rise
Hi All,

I found the solution, Find the code for the same

   
   /**
    * Code for specialising the content Type
* @param registry
* @param actionedUponNodeRef
* @param destinationType
* @return
*/
public static boolean specialiseType(ServiceRegistry registry, NodeRef actionedUponNodeRef ,QName destinationType )
    {
       boolean specialise = false;
      if (registry.getNodeService().exists(actionedUponNodeRef) == true)
      {
          // Get the type of the node
            QName currentType = registry.getNodeService().getType(actionedUponNodeRef);
                
            // Ensure that we are performing a specialise
            if (currentType.equals(destinationType) == false &&
                  registry.getDictionaryService().isSubClass(destinationType, currentType) == true)
            {
                // Specialise the type of the node
               registry.getNodeService().setType(actionedUponNodeRef, destinationType);
               specialise = true;
            }
      }
      return specialise;
    }


After changing the type, set the properties


Thanks,
Patil
Cignex Technologies
Bangalore