As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<type name="my:type1"> <title>My Type 1</title> <parent>cm:content</parent> <mandatory-aspects> <aspect>my:aspect_myaspect1</aspect> <aspect>my:aspect_myaspect2</aspect> <aspect>my:aspect_myaspect3</aspect> </mandatory-aspects> </type> <type name="my:type2"> <title>My Type 2</title> <parent>cm:content</parent> <mandatory-aspects> <aspect>my:aspect_myaspect1</aspect> <aspect>my:aspect_myaspect4</aspect> <aspect>my:aspect_myaspect5</aspect> </mandatory-aspects> </type>
<config evaluator="string-compare" condition="DocumentLibrary" replace="true"> <type name="my:type1" > <subtype name="my:type2" /> </type> <type name="my:type2" > <subtype name="my:type1" /> </type>
if (!node.specializeType(type)) { try { customSpecializeTypeScript.customSpecializeType(node,type); } catch (e) { status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Could not change type of nodeRef '" + nodeRef + "' to '" + type + "'"); return null; } }
public boolean customSpecializeType(Object obj,Object type) { if(obj instanceof ScriptNode) { ScriptNode nodeScript = (ScriptNode)obj; NodeRef nodeRef = nodeScript.getNodeRef(); if(type instanceof String) { String[] splitType = ((String)type).split(":"); if(splitType.length==2) { QName qnameNewType = QName.createQName(Constants.COSTMTYPEURI,splitType[1]); nodeService.setType(nodeRef, qnameNewType); return true; } } } return false; }