Repair web project web script

Showing results for 
Search instead for 
Did you mean: 

Repair web project web script

Active Member II
0 5 1,826
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.

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.
Active Member

I have used your webscript. and it works fine. but it works onley when you have a prefix() in your form as rootelement. when you ditn't have  it() then are there a few problems.

webscript can not found rootelement of the form.

but we chances a few things in the

firts we chance in the xmlGetRootElementName function the regular expression  to  var re = /0){

       outputPath = '' + outputPath;


this becaus we go to check if the rootPrefix > 0 and the we create outputPath.

thanks Peter
Active Member

I'm trying your webscript but I have a problem with Lucene search. The script find the associated forms with the web project, but when trying to find the web forms at this line :

var formResults = search.luceneSearch('TYPE:wca\\:formfolder AND @cm\\:name:\'' + formname + '\'');

no forms are returned. If I try to execute this query in the node browser, in the workspace://SpacesStore, the query works fine and the requested web form is returned.

After a lot of search, I can't find a solution to this problem.

Please can you help me?


Active Member
Same problems with Lucene search
Active Member
We did follow your link and we are able to achieve our xml to webform association along with metadata extraction.

This is our use case

a)      Using FTP client/java program to upload the XML content to AVM.

b)      Associating the XML content to a pre configured web form.

c)      Metadata extraction using aspects

d)      Generate Renditions

As mentioned the renditions didnot work. Web form has been configured to have xml and html. Are we missing something or any further configuration required.

Please suggest.
Member II

Repairing a web project or web script typically involves identifying and fixing issues within the codebase to restore functionality and improve performance. Glass Door Repair This process begins with a thorough analysis to pinpoint bugs, errors, or areas where the script is not functioning as intended. Depending on the nature of the problem, repairs may involve debugging to trace and correct coding errors, updating outdated libraries or dependencies, optimizing database queries for better performance, or enhancing security measures to protect against vulnerabilities.