specialize type

cancel
Showing results for 
Search instead for 
Did you mean: 
Alessia
Active Member

specialize type

Salve,

Premetto che sono davvero alle prime armi con alfresco.

Sto cercando di inserire una regola all'interno di una cartella, cioè una volta che vengono creare al suo interno delle cartelle (in modo automatico VBA) questi devono cambiare il tipo con uno da me creato.

Per questo stavo cercando di usare "Specializza tipo", ma non mi dà modo di scegliere un tipo da me creato:

Specializza tipo.png

7 Replies
abhinavmishra14
Advanced

Re: specialize type

You would need to define the types/subtypes in share config. By default all the content nodes are of type cm:content and to specialize them to another type either via rule or change type action, you need to have the below config

 

Dovresti definire i tipi / sottotipi nella configurazione della condivisione. Per impostazione predefinita tutti i nodi di contenuto sono di tipo cm: contenuto e per specializzarli in un altro tipo tramite regola o azione di modifica del tipo, è necessario disporre della configurazione seguente

<config evaluator="string-compare" condition="DocumentLibrary">
	<types>
		<type name="cm:content">
			<subtype name="demo:yourCustomTypeA"/>
<subtype name="demo:yourCustomTypeB"/>
...... </type> </types> </config>

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
Alessia
Active Member

Re: specialize type

Ciao Abhinav,

Innanzitutto grazie mille per l'attenzione.

Ho apportato le modifiche al file "share config document library" così come mi hai indicato.

-------------------

<types>
<type name="cm:content">
<subtype name="smf:smartFolderTemplate" />
</type>

<type name="cm:folder">
<subtype name="my:filename" />
</type>

<type name="trx:transferTarget">
<subtype name="trx:fileTransferTarget" />
</type>
</types>

----------------------------------

 

Purtroppo però quando definisco la regola le alternative restano le seguenti:

 

Specializza tipo.png

Ti ringrazio in anticipo per l'attenzione e spero possa risolvere il mio problema

Buona serata

abhinavmishra14
Advanced

Re: specialize type


-------------------

<types>
<type name="cm:content">
<subtype name="smf:smartFolderTemplate" />
</type>

<type name="cm:folder">
<subtype name="my:filename" />
</type>

<type name="trx:transferTarget">
<subtype name="trx:fileTransferTarget" />
</type>
</types>

----------------------------------

 

Purtroppo però quando definisco la regola le alternative restano le seguenti:

@Alessia You seems to be making change at wrong place, cm:content can't be subtyped with cm:folder. Here is your corrected config:

Sembra che tu stia apportando modifiche nel posto sbagliato, cm: il contenuto non può essere sottotipizzato con cm: cartella. Ecco la tua configurazione corretta:

<types>
  <type name="cm:content">
     <subtype name="smf:smartFolderTemplate" />
<subtype name="my:filename" /> <!-- my:filename is subtype of cm:content as defined in content model -->
</type>
<type name="trx:transferTarget"> <subtype name="trx:fileTransferTarget" /> </type> </types>

If you have a custom folder type that you have defined in your content model e.g. my:myFolderType then config will look like:

Se hai un tipo di cartella personalizzato che hai definito nel tuo modello di contenuto, ad es. my: myFolderType quindi config sarà simile a:

 

<types>
  <type name="cm:content">
     <subtype name="smf:smartFolderTemplate" />
  </type>
  
  <type name="cm:folder">
     <subtype name="my:myFolderType" /> <!-- my:myFolderType is subtype of cm:folder as defined in content model -->  
  </type>

  <type name="trx:transferTarget">
   <subtype name="trx:fileTransferTarget" />
  </type>
</types>

In the content model, custom types would be something like this, considering above examples:

Nel modello di contenuto, i tipi personalizzati sarebbero qualcosa di simile, considerando gli esempi precedenti:

<!-- Type Definitions -->
<types>
 <type name="my:myFolderType">
  <title>My Folder type</title>
  <description>My Custom Folder type</description>
  <parent>cm:folder</parent>
 </type>

 <type name="my:filename">
  <title>My file type</title>
  <description>My custom file type</description>
  <parent>cm:content</parent>
 </type>
</types>

Based on above type definition and share config examples i gave, see what is missing in your case. If you still can't make it work, share the content model and share config file for review here.

