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.select.bo.OleGloballyProtectedField;
7   import org.kuali.rice.krad.maintenance.MaintenanceDocument;
8   import org.kuali.rice.krad.service.KRADServiceLocator;
9   import org.kuali.rice.krad.uif.UifParameters;
10  import org.kuali.rice.krad.uif.container.CollectionGroup;
11  import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
12  import org.kuali.rice.krad.uif.view.View;
13  import org.kuali.rice.krad.util.GlobalVariables;
14  import org.kuali.rice.krad.util.KRADConstants;
15  import org.kuali.rice.krad.web.controller.MaintenanceDocumentController;
16  import org.kuali.rice.krad.web.form.DocumentFormBase;
17  import org.kuali.rice.krad.web.form.MaintenanceDocumentForm;
18  import org.kuali.rice.krad.web.form.UifFormBase;
19  import org.springframework.stereotype.Controller;
20  import org.springframework.validation.BindingResult;
21  import org.springframework.web.bind.annotation.ModelAttribute;
22  import org.springframework.web.bind.annotation.RequestMapping;
23  import org.springframework.web.bind.annotation.RequestMethod;
24  import org.springframework.web.servlet.ModelAndView;
25  
26  import javax.servlet.http.HttpServletRequest;
27  import javax.servlet.http.HttpServletResponse;
28  import java.util.*;
29  import java.util.regex.Pattern;
30  
31  /**
32   * Created with IntelliJ IDEA.
33   * User: adityas
34   * Date: 7/10/13
35   * Time: 4:30 PM
36   * To change this template use File | Settings | File Templates.
37   */
38  
39  @Controller
40  @RequestMapping(value = "/oleBatchProcessProfile")
41  public class OLEBatchProcessProfileController extends MaintenanceDocumentController {
42  
43      /**
44       *   This method takes the initial request when click on OlePatronRecord Screen.
45       * @param form
46       * @param result
47       * @param request
48       * @param response
49       * @return  ModelAndView
50       */
51      @Override
52      @RequestMapping(params = "methodToCall=start")
53      public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
54                                HttpServletRequest request, HttpServletResponse response) {
55          LOG.debug("Start -- Start Method of OlePatronRecordForm");
56          MaintenanceDocumentForm maintenanceForm = (MaintenanceDocumentForm) form;
57          setupMaintenance(maintenanceForm, request, KRADConstants.MAINTENANCE_NEW_ACTION);
58          MaintenanceDocument document = (MaintenanceDocument) maintenanceForm.getDocument();
59          OLEBatchProcessProfileBo batchProcessProfileBo = (OLEBatchProcessProfileBo) document.getDocumentDataObject();
60          List<OleGloballyProtectedField> oleGloballyProtectedFields = (List<OleGloballyProtectedField>) KRADServiceLocator.getBusinessObjectService().findAll(OleGloballyProtectedField.class);
61          if(oleGloballyProtectedFields.size()>0){
62              List<OLEBatchGloballyProtectedField> batchGloballyProtectedFields = new ArrayList<OLEBatchGloballyProtectedField>();
63              for(OleGloballyProtectedField globallyProtectedField : oleGloballyProtectedFields){
64                  OLEBatchGloballyProtectedField oleBatchGloballyProtectedField = new OLEBatchGloballyProtectedField();
65                  oleBatchGloballyProtectedField.setGloballyProtectedFieldId(globallyProtectedField.getOleGloballyProtectedFieldId());
66                  oleBatchGloballyProtectedField.setTag(globallyProtectedField.getTag());
67                  oleBatchGloballyProtectedField.setFirstIndicator(globallyProtectedField.getFirstIndicator());
68                  oleBatchGloballyProtectedField.setSecondIndicator(globallyProtectedField.getSecondIndicator());
69                  oleBatchGloballyProtectedField.setSubField(globallyProtectedField.getSubField());
70                  batchGloballyProtectedFields.add(oleBatchGloballyProtectedField);
71              }
72              batchProcessProfileBo.setOleBatchGloballyProtectedFieldList(batchGloballyProtectedFields);
73          }
74          /*List<OLEBatchGloballyProtectedField> oleGloballyProtectedFields=batchProcessProfileBo.getOleBatchGloballyProtectedFieldList();
75  
76          List<OLEBatchProcessProfileProtectedField> oleBatchProcessProfileProtectedFields=batchProcessProfileBo.getOleBatchProcessProfileProtectedFieldList();
77          for(OLEBatchGloballyProtectedField globallyProtectedField:oleGloballyProtectedFields){
78                     if(globallyProtectedField.isIgnoreValue()){
79                         OLEBatchProcessProfileProtectedField oleBatchGloballyProtectedField = new OLEBatchProcessProfileProtectedField();
80                         oleBatchGloballyProtectedField.setFirstIndicator(globallyProtectedField.getFirstIndicator());
81                         oleBatchGloballyProtectedField.setSecondIndicator(globallyProtectedField.getSecondIndicator());
82                         oleBatchGloballyProtectedField.setTag(globallyProtectedField.getTag());
83                         oleBatchGloballyProtectedField.setSubField(globallyProtectedField.getSubField());
84                         oleBatchProcessProfileProtectedFields.add(oleBatchGloballyProtectedField);
85                     }
86          }
87          batchProcessProfileBo.setOleBatchGloballyProtectedFieldList(oleGloballyProtectedFields);*/
88          return super.start(form, result, request, response);
89      }
90  
91      @Override
92      @RequestMapping(params = "methodToCall=maintenanceEdit")
93      public ModelAndView maintenanceEdit(@ModelAttribute("KualiForm") MaintenanceDocumentForm form, BindingResult result,
94                                          HttpServletRequest request, HttpServletResponse response) throws Exception {
95          MaintenanceDocumentForm maintenanceForm = (MaintenanceDocumentForm) form;
96          setupMaintenance(form, request, KRADConstants.MAINTENANCE_EDIT_ACTION);
97          MaintenanceDocument document = (MaintenanceDocument) maintenanceForm.getDocument();
98          OLEBatchProcessProfileBo oldOleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getOldMaintainableObject().getDataObject();
99          OLEBatchProcessProfileBo newOleBatchProcessProfileBo = (OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
100         Map<String,String> map=new HashMap<String,String>();
101         map.put("batchProcessProfileId",oldOleBatchProcessProfileBo.getBatchProcessProfileId());
102         List<OLEBatchGloballyProtectedField> existBatchGloballyProtectedFields = (List<OLEBatchGloballyProtectedField>) KRADServiceLocator.getBusinessObjectService().findMatching(OLEBatchGloballyProtectedField.class,map);
103         List<OleGloballyProtectedField> oleGloballyProtectedFields = (List<OleGloballyProtectedField>) KRADServiceLocator.getBusinessObjectService().findAll(OleGloballyProtectedField.class);
104         if (oleGloballyProtectedFields.size() > 0) {
105             List<OLEBatchGloballyProtectedField> batchGloballyProtectedFields = new ArrayList<OLEBatchGloballyProtectedField>();
106             for (OleGloballyProtectedField globallyProtectedField : oleGloballyProtectedFields) {
107                 OLEBatchGloballyProtectedField oleBatchGloballyProtectedField = new OLEBatchGloballyProtectedField();
108                 oleBatchGloballyProtectedField.setGloballyProtectedFieldId(globallyProtectedField.getOleGloballyProtectedFieldId());
109                 oleBatchGloballyProtectedField.setTag(globallyProtectedField.getTag());
110                 oleBatchGloballyProtectedField.setFirstIndicator(globallyProtectedField.getFirstIndicator());
111                 oleBatchGloballyProtectedField.setSecondIndicator(globallyProtectedField.getSecondIndicator());
112                 oleBatchGloballyProtectedField.setSubField(globallyProtectedField.getSubField());
113                 for (OLEBatchGloballyProtectedField existBatchGloballyProtectedField : existBatchGloballyProtectedFields) {
114                     if (existBatchGloballyProtectedField.getGloballyProtectedFieldId().equals(globallyProtectedField.getOleGloballyProtectedFieldId())) {
115                         oleBatchGloballyProtectedField.setIgnoreValue(existBatchGloballyProtectedField.isIgnoreValue());
116                         oleBatchGloballyProtectedField.setId(existBatchGloballyProtectedField.getId());
117                     }
118                 }
119                 batchGloballyProtectedFields.add(oleBatchGloballyProtectedField);
120             }
121             oldOleBatchProcessProfileBo.setOleBatchGloballyProtectedFieldList(batchGloballyProtectedFields);
122         }
123         return super.maintenanceEdit(form, result, request, response);
124     }
125 
126     @Override
127     @RequestMapping(params = "methodToCall=route")
128     public ModelAndView route(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
129                               HttpServletRequest request, HttpServletResponse response) {
130         MaintenanceDocumentForm mainForm = (MaintenanceDocumentForm) form;
131         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
132         OLEBatchProcessProfileBo oldOleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getOldMaintainableObject().getDataObject();
133         //OLEBatchProcessProfileBo oleBatchProcessProfileBo1 = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
134         OLEBatchProcessProfileBo newOleBatchProcessProfileBo = (OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
135         List<OLEBatchProcessProfileFilterCriteriaBo> filterCriteriaBoList=new ArrayList<OLEBatchProcessProfileFilterCriteriaBo>();
136         if(newOleBatchProcessProfileBo.getOleBatchProcessProfileFilterCriteriaList().size()>0){
137             for(OLEBatchProcessProfileFilterCriteriaBo oleBatchProcessProfileFilterCriteriaBo:newOleBatchProcessProfileBo.getOleBatchProcessProfileFilterCriteriaList()){
138                 if((oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName().isEmpty() || oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName()==null) ){
139                     oleBatchProcessProfileFilterCriteriaBo.setFilterFieldName(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldNameText());
140                 }
141                 filterCriteriaBoList.add(oleBatchProcessProfileFilterCriteriaBo);
142             }
143             ((OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject()).setOleBatchProcessProfileFilterCriteriaList(filterCriteriaBoList);
144             ((MaintenanceDocumentForm) form).setDocument(document);
145         }
146 
147         List<OLEBatchProcessProfileBibMatchPoint> oleBatchProcessProfileBibMatchPoints=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileBibMatchPointList();
148         KRADServiceLocator.getBusinessObjectService().save(oleBatchProcessProfileBibMatchPoints);
149         for(OLEBatchProcessProfileBibMatchPoint oleBatchProcessProfileBibMatchPoint:oleBatchProcessProfileBibMatchPoints){
150             Map<String,String> map=new HashMap<String,String>();
151             map.put("oleBibMatchPointId",oleBatchProcessProfileBibMatchPoint.getOleBibMatchPointId());
152             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileBibMatchPoint.class,map);
153         }
154 
155         List<OLEBatchProcessProfileBibStatus> oleBatchProcessProfileBibStatuses=newOleBatchProcessProfileBo.getDeleteBatchProcessProfileBibStatusList();
156         KRADServiceLocator.getBusinessObjectService().save(oleBatchProcessProfileBibStatuses);
157         for(OLEBatchProcessProfileBibStatus oleBatchProcessProfileBibStatus:oleBatchProcessProfileBibStatuses){
158             Map<String,String> map=new HashMap<String,String>();
159             map.put("batchProcessBibStatusId",oleBatchProcessProfileBibStatus.getBatchProcessBibStatusId());
160             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileBibStatus.class,map);
161         }
162 
163         List<OLEBatchProcessProfileDeleteField> oleBatchProcessProfileDeleteFields=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileDeleteFieldsList();
164         KRADServiceLocator.getBusinessObjectService().save(oleBatchProcessProfileDeleteFields);
165         for(OLEBatchProcessProfileDeleteField oleBatchProcessProfileDeleteField:oleBatchProcessProfileDeleteFields){
166             Map<String,String> map=new HashMap<String,String>();
167             map.put("id",oleBatchProcessProfileDeleteField.getId());
168             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileDeleteField.class,map);
169         }
170 
171         List<OLEBatchProcessProfileRenameField> oleBatchProcessProfileRenameFields=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileRenameFieldsList();
172         for(OLEBatchProcessProfileRenameField oleBatchProcessProfileRenameField:oleBatchProcessProfileRenameFields){
173             Map<String,String> map=new HashMap<String,String>();
174             map.put("id",oleBatchProcessProfileRenameField.getId());
175             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileRenameField.class,map);
176         }
177         List<OLEBatchProcessProfileFilterCriteriaBo> oleBatchProcessProfileFilterCriteriaBos=newOleBatchProcessProfileBo.getDeleteBatchProcessProfileFilterCriteriaList();
178         for(OLEBatchProcessProfileFilterCriteriaBo oleBatchProcessProfileFilterCriteriaBo:oleBatchProcessProfileFilterCriteriaBos){
179             Map<String,String> map=new HashMap<String,String>();
180             map.put("filterId",oleBatchProcessProfileFilterCriteriaBo.getFilterId());
181             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileFilterCriteriaBo.class,map);
182         }
183         List<OLEBatchProcessProfileDataMappingOptionsBo> oleBatchProcessProfileDataMappingOptionsBos=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileDataMappingOptionsList();
184         for(OLEBatchProcessProfileDataMappingOptionsBo oleBatchProcessProfileDataMappingOptionsBo:oleBatchProcessProfileDataMappingOptionsBos){
185             Map<String,String> map=new HashMap<String,String>();
186             map.put("oleBatchProcessProfileDataMappingOptionId",oleBatchProcessProfileDataMappingOptionsBo.getOleBatchProcessProfileDataMappingOptionId());
187             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileDataMappingOptionsBo.class,map);
188         }
189         List<OLEBatchProcessProfileMappingOptionsBo> oleBatchProcessProfileMappingOptionsBos=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileMappingOptionsList();
190         for(OLEBatchProcessProfileMappingOptionsBo oleBatchProcessProfileMappingOptionsBo:oleBatchProcessProfileMappingOptionsBos){
191             Map<String,String> map=new HashMap<String,String>();
192             map.put("oleBatchProcessDataMapId",oleBatchProcessProfileMappingOptionsBo.getOleBatchProcessDataMapId());
193             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileMappingOptionsBo.class,map);
194         }
195         List<OLEBatchProcessProfileConstantsBo> oleBatchProcessProfileConstantsBos=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileConstantsList();
196         for(OLEBatchProcessProfileConstantsBo oleBatchProcessProfileConstantsBo:oleBatchProcessProfileConstantsBos){
197             Map<String,String> map=new HashMap<String,String>();
198             map.put("oleBatchProcessProfileConstantsId",oleBatchProcessProfileConstantsBo.getOleBatchProcessProfileConstantsId());
199             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileConstantsBo.class,map);
200         }
201         List<OLEBatchProcessProfileProtectedField> oleBatchProcessProfileProtectedFields=newOleBatchProcessProfileBo.getDeletedBatchProcessProfileProtectedFieldList();
202         for(OLEBatchProcessProfileProtectedField oleBatchProcessProfileProtectedField:oleBatchProcessProfileProtectedFields){
203             Map<String,String> map=new HashMap<String,String>();
204             map.put("oleProfileProtectedFieldId",oleBatchProcessProfileProtectedField.getOleProfileProtectedFieldId());
205             KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchProcessProfileProtectedField.class,map);
206         }
207         List<OLEBatchGloballyProtectedField> batchGloballyProtectedFields = new ArrayList<OLEBatchGloballyProtectedField>();
208         batchGloballyProtectedFields.addAll(newOleBatchProcessProfileBo.getOleBatchGloballyProtectedFieldList());
209 
210         if (StringUtils.isNotBlank(newOleBatchProcessProfileBo.getBatchProcessProfileId())) {
211             for (OLEBatchGloballyProtectedField globallyProtectedField : batchGloballyProtectedFields) {
212                 Map<String, String> map = new HashMap<String, String>();
213                 map.put("batchProcessProfileId", newOleBatchProcessProfileBo.getBatchProcessProfileId());
214                 KRADServiceLocator.getBusinessObjectService().deleteMatching(OLEBatchGloballyProtectedField.class, map);
215             }
216 
217             List<OLEBatchGloballyProtectedField> batchGloballyProtectedFieldList = new ArrayList<OLEBatchGloballyProtectedField>();
218             for (OLEBatchGloballyProtectedField globallyProtectedField : batchGloballyProtectedFields) {
219                 if (!globallyProtectedField.isIgnoreValue()) {
220                     globallyProtectedField.setBatchProcessProfileId(newOleBatchProcessProfileBo.getBatchProcessProfileId());
221                     batchGloballyProtectedFieldList.add(globallyProtectedField);
222                 }
223             }
224             newOleBatchProcessProfileBo.setOleBatchGloballyProtectedFieldList(batchGloballyProtectedFieldList);
225             KRADServiceLocator.getBusinessObjectService().linkAndSave(batchGloballyProtectedFieldList);
226         } else {
227 
228             List<OLEBatchGloballyProtectedField> batchGloballyProtectedFieldList = new ArrayList<OLEBatchGloballyProtectedField>();
229             for (OLEBatchGloballyProtectedField globallyProtectedField : batchGloballyProtectedFields) {
230                 if (globallyProtectedField.isIgnoreValue()) {
231                     //globallyProtectedField.setBatchProcessProfileId(newOleBatchProcessProfileBo.getBatchProcessProfileId());
232                     batchGloballyProtectedFieldList.add(globallyProtectedField);
233                 }
234             }
235             newOleBatchProcessProfileBo.setOleBatchGloballyProtectedFieldList(batchGloballyProtectedFieldList);
236         }
237         return super.route(form, result, request, response);
238     }
239 
240 
241 
242 
243     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLineConstant")
244     public ModelAndView addLineConstant(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
245                                 HttpServletRequest request, HttpServletResponse response) {
246         LOG.debug("Initialized addLine method");
247         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
248         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
249         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
250         if(oleBatchProcessProfileBo.getOleBatchProcessProfileBibMatchPointList().size()<3){
251             String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
252             CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
253             String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
254             Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
255             OLEBatchProcessProfileBibMatchPoint oleBatchProcessProfileBibMatchPoint = (OLEBatchProcessProfileBibMatchPoint) eventObject;
256             if(oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)){
257                 if(validateBibMatchPoint(oleBatchProcessProfileBibMatchPoint.getOleBibMatchPoint())==Boolean.FALSE){
258                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_BIB_MATCH_POINT_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_MATCH_POINT_ERR);
259                     return getUIFModelAndView(form);
260                 }
261             }
262             View view = form.getPostedView();
263             view.getViewHelperService().processCollectionAddLine(view, form, selectedCollectionPath);
264             oleBatchProcessProfileBo.getOleBatchProcessProfileBibMatchPointList().remove(oleBatchProcessProfileBibMatchPoint);
265             int lastIndex=oleBatchProcessProfileBo.getOleBatchProcessProfileBibMatchPointList().size();
266             oleBatchProcessProfileBo.getOleBatchProcessProfileBibMatchPointList().add(lastIndex,oleBatchProcessProfileBibMatchPoint);
267 
268         }
269         return getUIFModelAndView(form);
270     }
271 
272 
273     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addFilterCriteriaMapping")
274     public ModelAndView addFilterCriteriaMapping(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
275                                            HttpServletRequest request, HttpServletResponse response) {
276 
277         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
278         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
279         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
280         String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
281         CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
282         String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
283         Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
284         OLEBatchProcessProfileFilterCriteriaBo oleBatchProcessProfileFilterCriteriaBo = (OLEBatchProcessProfileFilterCriteriaBo) eventObject;
285         boolean matchPointFlag1 = true;
286         if ((oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) && oleBatchProcessProfileFilterCriteriaBo != null && oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName()!=null && oleBatchProcessProfileFilterCriteriaBo.getFilterFieldNameText()!=null) {
287             if(!StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName()) && !StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldNameText()) && !StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldValue())){
288                 matchPointFlag1 = validateFilterCriteriaFieldValue(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName());
289             if (!matchPointFlag1) {
290                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_DATA_MAPPING_FIELD_ERR);
291                 return getUIFModelAndView(form);
292             }
293             } else if(!StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldName()) && StringUtils.isEmpty(oleBatchProcessProfileFilterCriteriaBo.getFilterFieldNameText())){
294                 return super.addLine(uifForm, result, request, response);
295             } else {
296                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_DATA_MAPPING_FIELD_ERR);
297                 return getUIFModelAndView(form);
298             }
299         } else {
300             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_DATA_MAPPING_FIELD_ERR);
301             return getUIFModelAndView(form);
302         }
303         return super.addLine(uifForm, result, request, response);
304     }
305     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLineDataMapping")
306     public ModelAndView addLineDataMapping(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
307                                            HttpServletRequest request, HttpServletResponse response) {
308 
309         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
310         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
311         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
312         String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
313         CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
314         String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
315         Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
316         OLEBatchProcessProfileDataMappingOptionsBo oleBatchProcessProfileDataMappingOptionsBo = (OLEBatchProcessProfileDataMappingOptionsBo) eventObject;
317         boolean matchPointFlag1 = true;
318         boolean matchPointFlag2 = true;
319         //validation for data mapping fields
320         if ((oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT) || oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) && oleBatchProcessProfileDataMappingOptionsBo != null) {
321             if (oleBatchProcessProfileDataMappingOptionsBo.getDataType().equals(OLEConstants.OLEBatchProcess.BATCH_PROCESS_PROFILE_DATATYPE_BIBMARC)) {
322                 matchPointFlag1 = validateDataMappingFieldValue(oleBatchProcessProfileDataMappingOptionsBo.getSourceFieldText());
323             }
324             if (oleBatchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField().equals(OLEConstants.OLEBatchProcess.BATCH_PROCESS_PROFILE_DATATYPE_BIBMARC)) {
325                 matchPointFlag2 = validateDataMappingFieldValue(oleBatchProcessProfileDataMappingOptionsBo.getDestinationFieldText());
326             }
327             if (!matchPointFlag1 || !matchPointFlag2) {
328                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.OLEBatchProcess.OLE_BATCH_PROFILE_DATA_MAPPING_SECTION_ID, OLEConstants.OLEBatchProcess.OLE_BATCH_BIB_DATA_MAPPING_FIELD_ERR);
329                 return getUIFModelAndView(form);
330             }
331 
332             boolean dupTagFlag = false;
333             List<OLEBatchProcessProfileMappingOptionsBo> oleBatchProcessProfileMappingOptionsList = oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList();
334             for (OLEBatchProcessProfileMappingOptionsBo oleBatchProcessProfileMappingOptionsBo : oleBatchProcessProfileMappingOptionsList) {
335                 List<OLEBatchProcessProfileDataMappingOptionsBo> oleBatchProcessProfileDataMappingOptionsBoList = oleBatchProcessProfileMappingOptionsBo.getOleBatchProcessProfileDataMappingOptionsBoList();
336                 for (OLEBatchProcessProfileDataMappingOptionsBo batchProcessProfileDataMappingOptionsBo : oleBatchProcessProfileDataMappingOptionsBoList) {
337                     if (oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_BIB_IMPORT)) {
338                         if (oleBatchProcessProfileDataMappingOptionsBo.getDataType().equals(OLEConstants.OLEBatchProcess.BATCH_PROCESS_PROFILE_DATATYPE_BIBMARC)) {
339                             if (!convertEnterDataField(batchProcessProfileDataMappingOptionsBo.getSourceField()).equals(convertEnterDataField(oleBatchProcessProfileDataMappingOptionsBo.getSourceField()))) {
340                                 if (batchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField().equals(oleBatchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField())) {
341                                     if (batchProcessProfileDataMappingOptionsBo.getDestinationField().equals(oleBatchProcessProfileDataMappingOptionsBo.getDestinationField())) {
342                                         dupTagFlag = true;
343                                         break;
344                                     }
345                                 }
346                             } else {
347                                 dupTagFlag = true;
348                                 break;
349                             }
350                         }
351                     } else if (oleBatchProcessProfileBo.getBatchProcessProfileType().equalsIgnoreCase(OLEConstants.OLEBatchProcess.BATCH_EXPORT)) {
352                         if (!convertEnterDataField(batchProcessProfileDataMappingOptionsBo.getDestinationField()).equals(convertEnterDataField(oleBatchProcessProfileDataMappingOptionsBo.getDestinationField()))) {
353                             if (oleBatchProcessProfileDataMappingOptionsBo.getDataTypeDestinationField().equals(OLEConstants.OLEBatchProcess.BATCH_PROCESS_PROFILE_DATATYPE_BIBMARC)) {
354                                 if (batchProcessProfileDataMappingOptionsBo.getSourceField().equals(oleBatchProcessProfileDataMappingOptionsBo.getSourceField())) {
355                                     if (batchProcessProfileDataMappingOptionsBo.getDataType().equals(oleBatchProcessProfileDataMappingOptionsBo.getDataType())) {
356                                         dupTagFlag = true;
357                                         break;
358                                     }
359                                 }
360                             }
361                         } else {
362                             dupTagFlag = true;
363                             break;
364                         }
365                     }
366                 }
367             }
368 
369             if (dupTagFlag) {
370                 return getUIFModelAndView(form);
371             }
372         }
373         return super.addLine(uifForm, result, request, response);
374     }
375 
376     private String convertEnterDataField(String tag) {
377         if (StringUtils.isNotEmpty(tag)) {
378             String[] matchPointArray = tag.split(" ");
379             if (matchPointArray.length == 3) {
380                 tag = matchPointArray[0] + " " + matchPointArray[2];
381             }
382         }
383         return tag;
384     }
385 
386     /**
387      * Validates the match point to match with the pattern 001 ,245 $a, 245 ## $a, 245 04 $a, 245 #4 $a, 245 0# $a
388      * @param bibMatchPoint
389      * @return
390      */
391     private boolean validateBibMatchPoint(String bibMatchPoint) {
392         boolean valid = true;
393         String pattern = "((001)|(^\\d\\d\\d\\s+([$]([a-z]|\\d))$)|(^\\d\\d\\d\\s+[#|\\d][#|\\d]\\s+([$]([a-z]|\\d))$))";
394         if (Pattern.matches(pattern, bibMatchPoint) == Boolean.FALSE) {
395             valid = false;
396         }
397         return valid;
398     }
399 
400     /**
401      * 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
402      * @param fieldValue
403      * @return
404      */
405     private boolean validateDataMappingFieldValue(String fieldValue) {
406         boolean valid = true;
407         String pattern = "((001)|(^\\d\\d\\d\\s+([$]([a-z]|\\d))+$)|(^\\d\\d\\d\\s+[#|\\d][#|\\d]\\s+([$]([a-z]|\\d))+$))";
408         if (Pattern.matches(pattern, fieldValue) == Boolean.FALSE) {
409             valid = false;
410         }
411         return valid;
412     }
413 
414     private boolean validateFilterCriteriaFieldValue(String fieldValue) {
415         boolean valid = true;
416 
417         String pattern = "((^\\d\\d\\d\\s+([$][a-z])+$)|(^\\d\\d\\d\\s+[#|\\d][#|\\d]\\s+([$][a-z])+$))";
418         if (Pattern.matches(pattern, fieldValue) == Boolean.FALSE) {
419             valid = false;
420         }
421         return valid;
422     }
423 
424     /*private boolean validateBibMatchPoint(String bibMatchPoint) {
425         boolean valid = true;
426         if (StringUtils.isNotEmpty(bibMatchPoint)) {
427 
428             String[] matchPointArray = bibMatchPoint.split(" ");
429             if (matchPointArray.length == 3) {
430                 if (matchPointArray[0].length() != 3 || !StringUtils.isNumeric(matchPointArray[0]) || matchPointArray[1].length() != 2 || matchPointArray[2].length() != 2) {
431                     valid = false;
432                 } else {
433                     if((matchPointArray[1].charAt(0) != '#' && !Character.isDigit(matchPointArray[1].charAt(0))) || (matchPointArray[1].charAt(1) != '#' && !Character.isDigit(matchPointArray[1].charAt(1)))) {
434                         valid = false;
435                     }
436                     else if (matchPointArray[2].charAt(0) != '$' || !Character.isAlphabetic(matchPointArray[2].charAt(1))) {
437                         valid = false;
438                     }
439                 }
440             } else if (matchPointArray.length == 2) {
441                 if (matchPointArray[0].length() != 3 || !StringUtils.isNumeric(matchPointArray[0]) || matchPointArray[1].length() != 2) {
442                     valid = false;
443                 } else {
444                     if (matchPointArray[1].charAt(0) != '$' || !Character.isAlphabetic(matchPointArray[1].charAt(1))) {
445                         valid = false;
446                     }
447                 }
448             } else if (matchPointArray.length == 1) {
449                 if (!matchPointArray[0].equals(OLEConstants.OLEBatchProcess.CONTROL_FIELD_001)) {
450                     valid = false;
451                 }
452             } else {
453                 valid = false;
454             }
455         } else {
456             valid =false;
457         }
458         return !valid;
459     }*/
460 
461     /*private boolean validateDataMappingFieldValue(String fieldValue) {
462         boolean valid = true;
463         if (StringUtils.isNotEmpty(fieldValue)) {
464 
465             String[] matchPointArray = fieldValue.split(" ");
466             if (matchPointArray.length == 3) {
467                 if (matchPointArray[0].length() != 3 || !StringUtils.isNumeric(matchPointArray[0]) || matchPointArray[1].length() != 2 ) {
468                     valid = false;
469                 } else {
470                     if((matchPointArray[1].charAt(0) != '#' && !Character.isDigit(matchPointArray[1].charAt(0))) || (matchPointArray[1].charAt(1) != '#' && !Character.isDigit(matchPointArray[1].charAt(1)))) {
471                         valid = false;
472                     }
473                     for(int i=0; i<matchPointArray[2].length(); i++){
474                         if (matchPointArray[2].charAt(i) != '$' || !Character.isAlphabetic(matchPointArray[2].charAt(++i))) {
475                             valid = false;
476                         }
477                     }
478                 }
479             } else if (matchPointArray.length == 2) {
480                 if (matchPointArray[0].length() != 3 || !StringUtils.isNumeric(matchPointArray[0]) ) {
481                     valid = false;
482                 } else {
483                     for(int i=0; i<matchPointArray[1].length(); i++){
484                         if (matchPointArray[1].charAt(i) != '$' || !Character.isAlphabetic(matchPointArray[1].charAt(++i))) {
485                             valid = false;
486                         }
487                     }
488                 }
489             } else if (matchPointArray.length == 1) {
490                 if (!matchPointArray[0].equals(OLEConstants.OLEBatchProcess.CONTROL_FIELD_001)) {
491                     valid = false;
492                 }
493             } else {
494                 valid = false;
495             }
496         } else {
497             valid = false;
498         }
499         return valid;
500 
501     }*/
502 
503     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLineInstance")
504     public ModelAndView addLineInstance(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
505                                         HttpServletRequest request, HttpServletResponse response) {
506         LOG.debug("Initialized addLine method");
507         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
508         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
509         OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
510         if(oleBatchProcessProfileBo.getOleBatchProcessProfileInstanceMatchPointList().size()<3){
511             String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
512             CollectionGroup collectionGroup = form.getPostedView().getViewIndex().getCollectionGroupByPath(selectedCollectionPath);
513             String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
514             Object eventObject = ObjectPropertyUtils.getPropertyValue(form, addLinePath);
515             OLEBatchProcessProfileInstanceMatchPoint oleBatchProcessProfileInstanceMatchPoint = (OLEBatchProcessProfileInstanceMatchPoint) eventObject;
516             View view = form.getPostedView();
517             view.getViewHelperService().processCollectionAddLine(view, form, selectedCollectionPath);
518             oleBatchProcessProfileBo.getOleBatchProcessProfileInstanceMatchPointList().remove(oleBatchProcessProfileInstanceMatchPoint);
519             int lastIndex=oleBatchProcessProfileBo.getOleBatchProcessProfileInstanceMatchPointList().size();
520             oleBatchProcessProfileBo.getOleBatchProcessProfileInstanceMatchPointList().add(lastIndex,oleBatchProcessProfileInstanceMatchPoint);
521 
522         }
523         return getUIFModelAndView(form);
524 
525     }
526 
527     @RequestMapping(params = "methodToCall=refreshPageView")
528     public ModelAndView refreshPageView(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
529                                         HttpServletRequest request, HttpServletResponse response) throws Exception {
530 
531         //OLEBatchProcessProfileBo oleBatchProcessProfileBo = (OLEBatchProcessProfileBo) document.getNewMaintainableObject().getDataObject();
532 
533        /* MaintenanceDocumentForm form1 = (MaintenanceDocumentForm) form;
534         MaintenanceDocument document = (MaintenanceDocument) form1.getDocument();*/
535 
536         return refresh(form,result,request,response);
537     }
538     @RequestMapping(params = "methodToCall=refreshBeanId")
539     public ModelAndView refreshBeanId(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
540                                         HttpServletRequest request, HttpServletResponse response) throws Exception {
541         return navigate(form, result, request, response);
542     }
543 
544     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteBibMatchPoint")
545     public ModelAndView deleteBibMatchPoint(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
546                                               HttpServletRequest request, HttpServletResponse response) {
547         LOG.debug("Initialized addLine method");
548         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
549         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
550         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
551         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
552         oleBatchProcessProfileBo.getDeletedBatchProcessProfileBibMatchPointList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileBibMatchPointList().get(Integer.parseInt(selectedLineIndex)));
553 
554         return deleteLine(uifForm, result, request, response);
555 
556     }
557     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteBibStatus")
558     public ModelAndView deleteBibStatus(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
559                                             HttpServletRequest request, HttpServletResponse response) {
560         LOG.debug("Initialized addLine method");
561         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
562         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
563         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
564         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
565         oleBatchProcessProfileBo.getDeleteBatchProcessProfileBibStatusList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileBibStatusList().get(Integer.parseInt(selectedLineIndex)));
566 
567          return deleteLine(uifForm, result, request, response);
568 
569     }
570     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteDeleteField")
571     public ModelAndView deleteDeleteField(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
572                                         HttpServletRequest request, HttpServletResponse response) {
573         LOG.debug("Initialized addLine method");
574         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
575         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
576         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
577         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
578         oleBatchProcessProfileBo.getDeletedBatchProcessProfileDeleteFieldsList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileDeleteFieldsList().get(Integer.parseInt(selectedLineIndex)));
579 
580          return deleteLine(uifForm, result, request, response);
581 
582     }
583     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteRenameField")
584     public ModelAndView deleteRenameField(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
585                                           HttpServletRequest request, HttpServletResponse response) {
586         LOG.debug("Initialized addLine method");
587         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
588         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
589         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
590         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
591         oleBatchProcessProfileBo.getDeletedBatchProcessProfileRenameFieldsList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileRenameFieldsList().get(Integer.parseInt(selectedLineIndex)));
592       return deleteLine(uifForm, result, request, response);
593     }
594     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=filterCriteriaDelete")
595     public ModelAndView filterCriteriaDelete(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
596                                           HttpServletRequest request, HttpServletResponse response) {
597         LOG.debug("Initialized addLine method");
598         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
599         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
600         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
601         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
602         oleBatchProcessProfileBo.getDeleteBatchProcessProfileFilterCriteriaList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileFilterCriteriaList().get(Integer.parseInt(selectedLineIndex)));
603         return deleteLine(uifForm, result, request, response);
604     }
605 
606     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=dataMappingDelete")
607     public ModelAndView dataMappingDelete(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
608                                              HttpServletRequest request, HttpServletResponse response) {
609         LOG.debug("Initialized addLine method");
610         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
611         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
612         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
613         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
614         oleBatchProcessProfileBo.getDeletedBatchProcessProfileMappingOptionsList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList().get(Integer.parseInt(selectedLineIndex)));
615         oleBatchProcessProfileBo.getDeletedBatchProcessProfileDataMappingOptionsList().addAll(oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList().get(Integer.parseInt(selectedLineIndex)).getOleBatchProcessProfileDataMappingOptionsBoList());
616         return deleteLine(uifForm, result, request, response);
617     }
618 
619     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=addLineDataMappingDelete")
620     public ModelAndView addLineDataMappingDelete(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
621                                           HttpServletRequest request, HttpServletResponse response) {
622         LOG.debug("Initialized addLine method");
623         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
624         Map<String,String> actionParameters = form.getActionParameters();
625         String subCollectionIndex = actionParameters.get(UifParameters.SELECTED_LINE_INDEX);
626         String mainCollectionIndex= StringUtils.substringBefore(StringUtils.substringAfter(actionParameters.get(UifParameters.SELLECTED_COLLECTION_PATH),"["),"]");
627         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
628         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
629         OLEBatchProcessProfileDataMappingOptionsBo oleBatchProcessProfileDataMappingOptionsBo = oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList().get(Integer.parseInt(mainCollectionIndex)).getOleBatchProcessProfileDataMappingOptionsBoList().get(Integer.parseInt(subCollectionIndex));
630         if(oleBatchProcessProfileBo.getBatchProcessProfileId()!=null){
631             KRADServiceLocator.getBusinessObjectService().delete(oleBatchProcessProfileDataMappingOptionsBo);
632             oleBatchProcessProfileBo.getOleBatchProcessProfileMappingOptionsList().get(Integer.parseInt(mainCollectionIndex)).getOleBatchProcessProfileDataMappingOptionsBoList().remove(Integer.parseInt(subCollectionIndex));
633             return getUIFModelAndView(uifForm);
634         }else{
635             oleBatchProcessProfileBo.getDeletedBatchProcessProfileDataMappingOptionsList().add(oleBatchProcessProfileDataMappingOptionsBo);
636             return deleteLine(uifForm, result, request, response);
637         }
638     }
639 
640     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteProfileConstant")
641     public ModelAndView deleteProfileConstant(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
642                                              HttpServletRequest request, HttpServletResponse response) {
643         LOG.debug("Initialized addLine method");
644         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
645         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
646         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
647         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
648         oleBatchProcessProfileBo.getDeletedBatchProcessProfileConstantsList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileConstantsList().get(Integer.parseInt(selectedLineIndex)));
649         return deleteLine(uifForm, result, request, response);
650     }
651 
652     @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteProfileProtectedField")
653     public ModelAndView deleteProfileProtectedField(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
654                                               HttpServletRequest request, HttpServletResponse response) {
655         LOG.debug("Initialized addLine method");
656         MaintenanceDocumentForm form = (MaintenanceDocumentForm) uifForm;
657         String selectedLineIndex = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
658         MaintenanceDocument document = (MaintenanceDocument) form.getDocument();
659         OLEBatchProcessProfileBo oleBatchProcessProfileBo=(OLEBatchProcessProfileBo)document.getNewMaintainableObject().getDataObject();
660         oleBatchProcessProfileBo.getDeletedBatchProcessProfileProtectedFieldList().add(oleBatchProcessProfileBo.getOleBatchProcessProfileProtectedFieldList().get(Integer.parseInt(selectedLineIndex)));
661         return deleteLine(uifForm, result, request, response);
662     }
663 }