01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.chart.maintenance;
17:
18: import java.util.ArrayList;
19: import java.util.List;
20:
21: import org.kuali.core.document.MaintenanceLock;
22: import org.kuali.core.maintenance.KualiGlobalMaintainableImpl;
23: import org.kuali.kfs.KFSConstants;
24: import org.kuali.module.chart.bo.AccountGlobalDetail;
25: import org.kuali.module.chart.bo.SubObjCd;
26: import org.kuali.module.chart.bo.SubObjCdGlobal;
27: import org.kuali.module.chart.bo.SubObjCdGlobalDetail;
28:
29: /**
30: * This class provides some specific functionality for the {@link SubObjCdGlobal} maintenance document generateMaintenanceLocks -
31: * generates maintenance locks on {@link SubObjCd}
32: */
33: public class SubObjCdGlobalMaintainableImpl extends
34: KualiGlobalMaintainableImpl {
35:
36: /**
37: * This generates maintenance locks on {@link SubObjCd}
38: *
39: * @see org.kuali.core.maintenance.Maintainable#generateMaintenanceLocks()
40: */
41: @Override
42: public List<MaintenanceLock> generateMaintenanceLocks() {
43: // create locking rep for each combination of account and object code
44: List<MaintenanceLock> maintenanceLocks = new ArrayList();
45: SubObjCdGlobal subObjCdGlobal = (SubObjCdGlobal) getBusinessObject();
46:
47: for (AccountGlobalDetail accountGlobalDetail : subObjCdGlobal
48: .getAccountGlobalDetails()) {
49: for (SubObjCdGlobalDetail subObjCdGlobalDetail : subObjCdGlobal
50: .getSubObjCdGlobalDetails()) {
51: MaintenanceLock maintenanceLock = new MaintenanceLock();
52: maintenanceLock.setDocumentNumber(subObjCdGlobal
53: .getDocumentNumber());
54:
55: StringBuffer lockrep = new StringBuffer();
56: lockrep.append(SubObjCd.class.getName()
57: + KFSConstants.Maintenance.AFTER_CLASS_DELIM);
58: lockrep
59: .append("fiscalYear"
60: + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
61: lockrep.append(subObjCdGlobalDetail
62: .getUniversityFiscalYear()
63: + KFSConstants.Maintenance.AFTER_VALUE_DELIM);
64: lockrep
65: .append("chartOfAccountsCode"
66: + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
67: lockrep.append(accountGlobalDetail
68: .getChartOfAccountsCode()
69: + KFSConstants.Maintenance.AFTER_VALUE_DELIM);
70: lockrep
71: .append("accountNumber"
72: + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
73: lockrep.append(accountGlobalDetail.getAccountNumber()
74: + KFSConstants.Maintenance.AFTER_VALUE_DELIM);
75: lockrep
76: .append("financialObjectCode"
77: + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
78: lockrep.append(subObjCdGlobalDetail
79: .getFinancialObjectCode()
80: + KFSConstants.Maintenance.AFTER_VALUE_DELIM);
81: lockrep
82: .append("financialSubObjectCode"
83: + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
84: lockrep.append(subObjCdGlobal
85: .getFinancialSubObjectCode());
86:
87: maintenanceLock.setLockingRepresentation(lockrep
88: .toString());
89: maintenanceLocks.add(maintenanceLock);
90: }
91: }
92: return maintenanceLocks;
93: }
94: }
|