Sulla base della definizione del tipo di cui sopra e degli esempi di configurazione della condivisione che ho fornito, guarda cosa manca nel tuo caso. Se ancora non riesci a farlo funzionare, condividi il modello di contenuto e condividi il file di configurazione per la revisione qui.

 

I want to add an additonal info, when you configure subtypes via share config, you will start seeing the custom type in the menu item, but specialize type will not work on custom types (when a type if defined by inheriting another custom type) ootb unless you extend the change type webscript. 

Voglio aggiungere informazioni aggiuntive, quando configuri i sottotipi tramite la configurazione della condivisione, inizierai a vedere il tipo personalizzato nella voce di menu, ma il tipo specializzato non funzionerà sui tipi personalizzati (quando un tipo è definito ereditando un altro tipo personalizzato) ootb a meno che non estendi il tipo di modifica webscript.

Here you have find a complete step by step process to do that:

Qui trovi un processo completo passo passo per farlo:

https://javaworld-abhinav.blogspot.com/2020/06/change-type-of-custom-content-types.html

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
Alessia
Active Member

Re: specialize type

Hi Abhinavmishra,

Thank you for your time.

1) I have a custum folder, i mean, my:filename is a custum folder (actually the name is ITGVEFR:Tipo)

I couldn't find the file you told me (content model), so i share the following image to make you understand the issue:Cattura.PNG

so what i do the last time i think is right, because we are talking about a custom folder.

However i share "share-documentlibrary-config.xml" as you told me:

https://jsonformatter.org/xml-viewer/b26085

 

2) I didn't understand what do you mean about ".....you will start seeing the custom type in the menu item, but specialize type will not work on custom types ootb unless you extend the change type webscript."

My aim as i write from the begin is make to work an rule, in particular specialize type (ITGVEFR:Tipo) on a folder when this is created.

Specializza tipo.png

So this is not an "additional info" but an fondamental point.

Sorry for my english and thank you very much for your patience.

 

abhinavmishra14
Advanced

Re: specialize type

You can specialize/change type from cm:content to any other custom content which is created by inheriting cm:content. same you can do for any custom folder which is created by inheriting cm:folder. This works ootb when you have defined appropriate share config as discussed above.

if you have a custom folder or custom content type which is inhertied from another custom content/folder type then it won't work out of the box even if you see the options in the menu. You would have to do some customizations as mentioned earlier.

Considering you have defined your custom folder type "ITGVEFR:Tipo" by inheriting cm:folder like:

<types>
   <type name="ITGVEFR:Tipo">
      <title>My Folder type</title>
      <description>My Custom Folder type</description>
      <parent>cm:folder</parent>
   </type>
...
</types>

then, this is enough to see the custom folder type in the specialize/change type menu. 

<types>
      <type name="cm:folder">
        <subtype name="ITGVEFR:Tipo" />
      </type>
</types>

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
Alessia
Active Member

Re: specialize type

ok,

I did all what you told me:

below you can see the content model:

https://jsonformatter.org/xml-viewer/e8862e 

While below you can see the share-documentlibrary-config.xml :

https://jsonformatter.org/xml-viewer/89234c 

But the result is the same, i can't specialyze a folder in ITGVEFR:Tipo

spec.JPG

Please let me know if i do sthg wrong!

Thank you again

 

abhinavmishra14
Advanced

Re: specialize type


below you can see the content model:

https://jsonformatter.org/xml-viewer/e8862e 

While below you can see the share-documentlibrary-config.xml :

https://jsonformatter.org/xml-viewer/89234c 

But the result is the same, i can't specialyze a folder in ITGVEFR:Tipo

 

 


Seems you are mixing your changes in out of the box core content model and same this you are doing with share config. Never never never do that. It is not recommended. Its all mixed up so can't tell what you did wrong.

Create your own custom extension and apply it on alfresco and share as needed.

Here is a demo project, refer this to make your changes:

https://github.com/abhinavmishra14/specialize-type-demo

Custom content model: https://github.com/abhinavmishra14/specialize-type-demo/blob/main/specialize-type-demo-platform/src/...

Share extension: https://github.com/abhinavmishra14/specialize-type-demo/blob/main/specialize-type-demo-share/src/mai...

I would also recommend to go through this tutorial: https://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html

https://ecmarchitect.com/alfresco-developer-series

https://docs.alfresco.com/6.1/references/dev-extension-points-content-model.html

~Abhinav
(ACSCE, AWS SAA, Azure Admin)