001    /*
002     * Copyright 2011 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     */
016    package org.kuali.kfs.module.bc.businessobject;
017    
018    import java.util.LinkedHashMap;
019    import java.util.SortedSet;
020    
021    import org.kuali.kfs.module.bc.BCConstants.LockStatus;
022    import org.kuali.rice.kns.bo.TransientBusinessObjectBase;
023    
024    /**
025     * This class defines a BudgetConstructionLockStatus object. This object is used by many of the methods in the Budget module's
026     * LockService as a mechanism to pass status information associated with the various types of locks. LockStatus uses enum values
027     * SUCCESS, BY_OTHER, NO_DOOR, OPTIMISTIC_EX, FLOCK_FOUND LockStatus.BY_OTHER usually means one of the *LockOwner attributes is set
028     * with the uid associated with the lock. LockStatus.FLOCK_FOUND usually means the set of fundingLocks is also defined. See the
029     * LockService methods JavaDoc for more details.
030     */
031    public class BudgetConstructionLockStatus extends TransientBusinessObjectBase{
032    
033        private LockStatus lockStatus;
034        private String accountLockOwner;
035        private String positionLockOwner;
036        private String transactionLockOwner;
037        private SortedSet<BudgetConstructionFundingLock> fundingLocks;
038        private BudgetConstructionHeader budgetConstructionHeader;
039    
040        /**
041         * Constructs a BudgetConstructionLockStatus object.
042         */
043        public BudgetConstructionLockStatus() {
044            lockStatus = LockStatus.NO_DOOR;
045            accountLockOwner = null;
046            positionLockOwner = null;
047            fundingLocks = null;
048            transactionLockOwner = null;
049            budgetConstructionHeader = null;
050        }
051    
052        /**
053         * This gets the accountLockOwner attribute
054         * 
055         * @return accountLockOwner
056         */
057        public String getAccountLockOwner() {
058            return accountLockOwner;
059        }
060    
061        /**
062         * This sets the accountLockOwner attribute
063         * 
064         * @param accountLockOwner
065         */
066        public void setAccountLockOwner(String accountLockOwner) {
067            this.accountLockOwner = accountLockOwner;
068        }
069    
070        /**
071         * This gets the lockStatus attribute
072         * 
073         * @return lockStatus
074         */
075        public LockStatus getLockStatus() {
076            return lockStatus;
077        }
078    
079        /**
080         * This sets the lockStatus attribute
081         * 
082         * @param lockStatus
083         */
084        public void setLockStatus(LockStatus lockStatus) {
085            this.lockStatus = lockStatus;
086        }
087    
088        /**
089         * This gets the positionLockOwner attribute
090         * 
091         * @return positionLockOwner
092         */
093        public String getPositionLockOwner() {
094            return positionLockOwner;
095        }
096    
097        /**
098         * This gets the positionLockOwner attribute
099         * 
100         * @param positionLockOwner
101         */
102        public void setPositionLockOwner(String positionLockOwner) {
103            this.positionLockOwner = positionLockOwner;
104        }
105    
106        /**
107         * This gets the fundingLocks attribute
108         * 
109         * @return fundingLocks
110         */
111        public SortedSet<BudgetConstructionFundingLock> getFundingLocks() {
112            return fundingLocks;
113        }
114    
115        /**
116         * This sets the fundingLocks attribute
117         * 
118         * @param fundingLocks
119         */
120        public void setFundingLocks(SortedSet<BudgetConstructionFundingLock> fundingLocks) {
121            this.fundingLocks = fundingLocks;
122        }
123    
124        /**
125         * This gets the transactionLockOwner attribute
126         * 
127         * @return ansactionLockOwner
128         */
129        public String getTransactionLockOwner() {
130            return transactionLockOwner;
131        }
132    
133        /**
134         * This gets the transactionLockOwner attribute
135         * 
136         * @param transactionLockOwner
137         */
138        public void setTransactionLockOwner(String transactionLockOwner) {
139            this.transactionLockOwner = transactionLockOwner;
140        }
141    
142        /**
143         * Gets the budgetConstructionHeader attribute. 
144         * @return Returns the budgetConstructionHeader.
145         */
146        public BudgetConstructionHeader getBudgetConstructionHeader() {
147            return budgetConstructionHeader;
148        }
149    
150        /**
151         * Sets the budgetConstructionHeader attribute value.
152         * @param budgetConstructionHeader The budgetConstructionHeader to set.
153         */
154        public void setBudgetConstructionHeader(BudgetConstructionHeader budgetConstructionHeader) {
155            this.budgetConstructionHeader = budgetConstructionHeader;
156        }
157    
158        /**
159         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
160         */
161        @Override
162        protected LinkedHashMap toStringMapper() {
163            LinkedHashMap<String,Object> mapper = new LinkedHashMap<String,Object>();
164            
165            mapper.put("lockStatus", this.lockStatus);
166            mapper.put("accountLockOwner", this.accountLockOwner);
167            mapper.put("positionLockOwner", this.positionLockOwner);
168            mapper.put("transactionLockOwner", this.transactionLockOwner);
169            mapper.put("fundingLocks", this.fundingLocks);
170            mapper.put("budgetConstructionHeader", this.budgetConstructionHeader);
171    
172            return mapper;
173        }
174    }