View Javadoc

1   package org.astrogrid.portal.myspace.acting.framework;
2   
3   import java.util.Map;
4   
5   import org.astrogrid.store.Agsl;
6   
7   /***
8    * Move a MySpace entry.
9    * 
10   * @author peter.shillan
11   */
12  public class MoveHandler extends AbstractMySpaceHandler {
13    /***
14     * @see org.astrogrid.portal.myspace.acting.framework.AbstractMySpaceHandler#AbstractMySpaceHandler(org.astrogrid.portal.myspace.acting.framework.ContextWrapper)
15     * @param context
16     */
17    public MoveHandler(ContextWrapper context) {
18      super(context);
19    }
20  
21    /***
22     * Move a MySpace entry.
23     * @see org.astrogrid.portal.myspace.acting.framework.AbstractMySpaceHandler#executeTemplateMethod(java.util.Map)
24     */
25    protected void executeTemplateMethod(Map results) throws Throwable {
26      String src = context.getParameter(MySpaceHandler.PARAM_SRC);
27      String dest = context.getParameter(MySpaceHandler.PARAM_DEST);
28      
29      if(src != null && src.length() > 0 &&
30          dest != null && dest.length() > 0) {
31        context.getStoreClient().move(src, new Agsl(context.getAgsl(), dest));
32        context.setMySpaceCache( null ) ;
33      }
34      else {
35        throw new MySpaceHandlerException("invalid source or destination");
36      }
37    }
38  }