cancel
Showing results for 
Search instead for 
Did you mean: 

Adding metadata to default file type or setting custom type of document as default

tomekszy
Confirmed Champ
Confirmed Champ

Hi,

I want to add a custom values (metadata fields) to standard type in Alfresco. I tried to add custom types in model, with all metadata that I need, but still after adding file, I have to manually change type so Alfresco will show me my custom fileds of metadata. This is how it looks now:

I have some metadata in Models/Custom Types:

Zrzut ekranu 2016-10-12 10.56.22.png

So if I add a file (to sites/document library), I have to change type, so alfresco shows me my custom metadata:

Zrzut ekranu 2016-10-12 10.53.07.png

Then metadata could be filled:

Zrzut ekranu 2016-10-12 10.53.52.png

But I want my custom metadata fields to be added for all files, which I put to Alfresco like that:

Zrzut ekranu 2016-10-12 10.59.33.png

But without changing file types in first place. For example that all added files will have automatically set type to my custom one or to add my metadata to default file type. How can I do that?

1 ACCEPTED ANSWER

1. you might need to create 2 rules on 'User Homes' and your 'Sites' and check the 'apply to subfolders'

2. you need to make your type visible in share: Share configuration for custom types and properties | Alfresco Documentation

3. you can do that, but as Douglas C. R. Paes​ already pointed out, thats probably not what you want. it can lead to problems.

1 thing to know about specializing an item is => you can not 'unspecialize' it once its in the repo. and your users can potentially upload anything.

do you want 1000 jpeg's of somebodies cat with your special type? i don't think so.

create a strict rule that only applies your type to the files that really need it.

View answer in original post

16 REPLIES 16

I don't have XML setting files, which are mentioned there (projects\repository\config\alfresco\model\contentModel.xml). Is there some step-by-step guide? Where to go, what file edit, what to do in repository? I know how to edit file, but I can't find the file to edit, and I don't know how to start

douglascrp
World-Class Innovator
World-Class Innovator

Hey Tomasz Szymański

Have you created a project following the tutorial instructions?

You will find that path inside the default project's folder structure when you create it using the Alfresco SDK.

douglascrp
World-Class Innovator
World-Class Innovator

Tomasz Szymański​ Sorry, I forgot to post the tutorial's link Working With Custom Content Types in Alfresco | ECMArchitect | Alfresco Developer Tutorials

douglascrp
World-Class Innovator
World-Class Innovator

Instead of adding new by specializing the object's type, you could create new aspects with the required fields and then attach the aspect to new nodes using the same folder rule idea.

zhihailiu
Champ on-the-rise
Champ on-the-rise

Have you thought of using Behaviors? There are hooks for beforeCreateNode, onCreateNode etc.

Behaviours / Policies | Alfresco Documentation

Jeff also has an excellent turorial.

Implementing Custom Behaviors in Alfresco | ECMArchitect | Alfresco Developer Tutorials

tomekszy
Confirmed Champ
Confirmed Champ

Thank you all for your help - it cleared out a lot. I decided to use rule to add an aspect to file - not change type. Right now i"m testing this solution.

I used the Markus Joos​ solution, and used aspects and rules in folders. It works very good, the only problem i've got is unability to edit an acive model, but I posted separate subject about that. Thaks once again for help!