View Javadoc
1   package org.kuali.ole.batch.controller;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.kuali.ole.OLEConstants;
5   import org.kuali.ole.batch.bo.*;
6   import org.kuali.ole.batch.util.BatchBibImportUtil;
7   import org.kuali.ole.docstore.model.enums.DocType;
8   import org.kuali.ole.select.OleSelectConstant;
9   import org.kuali.ole.select.bo.OleGloballyProtectedField;
10  import org.kuali.ole.select.document.service.OleInvoiceService;
11  import org.kuali.ole.select.document.service.OleSelectDocumentService;
12  import org.kuali.ole.service.OleOrderRecordService;
13  import org.kuali.ole.sys.context.SpringContext;
14  import org.kuali.ole.vnd.businessobject.OleExchangeRate;
15  import org.kuali.rice.krad.maintenance.MaintenanceDocument;
16  import org.kuali.rice.krad.service.BusinessObjectService;
17  import org.kuali.rice.krad.service.KRADServiceLocator;
18  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
19  import org.kuali.rice.krad.service.LookupService;
20  import org.kuali.rice.krad.uif.UifParameters;
21  import org.kuali.rice.krad.uif.container.CollectionGroup;
22  import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
23  import org.kuali.rice.krad.uif.view.View;
24  import org.kuali.rice.krad.util.GlobalVariables;
25  import org.kuali.rice.krad.util.KRADConstants;
26  import org.kuali.rice.krad.web.controller.MaintenanceDocumentController;
27  import org.kuali.rice.krad.web.form.DocumentFormBase;
28  import org.kuali.rice.krad.web.form.MaintenanceDocumentForm;
29  import org.kuali.rice.krad.web.form.UifFormBase;
30  import org.springframework.stereotype.Controller;
31  import org.springframework.validation.BindingResult;
32  import org.springframework.web.bind.annotation.ModelAttribute;
33  import org.springframework.web.bind.annotation.RequestMapping;
34  import org.springframework.web.bind.annotation.RequestMethod;
35  import org.springframework.web.servlet.ModelAndView;
36  
37  import javax.servlet.http.HttpServletRequest;
38  import javax.servlet.http.HttpServletResponse;
39  import java.text.ParseException;
40  import java.text.SimpleDateFormat;
41  import java.util.*;
42  import java.util.regex.Pattern;
43  
44  /**
45   * Created with IntelliJ IDEA.
46   * User: adityas
47   * Date: 7/10/13
48   * Time: 4:30 PM
49   * To change this template use File | Settings | File Templates.
50   */
51  
52  @Controller
53  @RequestMapping(value = "/oleBatchProcessProfile")
54  public class OLEBatchProcessProfileController extends MaintenanceDocumentController {
55  
56  
57      BusinessObjectService businessObject = SpringContext.getBean(BusinessObjectService.class);
58  
59  
60      private OleSelectDocumentService oleSelectDocumentService;
61      private OleOrderRecordService oleOrderRecordService;
62      private OleInvoiceService oleInvoiceService;
63  
64      public OleSelectDocumentService getOleSelectDocumentService() {
65          if (oleSelectDocumentService == null) {
66              oleSelectDocumentService = SpringContext.getBean(OleSelectDocumentService.class);
67          }
68          return oleSelectDocumentService;
69      }
70  
71      public OleOrderRecordService getOleOrderRecordService() {
72          if (oleOrderRecordService == null) {
73              oleOrderRecordService = SpringContext.getBean(OleOrderRecordService.class);
74          }
75          return oleOrderRecordService;
76      }
77  
78      public OleInvoiceService getOleInvoiceService() {
79          if (oleInvoiceService == null) {
80              oleInvoiceService = SpringContext.getBean(OleInvoiceService.class);
81          }
82          return oleInvoiceService;
83      }
84  
85      private LookupService getLookupService() {
86          return KRADServiceLocatorWeb.getLookupService();
87      }
88  
89      @Override
90      protected MaintenanceDocumentForm createInitialForm(HttpServletRequest request) {
91          return new MaintenanceDocumentForm();
92      }
93  
94      /**
95       *   This method takes the initial request when click on Batch Process Profile Screen.
96       * @param form
97       * @param result
98       * @param request
99       * @param response
100      * @return  ModelAndView
101     */
102     @Override
103     @RequestMapping(params = "methodToCall=start")
104     public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
105                               HttpServletRequest request, HttpServletResponse response) {
106         LOG.debug("Start -- Start Method of OlePatronRecordForm");
107         MaintenanceDocumentForm maintenanceForm = (MaintenanceDocumentForm) form;
108         setupMaintenance(maintenanceForm, request, KRADConstants.MAINTENANCE_NEW_ACTION);
109         MaintenanceDocument document = (MaintenanceDocument) maintenanceForm.getDocument();
110         OLEBatchProcessProfileBo batchProcessProfileBo = (OLEBatchProcessProfileBo) document.getDocumentDataObject();
111         List<OleGloballyProtectedField> oleGloballyProtectedFields = (List<OleGloballyProtectedField>) KRADServiceLocator.getBusinessObjectService().findAll(OleGloballyProtectedField.class);
112         if(oleGloballyProtectedFields.size()>0){
113             List<OLEBatchGloballyProtectedField> batchGloballyProtectedFields = new ArrayList<OLEBatchGloballyProtectedField>();
114             for(OleGloballyProtectedField globallyProtectedField : oleGloballyProtectedFields){
115                 OLEBatchGloballyProtectedField oleBatchGloballyProtectedField = new OLEBatchGloballyProtectedField();
116                 oleBatchGloballyProtectedField.setGloballyProtectedFieldId(globallyProtectedField.getOleGloballyProtectedFieldId());
117                 oleBatchGloballyProtectedField.setTag(globallyProtectedField.getTag());
118                 oleBatchGloballyProtectedField.setFirstIndicator(globallyProtectedField.getFirstIndicator());
119                 oleBatchGloballyProtectedField.setSecondIndicator(globallyProtectedField.getSecondIndicator());
120                 oleBatchGloballyProtectedField.setSubField(globallyProtectedField.getSubField());
121                 batchGloballyProtectedFields.add(oleBatchGloballyProtectedField);
122             }
123             batchProcessProfileBo.setOleBatchGloballyProtectedFieldList(batchGloballyProtectedFields);
124         }
125         /*List<OLEBatchGloballyProtectedField> oleGloballyProtectedFields=batchProcessProfileBo.getOleBatchGloballyProtectedFieldList();
126 
127         List<OLEBatchProcessProfileProtectedField> oleBatchProcessProfileProtectedFields=batchProcessProfileBo.getOleBatchProcessProfileProtectedFieldList();
128         for(OLEBatchGloballyProtectedField globallyProtectedField:oleGloballyProtectedFields){
129                    if(globallyProtectedField.isIgnoreValue()){
130                        OLEBatchProcessProfileProtectedField oleBatchGloballyProtectedField = new OLEBatchProcessProfileProtectedField();
131                        oleBatchGloballyProtectedField.setFirstIndicator(globallyProtectedField.getFirstIndicator());
132                        oleBatchGloballyProtectedField.setSecondIndicator(globallyProtectedField.getSecondIndicator());
133                        oleBatchGloballyProtectedField.setTag(globallyProtectedField.getTag());
134                        oleBatchGloballyProtectedField.setSubField(globallyProtectedField.getSubField());
135                        oleBatchProcessProfileProtectedFields.add(oleBatchGloballyProtectedField);
136                    }
137         }
138         batchProcessProfileBo.setOleBatchGloballyProtectedFieldList(oleGloballyProtectedFields);*/
139         return super.start(form, result, request, response);
140     }
141 
142     @Override
143     @RequestMapping(params = "methodToCall=maintenanceEdit")
144     public ModelAndView maintenanceEdit(@ModelAttribute("KualiForm") MaintenanceDocumentForm form, BindingResult result,
145                                         HttpServletRequest request, HttpServletResponse response) throws Exception {
146         MaintenanceDocumentForm maintenanceForm = (MaintenanceDocumentForm) form;
147         setupMaintenance(form, request, KRADConstants.MAINTENANCE_EDIT_ACTION);
148         MaintenanceDocument document = (MaintenanceDocument) maintenanceForm.getDocument();
149         OLEBatchProcessProfileBo oldOleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getOldMaintainableObject().getDataObject();
150         OLEBatchProcessProfileBo newOleBatchProcessProfileBo = (OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
151         //oldOleBatchProcessProfileBo.setMatchingProfileObj(MatchingProfile.buildMatchProfileObj(oldOleBatchProcessProfileBo.getMatchingProfile()));
152         Map<String,String> map=new HashMap<String,String>();
153         map.put("batchProcessProfileId",oldOleBatchProcessProfileBo.getBatchProcessProfileId());
154         List<OLEBatchGloballyProtectedField> existBatchGloballyProtectedFields = (List<OLEBatchGloballyProtectedField>) KRADServiceLocator.getBusinessObjectService().findMatching(OLEBatchGloballyProtectedField.class,map);
155         List<OleGloballyProtectedField> oleGloballyProtectedFields = (List<OleGloballyProtectedField>) KRADServiceLocator.getBusinessObjectService().findAll(OleGloballyProtectedField.class);
156         if (oleGloballyProtectedFields.size() > 0) {
157             List<OLEBatchGloballyProtectedField> batchGloballyProtectedFields = new ArrayList<OLEBatchGloballyProtectedField>();
158             for (OleGloballyProtectedField globallyProtectedField : oleGloballyProtectedFields) {
159                 OLEBatchGloballyProtectedField oleBatchGloballyProtectedField = new OLEBatchGloballyProtectedField();
160                 oleBatchGloballyProtectedField.setGloballyProtectedFieldId(globallyProtectedField.getOleGloballyProtectedFieldId());
161                 oleBatchGloballyProtectedField.setTag(globallyProtectedField.getTag());
162                 oleBatchGloballyProtectedField.setFirstIndicator(globallyProtectedField.getFirstIndicator());
163                 oleBatchGloballyProtectedField.setSecondIndicator(globallyProtectedField.getSecondIndicator());
164                 oleBatchGloballyProtectedField.setSubField(globallyProtectedField.getSubField());
165                 for (OLEBatchGloballyProtectedField existBatchGloballyProtectedField : existBatchGloballyProtectedFields) {
166                     if (existBatchGloballyProtectedField.getGloballyProtectedFieldId().equals(globallyProtectedField.getOleGloballyProtectedFieldId())) {
167                         oleBatchGloballyProtectedField.setIgnoreValue(existBatchGloballyProtectedField.isIgnoreValue());
168                         oleBatchGloballyProtectedField.setId(existBatchGloballyProtectedField.getId());
169                     }
170                 }
171                 batchGloballyProtectedFields.add(oleBatchGloballyProtectedField);
172             }
173             oldOleBatchProcessProfileBo.setOleBatchGloballyProtectedFieldList(batchGloballyProtectedFields);
174         }
175 
176         for (OLEBatchProcessProfileMatchPoint oleBatchProcessProfileMatchPoint : oldOleBatchProcessProfileBo.getOleBatchProcessProfileMatchPointList()) {
177            if(oleBatchProcessProfileMatchPoint.getMatchPointType() != null && oleBatchProcessProfileMatchPoint.getMatchPointType().equalsIgnoreCase("bibliographic")) {
178                oldOleBatchProcessProfileBo.getOleBatchProcessProfileBibliographicMatchPointList().add(oleBatchProcessProfileMatchPoint);
179            } else if(oleBatchProcessProfileMatchPoint.getMatchPointType() != null && oleBatchProcessProfileMatchPoint.getMatchPointType().equalsIgnoreCase("holdings")) {
180                oldOleBatchProcessProfileBo.getOleBatchProcessProfileHoldingMatchPointList().add(oleBatchProcessProfileMatchPoint);
181            } else if(oleBatchProcessProfileMatchPoint.getMatchPointType() != null && oleBatchProcessProfileMatchPoint.getMatchPointType().equalsIgnoreCase("item")) {
182                oldOleBatchProcessProfileBo.getOleBatchProcessProfileItemMatchPointList().add(oleBatchProcessProfileMatchPoint);
183            } else if(oleBatchProcessProfileMatchPoint.getMatchPointType() != null && oleBatchProcessProfileMatchPoint.getMatchPointType().equalsIgnoreCase("eHoldings")) {
184                oldOleBatchProcessProfileBo.getOleBatchProcessProfileEholdingMatchPointList().add(oleBatchProcessProfileMatchPoint);
185            }
186         }
187         return super.maintenanceEdit(form, result, request, response);
188     }
189 
190     @Override
191     @RequestMapping(params = "methodToCall=route")
192     public ModelAndView route(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
193                               HttpServletRequest request, HttpServletResponse response) {
194         MaintenanceDocumentForm mainForm = (MaintenanceDocumentForm) form;
195         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
196         //OLEBatchProcessProfileBo oldOleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getOldMaintainableObject().getDataObject();
197         //OLEBatchProcessProfileBo oleBatchProcessProfileBo1 = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
198         OLEBatchProcessProfileBo newOleBatchProcessProfileBo = (OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
199         MatchingProfile matchingProfile = newOleBatchProcessProfileBo.getMatchingProfileObj();
200         newOleBatchProcessProfileBo.setMatchingProfile(matchingProfile.toString());
201         List<OLEBatchProcessProfileFilterCriteriaBo> filterCriteriaBoList=new ArrayList<OLEBatchProcessProfileFilterCriteriaBo>();
202         if(newOleBatchProcessProfileBo.getOleBatchProcessProfileFilterCriteriaList().size()>0){
203             for(OLEBatchProcessProfileFilterCriteriaBo oleBatchProcessProfileFilterCriteriaBo:newOleBatchProcessProfileBo.getOleBatchProcessProfileFilterCriteriaList()){
204                 if((oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName().isEmpty() || oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName()==null) ){
205                     oleBatchProcessProfileFilterCriteriaBo.setFilterFieldName(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldNameText());
206                 }
207                 filterCriteriaBoList.add(oleBatchProcessProfileFilterCriteriaBo);
208             }
209             ((OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject()).setOleBatchProcessProfileFilterCriteriaList(filterCriteriaBoList);
210             ((MaintenanceDocumentForm) form).setDocument(document);
211         }
212         if (!newOleBatchProcessProfileBo.getRemoveValueFrom001()){
213                 newOleBatchProcessProfileBo.setValueToRemove("");
214         }
215 
216         if (!validateMatchPoints(newOleBatchProcessProfileBo,matchingProfile)) {
217             return getUIFModelAndView(form);
218         }
219         List<OLEBatchProcessProfileBibStatus> oleBatchProcessProfileBibStatuses=newOleBatchProcessProfileBo.getDeleteBatchProcessProfileBibStatusList();
220         KRADServiceLocator.getBusinessObjectService().save(oleBatchProcessProfileBibStatuses);
221         for(OLEBatchProcessProfileBibStatus oleBatchProcessProfileBibStatus:oleBatchProcessProfileBibStatuses){
222             Map<String,String> map=new HashMap<String,String>();
223             map.put("batchProcessBibStatusId",oleBatchProcessProfileBibStatus.getBatchProcessBibStatusId());
224             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileBibStatus.class,map);
225         }
226 
227         List<OLEBatchProcessProfileDeleteField> oleBatchProcessProfileDeleteFields=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileDeleteFieldsList();
228         KRADServiceLocator.getBusinessObjectService().save(oleBatchProcessProfileDeleteFields);
229         for(OLEBatchProcessProfileDeleteField oleBatchProcessProfileDeleteField:oleBatchProcessProfileDeleteFields){
230             Map<String,String> map=new HashMap<String,String>();
231             map.put("id",oleBatchProcessProfileDeleteField.getId());
232             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileDeleteField.class,map);
233         }
234 
235         List<OLEBatchProcessProfileRenameField> oleBatchProcessProfileRenameFields=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileRenameFieldsList();
236         for(OLEBatchProcessProfileRenameField oleBatchProcessProfileRenameField:oleBatchProcessProfileRenameFields){
237             Map<String,String> map=new HashMap<String,String>();
238             map.put("id",oleBatchProcessProfileRenameField.getId());
239             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileRenameField.class,map);
240         }
241         List<OLEBatchProcessProfileFilterCriteriaBo> oleBatchProcessProfileFilterCriteriaBos=newOleBatchProcessProfileBo.getDeleteBatchProcessProfileFilterCriteriaList();
242         for(OLEBatchProcessProfileFilterCriteriaBo oleBatchProcessProfileFilterCriteriaBo:oleBatchProcessProfileFilterCriteriaBos){
243             Map<String,String> map=new HashMap<String,String>();
244             map.put("filterId",oleBatchProcessProfileFilterCriteriaBo.getFilterId());
245             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileFilterCriteriaBo.class,map);
246         }
247         List<OLEBatchProcessProfileDataMappingOptionsBo> oleBatchProcessProfileDataMappingOptionsBos=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileDataMappingOptionsList();
248         for(OLEBatchProcessProfileDataMappingOptionsBo oleBatchProcessProfileDataMappingOptionsBo:oleBatchProcessProfileDataMappingOptionsBos){
249             Map<String,String> map=new HashMap<String,String>();
250             map.put("oleBatchProcessProfileDataMappingOptionId",oleBatchProcessProfileDataMappingOptionsBo.getOleBatchProcessProfileDataMappingOptionId());
251             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileDataMappingOptionsBo.class,map);
252         }
253         List<OLEBatchProcessProfileMappingOptionsBo> oleBatchProcessProfileMappingOptionsBos=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileMappingOptionsList();
254         for(OLEBatchProcessProfileMappingOptionsBo oleBatchProcessProfileMappingOptionsBo:oleBatchProcessProfileMappingOptionsBos){
255             Map<String,String> map=new HashMap<String,String>();
256             map.put("oleBatchProcessDataMapId",oleBatchProcessProfileMappingOptionsBo.getOleBatchProcessDataMapId());
257             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileMappingOptionsBo.class,map);
258         }
259         List<OLEBatchProcessProfileConstantsBo> oleBatchProcessProfileConstantsBos=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileConstantsList();
260         for(OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo:oleBatchProcessProfileConstantsBos){
261             Map<String,String> map=new HashMap<String,String>();
262             map.put("oleBatchProcessProfileConstantsId",oleBatchProcessProfileConstantsBo.getOleBatchProcessProfileConstantsId());
263             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileConstantsBo.class,map);
264         }
265         List<OLEBatchProcessProfileProtectedField> oleBatchProcessProfileProtectedFields=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileProtectedFieldList();
266         for(OLEBatchProcessProfileProtectedField oleBatchProcessProfileProtectedField:oleBatchProcessProfileProtectedFields){
267             Map<String,String> map=new HashMap<String,String>();
268             map.put("oleProfileProtectedFieldId",oleBatchProcessProfileProtectedField.getOleProfileProtectedFieldId());
269             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileProtectedField.class,map);
270         }
271         List<OLEBatchProcessProfileMatchPoint> oleBatchProcessProfileMatchPointList = newOleBatchProcessProfileBo.getDeletedBatchProcessProfileMatchPointList();
272         newOleBatchProcessProfileBo.getOleBatchProcessProfileMatchPointList().removeAll(oleBatchProcessProfileMatchPointList);
273         for (OLEBatchProcessProfileMatchPoint oleBatchProcessProfileMatchPoint : oleBatchProcessProfileMatchPointList) {
274             KRADServiceLocator.getBusinessObjectService().delete(oleBatchProcessProfileMatchPoint);
275         }
276         List<OLEBatchGloballyProtectedField> batchGloballyProtectedFields = new ArrayList<OLEBatchGloballyProtectedField>();
277         batchGloballyProtectedFields.addAll(newOleBatchProcessProfileBo.getOleBatchGloballyProtectedFieldList());
278 
279         if (StringUtils.isNotBlank(newOleBatchProcessProfileBo.getBatchProcessProfileId())) {
280             for (OLEBatchGloballyProtectedField globallyProtectedField : batchGloballyProtectedFields) {
281                 Map<String, String> map = new HashMap<String, String>();
282                 map.put("batchProcessProfileId", newOleBatchProcessProfileBo.getBatchProcessProfileId());
283                 KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchGloballyProtectedField.class, map);
284             }
285 
286             List<OLEBatchGloballyProtectedField> batchGloballyProtectedFieldList = new ArrayList<OLEBatchGloballyProtectedField>();
287             for (OLEBatchGloballyProtectedField globallyProtectedField : batchGloballyProtectedFields) {
288                 //if (globallyProtectedField.isIgnoreValue()) {
289                     globallyProtectedField.setBatchProcessProfileId(newOleBatchProcessProfileBo.getBatchProcessProfileId());
290                     batchGloballyProtectedFieldList.add(globallyProtectedField);
291                 //}
292             }
293             newOleBatchProcessProfileBo.setOleBatchGloballyProtectedFieldList(batchGloballyProtectedFieldList);
294             KRADServiceLocator.getBusinessObjectService().linkAndSave(batchGloballyProtectedFieldList);
295         } else {
296 
297             List<OLEBatchGloballyProtectedField> batchGloballyProtectedFieldList = new ArrayList<OLEBatchGloballyProtectedField>();
298             for (OLEBatchGloballyProtectedField globallyProtectedField : batchGloballyProtectedFields) {
299                 //if (globallyProtectedField.isIgnoreValue()) {
300                     //globallyProtectedField.setBatchProcessProfileId(newOleBatchProcessProfileBo.getBatchProcessProfileId());
301                     batchGloballyProtectedFieldList.add(globallyProtectedField);
302                 //}
303             }
304             newOleBatchProcessProfileBo.setOleBatchGloballyProtectedFieldList(batchGloballyProtectedFieldList);
305         }
306         return super.route(form, result, request, response);
307     }
308 
309     private boolean validateMatchPoints(OLEBatchProcessProfileBo newOleBatchProcessProfileBo, MatchingProfile matchingProfile) {
310         boolean isValid = true;
311         if (newOleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)) {
312             if (matchingProfile.isMatchBibs()) {
313                 List<OLEBatchProcessProfileMatchPoint> oleBatchProcessProfileMatchPointList = newOleBatchProcessProfileBo.getOleBatchProcessProfileBibliographicMatchPointList();
314                 if (oleBatchProcessProfileMatchPointList.size() == 0) {
315                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_MATCH_POINT);
316                     isValid = false;
317                 }
318                 if (matchingProfile.isMatchHoldings()) {
319                     if (OLEConstants.OLEBatchProcess.DATA_TO_IMPORT_BIB_INSTANCE.equalsIgnoreCase(newOleBatchProcessProfileBo.getDataToImport()) ||
320                             OLEConstants.OLEBatchProcess.DATA_TO_IMPORT_BIB_INSTANCE_EINSTANCE.equalsIgnoreCase(newOleBatchProcessProfileBo.getDataToImport())) {
321                         oleBatchProcessProfileMatchPointList = newOleBatchProcessProfileBo.getOleBatchProcessProfileHoldingMatchPointList();
322                         if (oleBatchProcessProfileMatchPointList.size() == 0) {
323                             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_HOLDINGS_MATCH_POINT);
324                             isValid = false;
325                         }
326 
327                         if (matchingProfile.isMatchItems()) {
328                             oleBatchProcessProfileMatchPointList = newOleBatchProcessProfileBo.getOleBatchProcessProfileItemMatchPointList();
329                             if (oleBatchProcessProfileMatchPointList.size() == 0) {
330                                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_ITEM_MATCH_POINT);
331                                 isValid = false;
332                             }
333                         }
334                     }
335                     if (OLEConstants.OLEBatchProcess.DATA_TO_IMPORT_BIB_EINSTANCE.equalsIgnoreCase(newOleBatchProcessProfileBo.getDataToImport()) ||
336                             OLEConstants.OLEBatchProcess.DATA_TO_IMPORT_BIB_INSTANCE_EINSTANCE.equalsIgnoreCase(newOleBatchProcessProfileBo.getDataToImport())) {
337                         oleBatchProcessProfileMatchPointList = newOleBatchProcessProfileBo.getOleBatchProcessProfileEholdingMatchPointList();
338                         if (oleBatchProcessProfileMatchPointList.size() == 0) {
339                             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_EHOLDINGS_MATCH_POINT);
340                             isValid = false;
341                         }
342                     }
343                 }
344 
345             }
346 
347         }
348         return isValid;
349     }
350 
351     @Override
352     @RequestMapping(params = "methodToCall=blanketApprove")
353     public ModelAndView blanketApprove(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
354                                        HttpServletRequest request, HttpServletResponse response) throws Exception {
355         route(form, result, request, response);
356         return super.blanketApprove(form, result, request, response);
357     }
358 
359     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addBibMatch")
360     public ModelAndView addBibMatch(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
361                                         HttpServletRequest request, HttpServletResponse response) {
362         LOG.debug("Initialized addLine method");
363         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
364         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
365         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
366 
367             String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
368             CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
369             String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
370             Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
371         OLEBatchProcessProfileMatchPoint oleBatchProcessProfileMatchPoint = (OLEBatchProcessProfileMatchPoint) eventObject;
372             if(oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)){
373                 if(validateBibMatchPoint(oleBatchProcessProfileMatchPoint.getMatchPoint())==Boolean.FALSE){
374                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_BIB_MATCH_POINT_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_MATCH_POINT_ERR);
375                     return getUIFModelAndView(form);
376                 }
377             }
378             View view = form.getPostedView();
379             view.getViewHelperService().processCollectionAddLine(view, form, selectedCollectionPath);
380             oleBatchProcessProfileBo.getOleBatchProcessProfileBibliographicMatchPointList().remove(oleBatchProcessProfileMatchPoint);
381             int lastIndex=oleBatchProcessProfileBo.getOleBatchProcessProfileBibliographicMatchPointList().size();
382             oleBatchProcessProfileBo.getOleBatchProcessProfileBibliographicMatchPointList().add(lastIndex,oleBatchProcessProfileMatchPoint);
383             oleBatchProcessProfileBo.getOleBatchProcessProfileMatchPointList().add(lastIndex,oleBatchProcessProfileMatchPoint);
384 
385 
386         return getUIFModelAndView(form);
387     }
388 
389     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addHoldingMatch")
390     public ModelAndView addHoldingMatch(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
391                                     HttpServletRequest request, HttpServletResponse response) {
392         LOG.debug("Initialized addLine method");
393         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
394         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
395         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
396 
397         String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
398         CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
399         String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
400         Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
401         OLEBatchProcessProfileMatchPoint oleBatchProcessProfileMatchPoint = (OLEBatchProcessProfileMatchPoint) eventObject;
402         if(oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)){
403 //            if(validateBibMatchPoint(oleBatchProcessProfileMatchPoint.getMatchPoint())==Boolean.FALSE){
404 //                GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_BIB_MATCH_POINT_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_MATCH_POINT_ERR);
405 //                return getUIFModelAndView(form);
406 //            }
407         }
408         View view = form.getPostedView();
409         view.getViewHelperService().processCollectionAddLine(view, form, selectedCollectionPath);
410         oleBatchProcessProfileBo.getOleBatchProcessProfileHoldingMatchPointList().remove(oleBatchProcessProfileMatchPoint);
411         int lastIndex=oleBatchProcessProfileBo.getOleBatchProcessProfileHoldingMatchPointList().size();
412         oleBatchProcessProfileBo.getOleBatchProcessProfileHoldingMatchPointList().add(lastIndex,oleBatchProcessProfileMatchPoint);
413         oleBatchProcessProfileBo.getOleBatchProcessProfileMatchPointList().add(lastIndex,oleBatchProcessProfileMatchPoint);
414 
415 
416         return getUIFModelAndView(form);
417     }
418 
419     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addItemMatch")
420     public ModelAndView addItemMatch(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
421                                         HttpServletRequest request, HttpServletResponse response) {
422         LOG.debug("Initialized addLine method");
423         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
424         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
425         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
426 
427         String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
428         CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
429         String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
430         Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
431         OLEBatchProcessProfileMatchPoint oleBatchProcessProfileMatchPoint = (OLEBatchProcessProfileMatchPoint) eventObject;
432         if(oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)){
433 //            if(validateBibMatchPoint(oleBatchProcessProfileMatchPoint.getMatchPoint())==Boolean.FALSE){
434 //                GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_BIB_MATCH_POINT_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_MATCH_POINT_ERR);
435 //                return getUIFModelAndView(form);
436 //            }
437             View view = form.getPostedView();
438             view.getViewHelperService().processCollectionAddLine(view, form, selectedCollectionPath);
439             oleBatchProcessProfileBo.getOleBatchProcessProfileItemMatchPointList().remove(oleBatchProcessProfileMatchPoint);
440             int lastIndex=oleBatchProcessProfileBo.getOleBatchProcessProfileItemMatchPointList().size();
441             oleBatchProcessProfileBo.getOleBatchProcessProfileItemMatchPointList().add(lastIndex,oleBatchProcessProfileMatchPoint);
442             oleBatchProcessProfileBo.getOleBatchProcessProfileMatchPointList().add(lastIndex,oleBatchProcessProfileMatchPoint);
443         }
444 
445 
446 
447         return getUIFModelAndView(form);
448     }
449 
450 
451 
452     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addEholdingMatch")
453     public ModelAndView addEholdingMatch(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
454                                         HttpServletRequest request, HttpServletResponse response) {
455         LOG.debug("Initialized addLine method");
456         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
457         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
458         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
459 
460         String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
461         CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
462         String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
463         Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
464         OLEBatchProcessProfileMatchPoint oleBatchProcessProfileMatchPoint = (OLEBatchProcessProfileMatchPoint) eventObject;
465         if(oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)){
466 //            if(validateBibMatchPoint(oleBatchProcessProfileMatchPoint.getMatchPoint())==Boolean.FALSE){
467 //                GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_BIB_MATCH_POINT_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_MATCH_POINT_ERR);
468 //                return getUIFModelAndView(form);
469 //            }
470         }
471         View view = form.getPostedView();
472         view.getViewHelperService().processCollectionAddLine(view, form, selectedCollectionPath);
473         oleBatchProcessProfileBo.getOleBatchProcessProfileEholdingMatchPointList().remove(oleBatchProcessProfileMatchPoint);
474         int lastIndex=oleBatchProcessProfileBo.getOleBatchProcessProfileEholdingMatchPointList().size();
475         oleBatchProcessProfileBo.getOleBatchProcessProfileEholdingMatchPointList().add(lastIndex,oleBatchProcessProfileMatchPoint);
476         oleBatchProcessProfileBo.getOleBatchProcessProfileMatchPointList().add(lastIndex,oleBatchProcessProfileMatchPoint);
477 
478 
479         return getUIFModelAndView(form);
480     }
481 
482 
483     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addFilterCriteriaMapping")
484     public ModelAndView addFilterCriteriaMapping(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
485                                                  HttpServletRequest request, HttpServletResponse response) {
486 
487         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
488         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
489         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
490         String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
491         CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
492         String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
493         Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
494         OLEBatchProcessProfileFilterCriteriaBo oleBatchProcessProfileFilterCriteriaBo = (OLEBatchProcessProfileFilterCriteriaBo) eventObject;
495         boolean matchPointFlag1 = true;
496         if ((oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) && oleBatchProcessProfileFilterCriteriaBo != null && oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName()!=null && oleBatchProcessProfileFilterCriteriaBo.getFilterFieldNameText()!=null) {
497             if(!StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName()) && !StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldNameText()) && !StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldValue())){
498                 matchPointFlag1 = validateFilterCriteriaFieldValue(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName());
499                 if (!matchPointFlag1) {
500                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_FILTER_CRITERIA_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_FILTER_CRITERIA_FIELD_ERR);
501                     return getUIFModelAndView(form);
502                 }
503             } else if(!StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName()) && StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldNameText())){
504                 return super.addLine(uifForm, result, request, response);
505             } else {
506                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_FILTER_CRITERIA_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_FILTER_CRITERIA_FIELD_ERR);
507                 return getUIFModelAndView(form);
508             }
509         } else {
510             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_FILTER_CRITERIA_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_FILTER_CRITERIA_FIELD_ERR);
511             return getUIFModelAndView(form);
512         }
513         return super.addLine(uifForm, result, request, response);
514     }
515 
516     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLineDataMapping")
517     public ModelAndView addLineDataMapping(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
518                                            HttpServletRequest request, HttpServletResponse response) {
519 
520         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
521         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
522         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
523         String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
524         CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
525         String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
526         Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
527         OLEBatchProcessProfileDataMappingOptionsBo oleBatchProcessProfileDataMappingOptionsBo = (OLEBatchProcessProfileDataMappingOptionsBo) eventObject;
528 
529         //validation for data mapping fields
530         if (!validateRequiredForMapping(oleBatchProcessProfileDataMappingOptionsBo, oleBatchProcessProfileBo, form)) {
531             return getUIFModelAndView(form);
532         }
533         boolean matchPointFlag1 = true;
534         boolean matchPointFlag2 = true;
535         if ((oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT) || oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT) || oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT)) && oleBatchProcessProfileDataMappingOptionsBo != null) {
536             if (oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT) || oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)){
537                 if (oleBatchProcessProfileDataMappingOptionsBo.getDataType().equals(OLEConstants.OLEBatchProcess.BATCH_PROCESS_PROFILE_DATATYPE_BIBMARC)) {
538                     matchPointFlag1 = validateDataMappingFieldValue(oleBatchProcessProfileDataMappingOptionsBo.getSourceFieldText());
539                 }
540                 if (oleBatchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField().equals(OLEConstants.OLEBatchProcess.BATCH_PROCESS_PROFILE_DATATYPE_BIBMARC)) {
541                     matchPointFlag2 = validateDataMappingFieldValue(oleBatchProcessProfileDataMappingOptionsBo.getDestinationFieldText());
542                 }
543                 if (!matchPointFlag1 || !matchPointFlag2) {
544                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_DATA_MAPPING_FIELD_ERR);
545                     return getUIFModelAndView(form);
546                 }
547             }
548 
549             boolean dupTagFlag = false;
550             List<OLEBatchProcessProfileMappingOptionsBo> oleBatchProcessProfileMappingOptionsList = oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList();
551             for (OLEBatchProcessProfileMappingOptionsBo oleBatchProcessProfileMappingOptionsBo : oleBatchProcessProfileMappingOptionsList) {
552                 List<OLEBatchProcessProfileDataMappingOptionsBo> oleBatchProcessProfileDataMappingOptionsBoList = oleBatchProcessProfileMappingOptionsBo.getOleBatchProcessProfileDataMappingOptionsBoList();
553                 for (OLEBatchProcessProfileDataMappingOptionsBo batchProcessProfileDataMappingOptionsBo : oleBatchProcessProfileDataMappingOptionsBoList) {
554                     if (oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)) {
555                         oleBatchProcessProfileDataMappingOptionsBo.setSourceField(oleBatchProcessProfileDataMappingOptionsBo.getSourceFieldText());
556                         if (oleBatchProcessProfileDataMappingOptionsBo.getDataType().equals(OLEConstants.OLEBatchProcess.BATCH_PROCESS_PROFILE_DATATYPE_BIBMARC)) {
557                             if (batchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField().equals(oleBatchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField())) {
558                                 if (batchProcessProfileDataMappingOptionsBo.getDestinationField().equals(oleBatchProcessProfileDataMappingOptionsBo.getDestinationField())
559                                         && batchProcessProfileDataMappingOptionsBo.getPriority() == oleBatchProcessProfileDataMappingOptionsBo.getPriority()) {
560                                     dupTagFlag = true;
561                                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_DATA_MAPPING_IMPORT_DESTINATION_FIELD_ERR, oleBatchProcessProfileDataMappingOptionsBo.getDestinationField(), oleBatchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField(), batchProcessProfileDataMappingOptionsBo.getSourceField());
562                                     break;
563                                 }
564                             }
565                         }
566                     } else if (oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) {
567                         oleBatchProcessProfileDataMappingOptionsBo.setDestinationField(oleBatchProcessProfileDataMappingOptionsBo.getDestinationFieldText());
568                         if (!convertEnterDataField(batchProcessProfileDataMappingOptionsBo.getDestinationField()).equals(convertEnterDataField(oleBatchProcessProfileDataMappingOptionsBo.getDestinationField()))) {
569                             if (oleBatchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField().equals(OLEConstants.OLEBatchProcess.BATCH_PROCESS_PROFILE_DATATYPE_BIBMARC)) {
570                                 if (batchProcessProfileDataMappingOptionsBo.getSourceField().equals(oleBatchProcessProfileDataMappingOptionsBo.getSourceField())) {
571                                     if (batchProcessProfileDataMappingOptionsBo.getDataType().equals(oleBatchProcessProfileDataMappingOptionsBo.getDataType())) {
572                                         dupTagFlag = true;
573                                         GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_DATA_MAPPING_EXPORT_SOURCE_FIELD_ERR, oleBatchProcessProfileDataMappingOptionsBo.getSourceField(), oleBatchProcessProfileDataMappingOptionsBo.getDataType(), batchProcessProfileDataMappingOptionsBo.getDestinationField());
574                                         break;
575                                     }
576                                 }
577                             }
578                         } else {
579                             dupTagFlag = true;
580                             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_DATA_MAPPING_EXPORT_DESTINATION_FIELD_ERR, oleBatchProcessProfileDataMappingOptionsBo.getDestinationField(), oleBatchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField(), batchProcessProfileDataMappingOptionsBo.getDataType(), batchProcessProfileDataMappingOptionsBo.getSourceField());
581                             break;
582                         }
583                     } else if (oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT)) {
584                         if (batchProcessProfileDataMappingOptionsBo.getDestinationField().equals(oleBatchProcessProfileDataMappingOptionsBo.getDestinationField())
585                                 && batchProcessProfileDataMappingOptionsBo.getPriority() == oleBatchProcessProfileDataMappingOptionsBo.getPriority()) {
586                             dupTagFlag = true;
587                             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_PRIORITY);
588                             break;
589                         }
590                     }
591                 }
592             }
593 
594             if (dupTagFlag) {
595                 return getUIFModelAndView(form);
596             }
597         }
598         return super.addLine(uifForm, result, request, response);
599     }
600 
601 
602     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLineForProfileConstants")
603     public ModelAndView addLineForProfileConstants(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
604                                            HttpServletRequest request, HttpServletResponse response) {
605 
606         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
607         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
608         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
609         String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
610         CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
611         String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
612         Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
613         OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo = (OLEBatchProcessProfileConstantsBo ) eventObject;
614         if (oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)) {
615             setAttributeValueForBibImport(oleBatchProcessProfileConstantsBo);
616         }
617         if(oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT)){
618             oleBatchProcessProfileConstantsBo.setOldAttributeName(null);
619             setAttributeValueForOrderImport(oleBatchProcessProfileConstantsBo);
620             boolean isRequired = validateRequiredFieldsForProfileConstants(oleBatchProcessProfileConstantsBo);
621             if(!isRequired){
622                 return getUIFModelAndView(form);
623             }
624             boolean isDupFound = validateDuplicateValuesForAttributeName(oleBatchProcessProfileBo.getOleBatchProcessProfileConstantsList(),oleBatchProcessProfileConstantsBo);
625             if(isDupFound){
626                 return getUIFModelAndView(form);
627             }
628             boolean invalidFieldValue = validateFieldValuesForConstantsAndDefaultForOrderImport(oleBatchProcessProfileConstantsBo);
629             if(invalidFieldValue){
630                 return getUIFModelAndView(form);
631             }
632         }
633         if(oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.INVOICE_RECORD_IMPORT)){
634             oleBatchProcessProfileConstantsBo.setOldAttributeName(null);
635             setAttributeValueForInvoiceImport(oleBatchProcessProfileConstantsBo);
636             boolean isRequired = validateRequiredFieldsForProfileConstants(oleBatchProcessProfileConstantsBo);
637             if(!isRequired){
638                 return getUIFModelAndView(form);
639             }
640             boolean isDupFound = validateDuplicateValuesForAttributeName(oleBatchProcessProfileBo.getOleBatchProcessProfileConstantsList(),oleBatchProcessProfileConstantsBo);
641             if(isDupFound){
642                 return getUIFModelAndView(form);
643             }
644             boolean invalidFieldValue = validateFieldValuesForConstantsAndDefaultForInvoiceImport(oleBatchProcessProfileConstantsBo);
645             if(invalidFieldValue){
646                 return getUIFModelAndView(form);
647             }
648         }
649         return super.addLine(uifForm, result, request, response);
650     }
651 
652     private boolean validateDuplicateValuesForAttributeName(List<OLEBatchProcessProfileConstantsBo> oleBatchProcessProfileConstantsBoList,OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo){
653         for(int constantList = 0;constantList < oleBatchProcessProfileConstantsBoList.size();constantList++){
654             if(oleBatchProcessProfileConstantsBoList.get(constantList).getAttributeName().equalsIgnoreCase(oleBatchProcessProfileConstantsBo.getAttributeName())){
655                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_DUPLICATE ,"This field name" );
656                 return true;
657             }
658         }
659         return false;
660     }
661 
662     private boolean validateRequiredFieldsForProfileConstants(OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo) {
663         boolean valid = true;
664             if (StringUtils.isBlank(oleBatchProcessProfileConstantsBo.getDataType())){
665                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Data Type");
666                 valid = false;
667             }
668             if(StringUtils.isBlank(oleBatchProcessProfileConstantsBo.getAttributeName())){
669                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Field Name");
670                 valid = false;
671             }
672             if(StringUtils.isBlank(oleBatchProcessProfileConstantsBo.getAttributeValue())){
673                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Field Value");
674                 valid = false;
675             }
676         return  valid;
677     }
678 
679     private boolean validateFieldValuesForConstantsAndDefaultForOrderImport(OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo) {
680         String attributeName = oleBatchProcessProfileConstantsBo.getAttributeName();
681         if(OLEConstants.OLEBatchProcess.PERCENT.equals(attributeName)){
682             String percent = oleBatchProcessProfileConstantsBo.getAttributeValue();
683             if(!getOleOrderRecordService().validateForPercentage(percent)){
684                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_PERCENT);
685                 return true;
686             }
687         }
688         else if(OLEConstants.OLEBatchProcess.LIST_PRICE.equals(attributeName)){
689             String listPrice = oleBatchProcessProfileConstantsBo.getAttributeValueText();
690             if(!getOleOrderRecordService().validateDestinationFieldValues(listPrice)){
691                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_LIST_PRICE);
692                 return true;
693             }
694         }
695         else if(OLEConstants.OLEBatchProcess.DISCOUNT.equals(attributeName)){
696             String discount = oleBatchProcessProfileConstantsBo.getAttributeValue();
697             if(!getOleOrderRecordService().validateDestinationFieldValues(discount)){
698                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_DISCOUNT);
699                 return true;
700             }
701         }
702         else if(OLEConstants.OLEBatchProcess.QUANTITY.equals(attributeName)){
703             String quantity = oleBatchProcessProfileConstantsBo.getAttributeValue();
704             if(!getOleOrderRecordService().validateForNumber(quantity)){
705                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_QUANTITY);
706                 return true;
707             }
708         }
709         else if(OLEConstants.OLEBatchProcess.ITEM_NO_OF_PARTS.equals(attributeName)){
710             String itemNoOfParts = oleBatchProcessProfileConstantsBo.getAttributeValue();
711             if(!getOleOrderRecordService().validateForNumber(itemNoOfParts)){
712                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_NO_OF_PARTS);
713                 return true;
714             }
715         }
716         else if(OLEConstants.OLEBatchProcess.RECURRING_PAYMENT_BEGIN_DT.equals(oleBatchProcessProfileConstantsBo.getAttributeName()) || OLEConstants.OLEBatchProcess.RECURRING_PAYMENT_END_DT.equals(oleBatchProcessProfileConstantsBo.getAttributeName())){
717             boolean validRecurringPaymenteDate = validateRecurringPaymentDate(oleBatchProcessProfileConstantsBo.getAttributeValue());
718             if(!validRecurringPaymenteDate){
719                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_RECURRING_PAYMENT_DATE);
720                 return true;
721             }
722         }
723 
724         return false;
725     }
726 
727     private void setAttributeValueForOrderImport(OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo){
728         String attributeName = oleBatchProcessProfileConstantsBo.getAttributeName();
729         if(attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.PERCENT) || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.LIST_PRICE) ||
730                 attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DISCOUNT) || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.QUANTITY) || OLEConstants.OLEBatchProcess.ITEM_NO_OF_PARTS.equals(attributeName) ||
731                 attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.RECURR_PAY_BEGIN_DATE) || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.RECURR_PAY_END_DATE)){
732             oleBatchProcessProfileConstantsBo.setAttributeValue(oleBatchProcessProfileConstantsBo.getAttributeValueText());
733         }
734     }
735     private void setAttributeValueForInvoiceImport(OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo){
736         String attributeName = oleBatchProcessProfileConstantsBo.getAttributeName();
737         if(attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.LIST_PRICE) || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.INVOICE_NUMBER) ||
738                 attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.QUANTITY) || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.VENDOR_INVOICE_AMOUNT) ||
739                 attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.INVOICE_DATE) || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.EXCHANGE_RATE) || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.FOREIGN_LIST_PRICE)){
740             oleBatchProcessProfileConstantsBo.setAttributeValue(oleBatchProcessProfileConstantsBo.getAttributeValueText());
741         }
742     }
743 
744     private void setAttributeValueForBibImport(OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo) {
745         String attributeName = oleBatchProcessProfileConstantsBo.getAttributeName();
746         if (attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_CALL_NUMBER)
747                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_CALL_NUMBER_TYPE_PREFIX)
748                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_COPY_NUMBER)
749                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER)
750                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER_PREFIX)
751                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_ITEM_HOLDINGS_COPY_NUMBER)
752                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.SOURCE_FIELD_DATE_CREATED)
753                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_ITEM_ITEM_BARCODE)
754                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_LINK_URL)
755                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_PERSISTENTLINK)
756                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_LINK_TEXT)
757                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_PUBLIC_DISPLAY_NOTE)
758                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_COVERAGE_START_DATE)
759                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_COVERAGE_START_ISSUE)
760                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_COVERAGE_START_VOLUME)
761                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_COVERAGE_END_DATE)
762                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_COVERAGE_END_ISSUE)
763                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_COVERAGE_END_VOLUME)
764                 || attributeName.equalsIgnoreCase(OLEConstants.OLEBatchProcess.DESTINATION_FIELD_PLATFORM)) {
765             oleBatchProcessProfileConstantsBo.setAttributeValue(oleBatchProcessProfileConstantsBo.getAttributeValueText());
766         }
767     }
768 
769     private boolean validateRequiredForMapping(OLEBatchProcessProfileDataMappingOptionsBo dataMappingOptionsBo, OLEBatchProcessProfileBo profileBo , MaintenanceDocumentForm form) {
770         boolean valid = true;
771         if ((profileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT))) {
772             if (StringUtils.isBlank(dataMappingOptionsBo.getDataType())){
773                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Data Type");
774                 valid = false;
775             }
776             if(StringUtils.isBlank(dataMappingOptionsBo.getSourceFieldText())){
777                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Source Field");
778                 valid = false;
779             }
780             if(StringUtils.isBlank(dataMappingOptionsBo.getDataTypeDestinationField())){
781                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Destination Data Type");
782                 valid = false;
783             }
784             if(StringUtils.isBlank(dataMappingOptionsBo.getDestinationField())){
785                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Destination Field");
786                 valid = false;
787             }
788         }
789         if ((profileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT))) {
790             if(StringUtils.isBlank(dataMappingOptionsBo.getDataType())){
791                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Data Type");
792                 valid = false;
793             }
794             if(StringUtils.isBlank(dataMappingOptionsBo.getSourceField())){
795                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Source Field");
796                 valid = false;
797             }
798             if(StringUtils.isBlank(dataMappingOptionsBo.getDataTypeDestinationField())){
799                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Destination Field");
800                 valid = false;
801             }
802             if(StringUtils.isBlank(dataMappingOptionsBo.getDestinationFieldText())){
803                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Destination Field Value");
804                 valid = false;
805             }
806         }
807         if ((profileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT))) {
808             if(StringUtils.isBlank(dataMappingOptionsBo.getSourceField())){
809                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Source Field");
810                 valid = false;
811             }
812             if(StringUtils.isBlank(dataMappingOptionsBo.getDataTypeDestinationField())){
813                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Destination Data Type");
814                 valid = false;
815             }
816             if(StringUtils.isBlank(dataMappingOptionsBo.getDestinationField())){
817                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Destination Field");
818                 valid = false;
819             }
820         }
821         if ((profileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.INVOICE_RECORD_IMPORT))) {
822             if(StringUtils.isBlank(dataMappingOptionsBo.getSourceField())){
823                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Source Field");
824                 valid = false;
825             }
826             if(StringUtils.isBlank(dataMappingOptionsBo.getDataTypeDestinationField())){
827                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Destination Data Type");
828                 valid = false;
829             }
830             if(StringUtils.isBlank(dataMappingOptionsBo.getDestinationField())){
831                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_REQUIRED , "Destination Field");
832                 valid = false;
833             }
834         }
835 
836         return valid;
837     }
838 
839     private boolean validateFieldValuesForConstantsAndDefaultForInvoiceImport(OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo) {
840 
841         if(OLEConstants.OLEBatchProcess.QUANTITY.equals(oleBatchProcessProfileConstantsBo.getAttributeName())){
842             String quantity = oleBatchProcessProfileConstantsBo.getAttributeValue();
843             if(!getOleOrderRecordService().validateForNumber(quantity)){
844                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_QUANTITY);
845                 return true;
846             }
847         }
848         /*else if(OLEConstants.OLEBatchProcess.INVOICE_NUMBER.equals(oleBatchProcessProfileConstantsBo.getAttributeName())){
849             String invoiceNumber = oleBatchProcessProfileConstantsBo.getAttributeValue();
850             if(!getOleOrderRecordService().validateForNumber(invoiceNumber)){
851                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_INVOICE_NUMBER);
852                 return true;
853             }
854         }*/
855         else if(OLEConstants.OLEBatchProcess.LIST_PRICE.equals(oleBatchProcessProfileConstantsBo.getAttributeName())){
856             String listPrice = oleBatchProcessProfileConstantsBo.getAttributeValue();
857             if(!getOleOrderRecordService().validateDestinationFieldValues(listPrice)){
858                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_INVOICED_PRICE);
859                 return true;
860             }
861         }
862         else if(OLEConstants.OLEBatchProcess.FOREIGN_LIST_PRICE.equals(oleBatchProcessProfileConstantsBo.getAttributeName())){
863             String foreignListPrice = oleBatchProcessProfileConstantsBo.getAttributeValue();
864             if(!getOleOrderRecordService().validateDestinationFieldValues(foreignListPrice)){
865                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_INVOICED_FOREIGN_PRICE);
866                 return true;
867             }
868         }
869         else if(OLEConstants.OLEBatchProcess.VENDOR_INVOICE_AMOUNT.equals(oleBatchProcessProfileConstantsBo.getAttributeName())){
870             String vendorInvoiceAmount = oleBatchProcessProfileConstantsBo.getAttributeValue();
871             if(!getOleOrderRecordService().validateDestinationFieldValues(vendorInvoiceAmount)){
872                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_VENDOR_INVOICE_AMOUNT);
873                 return true;
874             }
875         }
876         else if(OLEConstants.OLEBatchProcess.INVOICE_DATE.equals(oleBatchProcessProfileConstantsBo.getAttributeName())){
877             boolean validInvoiceDate = validateInvoiceDate(oleBatchProcessProfileConstantsBo.getAttributeValue());
878             if(!validInvoiceDate){
879                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_INVOICE_DATE);
880                 return true;
881             }
882         }
883         else if(OLEConstants.OLEBatchProcess.EXCHANGE_RATE.equals(oleBatchProcessProfileConstantsBo.getAttributeName())){
884             String exchangeRate = oleBatchProcessProfileConstantsBo.getAttributeValue();
885             if(!getOleOrderRecordService().validateDestinationFieldValues(exchangeRate)){
886                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_EXCHANGE_RATE);
887                 return true;
888             }
889             if (exchangeRate.length()>10) {
890                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_CONSTANT_SECTION_ID, OLEConstants.OLEBatchProcess.INVALID_EXCHANGE_RATE_NUMBER);
891                 return true;
892             }
893         }
894         return false;
895     }
896 
897     private boolean validateInvoiceDate(String invoiceDate){
898         SimpleDateFormat dateFromRawFile = new SimpleDateFormat("yyyyMMdd");
899         try {
900             dateFromRawFile.parse(invoiceDate);
901             return true;
902         }
903         catch (ParseException e) {
904             return false;
905         }
906     }
907 
908     public boolean validateRecurringPaymentDate(String recurringPaymentDate){
909         SimpleDateFormat dateFromRawFile = new SimpleDateFormat(org.kuali.ole.OLEConstants.DATE_FORMAT);
910         dateFromRawFile.setLenient(false);
911         try {
912             dateFromRawFile.parse(recurringPaymentDate);
913             return true;
914         }
915         catch (ParseException e) {
916             return false;
917         }
918     }
919 
920     private String convertEnterDataField(String tag) {
921         if (StringUtils.isNotEmpty(tag)) {
922             String[] matchPointArray = tag.split(" ");
923             if (matchPointArray.length == 3) {
924                 tag = matchPointArray[0] + " " + matchPointArray[2];
925             }
926         }
927         return tag;
928     }
929 
930     /**
931      * Validates the match point to match with the pattern 001 ,245 $a, 245 ## $a, 245 04 $a, 245 #4 $a, 245 0# $a
932      * @param bibMatchPoint
933      * @return
934      */
935     private boolean validateBibMatchPoint(String bibMatchPoint) {
936         boolean valid = true;
937         String pattern = "((001)|(^\\d\\d\\d\\s+([$]([a-z]|\\d))$)|(^\\d\\d\\d\\s+[#|\\d][#|\\d]\\s+([$]([a-z]|\\d))$))";
938         if (Pattern.matches(pattern, bibMatchPoint) == Boolean.FALSE) {
939             valid = false;
940         }
941         return valid;
942     }
943 
944     /**
945      * Validates the data mapping field value to match with the pattern 001, 245 $a, 245 $a$b, 245 ## $a, 245 04 $a, 245 ## $a$b
946      * @param fieldValue
947      * @return
948      */
949     private boolean validateDataMappingFieldValue(String fieldValue) {
950         boolean valid = true;
951         String pattern = "((001)|(^\\d\\d\\d\\s+([$]([a-z]|\\d))+$)|(^\\d\\d\\d\\s+[#|\\d][#|\\d]\\s+([$]([a-z]|\\d))+$))";
952         if (Pattern.matches(pattern, fieldValue) == Boolean.FALSE) {
953             valid = false;
954         }
955         return valid;
956     }
957 
958     private boolean validateFilterCriteriaFieldValue(String fieldValue) {
959         boolean valid = true;
960 
961         String pattern = "((^\\d\\d\\d\\s+([$][a-z])+$)|(^\\d\\d\\d\\s+[#|\\d][#|\\d]\\s+([$][a-z])+$))";
962         if (Pattern.matches(pattern, fieldValue) == Boolean.FALSE) {
963             valid = false;
964         }
965         return valid;
966     }
967 
968     @RequestMapping(params = "methodToCall=refreshPageView")
969     public ModelAndView refreshPageView(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
970                                         HttpServletRequest request, HttpServletResponse response) throws Exception {
971 
972         //OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
973 
974        /* MaintenanceDocumentForm form1 = (MaintenanceDocumentForm) form;
975         MaintenanceDocument document = (MaintenanceDocument) form1.getDocument();*/
976 
977         return refresh(form,result,request,response);
978     }
979     @RequestMapping(params = "methodToCall=refreshBeanId")
980     public ModelAndView refreshBeanId(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
981                                       HttpServletRequest request, HttpServletResponse response) throws Exception {
982         return navigate(form, result, request, response);
983     }
984 
985     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteBibStatus")
986     public ModelAndView deleteBibStatus(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
987                                         HttpServletRequest request, HttpServletResponse response) {
988         LOG.debug("Initialized addLine method");
989         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
990         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
991         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
992         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
993         oleBatchProcessProfileBo.getDeleteBatchProcessProfileBibStatusList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileBibStatusList().get(Integer.parseInt(selectedLineIndex)));
994 
995         return deleteLine(uifForm, result, request, response);
996 
997     }
998     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteDeleteField")
999     public ModelAndView deleteDeleteField(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1000                                           HttpServletRequest request, HttpServletResponse response) {
1001         LOG.debug("Initialized addLine method");
1002         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1003         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1004         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1005         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
1006         oleBatchProcessProfileBo.getDeletedBatchProcessProfileDeleteFieldsList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileDeleteFieldsList().get(Integer.parseInt(selectedLineIndex)));
1007 
1008         return deleteLine(uifForm, result, request, response);
1009 
1010     }
1011     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteRenameField")
1012     public ModelAndView deleteRenameField(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1013                                           HttpServletRequest request, HttpServletResponse response) {
1014         LOG.debug("Initialized addLine method");
1015         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1016         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1017         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1018         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
1019         oleBatchProcessProfileBo.getDeletedBatchProcessProfileRenameFieldsList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileRenameFieldsList().get(Integer.parseInt(selectedLineIndex)));
1020         return deleteLine(uifForm, result, request, response);
1021     }
1022     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=filterCriteriaDelete")
1023     public ModelAndView filterCriteriaDelete(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1024                                              HttpServletRequest request, HttpServletResponse response) {
1025         LOG.debug("Initialized addLine method");
1026         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1027         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1028         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1029         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
1030         oleBatchProcessProfileBo.getDeleteBatchProcessProfileFilterCriteriaList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileFilterCriteriaList().get(Integer.parseInt(selectedLineIndex)));
1031         return deleteLine(uifForm, result, request, response);
1032     }
1033 
1034     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=dataMappingDelete")
1035     public ModelAndView dataMappingDelete(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1036                                           HttpServletRequest request, HttpServletResponse response) {
1037         LOG.debug("Initialized addLine method");
1038         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1039         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1040         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1041         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
1042         oleBatchProcessProfileBo.getDeletedBatchProcessProfileMappingOptionsList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList().get(Integer.parseInt(selectedLineIndex)));
1043         oleBatchProcessProfileBo.getDeletedBatchProcessProfileDataMappingOptionsList().addAll(oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList().get(Integer.parseInt(selectedLineIndex)).getOleBatchProcessProfileDataMappingOptionsBoList());
1044         return deleteLine(uifForm, result, request, response);
1045     }
1046 
1047     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLineDataMappingDelete")
1048     public ModelAndView addLineDataMappingDelete(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1049                                                  HttpServletRequest request, HttpServletResponse response) {
1050         LOG.debug("Initialized addLine method");
1051         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1052         Map<String,String> actionParameters = form.getActionParameters();
1053         String subCollectionIndex = actionParameters.get(UifParameters.SELECTED_LINE_INDEX);
1054         String mainCollectionIndex= StringUtils.substringBefore(StringUtils.substringAfter(actionParameters.get(UifParameters.SELLECTED_COLLECTION_PATH),"["),"]");
1055         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1056         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
1057         OLEBatchProcessProfileDataMappingOptionsBo oleBatchProcessProfileDataMappingOptionsBo = oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList().get(Integer.parseInt(mainCollectionIndex)).getOleBatchProcessProfileDataMappingOptionsBoList().get(Integer.parseInt(subCollectionIndex));
1058         if(oleBatchProcessProfileBo.getBatchProcessProfileId()!=null){
1059             //KRADServiceLocator.getBusinessObjectService().delete(oleBatchProcessProfileDataMappingOptionsBo);
1060             oleBatchProcessProfileBo.getDeletedBatchProcessProfileDataMappingOptionsList().add(oleBatchProcessProfileDataMappingOptionsBo);
1061             oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList().get(Integer.parseInt(mainCollectionIndex)).getOleBatchProcessProfileDataMappingOptionsBoList().remove(Integer.parseInt(subCollectionIndex));
1062             return getUIFModelAndView(uifForm);
1063         }else{
1064             oleBatchProcessProfileBo.getDeletedBatchProcessProfileDataMappingOptionsList().add(oleBatchProcessProfileDataMappingOptionsBo);
1065             return deleteLine(uifForm, result, request, response);
1066         }
1067     }
1068 
1069     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteProfileConstant")
1070     public ModelAndView deleteProfileConstant(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1071                                               HttpServletRequest request, HttpServletResponse response) {
1072         LOG.debug("Initialized addLine method");
1073         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1074         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1075         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1076         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
1077         if(oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.ORDER_RECORD_IMPORT) ||
1078                 oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.INVOICE_RECORD_IMPORT)){
1079             String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
1080             CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
1081             String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
1082             Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
1083             OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo = (OLEBatchProcessProfileConstantsBo ) eventObject;
1084             oleBatchProcessProfileConstantsBo.setOldAttributeName(null);
1085         }
1086         oleBatchProcessProfileBo.getDeletedBatchProcessProfileConstantsList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileConstantsList().get(Integer.parseInt(selectedLineIndex)));
1087         return deleteLine(uifForm, result, request, response);
1088     }
1089 
1090     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteProfileProtectedField")
1091     public ModelAndView deleteProfileProtectedField(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1092                                                     HttpServletRequest request, HttpServletResponse response) {
1093         LOG.debug("Initialized addLine method");
1094         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1095         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1096         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1097         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
1098         oleBatchProcessProfileBo.getDeletedBatchProcessProfileProtectedFieldList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileProtectedFieldList().get(Integer.parseInt(selectedLineIndex)));
1099         return deleteLine(uifForm, result, request, response);
1100     }
1101 
1102     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteBibMatch")
1103     public ModelAndView deleteBibMatch(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1104                                        HttpServletRequest request, HttpServletResponse response) {
1105         LOG.debug("Initialized deleteLine method");
1106         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1107         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1108         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1109         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
1110         oleBatchProcessProfileBo.getDeletedBatchProcessProfileMatchPointList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileBibliographicMatchPointList().get(Integer.parseInt(selectedLineIndex)));
1111         return deleteLine(uifForm, result, request, response);
1112     }
1113 
1114     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteHoldingMatch")
1115     public ModelAndView deleteHoldingMatch(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1116                                            HttpServletRequest request, HttpServletResponse response) {
1117         LOG.debug("Initialized deleteLine method");
1118         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1119         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1120         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1121         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
1122         oleBatchProcessProfileBo.getDeletedBatchProcessProfileMatchPointList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileHoldingMatchPointList().get(Integer.parseInt(selectedLineIndex)));
1123         return deleteLine(uifForm, result, request, response);
1124     }
1125 
1126     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteItemMatch")
1127     public ModelAndView deleteItemMatch(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1128                                         HttpServletRequest request, HttpServletResponse response) {
1129         LOG.debug("Initialized deleteLine method");
1130         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1131         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1132         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1133         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
1134         oleBatchProcessProfileBo.getDeletedBatchProcessProfileMatchPointList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileItemMatchPointList().get(Integer.parseInt(selectedLineIndex)));
1135         return deleteLine(uifForm, result, request, response);
1136     }
1137     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteEholdingMatch")
1138     public ModelAndView deleteEholdingMatch(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1139                                             HttpServletRequest request, HttpServletResponse response) {
1140         LOG.debug("Initialized deleteLine method");
1141         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1142         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
1143         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1144         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
1145         oleBatchProcessProfileBo.getDeletedBatchProcessProfileMatchPointList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileEholdingMatchPointList().get(Integer.parseInt(selectedLineIndex)));
1146         return deleteLine(uifForm, result, request, response);
1147     }
1148 
1149     @RequestMapping(params = "methodToCall=populateExchangeRate")
1150     public ModelAndView populateExchangeRate(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
1151                                         HttpServletRequest request, HttpServletResponse response) throws Exception {
1152 
1153         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
1154         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
1155         CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath("document.newMaintainableObject.dataObject.oleBatchProcessProfileConstantsList");
1156         String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
1157         Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
1158         OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo = (OLEBatchProcessProfileConstantsBo ) eventObject;
1159         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
1160         List<OLEBatchProcessProfileConstantsBo> oleBatchProcessProfileConstantsBoList = oleBatchProcessProfileBo.getOleBatchProcessProfileConstantsList();
1161         for(int recordCount = 0; recordCount < oleBatchProcessProfileConstantsBoList.size();recordCount++) {
1162             if(oleBatchProcessProfileConstantsBoList.get(recordCount).getAttributeName().equalsIgnoreCase(OLEConstants.OLEBatchProcess.CURRENCY_TYPE)){
1163                 if(!oleBatchProcessProfileConstantsBoList.get(recordCount).getAttributeValue().equalsIgnoreCase(OleSelectConstant.CURRENCY_TYPE_NAME)){
1164                     String currencyTypeId = getOleInvoiceService().getCurrencyTypeIdFromCurrencyType(oleBatchProcessProfileConstantsBoList.get(recordCount).getAttributeValue());
1165                     Map exchangeRateMap = new HashMap();
1166                     exchangeRateMap.put(OLEConstants.OLEBatchProcess.CURRENCY_TYPE_ID,currencyTypeId);
1167                     List<OleExchangeRate> exchangeRateList = (List) getBusinessObjectService().findMatchingOrderBy(
1168                             OleExchangeRate.class, exchangeRateMap, OleSelectConstant.EXCHANGE_RATE_DATE, false);
1169                     oleBatchProcessProfileConstantsBo.setAttributeValueText(exchangeRateList.get(0).getExchangeRate().toString());
1170                 }
1171                 else {
1172                     oleBatchProcessProfileConstantsBo.setAttributeValueText("0.0");
1173                 }
1174                 break;
1175             }
1176             oleBatchProcessProfileConstantsBo.setAttributeValueText("0.0");
1177         }
1178         return getUIFModelAndView(form);
1179     }
1180 
1181 }