001/* 002 * Copyright 2012 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.ole.sys.batch; 017 018import java.util.Date; 019 020import org.apache.commons.lang.StringUtils; 021import org.kuali.ole.sys.OLEConstants; 022import org.kuali.ole.sys.batch.service.LockModuleService; 023 024/*** 025 * The step to lock or unlock module for the batch 026 */ 027public class LockModuleStep extends AbstractStep{ 028 029 private boolean lockModule; 030 private LockModuleService lockModuleService; 031 private String namespaceCode; 032 033 public boolean execute(String jobName, Date jobRunDate) 034 throws InterruptedException { 035 String openStr = "lock"; 036 if(!lockModule) { 037 openStr = "unlock"; 038 } 039 lockModuleService.lockModule(namespaceCode, lockModule); 040 return true; 041 } 042 043 /** 044 * 045 * @return true if module to be locked , otherwise false 046 */ 047 public boolean isLockModule() { 048 return lockModule; 049 } 050 051 /** 052 * set to true if module to be locked, otheriwse false 053 * @param lockModule 054 */ 055 public void setLockModule(boolean lockModule) { 056 this.lockModule = lockModule; 057 } 058 059 public LockModuleService getLockModuleService() { 060 return lockModuleService; 061 } 062 063 public void setLockModuleService(LockModuleService lockModuleService) { 064 this.lockModuleService = lockModuleService; 065 } 066 067 public String getNamespaceCode() { 068 return namespaceCode; 069 } 070 071 public void setNamespaceCode(String namespaceCode) { 072 this.namespaceCode = namespaceCode; 073 } 074 075}