08-17-2022 03:39 AM
Hello,
when alfresco was migrated to a newer version (5.2->7.x), incompatible extensions were removed (not installed), and also their custom model is missing (aspects and its properties). Files and folders In Alfresco have this metadata marked with a special flag and the document cannot be edited in Share (Edit Properties). I created missing custom model again by model modeler and it seems it worked well.
In this moment, I would like to remove old unnecessary aspect from all documents in the system, how to do that?
Thank you!
08-17-2022 03:51 PM
You can create a javabacked or javascript webscript to cleanup your content in bulk based on given parameters.
Here is an example of applying aspect in bulk, in same way you can remove aspects via the script:
Since content model is no longer available and your content may have aspects and properties, the script will throw integrity violation error, you will have to disable the behaviors that run the validation in the backgroud.
example;
var webContext = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext(); var behaviourFilter = webContext.getBean("policyBehaviourFilter", org.alfresco.repo.policy.BehaviourFilter); // Disable all behaviors, so we can remove the aspect without any validations behaviourFilter.disableAllBehaviours(); if(node.hasAspect(aspectName)){ // Remove aspect node.removeAspect(aspectName); } // Enable all the behaviors behaviourFilter.enableAllBehaviours();
Explore our Alfresco products with the links below. Use labels to filter content by product module.