View Javadoc

1   /*
2    * DataSourceApplyAction.java
3    * Created on 27 Апрель 2006 г., 0:11
4    */
5   
6   package org.weda.store.actions;
7   
8   import org.weda.action.ActionContainer;
9   import org.weda.action.ActionState;
10  import org.weda.store.ObjectSource;
11  import org.weda.action.impl.AbstractAction;
12  import org.weda.action.impl.ActionStateImpl;
13  
14  /**
15   *
16   * @author Mikhail Titov
17   */
18  public class ObjectSourceApplyAction extends AbstractAction {
19      
20      public ActionState getActionState(ActionContainer targetObject) 
21          throws Exception 
22      {
23          ObjectSource ds = (ObjectSource)targetObject;
24          return new ActionStateImpl(ds.getMode()==ObjectSource.Mode.EDIT, true);
25      }
26  
27      public Object execute(ActionContainer targetObject) throws Exception {
28          ObjectSource ds = (ObjectSource)targetObject;
29          ds.applyModification();
30          return null;
31      }
32      
33  }