1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.document;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.kuali.ole.coa.businessobject.Account;
22 import org.kuali.ole.coa.businessobject.AccountGlobal;
23 import org.kuali.ole.coa.businessobject.AccountGlobalDetail;
24 import org.kuali.ole.sys.OLEConstants;
25 import org.kuali.ole.sys.document.FinancialSystemGlobalMaintainable;
26 import org.kuali.rice.krad.bo.PersistableBusinessObject;
27 import org.kuali.rice.krad.maintenance.MaintenanceLock;
28
29
30
31
32 public class AccountGlobalMaintainableImpl extends FinancialSystemGlobalMaintainable {
33
34
35
36
37
38
39 @Override
40 public List<MaintenanceLock> generateMaintenanceLocks() {
41 AccountGlobal accountGlobal = (AccountGlobal) getBusinessObject();
42 List<MaintenanceLock> maintenanceLocks = new ArrayList();
43
44 for (AccountGlobalDetail detail : accountGlobal.getAccountGlobalDetails()) {
45 MaintenanceLock maintenanceLock = new MaintenanceLock();
46 StringBuffer lockrep = new StringBuffer();
47
48 lockrep.append(Account.class.getName() + OLEConstants.Maintenance.AFTER_CLASS_DELIM);
49 lockrep.append("chartOfAccountsCode" + OLEConstants.Maintenance.AFTER_FIELDNAME_DELIM);
50 lockrep.append(detail.getChartOfAccountsCode() + OLEConstants.Maintenance.AFTER_VALUE_DELIM);
51 lockrep.append("accountNumber" + OLEConstants.Maintenance.AFTER_FIELDNAME_DELIM);
52 lockrep.append(detail.getAccountNumber());
53
54 maintenanceLock.setDocumentNumber(accountGlobal.getDocumentNumber());
55 maintenanceLock.setLockingRepresentation(lockrep.toString());
56 maintenanceLocks.add(maintenanceLock);
57 }
58 return maintenanceLocks;
59 }
60
61 @Override
62 public Class<? extends PersistableBusinessObject> getPrimaryEditedBusinessObjectClass() {
63 return Account.class;
64 }
65 }