apache > lenya
 

Delete Trash

Introduction

We have to :

  • delete all the files in the trash directory
  • to reset the trash sitetree

Parameters

Required parameters:

  • the task id

Implementation

It is implemented in a sequence of usecases to get all needed parameters, and uses the task concept to execute some ant task

usecase

Delete Trash screen

URL :

{document-URL}?lenya.usecase=deleteTrash&lenya.step=showscreen

usecase sitemap:

            <map:match pattern="deleteTrash" type="usecase">
              <map:match pattern="showscreen" type="step">
              <map:generate src="content/admin/content/deleteTrash.xsp" type="serverpages"/>
              <map:transform src="xslt/admin/content/deleteTrash.xsl"/>
              <map:call resource="style-cms-page"/>
            </map:match>
          </map:match>
          

The required parameters are get in the serverpage. A form (build with the xslt transformation) sends then the parameters as request parameters with the new URL.

Delete Trash confirmation

URL :

{document-URL}?lenya.usecase=deleteTrash&lenya.step=deleteTrash&...{source parameters}

usecase sitemap:

          <map:match pattern="deleteTrash" type="usecase">
            <map:match pattern="deleteTrash" type="step">
              <map:act type="task">
                <map:redirect-to session="true" uri="{request:requestURI}"/>
              </map:act>
            </map:match>
          </map:match>
        

The action org.apache.lenya.cms.cocoon.acting.TaskAction calls the execution of the ant task.

Ant Task

The ant target deleteTrash is in the publication :

{publication}/config/tasks/targets.xml

More about ant task, see the documentation Ant Task and the Javadoc