View Javadoc
1   /*
2    * Copyright 2012 The Kuali Foundation.
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.sys.batch;
17  
18  import java.util.Date;
19  
20  import org.apache.commons.lang.StringUtils;
21  import org.kuali.ole.sys.OLEConstants;
22  import org.kuali.ole.sys.batch.service.LockModuleService;
23  
24  /***
25   * The step to lock or unlock module for the batch  
26   */
27  public class LockModuleStep extends AbstractStep{
28     
29      private boolean lockModule;
30      private LockModuleService lockModuleService;
31      private String namespaceCode;
32      
33      public boolean execute(String jobName, Date jobRunDate)
34      throws InterruptedException {
35              String openStr = "lock";
36              if(!lockModule) {
37                  openStr = "unlock";
38              }
39              lockModuleService.lockModule(namespaceCode, lockModule);
40              return true;
41      }
42     
43      /**
44       * 
45       * @return true if module to be locked , otherwise false
46       */
47      public boolean isLockModule() {
48          return lockModule;
49      }
50  
51      /**
52       * set to true if module to be locked, otheriwse false
53       * @param lockModule
54       */
55      public void setLockModule(boolean lockModule) {
56          this.lockModule = lockModule;
57      }
58  
59      public LockModuleService getLockModuleService() {
60          return lockModuleService;
61      }
62  
63      public void setLockModuleService(LockModuleService lockModuleService) {
64          this.lockModuleService = lockModuleService;
65      }
66  
67      public String getNamespaceCode() {
68          return namespaceCode;
69      }
70  
71      public void setNamespaceCode(String namespaceCode) {
72          this.namespaceCode = namespaceCode;
73      }
74      
75  }