Specialize type no parent
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2014 05:36 AM
Hi,
I have this configuration:
It's possible specialize type from my:type1 to my:type2 losing properties contained in my:aspect_myaspect2 and my:aspect_myaspect3 and save the properties contained in my:aspect_myaspect1 ?.
I have this configuration:
<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>
It's possible specialize type from my:type1 to my:type2 losing properties contained in my:aspect_myaspect2 and my:aspect_myaspect3 and save the properties contained in my:aspect_myaspect1 ?.
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2014 10:36 AM
In alfresco set a node to new type will do following:
1.update the node's basic data(type qname,transaction,auditable properties);
2.add the default aspects and properties required for the new type.Existing property values will not be overridden or removed.
So I guess all properties belong to my:aspect_myaspect1/my:aspect_myaspect2/my:aspect_myaspect3 will all be preserved.
That is all what I'm thinking ,you 'd better perform a test to validate whether properties belong to my:aspect_myaspect2/my:aspect_myaspect3 are preserved or not
1.update the node's basic data(type qname,transaction,auditable properties);
2.add the default aspects and properties required for the new type.Existing property values will not be overridden or removed.
So I guess all properties belong to my:aspect_myaspect1/my:aspect_myaspect2/my:aspect_myaspect3 will all be preserved.
That is all what I'm thinking ,you 'd better perform a test to validate whether properties belong to my:aspect_myaspect2/my:aspect_myaspect3 are preserved or not
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2014 11:42 AM
Yes. Aspect 1,2 and 3 will remain.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2014 03:49 AM
When I put in the file share-config-custom.xml this configuration:
I try to convert the document in Share, but the system generates an error "Unable to convert the document into my: type2".
<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>
I try to convert the document in Share, but the system generates an error "Unable to convert the document into my: type2".
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2014 05:07 AM
You can not fulfill your requirement in share ,in share it will only specialise the node to a sub class of current type
You should do some custom developmennt
You should do some custom developmennt
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2014 10:13 AM
I have found the solution:
1) Override the file webapps/alfresco/web-inf/classes/org/alfresco/slingshot/documentlibrary/type.post.json.js with:
2)Create custom BaseScopableProcessorExtension:
1) Override the file webapps/alfresco/web-inf/classes/org/alfresco/slingshot/documentlibrary/type.post.json.js with:
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; } }
2)Create custom BaseScopableProcessorExtension:
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; }
