cancel
Showing results for 
Search instead for 
Did you mean: 

Possible to remove ALL googledocs aspects from ALL documents?

ttownsend
Champ on-the-rise
Champ on-the-rise
Hi all,

I've trying to upgrade 4.0.c to 4.2.e and have hit the backward compatibility break in google docs v1.0 support (don't panic - it's already in JIRA).

Can anyone tell me if it's possible/how to remove ALL googledocs aspects from ALL documents in a repository?  In theory (from reading JIRA and heaps of other information) this should allow upgrading to Alfresco versions where Google Docs 1.0 support has been removed.

Many thanks indeed!

Cheers,
Trevor

EDIT:  I should add that this is related to this issue (https://forums.alfresco.com/forum/installation-upgrades-configuration-integration/installation-upgra...), but it is a different question so I'm posting my question here.
Also, I have a 4.0.c test server set up (~70GB repository with 10+ sites) and I am willing to test any solutions and post the results back here.
6 REPLIES 6

jpotts
World-Class Innovator
World-Class Innovator
How about a server-side JavaScript file that contains something like:

var results = search.luceneSearch("ASPECT:\"ASPECT NAME HERE\"");

for each (var doc in results) {
   doc.removeAspect("ASPECT NAME HERE");
}


Where it says "ASPECT NAME HERE" you'd replace that with the aspect you are trying to remove. I don't know the exact Google Docs 1.0 integration aspect name but you can find it easily when you look at the node in the node browser.

You could run this JavaScript with Florian Maul's JavaScript console, or you could upload it to the data dictionary under "scripts" and use the "execute script" action.

Any data defined in these aspects will be lost, so make sure that is okay with you before you do it.

Jeff

ttownsend
Champ on-the-rise
Champ on-the-rise
Hi Jeff,

Many thanks for this!  I'll give it a go today and let you know how it turns out and if (fingers-crossed) this works around the upgrade issues to the higher version of 4.2.x.

Out of curiosity, is there not another way of doing this - perhaps through the Alfresco explorer?  I have little experience with it, so I don't know for myself.

EDIT:  Since I'm not a coder, could you please give me an idea of how this is written, where it is executed, and by what commands?

Many thanks,
Trevor

jpotts
World-Class Innovator
World-Class Innovator
Trevor,

Unfortunately, running a script is the only way to remove aspects from documents in bulk.

That is server-side JavaScript. There are a few options for executing server-side JavaScript but this is the one I'd recommend for you:

1. Copy that code into a file named "remove-aspects.js". Remember that you need to put the Google Docs aspect name in that code. You can find that aspect name by going to the admin console, going into the node browser, and navigating to a document you know has that aspect, then look at the list of aspects. It should be obvious which one is for Google Docs.
2. Upload the file to your repository under Data Dictionary/Scripts.
3. Log in to Alfresco Explorer. On any document (it doesn't matter which one for this particular script), click Run Action.
4. Select "Execute Script" as the action to run.
5. Click "Set Values and Add" to select the script you uploaded in Step 2.
6. Click "Next" until the script runs. If it runs successfully you won't see any feedback, otherwise you'll see an error message. Hopefully yours works the first time out. If not, tweak your script and repeat these steps.

Good luck,

Jeff

ttownsend
Champ on-the-rise
Champ on-the-rise
Hey Jeff - many thanks for this; I'll do my best and let you know how it works out.

Cheers,
Trevor

ttownsend
Champ on-the-rise
Champ on-the-rise
Hi Jeff,

I'm working my way through this.  My attempt at a maven build of js-console failed, but I thought I would try (trace below).
Apologies if these are very basic questions…
1.  With respect to your script example, I use SOLR, so should I change the script to reflect this somehow?
2.  How will I know that the script has run to completion, and with what results?

Many thanks,
Trevor



[INFO] 7 errors
[INFO] ————————————————————-
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 20:09.338s
[INFO] Finished at: Wed Apr 09 12:42:37 EDT 2014
[INFO] Final Memory: 43M/146M
[INFO] ————————————————————————
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project javascript-console-repo: Compilation failure: Compilation failure:
[ERROR] /opt/extras/js-console-master/javascript-console-repo/src/main/java/de/fme/jsconsole/JavascriptConsoleScriptObject.java:[71,22] cannot find symbol
[ERROR] symbol  : class JsConsoleDump
[ERROR] location: class de.fme.jsconsole.JavascriptConsoleScriptObject
[ERROR] /opt/extras/js-console-master/javascript-console-repo/src/main/java/de/fme/jsconsole/JavascriptConsoleScriptObject.java:[249,21] cannot find symbol
[ERROR] symbol  : class JsConsoleDump
[ERROR] location: class de.fme.jsconsole.JavascriptConsoleScriptObject
[ERROR] /opt/extras/js-console-master/javascript-console-repo/src/main/java/de/fme/jsconsole/JavascriptConsoleScriptObject.java:[280,17] cannot find symbol
[ERROR] symbol  : class JsConsoleDump
[ERROR] location: class de.fme.jsconsole.JavascriptConsoleScriptObject
[ERROR] /opt/extras/js-console-master/javascript-console-repo/src/main/java/de/fme/jsconsole/JavascriptConsoleResult.java:[42,22] cannot find symbol
[ERROR] symbol  : class JsConsoleDump
[ERROR] location: class de.fme.jsconsole.JavascriptConsoleResult
[ERROR] /opt/extras/js-console-master/javascript-console-repo/src/main/java/de/fme/jsconsole/JavascriptConsoleResult.java:[133,40] cannot find symbol
[ERROR] symbol  : class JsConsoleDump
[ERROR] location: class de.fme.jsconsole.JavascriptConsoleResult
[ERROR] /opt/extras/js-console-master/javascript-console-repo/src/main/java/de/fme/jsconsole/JavascriptConsoleScriptObject.java:[71,65] cannot find symbol
[ERROR] symbol  : class JsConsoleDump
[ERROR] location: class de.fme.jsconsole.JavascriptConsoleScriptObject
[ERROR] /opt/extras/js-console-master/javascript-console-repo/src/main/java/de/fme/jsconsole/JavascriptConsoleScriptObject.java:[430,28] cannot find symbol
[ERROR] symbol  : class JsConsoleDump
[ERROR] location: class de.fme.jsconsole.JavascriptConsoleScriptObject
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException



jpotts
World-Class Innovator
World-Class Innovator
In what directory were you sitting when you ran mvn install? Your error messages are complaining about not finding classes which should definitely be there.

Jeff