1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.kuali.kfs.module.cam.document.validation.impl;
20
21 import org.kuali.kfs.module.cam.CamsKeyConstants;
22 import org.kuali.kfs.module.cam.businessobject.AssetPaymentAssetDetail;
23 import org.kuali.kfs.module.cam.document.service.AssetPaymentService;
24 import org.kuali.kfs.sys.document.validation.GenericValidation;
25 import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
26 import org.kuali.rice.krad.util.GlobalVariables;
27 import org.kuali.rice.krad.util.ObjectUtils;
28
29
30
31
32
33
34 public class AssetPaymentAddAssetValidation extends GenericValidation {
35 private AssetPaymentService assetPaymentService;
36 private AssetPaymentAssetDetail assetPaymentAssetDetailForValidation;
37
38
39
40
41
42 public boolean validate(AttributedDocumentEvent event) {
43 String errorPath = event.getErrorPathPrefix();
44
45
46 if (ObjectUtils.isNull(this.getAssetPaymentAssetDetailForValidation().getAsset())) {
47 GlobalVariables.getMessageMap().putError(errorPath, CamsKeyConstants.AssetLocationGlobal.ERROR_INVALID_CAPITAL_ASSET_NUMBER, this.getAssetPaymentAssetDetailForValidation().getCapitalAssetNumber().toString());
48 return false;
49 }
50 return this.getAssetPaymentService().validateAssets(errorPath, this.getAssetPaymentAssetDetailForValidation().getAsset());
51 }
52
53 public AssetPaymentAssetDetail getAssetPaymentAssetDetailForValidation() {
54 return assetPaymentAssetDetailForValidation;
55 }
56
57 public void setAssetPaymentAssetDetailForValidation(AssetPaymentAssetDetail assetPaymentAssetDetailForValidation) {
58 this.assetPaymentAssetDetailForValidation = assetPaymentAssetDetailForValidation;
59 }
60
61 public AssetPaymentService getAssetPaymentService() {
62 return assetPaymentService;
63 }
64
65 public void setAssetPaymentService(AssetPaymentService assetPaymentService) {
66 this.assetPaymentService = assetPaymentService;
67 }
68 }