1 /*****************************************************************************
5 * Creation date 02.12.2012
8 * @copyright OPEN CASCADE 2012
9 *****************************************************************************/
11 package org.splat.simer;
13 import org.splat.exception.BusinessException;
14 import org.splat.log.AppLogger;
15 import org.splat.service.ScenarioService;
17 import com.opensymphony.xwork2.ActionSupport;
20 * Action to checkout a scenario.
22 * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
24 public class CheckoutAction extends ActionSupport {
27 * Serialization version id.
29 private static final long serialVersionUID = 6140789360802711199L;
34 protected static final AppLogger LOG = AppLogger
35 .getLogger(CheckoutAction.class);
38 * Result message. If the scenario is successfully checked out then result is "true", otherwise it contains the error message.
40 private String _result;
42 * Scenario id action parameter. Defines the scenario to check out.
44 private long _scenario;
46 * User login name action parameter. Defines the user who performs check out.
50 * Injected scenario service.
52 private ScenarioService _scenarioService;
55 * Mark the currently selected scenario as checked out. If the scenario is successfully checked out then result is "true", otherwise it
56 * contains the error message.
60 public String doCheckout() {
62 getScenarioService().checkout(getScenario(), getUser());
64 } catch (BusinessException e) {
65 setResult(e.getMessage());
67 if (LOG.isDebugEnabled()) {
68 LOG.debug("Can checkout scenario #" + getScenario()
69 + " by the user " + getUser() + ": " + getResult());
75 * Get the scenarioService.
77 * @return the scenarioService
79 public ScenarioService getScenarioService() {
80 return _scenarioService;
84 * Set the scenarioService.
86 * @param scenarioService
87 * the scenarioService to set
89 public void setScenarioService(final ScenarioService scenarioService) {
90 _scenarioService = scenarioService;
94 * Result message. If the scenario is successfully checked out then result is "true", otherwise it contains the error message.
98 public String getResult() {
108 public void setResult(final String result) {
115 * @return the scenario
117 public long getScenario() {
125 * the scenario to set
127 public void setScenario(final long scenario) {
128 _scenario = scenario;
136 public long getUser() {
146 public void setUser(final long user) {