Repair web project web script

cancel
Showing results for 
Search instead for 
Did you mean: 

Repair web project web script

wabson
Active Member II
0 4 1,677
This is actually two small web scripts, which between them allow you to select an Alfresco web project and fix up the metadata on all form generated assets, including renditions. I wrote it to allow me to reassociate assets with their forms after using CIFS to do an export and import of some sites I've been working on.

The functionality is similar to that provided by Uzi's Web Project Tools AMP which isn't yet building against 2.2, but rather than being Java-based uses the JavaScript API against the AVM - which should remain stable over time.

At the moment the script iterates through the site directory structure looking for any XML item not associated with a web form. Then, if a form with a matching root tag is found associated with the web project then the appropriate aspects and properties are added to the node and any existing renditions.

Unlike with the Web Project Tools AMP existing form metadata cannot be removed or repaired, but I quite like the simpleness of this approach. Adding the ability to do this would perhaps be useful, but would complicate the UI and wasn't required for my purposes. I might add this later, in addition to the ability to preview the changes.

Right now it's recommended to ensure the current user's sandbox is empty before executing the script, so that you can easily undo all changes should your data get munged. The script has been tested against a couple of web projects that I have access to but as it has not yet had widespread testing it should be used with caution!

Note, you need to have a sandbox for the web project you want to repair. If you do not then the site will not show up in the initial list.

To install the web script extract the contents of the ZIP file somewhere in your web script package hierarchy, either on the classpath or inside the Data Dictionary - org/alfresco/wcm works for me. Remember you'll need to reload Alfresco or at least refresh the list of web scripts to get Alfresco to pick it up.

repair-web-project.zip

Comments welcome!

Update: Thanks to Nancy for pointing me at the Developer Tools area of the Content Community - the code is also now available there.
4 Comments