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.rules;
17:
18: import org.kuali.core.document.MaintenanceDocument;
19: import org.kuali.module.chart.bo.OrganizationRoutingModel;
20: import org.kuali.module.chart.bo.OrganizationRoutingModelName;
21:
22: /**
23: *
24: * This class...
25: */
26: public class OrganizationRoutingModelPreRules extends
27: MaintenancePreRulesBase {
28: public OrganizationRoutingModelPreRules() {
29: }
30:
31: /**
32: * This performs pre rules checks
33: * <ul>
34: * <li>{@link OrganizationRoutingModelPreRules#copyKeyAttributesToModelDetail(OrganizationRoutingModelName)}</li>
35: * </ul>
36: * @see org.kuali.module.chart.rules.MaintenancePreRulesBase#doCustomPreRules(org.kuali.core.document.MaintenanceDocument)
37: */
38: @Override
39: protected boolean doCustomPreRules(MaintenanceDocument maintDoc) {
40: OrganizationRoutingModelName model = (OrganizationRoutingModelName) maintDoc
41: .getNewMaintainableObject().getBusinessObject();
42: copyKeyAttributesToModelDetail(model);
43: return true;
44: }
45:
46: /**
47: *
48: * This copies the chart of accounts, object code, and organization model name from the parent {@link OrganizationRoutingModelName} to the
49: * {@link OrganizationRoutingModel} objects
50: * @param model
51: */
52: protected void copyKeyAttributesToModelDetail(
53: OrganizationRoutingModelName model) {
54: for (OrganizationRoutingModel modelDelegate : model
55: .getOrganizationRoutingModel()) {
56: modelDelegate.setChartOfAccountsCode(model
57: .getChartOfAccountsCode());
58: modelDelegate.setOrganizationCode(model
59: .getOrganizationCode());
60: modelDelegate.setOrganizationRoutingModelName(model
61: .getOrganizationRoutingModelName());
62: }
63: }
64:
65: }
|