Model Alfresco

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

Model Alfresco

Hello
how to compare with the source model and copy from the model the elements via JS
 
thanks for the help
5 Replies
abhinavmishra14
Advanced

Re: Model Alfresco

Can you explain what you want to achieve? its not completly clear

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

Re: Model Alfresco

thank you for reply,

when we create a site we create it according to a model.
- how can I recover a model and see these elements (js)?
- how can I know the model in which the site is created via (js)?
- I deleted some files in my site and the objective is to make the comparison with the source model and copy from the model the missing files.

did you understand me?

abhinavmishra14
Advanced

Re: Model Alfresco

No it is still not clear. 

Are you referring to content model ? if yes -> "site creation doesn't care what content models you have created/deployed in repository." 

What model you want to recover and what js you are looking to see ?

When you delete files from sites/repository, it goes to trash can. you can recover the deleted files from there if needed. 

Please provide detailed descripition of your use case.

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

Re: Model Alfresco

My problem: is when the user deletes a folder in the documantLibrary, I have to launch a javascript to retrieve them.

When a site is created, it is the result of a duplication of a xx model. In my opinion, we should compare with the source model and copy the missing files from the model.
what I thought of as a solution and I don't know if it's possible to do it !!


But according to your answer I think  of recovering them from the trash but how to do it in JS please?

abhinavmishra14
Advanced

Re: Model Alfresco

I am not sure what is the real benefit implement a js to retrieve the deleted files. it would be simple for the user to simply go to their trashcan and restore the deleted file as needed. But it may be a particular use case for you which is fine.

You need to also understand the lifecycle of a node/file/folder etc. 

Refer these posts , they are old but helpful:

https://blog.arvixe.com/content-lifecycle-in-alfresco/ 

https://blog.dbi-services.com/understand-the-lifecycle-of-alfresco-nodes/

If you still want to use your custom js to restore files, you would have make a lot of customizations to list of files which are deleted and then restore them based on their nodeIds. You might have to implement some sort of UI as well.

Have a look at these rest apis which can be a reference for your customization in order to list deleted files and retrieve them: 

https://docs.alfresco.com/6.1/concepts/dev-api-by-language-alf-rest-list-trashcan.html

https://docs.alfresco.com/6.1/concepts/dev-api-by-language-alf-rest-restore-trashcan-items.html

 

"When a site is created, it is the result of a duplication of a xx model. In my opinion, we should compare with the source model and copy the missing files from the model" ----> Seems you are confusing between site and content model with this statement you mentioned above. It is not correct. Content model is created/deployed at repository level. You create/configure, types, aspects, constraints, associations etc. in your content model and when you create sites, you could utilize your custom types aspects etc. to create content/metadata/associations. 

I would recommend to go through these docs and understand the site and content model:

https://docs.alfresco.com/6.1/concepts/sites-intro.html

https://docs.alfresco.com/6.1/concepts/library-intro.html

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

https://docs.alfresco.com/6.2/references/dev-extension-points-content-model-define-and-deploy.html

~Abhinav
(ACSCE, AWS SAA, Azure Admin)