https://oxpedia.org/wiki/index.php?title=Automatic_Delete_OXObjects_Per_User&feed=atom&action=history
Automatic Delete OXObjects Per User - Revision history
2024-03-28T11:40:22Z
Revision history for this page on the wiki
MediaWiki 1.31.0
https://oxpedia.org/wiki/index.php?title=Automatic_Delete_OXObjects_Per_User&diff=22092&oldid=prev
Martin.schneider: Move to https://documentation.open-xchange.com/
2016-06-29T13:48:57Z
<p>Move to https://documentation.open-xchange.com/</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 13:48, 29 June 2016</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><div class="title">How to automatically delete all objects of one user</div></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><div class="title">How to automatically delete all objects of one user</div></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>I just wrote the following quick&dirty hack to delete all objects and folders created by an OXHE User. It can be useful to clean up a context or to just delete all data from one user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange [<del class="diffchange diffchange-inline">[</del>HTTP API<del class="diffchange diffchange-inline">]</del>].</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>I just wrote the following quick&dirty hack to delete all objects and folders created by an OXHE User. It can be useful to clean up a context or to just delete all data from one user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange [<ins class="diffchange diffchange-inline">https://documentation.open-xchange.com/ </ins>HTTP API].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
</table>
Martin.schneider
https://oxpedia.org/wiki/index.php?title=Automatic_Delete_OXObjects_Per_User&diff=16540&oldid=prev
Tierlieb at 15:58, 22 November 2013
2013-11-22T15:58:11Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 15:58, 22 November 2013</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>I just wrote the following quick&dirty hack to delete all objects and folders created by an OXHE User. It can be <del class="diffchange diffchange-inline">usefull </del>to clean up a context or to just delete all data from <del class="diffchange diffchange-inline">1 </del>user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange HTTP <del class="diffchange diffchange-inline">Json </del>API<del class="diffchange diffchange-inline">. Which is btw. a great interface to the whole Open-Xchange System</del>.</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"><div class="title">How to automatically delete all objects of one user</div></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>I just wrote the following quick&dirty hack to delete all objects and folders created by an OXHE User. It can be <ins class="diffchange diffchange-inline">useful </ins>to clean up a context or to just delete all data from <ins class="diffchange diffchange-inline">one </ins>user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange <ins class="diffchange diffchange-inline">[[</ins>HTTP API<ins class="diffchange diffchange-inline">]]</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l466" >Line 466:</td>
<td colspan="2" class="diff-lineno">Line 468:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[[Category: OX6]]</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[[Category: OX6<ins class="diffchange diffchange-inline">]] [[Category:Quick hack</ins>]]</div></td></tr>
</table>
Tierlieb
https://oxpedia.org/wiki/index.php?title=Automatic_Delete_OXObjects_Per_User&diff=4073&oldid=prev
Mheiland at 13:20, 27 June 2009
2009-06-27T13:20:55Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 13:20, 27 June 2009</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l465" >Line 465:</td>
<td colspan="2" class="diff-lineno">Line 465:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">[[Category: OX6]]</ins></div></td></tr>
</table>
Mheiland
https://oxpedia.org/wiki/index.php?title=Automatic_Delete_OXObjects_Per_User&diff=2000&oldid=prev
Cutmasta at 13:55, 7 July 2008
2008-07-07T13:55:40Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 13:55, 7 July 2008</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>I just wrote the following quick hack to delete all objects and folders created by an OXHE User. It can be usefull to clean up a context or to just delete all data from 1 user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange HTTP Json API. Which is btw. a great interface to the whole Open-Xchange System.</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>I just wrote the following quick<ins class="diffchange diffchange-inline">&dirty </ins>hack to delete all objects and folders created by an OXHE User. It can be usefull to clean up a context or to just delete all data from 1 user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange HTTP Json API. Which is btw. a great interface to the whole Open-Xchange System.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
</table>
Cutmasta
https://oxpedia.org/wiki/index.php?title=Automatic_Delete_OXObjects_Per_User&diff=1999&oldid=prev
Cutmasta at 13:54, 7 July 2008
2008-07-07T13:54:57Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 13:54, 7 July 2008</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>I just wrote the following quick hack to delete all objects and folders created by <del class="diffchange diffchange-inline">a </del>OXHE User. It can be usefull to clean up a context or to just delete all data from 1 user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange HTTP Json API. Which is btw. a great interface to the whole Open-Xchange System.</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>I just wrote the following quick hack to delete all objects and folders created by <ins class="diffchange diffchange-inline">an </ins>OXHE User. It can be usefull to clean up a context or to just delete all data from 1 user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange HTTP Json API. Which is btw. a great interface to the whole Open-Xchange System.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
</table>
Cutmasta
https://oxpedia.org/wiki/index.php?title=Automatic_Delete_OXObjects_Per_User&diff=1998&oldid=prev
Cutmasta at 13:50, 7 July 2008
2008-07-07T13:50:43Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 13:50, 7 July 2008</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>I just wrote <del class="diffchange diffchange-inline">a </del>quick hack to delete all objects and folders created by a <del class="diffchange diffchange-inline">user</del>. <del class="diffchange diffchange-inline">This </del>can usefull to clean up <del class="diffchange diffchange-inline">Context </del>just delete all data from 1 user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange HTTP Json API. Which is btw. a great interface to the whole Open-Xchange System.</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>I just wrote <ins class="diffchange diffchange-inline">the following </ins>quick hack to delete all objects and folders created by a <ins class="diffchange diffchange-inline">OXHE User</ins>. <ins class="diffchange diffchange-inline">It </ins>can <ins class="diffchange diffchange-inline">be </ins>usefull to clean up <ins class="diffchange diffchange-inline">a context or to </ins>just delete all data from 1 user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange HTTP Json API. Which is btw. a great interface to the whole Open-Xchange System.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
</table>
Cutmasta
https://oxpedia.org/wiki/index.php?title=Automatic_Delete_OXObjects_Per_User&diff=1997&oldid=prev
Cutmasta: New page: I just wrote a quick hack to delete all objects and folders created by a user. This can usefull to clean up Context just delete all data from 1 user. The following JAVA file contains the l...
2008-07-07T13:48:56Z
<p>New page: I just wrote a quick hack to delete all objects and folders created by a user. This can usefull to clean up Context just delete all data from 1 user. The following JAVA file contains the l...</p>
<p><b>New page</b></p><div>I just wrote a quick hack to delete all objects and folders created by a user. This can usefull to clean up Context just delete all data from 1 user. The following JAVA file contains the logic which is needed to login/search/delete via the Open-Xchange HTTP Json API. Which is btw. a great interface to the whole Open-Xchange System.<br />
<br />
<pre><br />
package com.openexchange.tools.cleaner;<br />
<br />
import java.io.IOException;<br />
import java.util.logging.Level;<br />
import java.util.logging.Logger;<br />
import org.apache.commons.httpclient.HttpClient;<br />
import org.apache.commons.httpclient.HttpException;<br />
import org.apache.commons.httpclient.methods.GetMethod;<br />
import org.apache.commons.httpclient.methods.PostMethod;<br />
import org.apache.commons.httpclient.methods.PutMethod;<br />
import org.apache.commons.httpclient.methods.RequestEntity;<br />
import org.apache.commons.httpclient.methods.StringRequestEntity;<br />
import org.apache.commons.httpclient.protocol.Protocol;<br />
import org.apache.commons.logging.Log;<br />
import org.apache.commons.logging.LogFactory;<br />
import org.json.JSONArray;<br />
import org.json.JSONException;<br />
import org.json.JSONObject;<br />
<br />
/**<br />
*<br />
* @author cutmasta<br />
*/<br />
public class Start {<br />
<br />
Log LOG = LogFactory.getLog(Start.class);<br />
private SessionObject so = null;<br />
private String username = null;<br />
private String password = null;<br />
private String host = "localhost";<br />
private String protocol = "http";<br />
private static String CONTENT_TYPE_JSCRIPT = "text/javascript";<br />
private static String CHARSET_JSCRIPT = "UTF-8";<br />
private String TASK_SEARCH = "tasks";<br />
private String CONTACT_SEARCH = "contacts";<br />
private String CALENDAR_SEARCH = "calendar";<br />
private String INFOSTORE_SEARCH = "infostore";<br />
<br />
public static void main(String[] args) {<br />
new Start(args);<br />
}<br />
<br />
private Start(String[] args) {<br />
<br />
if (args.length != 4) {<br />
LOG.info("Arguments needed: <host> <protocol> <username> <password>");<br />
LOG.info("Example: test.org https test@sp4.com test");<br />
exitApp();<br />
}<br />
<br />
host = args[0].trim();<br />
protocol = args[1].trim();<br />
username = args[2].trim();<br />
password = args[3].trim();<br />
<br />
if (protocol.equals("https")) {<br />
Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);<br />
Protocol.registerProtocol("https", easyhttps);<br />
}<br />
<br />
doLogin();<br />
<br />
try {<br />
<br />
// search all modules and fetch the id arrays<br />
doSearch();<br />
} catch (IOException ex) {<br />
LOG.error(ex);<br />
} catch (JSONException ex) {<br />
LOG.error("Error in process", ex);<br />
}<br />
<br />
<br />
}<br />
<br />
public String getSessionID() {<br />
return getSessionObject().getSessionid();<br />
}<br />
<br />
public SessionObject getSessionObject() {<br />
return so;<br />
}<br />
<br />
public String getUsername() {<br />
return username;<br />
}<br />
<br />
public String getPassword() {<br />
return password;<br />
}<br />
<br />
public String getHost() {<br />
return host;<br />
}<br />
<br />
private void doDeleteCreatedFolders(JSONArray rootfolders, String timestamp) throws JSONException, IOException {<br />
<br />
/* <br />
* In this method here we delete all folders <br />
* <br />
*/<br />
<br />
<br />
// loop through all root folders<br />
for (int i = 0; i < rootfolders.length(); i++) {<br />
<br />
// for each root/system folder , loop and delete its subfolders<br />
JSONObject subfolders_of_rootfolder_response = doGetSubFolders(rootfolders.getJSONArray(i).getInt(0));<br />
JSONArray subfolders_of_rootfolder = subfolders_of_rootfolder_response.getJSONArray("data"); <br />
for (int b = 0; b < subfolders_of_rootfolder.length(); b++) {<br />
JSONArray tmp_folder = subfolders_of_rootfolder.getJSONArray(b);<br />
if (!tmp_folder.getString(0).equalsIgnoreCase("default")) {<br />
LOG.debug("Deleting recursive all private folders with array: " + tmp_folder);<br />
deleteRecursiveFolder(tmp_folder);<br />
}<br />
}<br />
<br />
}<br />
<br />
<br />
<br />
}<br />
<br />
/**<br />
* This delete the subfolders of the given folder and the folder itself!<br />
* @param my_private_folder_array<br />
* @throws java.io.IOException<br />
* @throws org.json.JSONException<br />
*/<br />
private void deleteRecursiveFolder(JSONArray my_private_folder_array) throws IOException, JSONException {<br />
<br />
JSONObject my_private_subfolders_response = doGetSubFolders(my_private_folder_array.getInt(0));<br />
<br />
// only delete if subfolders exists<br />
//if (my_private_subfolders_response.length() > 0) {<br />
if (my_private_subfolders_response.getJSONArray("data").length() > 0) {<br />
<br />
LOG.debug(my_private_subfolders_response);<br />
<br />
JSONArray my_private_subfolders = my_private_subfolders_response.getJSONArray("data");<br />
<br />
String my_private_subfolders_timestamp = my_private_subfolders_response.getString("timestamp");<br />
<br />
//LOG.info("Private folders list: " +my_private_subfolders);<br />
for (int i = 0; i < my_private_subfolders.length(); i++) {<br />
JSONArray folder_data = my_private_subfolders.getJSONArray(i);<br />
LOG.debug("Deleting folder with ID " + folder_data.getInt(0) + " and parent ID " + folder_data.getInt(1) + " - Tstamp " + my_private_subfolders_timestamp);<br />
doDeleteFolder(folder_data.getInt(0), folder_data.getInt(1), my_private_subfolders_timestamp);<br />
}<br />
}<br />
<br />
<br />
/* Now delete the folder itself , which could contain the subfolders before!<br />
* We must "get" the folder data because we need the correct timestamp for deleting!<br />
*/<br />
JSONObject top_level_folder_data = doGetSingleFolder(my_private_folder_array.getInt(0));<br />
if(!my_private_folder_array.isNull(0) && !my_private_folder_array.isNull(1) && !top_level_folder_data.isNull("timestamp")){<br />
// execute delete<br />
doDeleteFolder(my_private_folder_array.getInt(0), my_private_folder_array.getInt(1), top_level_folder_data.getString("timestamp"));<br />
} <br />
<br />
<br />
<br />
}<br />
<br />
private void doDeleteFolder(int folder_id, int parent_id, String tstamp) {<br />
<br />
try {<br />
<br />
PutMethod deleteMethod = new PutMethod(getProtocol() + "://" + getHost() + "/ajax/folders?action=delete&timestamp=" + tstamp + "&session=" + getSessionObject().getSessionid());<br />
<br />
RequestEntity data = new StringRequestEntity("[" + folder_id + "]", CONTENT_TYPE_JSCRIPT, CHARSET_JSCRIPT);<br />
deleteMethod.setRequestEntity(data);<br />
getSessionObject().getOxClient().executeMethod(deleteMethod);<br />
<br />
JSONObject responseObject = ResponseTools.reponse2JsonObject(deleteMethod);<br />
<br />
LOG.debug("Delete folder response is: " + responseObject);<br />
<br />
} catch (Exception ex) {<br />
LOG.error("Error deleting folder with ID " + folder_id + " and parent ID " + parent_id, ex);<br />
}<br />
}<br />
<br />
private JSONObject doGetSubFolders(int parent_folder) throws IOException, JSONException {<br />
<br />
// 1 = id<br />
// 20 = Object ID of the parent folder.<br />
// 300 = Name of this folder.<br />
// 301 = Name of the module which implements this folder.<br />
// 302 = type // 1 private<br />
//2 public<br />
//3 shared<br />
// 5 system folder<br />
// 304 = true if this folder has subfolders.<br />
// 305 = own_rights<br />
<br />
try {<br />
<br />
<br />
GetMethod folder_search = new GetMethod(getProtocol() + "://" + getHost() + "/ajax/folders?action=list&columns=1,20,300,301,302,304,305&parent=" + parent_folder + "&session=" + getSessionObject().getSessionid());<br />
<br />
<br />
getSessionObject().getOxClient().executeMethod(folder_search);<br />
<br />
JSONObject responseObject = ResponseTools.reponse2JsonObject(folder_search);<br />
<br />
return responseObject;<br />
<br />
} catch (IOException ex) {<br />
LOG.error("Generic IO error while searching folders", ex);<br />
throw ex;<br />
} catch (JSONException ex) {<br />
LOG.error("JSON error while searching folders", ex);<br />
throw ex;<br />
}<br />
}<br />
<br />
private JSONObject doGetSingleFolder(int folder_id) throws IOException, JSONException {<br />
<br />
// 1 = id<br />
// 20 = Object ID of the parent folder.<br />
// 300 = Name of this folder.<br />
// 301 = Name of the module which implements this folder.<br />
// 302 = type // 1 private<br />
//2 public<br />
//3 shared<br />
// 5 system folder<br />
// 304 = true if this folder has subfolders.<br />
// 305 = own_rights<br />
<br />
try {<br />
<br />
<br />
GetMethod folder_search = new GetMethod(getProtocol() + "://" + getHost() + "/ajax/folders?action=get&id=" + folder_id + "&columns=1,20,300,301,302,304,305&session=" + getSessionObject().getSessionid());<br />
<br />
<br />
getSessionObject().getOxClient().executeMethod(folder_search);<br />
<br />
JSONObject responseObject = ResponseTools.reponse2JsonObject(folder_search);<br />
<br />
return responseObject;<br />
<br />
} catch (IOException ex) {<br />
LOG.error("Generic IO error while searching folders", ex);<br />
throw ex;<br />
} catch (JSONException ex) {<br />
LOG.error("JSON error while searching folders", ex);<br />
throw ex;<br />
}<br />
}<br />
<br />
private void doLogin() {<br />
<br />
LOG.info("Using " + getProtocol() + "://" + getUsername() + "@" + getHost() + " for connections!");<br />
<br />
HttpClient client = new HttpClient();<br />
<br />
<br />
PostMethod login_post = new PostMethod(getProtocol() + "://" + getHost() + "/ajax/login?action=login");<br />
login_post.addParameter("name", getUsername());<br />
login_post.addParameter("password", getPassword());<br />
<br />
try {<br />
<br />
client.executeMethod(login_post);<br />
<br />
JSONObject loginObject = ResponseTools.reponse2JsonObject(login_post);<br />
<br />
if (loginObject.has("session")) {<br />
so = new SessionObject();<br />
getSessionObject().setCookies(client.getState().getCookies());<br />
getSessionObject().setSessionid((String) loginObject.get("session"));<br />
getSessionObject().setOxClient(client);<br />
LOG.info("Login successfull!");<br />
} else {<br />
String errmsg = (String) loginObject.get("error");<br />
LOG.info("Error login into system!\n" + errmsg);<br />
exitApp();<br />
}<br />
} catch (Exception exp) {<br />
LOG.error("LOGIN ERROR", exp);<br />
} finally {<br />
login_post.releaseConnection();<br />
}<br />
}<br />
<br />
private void doSearch() throws JSONException, IOException {<br />
<br />
LOG.info("Starting search for objects...");<br />
<br />
JSONObject task_objects = doSearchInModule(TASK_SEARCH);<br />
JSONObject contact_objects = doSearchInModule(CONTACT_SEARCH);<br />
JSONObject calendar_objects = doSearchInModule(CALENDAR_SEARCH);<br />
JSONObject store_objects = doSearchInModule(INFOSTORE_SEARCH);<br />
<br />
LOG.info("Search done!");<br />
<br />
//LOG.info("Found " + task_objects.getJSONArray("data").length() + " task items");<br />
//LOG.info("Found " + contact_objects.getJSONArray("data").length() + " contact items");<br />
//LOG.info("Found " + calendar_objects.getJSONArray("data").length() + " calendar items");<br />
//LOG.info("Found " + store_objects.getJSONArray("data").length() + " infostore items");<br />
<br />
LOG.info("Starting delete process...");<br />
<br />
doDeleteMultiple(task_objects, contact_objects, calendar_objects, store_objects);<br />
<br />
LOG.info("Deleting Objects done!");<br />
<br />
<br />
LOG.info("Starting delete process for folders...");<br />
<br />
// search all folders and delete them<br />
JSONObject rootfolders_response = doGetRootFolders();<br />
<br />
JSONArray rootfolders = rootfolders_response.getJSONArray("data");<br />
<br />
doDeleteCreatedFolders(rootfolders, rootfolders_response.getString("timestamp"));<br />
<br />
LOG.info("Deleting folders done!");<br />
<br />
}<br />
<br />
private JSONArray buildDeleteArray(JSONObject module_objects, String MODULE) throws JSONException {<br />
<br />
JSONArray dat_array = new JSONArray();<br />
<br />
LOG.debug("Building delete array from json object: " + module_objects);<br />
<br />
if (module_objects.has("data") && module_objects.has("timestamp")) {<br />
<br />
String tstamp = module_objects.getString("timestamp");<br />
JSONArray srv_data_ids = module_objects.getJSONArray("data");<br />
for (int i = 0; i < srv_data_ids.length(); i++) {<br />
JSONArray ids = (JSONArray) srv_data_ids.get(i);<br />
JSONObject js = new JSONObject();<br />
js.put("module", MODULE);<br />
js.put("timestamp", tstamp);<br />
js.put("action", "delete");<br />
<br />
<br />
<br />
JSONObject del_ids = new JSONObject();<br />
del_ids.put("id", ids.getInt(0));<br />
del_ids.put("folder", ids.getInt(1));<br />
<br />
// workaround because infostore expects an array with a 1 json object which contains the ids<br />
if (MODULE.equals(INFOSTORE_SEARCH)) {<br />
// send array with object<br />
JSONArray tmp = new JSONArray();<br />
tmp.put(del_ids);<br />
js.put("data", tmp);<br />
} else {<br />
// send normal id <br />
js.put("data", del_ids);<br />
}<br />
dat_array.put(js);<br />
}<br />
}<br />
<br />
<br />
return dat_array;<br />
}<br />
<br />
private void doDeleteMultiple(JSONObject task_objects, JSONObject contact_objects, JSONObject calendar_objects, JSONObject store_objects) throws JSONException {<br />
<br />
LOG.info("Deleting tasks...");<br />
fireDeleteMultiple(buildDeleteArray(task_objects, TASK_SEARCH));<br />
LOG.info("Deleting contacts...");<br />
fireDeleteMultiple(buildDeleteArray(contact_objects, CONTACT_SEARCH));<br />
LOG.info("Deleting appointments...");<br />
fireDeleteMultiple(buildDeleteArray(calendar_objects, CALENDAR_SEARCH));<br />
LOG.info("Deleting infostore objects...");<br />
fireDeleteMultiple(buildDeleteArray(store_objects, INFOSTORE_SEARCH));<br />
}<br />
<br />
private JSONObject doGetRootFolders() throws IOException, JSONException {<br />
<br />
// 1 = id<br />
// 20 = Object ID of the parent folder.<br />
// 300 = Name of this folder.<br />
// 301 = Name of the module which implements this folder.<br />
// 302 = type // 1 private<br />
//2 public<br />
//3 shared<br />
// 5 system folder<br />
// 304 = true if this folder has subfolders.<br />
// 305 = own_rights<br />
<br />
try {<br />
<br />
<br />
GetMethod folder_search = new GetMethod(getProtocol() + "://" + getHost() + "/ajax/folders?action=root&columns=1,20,300,301,302,304,305&session=" + getSessionObject().getSessionid());<br />
<br />
<br />
getSessionObject().getOxClient().executeMethod(folder_search);<br />
<br />
return ResponseTools.reponse2JsonObject(folder_search);<br />
<br />
} catch (IOException ex) {<br />
LOG.error("Generic IO error while searching folders", ex);<br />
throw ex;<br />
} catch (JSONException ex) {<br />
LOG.error("JSON error while searching folders", ex);<br />
throw ex;<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
}<br />
<br />
private void fireDeleteMultiple(JSONArray del_data_array) {<br />
<br />
try {<br />
<br />
//LOG.info("Sending delete array: " + del_data_array);<br />
<br />
PutMethod deleteMethod = new PutMethod(getProtocol() + "://" + getHost() + "/ajax/multiple?continue=true&session=" + getSessionObject().getSessionid());<br />
<br />
RequestEntity data = new StringRequestEntity(del_data_array.toString(), CONTENT_TYPE_JSCRIPT, CHARSET_JSCRIPT);<br />
deleteMethod.setRequestEntity(data);<br />
getSessionObject().getOxClient().executeMethod(deleteMethod);<br />
<br />
JSONArray responseObject = ResponseTools.reponse2JsonArray(deleteMethod);<br />
<br />
//LOG.info(responseObject);<br />
<br />
} catch (Exception ex) {<br />
LOG.error("Error deleting items", ex);<br />
}<br />
}<br />
<br />
private JSONObject doSearchInModule(String MODULE) {<br />
<br />
// FETCH ALL OBJECT IDS FROM ALL FOLDERS <br />
// EXCLUDING PUBLIC ADRESSBOOK WHICH HAS ID 6 <br />
PutMethod searchMethod = new PutMethod(getProtocol() + "://" + getHost() + "/ajax/" + MODULE + "?action=search&columns=1,20&session=" + getSessionObject().getSessionid());<br />
<br />
try {<br />
<br />
RequestEntity data = new StringRequestEntity("{\"pattern\":\"*\"}", CONTENT_TYPE_JSCRIPT, CHARSET_JSCRIPT);<br />
searchMethod.setRequestEntity(data);<br />
getSessionObject().getOxClient().executeMethod(searchMethod);<br />
<br />
return ResponseTools.reponse2JsonObject(searchMethod);<br />
} catch (Exception ex) {<br />
LOG.error("Error searching " + MODULE, ex);<br />
return null;<br />
}<br />
}<br />
<br />
private void exitApp() {<br />
System.exit(1);<br />
}<br />
<br />
public String getProtocol() {<br />
return protocol;<br />
}<br />
}<br />
</pre></div>
Cutmasta