Powered By Blogger

Sunday, December 26, 2010

Changing the content Type of existing content

/**
* 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;
}

No comments:

Post a Comment