1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.document.validation.impl;
17
18 import java.util.ArrayList;
19 import java.util.Collection;
20 import java.util.HashMap;
21 import java.util.List;
22 import java.util.Map;
23 import java.util.Properties;
24 import java.util.Set;
25
26 import org.apache.commons.lang.StringUtils;
27 import org.kuali.ole.coa.businessobject.IndirectCostRecoveryExclusionAccount;
28 import org.kuali.ole.coa.businessobject.ObjectCode;
29 import org.kuali.ole.coa.businessobject.ObjectCodeGlobal;
30 import org.kuali.ole.coa.businessobject.ObjectCodeGlobalDetail;
31 import org.kuali.ole.coa.businessobject.ObjectLevel;
32 import org.kuali.ole.coa.businessobject.OffsetDefinition;
33 import org.kuali.ole.coa.service.ObjectCodeService;
34 import org.kuali.ole.coa.service.ObjectLevelService;
35 import org.kuali.ole.sys.OLEConstants;
36 import org.kuali.ole.sys.OLEKeyConstants;
37 import org.kuali.ole.sys.OLEPropertyConstants;
38 import org.kuali.ole.sys.context.SpringContext;
39 import org.kuali.ole.sys.service.UniversityDateService;
40 import org.kuali.rice.kns.document.MaintenanceDocument;
41 import org.kuali.rice.kns.maintenance.Maintainable;
42 import org.kuali.rice.kns.maintenance.rules.MaintenanceDocumentRuleBase;
43 import org.kuali.rice.krad.bo.BusinessObject;
44 import org.kuali.rice.krad.bo.GlobalBusinessObject;
45 import org.kuali.rice.krad.bo.PersistableBusinessObject;
46 import org.kuali.rice.krad.datadictionary.InactivationBlockingMetadata;
47 import org.kuali.rice.krad.service.BusinessObjectService;
48 import org.kuali.rice.krad.service.InactivationBlockingDetectionService;
49 import org.kuali.rice.krad.util.GlobalVariables;
50 import org.kuali.rice.krad.util.KRADConstants;
51 import org.kuali.rice.krad.util.ObjectUtils;
52 import org.kuali.rice.krad.util.UrlFactory;
53
54
55
56
57 public class ObjectCodeGlobalRule extends MaintenanceDocumentRuleBase {
58 protected ObjectCodeGlobal objectCodeGlobal;
59 protected ObjectCodeService objectCodeService;
60 protected ObjectLevelService objectLevelService;
61
62 public ObjectCodeGlobalRule() {
63 super();
64 setObjectCodeService(SpringContext.getBean(ObjectCodeService.class));
65 setObjectLevelService(SpringContext.getBean(ObjectLevelService.class));
66 }
67
68
69
70
71
72
73
74
75
76 @Override
77 public void setupConvenienceObjects() {
78
79
80
81 objectCodeGlobal = (ObjectCodeGlobal) super.getNewBo();
82
83
84 for (ObjectCodeGlobalDetail objectCodeGlobalDetail : objectCodeGlobal.getObjectCodeGlobalDetails()) {
85 objectCodeGlobalDetail.refreshNonUpdateableReferences();
86 }
87 }
88
89
90
91
92
93
94
95
96
97 @Override
98 protected boolean processCustomApproveDocumentBusinessRules(MaintenanceDocument document) {
99 boolean success = true;
100 setupConvenienceObjects();
101
102 success &= checkSimpleRulesAllLines();
103 return success;
104 }
105
106
107
108
109
110
111
112
113
114 @Override
115 protected boolean processCustomRouteDocumentBusinessRules(MaintenanceDocument document) {
116 boolean success = true;
117 setupConvenienceObjects();
118
119 success &= checkSimpleRulesAllLines();
120 return success;
121 }
122
123
124 @Override
125 protected boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument) {
126 boolean success = true;
127 if (!objectCodeGlobal.isFinancialObjectActiveIndicator()) {
128
129 Collection<? extends ObjectCodeGlobalDetail> objectCodeGlobalDetails = objectCodeGlobal.getObjectCodeGlobalDetails();
130 int i = 0;
131 for ( ObjectCodeGlobalDetail objectCodeGlobalDetail : objectCodeGlobalDetails ) {
132
133 ObjectCode objectCode = objectCodeService.getByPrimaryId(objectCodeGlobalDetail.getUniversityFiscalYear(), objectCodeGlobalDetail.getChartOfAccountsCode(), objectCodeGlobal.getFinancialObjectCode());
134 if (objectCode != null) {
135 if (objectCode.isActive()) {
136
137 success &= processInactivationBlockChecking(maintenanceDocument.getNewMaintainableObject(), objectCode, i);
138 }
139 }
140 i++;
141 }
142 }
143 return success;
144 }
145
146 protected boolean processInactivationBlockChecking(Maintainable maintainable, ObjectCode objectCode, int index) {
147 Set<InactivationBlockingMetadata> inactivationBlockingMetadatas = ddService.getAllInactivationBlockingDefinitions(ObjectCode.class);
148 for (InactivationBlockingMetadata inactivationBlockingMetadata : inactivationBlockingMetadatas) {
149 String inactivationBlockingDetectionServiceBeanName = inactivationBlockingMetadata.getInactivationBlockingDetectionServiceBeanName();
150 InactivationBlockingDetectionService inactivationBlockingDetectionService;
151 if (StringUtils.isBlank(inactivationBlockingDetectionServiceBeanName)) {
152 inactivationBlockingDetectionService = SpringContext.getBean(InactivationBlockingDetectionService.class);
153 } else {
154 inactivationBlockingDetectionService = SpringContext.getBean(InactivationBlockingDetectionService.class, inactivationBlockingDetectionServiceBeanName);
155 }
156
157 Collection<BusinessObject> blockingBusinessObjects = inactivationBlockingDetectionService.listAllBlockerRecords(objectCode, inactivationBlockingMetadata);
158 blockingBusinessObjects = addAdditionalBlockingBusinessObjects(blockingBusinessObjects, objectCode);
159
160 if (blockingBusinessObjects != null && !blockingBusinessObjects.isEmpty()) {
161 final List<PersistableBusinessObject> persistingChanges = ((GlobalBusinessObject)maintainable.getBusinessObject()).generateGlobalChangesToPersist();
162 if (!isOnlyPersistingChangesInBlockingBusinessObjects(blockingBusinessObjects, persistingChanges)) {
163 putInactivationBlockingErrorOnPage(objectCode, inactivationBlockingMetadata, index);
164 return false;
165 }
166 }
167 }
168 return true;
169 }
170
171 protected void putInactivationBlockingErrorOnPage(ObjectCode objectCode, InactivationBlockingMetadata inactivationBlockingMetadata, int index) {
172 String objectCodeSummaryString = objectCode.getUniversityFiscalYear() + " - " + objectCode.getChartOfAccountsCode() + " - " + objectCode.getFinancialObjectCode();
173
174 Properties parameters = new Properties();
175 parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, inactivationBlockingMetadata.getBlockedBusinessObjectClass().getName());
176 parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.METHOD_DISPLAY_ALL_INACTIVATION_BLOCKERS);
177 parameters.put(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, objectCode.getUniversityFiscalYear().toString());
178 parameters.put(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, objectCode.getChartOfAccountsCode());
179 parameters.put(OLEPropertyConstants.FINANCIAL_OBJECT_CODE, objectCode.getFinancialObjectCode());
180 String blockingUrl = UrlFactory.parameterizeUrl(KRADConstants.DISPLAY_ALL_INACTIVATION_BLOCKERS_ACTION, parameters);
181
182 String errorPropertyPath = OLEConstants.MAINTENANCE_NEW_MAINTAINABLE + OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "[" + index + "]." + OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE;
183
184
185 GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(errorPropertyPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_INACTIVATION_BLOCKING, objectCodeSummaryString, blockingUrl);
186 }
187
188
189
190
191
192
193
194 protected boolean isOnlyPersistingChangesInBlockingBusinessObjects(Collection<BusinessObject> blockingBusinessObjects, List<PersistableBusinessObject> persistingChanges) {
195 for (BusinessObject bo : blockingBusinessObjects) {
196 if (bo instanceof ObjectCode) {
197 if (!isObjectCodeInPersistingChanges(persistingChanges, (ObjectCode)bo)) {
198 return false;
199 }
200 } else {
201 return false;
202 }
203 }
204 return true;
205 }
206
207
208
209
210
211
212
213 protected boolean isObjectCodeInPersistingChanges(List<PersistableBusinessObject> persistingChanges, ObjectCode objectCode) {
214 for (PersistableBusinessObject persistingObjectCodeAsObject : persistingChanges) {
215 if (isEqualObjectCode(objectCode, (ObjectCode)persistingObjectCodeAsObject)) {
216 return true;
217 }
218 }
219 return false;
220 }
221
222
223
224
225
226
227
228 protected boolean isEqualObjectCode(ObjectCode castor, ObjectCode pollux) {
229 return org.springframework.util.ObjectUtils.nullSafeEquals(castor.getUniversityFiscalYear(), pollux.getUniversityFiscalYear())
230 && org.springframework.util.ObjectUtils.nullSafeEquals(castor.getChartOfAccountsCode(), pollux.getChartOfAccountsCode())
231 && org.springframework.util.ObjectUtils.nullSafeEquals(castor.getFinancialObjectCode(), pollux.getFinancialObjectCode());
232 }
233
234
235
236
237
238
239
240 protected Collection<BusinessObject> addAdditionalBlockingBusinessObjects(Collection<BusinessObject> blockingBusinessObjects, ObjectCode objectCode) {
241 List<BusinessObject> additionalBlockingObjects = new ArrayList<BusinessObject>();
242 retrieveBlockingOffsetDefinitions(objectCode, additionalBlockingObjects);
243 retrieveBlockingIndirectCostRecoveryExclusionAccounts(objectCode, additionalBlockingObjects);
244 if (!additionalBlockingObjects.isEmpty()) {
245 additionalBlockingObjects.addAll(blockingBusinessObjects);
246 return additionalBlockingObjects;
247 }
248 return blockingBusinessObjects;
249 }
250
251
252
253
254
255
256 protected void retrieveBlockingOffsetDefinitions(ObjectCode objectCode, List<BusinessObject> additionalBlockingObjects) {
257 final BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
258
259 Map<String, Object> keys = new HashMap<String, Object>();
260 keys.put("universityFiscalYear", objectCode.getUniversityFiscalYear());
261 keys.put("chartOfAccountsCode", objectCode.getChartOfAccountsCode());
262 keys.put("financialObjectCode", objectCode.getFinancialObjectCode());
263
264 Collection<OffsetDefinition> offsetDefinitions = businessObjectService.findMatching(OffsetDefinition.class, keys);
265 if (offsetDefinitions != null && !offsetDefinitions.isEmpty()) {
266 additionalBlockingObjects.addAll(offsetDefinitions);
267 }
268 }
269
270
271
272
273
274
275 protected void retrieveBlockingIndirectCostRecoveryExclusionAccounts(ObjectCode objectCode, List<BusinessObject> additionalBlockingObjects) {
276 final UniversityDateService universityDateService = SpringContext.getBean(UniversityDateService.class);
277 if (objectCode.getUniversityFiscalYear() != null && objectCode.getUniversityFiscalYear().equals(universityDateService.getCurrentFiscalYear())) {
278 final BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
279
280 Map<String, Object> keys = new HashMap<String, Object>();
281 keys.put("financialObjectChartOfAccountCode", objectCode.getChartOfAccountsCode());
282 keys.put("financialObjectCode", objectCode.getFinancialObjectCode());
283
284 Collection<IndirectCostRecoveryExclusionAccount> icrExclusionAccounts = businessObjectService.findMatching(IndirectCostRecoveryExclusionAccount.class, keys);
285 if (icrExclusionAccounts != null && !icrExclusionAccounts.isEmpty()) {
286 additionalBlockingObjects.addAll(icrExclusionAccounts);
287 }
288 }
289 }
290
291
292
293
294
295
296
297
298
299 @Override
300 protected boolean processCustomSaveDocumentBusinessRules(MaintenanceDocument document) {
301 setupConvenienceObjects();
302
303 checkSimpleRulesAllLines();
304
305 return true;
306 }
307
308
309
310
311
312
313
314
315
316
317 @Override
318 public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject bo) {
319 boolean success = true;
320 if (bo instanceof ObjectCodeGlobalDetail) {
321 ObjectCodeGlobalDetail detail = (ObjectCodeGlobalDetail) bo;
322 if (!checkEmptyValue(detail.getChartOfAccountsCode())) {
323
324 GlobalVariables.getMessageMap().putError("chartOfAccountsCode", OLEKeyConstants.ERROR_REQUIRED, "Chart of Accounts Code");
325 success &= false;
326 }
327 if (!checkEmptyValue(detail.getUniversityFiscalYear())) {
328
329 GlobalVariables.getMessageMap().putError("universityFiscalYear", OLEKeyConstants.ERROR_REQUIRED, "University Fiscal Year");
330 success &= false;
331 }
332 if (!checkUniqueIdentifiers(detail)) {
333
334 success &= false;
335 }
336
337 if (success) {
338 success &= checkObjectCodeDetails(detail);
339 }
340
341 }
342 return success;
343 }
344
345
346
347
348
349
350
351 protected boolean checkUniqueIdentifiers(ObjectCodeGlobalDetail dtl) {
352 boolean success = true;
353 return success;
354
355 }
356
357
358
359
360
361
362
363
364
365
366
367
368 public boolean checkObjectCodeDetails(ObjectCodeGlobalDetail dtl) {
369 boolean success = true;
370 int originalErrorCount = GlobalVariables.getMessageMap().getErrorCount();
371 getDictionaryValidationService().validateBusinessObject(dtl);
372 dtl.refreshNonUpdateableReferences();
373
374 success &= checkObjectLevelCode(objectCodeGlobal, dtl, 0, true);
375 success &= checkNextYearObjectCode(objectCodeGlobal, dtl, 0, true);
376 success &= checkReportsToObjectCode(objectCodeGlobal, dtl, 0, true);
377 success &= GlobalVariables.getMessageMap().getErrorCount() == originalErrorCount;
378
379 return success;
380 }
381
382
383
384
385
386
387
388
389 protected boolean checkReportsToObjectCode(ObjectCodeGlobal objectCodeGlobal, ObjectCodeGlobalDetail dtl, int lineNum, boolean add) {
390 boolean success = true;
391 String errorPath = OLEConstants.EMPTY_STRING;
392 if (checkEmptyValue(objectCodeGlobal.getReportsToFinancialObjectCode())) {
393
394 String reportsToObjectCode = objectCodeGlobal.getReportsToFinancialObjectCode();
395 String reportsToChartCode = dtl.getChartOfAccounts().getReportsToChartOfAccountsCode();
396 Integer fiscalYear = dtl.getUniversityFiscalYear();
397
398
399 ObjectCode objCode = objectCodeService.getByPrimaryId(fiscalYear, reportsToChartCode, reportsToObjectCode);
400 if (ObjectUtils.isNull(objCode)) {
401 success &= false;
402 String[] errorParameters = { reportsToObjectCode, reportsToChartCode, fiscalYear.toString() };
403 if (add) {
404 errorPath = OLEConstants.MAINTENANCE_ADD_PREFIX + OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "." + "chartOfAccountsCode";
405 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_INVALID_RPTS_TO_OBJ_CODE, errorParameters);
406 }
407 else {
408 errorPath = OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "[" + lineNum + "]." + "chartOfAccountsCode";
409 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_INVALID_RPTS_TO_OBJ_CODE, errorParameters);
410 }
411 }
412 return success;
413
414 }
415 else {
416 GlobalVariables.getMessageMap().putError("reportsToFinancialObjectCode", OLEKeyConstants.ERROR_REQUIRED, "Reports to Object Code");
417 success &= false;
418 }
419
420 return success;
421 }
422
423
424
425
426
427
428
429
430
431 protected boolean checkNextYearObjectCode(ObjectCodeGlobal objectCodeGlobal, ObjectCodeGlobalDetail dtl, int lineNum, boolean add) {
432 boolean success = true;
433 String errorPath = OLEConstants.EMPTY_STRING;
434
435 if (checkEmptyValue(objectCodeGlobal.getNextYearFinancialObjectCode())) {
436
437 ObjectCode objCode = objectCodeService.getByPrimaryId(dtl.getUniversityFiscalYear(), dtl.getChartOfAccountsCode(), objectCodeGlobal.getNextYearFinancialObjectCode());
438 if (ObjectUtils.isNull(objCode)) {
439 success &= false;
440 String[] errorParameters = { objectCodeGlobal.getNextYearFinancialObjectCode(), dtl.getChartOfAccountsCode(), dtl.getUniversityFiscalYear().toString() };
441 if (add) {
442 errorPath = OLEConstants.MAINTENANCE_ADD_PREFIX + OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "." + "chartOfAccountsCode";
443 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_INVALID_NEXT_YEAR_OBJ_CODE, errorParameters);
444 }
445 else {
446 errorPath = OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "[" + lineNum + "]." + "chartOfAccountsCode";
447 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_INVALID_NEXT_YEAR_OBJ_CODE, errorParameters);
448 }
449 }
450 return success;
451 }
452
453 return success;
454 }
455
456
457
458
459
460
461
462
463 protected boolean checkObjectLevelCode(ObjectCodeGlobal objectCodeGlobal, ObjectCodeGlobalDetail dtl, int lineNum, boolean add) {
464 boolean success = true;
465 String errorPath = OLEConstants.EMPTY_STRING;
466
467 if (checkEmptyValue(objectCodeGlobal.getFinancialObjectLevelCode())) {
468 ObjectLevel objLevel = objectLevelService.getByPrimaryId(dtl.getChartOfAccountsCode(), objectCodeGlobal.getFinancialObjectLevelCode());
469 if (ObjectUtils.isNull(objLevel)) {
470 success &= false;
471 String[] errorParameters = { objectCodeGlobal.getFinancialObjectLevelCode(), dtl.getChartOfAccountsCode() };
472 if (add) {
473 errorPath = OLEConstants.MAINTENANCE_ADD_PREFIX + OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "." + "chartOfAccountsCode";
474 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_INVALID_OBJ_LEVEL, errorParameters);
475 }
476 else {
477 errorPath = OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "[" + lineNum + "]." + "chartOfAccountsCode";
478 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_INVALID_OBJ_LEVEL, errorParameters);
479 }
480 }
481 return success;
482
483 }
484 else {
485 GlobalVariables.getMessageMap().putError("financialObjectLevelCode", OLEKeyConstants.ERROR_REQUIRED, "Object Level Code");
486 success &= false;
487 }
488 return success;
489 }
490
491
492
493
494
495
496
497
498
499
500
501
502
503 protected boolean checkSimpleRulesAllLines() {
504 boolean success = true;
505
506 if (!checkForObjectCodeGlobalDetails(objectCodeGlobal.getObjectCodeGlobalDetails())) {
507 success = false;
508 }
509 else {
510
511 success &= checkFiscalYearAllLines(objectCodeGlobal);
512
513
514 success &= checkChartAllLines(objectCodeGlobal);
515
516
517 success &= checkObjectLevelCodeAllLines(objectCodeGlobal);
518
519
520 success &= checkNextYearObjectCodeAllLines(objectCodeGlobal);
521
522
523 success &= checkReportsToObjectCodeAllLines(objectCodeGlobal);
524
525 }
526 return success;
527 }
528
529
530
531
532
533
534
535 protected boolean checkForObjectCodeGlobalDetails(Collection<? extends PersistableBusinessObject> objectCodeGlobalDetails) {
536 if (objectCodeGlobalDetails == null || objectCodeGlobalDetails.size() == 0) {
537 putFieldError(OLEConstants.MAINTENANCE_ADD_PREFIX + OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "." + OLEPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_NO_CHART_FISCAL_YEAR);
538 return false;
539 }
540 return true;
541 }
542
543
544
545
546
547
548
549 protected boolean checkFiscalYearAllLines(ObjectCodeGlobal objectCodeGlobal) {
550 boolean success = true;
551 int i = 0;
552 for (ObjectCodeGlobalDetail objectCodeGlobalDetail : objectCodeGlobal.getObjectCodeGlobalDetails()) {
553
554
555 success &= checkFiscalYear(objectCodeGlobal, objectCodeGlobalDetail, i, false);
556
557
558 i++;
559 }
560
561 return success;
562 }
563
564
565
566
567
568
569
570
571 protected boolean checkChartAllLines(ObjectCodeGlobal ocChangeDocument) {
572 boolean success = true;
573 int i = 0;
574 for (ObjectCodeGlobalDetail objectCodeGlobalDetail : ocChangeDocument.getObjectCodeGlobalDetails()) {
575
576
577 success &= checkChartOnObjCodeDetails(ocChangeDocument, objectCodeGlobalDetail, i, false);
578
579 i++;
580 }
581
582 return success;
583 }
584
585
586
587
588
589
590
591
592
593 protected boolean checkReportsToObjectCodeAllLines(ObjectCodeGlobal objectCodeGlobalDocument2) {
594 boolean success = true;
595 int i = 0;
596 for (ObjectCodeGlobalDetail objectCodeGlobalDetail : objectCodeGlobal.getObjectCodeGlobalDetails()) {
597
598
599 success &= checkReportsToObjectCode(objectCodeGlobal, objectCodeGlobalDetail, i, false);
600
601
602 i++;
603 }
604
605 return success;
606 }
607
608
609
610
611
612
613
614
615 protected boolean checkNextYearObjectCodeAllLines(ObjectCodeGlobal objectCodeGlobalDocument2) {
616 boolean success = true;
617 int i = 0;
618 for (ObjectCodeGlobalDetail objectCodeGlobalDetail : objectCodeGlobal.getObjectCodeGlobalDetails()) {
619
620
621 success &= checkNextYearObjectCode(objectCodeGlobal, objectCodeGlobalDetail, i, false);
622
623
624 i++;
625 }
626
627 return success;
628 }
629
630
631
632
633
634
635
636
637 protected boolean checkObjectLevelCodeAllLines(ObjectCodeGlobal objectCodeGlobalDocument2) {
638 boolean success = true;
639 int i = 0;
640 for (ObjectCodeGlobalDetail objectCodeGlobalDetail : objectCodeGlobal.getObjectCodeGlobalDetails()) {
641
642
643 success &= checkObjectLevelCode(objectCodeGlobal, objectCodeGlobalDetail, i, false);
644
645
646 i++;
647 }
648
649 return success;
650 }
651
652
653
654
655
656
657
658
659
660
661 protected boolean checkFiscalYear(ObjectCodeGlobal objectCodeGlobal, ObjectCodeGlobalDetail objectCodeGlobalDetail, int lineNum, boolean add) {
662 boolean success = true;
663 String errorPath = OLEConstants.EMPTY_STRING;
664
665 if (objectCodeGlobalDetail.getUniversityFiscalYear() == null) {
666 if (add) {
667 errorPath = OLEConstants.MAINTENANCE_ADD_PREFIX + OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "." + "universityFiscalYear";
668 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_FISCAL_YEAR_MUST_EXIST);
669 }
670 else {
671 errorPath = OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "[" + lineNum + "]." + "universityFiscalYear";
672 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_FISCAL_YEAR_MUST_EXIST);
673 }
674 success &= false;
675 return success;
676 }
677
678 return success;
679 }
680
681
682
683
684
685
686
687
688
689
690 protected boolean checkChartOnObjCodeDetails(ObjectCodeGlobal objectCodeGlobal, ObjectCodeGlobalDetail objectCodeGlobalDetail, int lineNum, boolean add) {
691 boolean success = true;
692 String errorPath = OLEConstants.EMPTY_STRING;
693
694 if (objectCodeGlobalDetail.getChartOfAccounts() == null) {
695 if (add) {
696 errorPath = OLEConstants.MAINTENANCE_ADD_PREFIX + OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "." + "chartOfAccountsCode";
697 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_CHART_MUST_EXIST);
698 }
699 else {
700 errorPath = OLEPropertyConstants.OBJECT_CODE_GLOBAL_DETAILS + "[" + lineNum + "]." + "chartOfAccountsCode";
701 putFieldError(errorPath, OLEKeyConstants.ERROR_DOCUMENT_GLOBAL_OBJECTMAINT_CHART_MUST_EXIST);
702 }
703 success &= false;
704 return success;
705 }
706
707 return success;
708 }
709
710
711
712
713
714
715
716 protected boolean checkResearchAdminAttributes(ObjectCodeGlobal objectCodeGlobal) {
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732 return true;
733 }
734
735 protected void setObjectCodeService(ObjectCodeService objectCodeService) {
736 this.objectCodeService = objectCodeService;
737
738 }
739
740
741 protected void setObjectLevelService(ObjectLevelService objectLevelService) {
742 this.objectLevelService = objectLevelService;
743
744 }
745 }