View Javadoc

1   package org.kuali.ole.editor.contoller;
2   
3   import org.apache.log4j.Logger;
4   import org.kuali.ole.OLEConstants;
5   import org.kuali.ole.docstore.model.xmlpojo.ingest.AdditionalAttributes;
6   import org.kuali.ole.docstore.model.xmlpojo.work.instance.oleml.*;
7   import org.kuali.ole.docstore.model.xstream.work.instance.oleml.WorkInstanceOlemlRecordProcessor;
8   import org.kuali.ole.editor.bo.*;
9   import org.kuali.ole.editor.form.InstanceEditorForm;
10  import org.kuali.ole.editor.service.DiscoveryHelperService;
11  import org.kuali.ole.editor.service.DocstoreHelperService;
12  import org.kuali.rice.krad.uif.UifParameters;
13  import org.kuali.rice.krad.web.controller.UifControllerBase;
14  import org.kuali.rice.krad.web.form.UifFormBase;
15  import org.springframework.stereotype.Controller;
16  import org.springframework.validation.BindingResult;
17  import org.springframework.web.bind.annotation.ModelAttribute;
18  import org.springframework.web.bind.annotation.RequestMapping;
19  import org.springframework.web.bind.annotation.RequestMethod;
20  import org.springframework.web.servlet.ModelAndView;
21  
22  import javax.servlet.http.HttpServletRequest;
23  import javax.servlet.http.HttpServletResponse;
24  import java.util.*;
25  
26  /**
27   * InstanceEditorController is the controller class for Instance Editor
28   */
29  @Controller
30  @RequestMapping(value = "/instanceeditor")
31  
32  public class InstanceEditorController extends UifControllerBase {
33  
34      private DocstoreHelperService docstoreHelperService;
35      private InstanceEditorFormDataHandler instanceEditorFormDataHandler;
36      private DiscoveryHelperService discoveryHelperService;
37  
38      private static final Logger LOG = Logger.getLogger(InstanceEditorController.class);
39  
40      /**
41       *   This method creates a instance of InstanceEditorForm
42       * @param httpServletRequest
43       * @return  InstanceEditorForm
44       */
45      @Override
46      protected InstanceEditorForm createInitialForm(HttpServletRequest httpServletRequest) {
47          return new InstanceEditorForm();
48      }
49  
50      /**
51       * This method takes the initial request when click on InstanceEditor Screen.
52       * @param form
53       * @param result
54       * @param request
55       * @param response
56       * @return  ModelAndView
57       */
58      @Override
59      @RequestMapping(params = "methodToCall=start")
60      public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
61                                HttpServletRequest request, HttpServletResponse response) {
62          InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
63          return super.start(instanceEditorForm, result, request, response);
64      }
65  
66      @RequestMapping(method = RequestMethod.POST, params = "methodToCall=navigate")
67      public ModelAndView navigate(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
68                                   HttpServletRequest request, HttpServletResponse response) {
69          InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
70          String pageId = form.getActionParamaterValue(UifParameters.NAVIGATE_TO_PAGE_ID);
71  
72          return getUIFModelAndView(instanceEditorForm, pageId);
73      }
74  
75      /**
76       *  This method will fetch the holding/Item records based on the AdditionalAttributes.
77       * @param form
78       * @param result
79       * @param request
80       * @param response
81       * @return  ModelAndView
82       */
83      @RequestMapping(params = "methodToCall=loadInstanceRecord")
84      public ModelAndView loadInstanceRecord(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
85                                             HttpServletRequest request, HttpServletResponse response) {
86          InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
87          String instanceIdentifier = request.getParameter("uuid");
88          if (null == instanceIdentifier) {
89              instanceIdentifier = instanceEditorForm.getUuid();
90          }
91          instanceEditorForm.setExisting("true");
92          try {
93              String docStoreData = getDocstoreHelperService().getDocstoreData(instanceIdentifier);
94              InstanceCollection instanceCollection = new WorkInstanceOlemlRecordProcessor().fromXML(docStoreData);
95              instanceEditorForm.setInstance(instanceCollection.getInstance().get(0));
96              instanceEditorForm.setSelectedHolding(instanceEditorForm.getInstance().getOleHoldings());
97              instanceEditorForm.setSelectedItem(instanceEditorForm.getInstance().getItems().getItem().get(0));
98              if(instanceEditorForm.getInstance().getSourceHoldings() != null) {
99                  instanceEditorForm.setSelectedSourceHolding(
100                         getInstanceEditorFormDataHandler().buildSourceHoldingForUI(instanceEditorForm));
101             }
102 
103             getInstanceEditorFormDataHandler().setLocationDetails(instanceEditorForm);
104             //Building Left Pane hierarchy
105             getInstanceEditorFormDataHandler().buildLeftPaneData(instanceEditorForm);
106 
107             //Building MetaData fields
108             //getInstanceEditorFormDataHandler().setMetaData(instanceEditorForm, OLEConstants.HOLDING_DOC_TYPE);
109 
110             StringBuffer instanceEditorSuccessMessage = new StringBuffer(OLEConstants.INSTANCE_EDITOR_LOAD_SUCCESS);
111             instanceEditorForm.setMessage(instanceEditorSuccessMessage.toString());
112         } catch (Exception e) {
113             StringBuffer instanceEditorErrorMessage = new StringBuffer(OLEConstants.INSTANCE_EDITOR_LOAD_FAILURE).append(" :: \n" + e.getMessage());
114             instanceEditorForm.setMessage(instanceEditorErrorMessage.toString());
115             LOG.error(instanceEditorErrorMessage);
116         }
117         return getUIFModelAndView(instanceEditorForm, OLEConstants.HOLDINGS_PAGE);
118     }
119 
120     /**
121      *  This method will ingest new record to docStore if uuid is null else it will update exisiting record.
122      *  and nullify the form.
123      * @param form
124      * @param result
125      * @param request
126      * @param response
127      * @return  ModelAndView
128      */
129     @RequestMapping(params = "methodToCall=submit")
130     public ModelAndView submit(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
131                                HttpServletRequest request, HttpServletResponse response) {
132         String responseFromDocstore = null;
133         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
134         String uuid = instanceEditorForm.getUuid();
135         try {
136             if (uuid != null && !uuid.trim().equals("")) {
137                 OleHoldings holdingData = instanceEditorForm.getInstance().getOleHoldings();
138                 String holdingId = instanceEditorForm.getInstance().getOleHoldings().getHoldingsIdentifier();
139                 String holdingXmlContent = getInstanceEditorFormDataHandler().buildHoldingContent(holdingData);
140                 String holdingRecordUpdateResponse =
141                         getDocstoreHelperService().updateInstanceRecord(holdingId, OLEConstants.HOLDING_DOC_TYPE, holdingXmlContent);
142 
143                 for (int item = 0; item < instanceEditorForm.getInstance().getItems().getItem().size(); item++) {
144                     Item itemData = instanceEditorForm.getInstance().getItems().getItem().get(item);
145                     String itemId = instanceEditorForm.getInstance().getItems().getItem().get(item).getItemIdentifier();
146                     String itemXmlContent = getInstanceEditorFormDataHandler().buildItemContent(itemData);
147                     if (itemId == null) {   //New Item
148                         //TODO: Change logic to get Instance UUID. As we are loading existing Instance Identifier, we are getting directly from form
149                         String instanceUuid = uuid;
150                         String itemRecordUpdateResponse =
151                                 getDocstoreHelperService().createItemForInstanceRecord(instanceUuid, OLEConstants.ITEM_DOC_TYPE, itemXmlContent);
152                     } else {
153                         String itemRecordUpdateResponse =
154                             getDocstoreHelperService().updateInstanceRecord(itemId, OLEConstants.ITEM_DOC_TYPE, itemXmlContent);
155                     }
156                 }
157                 SourceHoldings sourceHoldings = getInstanceEditorFormDataHandler().buildSourceHoldings(instanceEditorForm);
158                 String sourceHoldingId = sourceHoldings.getHoldingsIdentifier();
159                 String sourceHoldinXml  =  getInstanceEditorFormDataHandler().buildSourceHoldingContent(sourceHoldings);
160                 String sourceHoldingUpdateResponse =
161                         getDocstoreHelperService().updateInstanceRecord(sourceHoldingId, "sourceHoldings", sourceHoldinXml);
162             }  else {
163                 Instance instance = new Instance();
164                 instanceEditorForm.setInstance(instance);
165                 Item oleItem = instanceEditorForm.getSelectedItem();
166                 Items items = new Items();
167                 items.setItem(Arrays.asList(oleItem));
168                 instanceEditorForm.getInstance().setItems(items);
169                 instanceEditorForm.getInstance().setOleHoldings(instanceEditorForm.getSelectedHolding());
170                 String content =  getInstanceEditorFormDataHandler().buildInstanceRecordForDocStore(instanceEditorForm, uuid);
171                 responseFromDocstore = getDocstoreHelperService().
172                         instanceRecordCallToDocstore(content, null, OLEConstants.OLEML_FORMAT);
173             }
174             instanceEditorForm.setUuid("");
175             StringBuffer instanceEditorSuccessMessage = new StringBuffer(OLEConstants.INSTANCE_EDITOR_SUCCESS);
176             instanceEditorForm.setMessage(instanceEditorSuccessMessage.toString());
177         } catch (Exception e) {
178             StringBuffer instanceEditorErrorMessage = new StringBuffer(OLEConstants.INSTANCE_EDITOR_FAILURE).append(" :: \n" + e.getMessage());
179             instanceEditorForm.setMessage(instanceEditorErrorMessage.toString());
180             LOG.error(instanceEditorErrorMessage);
181         }
182         InstanceEditorForm finalForm = instanceEditorForm;
183         instanceEditorForm.setInstance(new Instance());
184         instanceEditorForm.setSelectedHolding(new OleHoldings());
185         instanceEditorForm.setSelectedSourceHolding(new SourceEditorForUI());
186         instanceEditorForm.setSelectedItem(new Item());
187         return getUIFModelAndView(finalForm, OLEConstants.HOLDINGS_PAGE);
188         //return getUIFModelAndView(form);
189     }
190 
191     /**
192      *   This Method will update the Left Pane hierarchy details.
193      * @param form
194      * @param result
195      * @param request
196      * @param response
197      * @return  ModelAndView
198      */
199     @RequestMapping(params = "methodToCall=updateLeftPane")
200     public ModelAndView updateLeftPane(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
201                                        HttpServletRequest request, HttpServletResponse response) {
202         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
203         String hiddenVal = instanceEditorForm.getHdnUuid();
204         int hdnIndex = instanceEditorForm.getHdnIndex();
205         instanceEditorForm.setSelectedItem(instanceEditorForm.getInstance().getItems().getItem().get(hdnIndex));
206         DiscoveryHelperService discoveryHelperService = getDiscoveryHelperService();
207 
208         List responseFromSOLR =  discoveryHelperService.getResponseFromSOLR("id", hiddenVal);
209         String docType = null;
210         for (Iterator iterator = responseFromSOLR.iterator(); iterator.hasNext(); ) {
211             Map map = (Map) iterator.next();
212             if (map.containsKey(OLEConstants.DOC_TYPE)) {
213                 String list = (String) map.get(OLEConstants.DOC_TYPE);
214                 docType = list;
215                 break;
216             }
217         }
218         if (docType.toString().equals(OLEConstants.ITEM_DOC_TYPE)) {
219             //getInstanceEditorFormDataHandler().setMetaData(instanceEditorForm, OLEConstants.ITEM_DOC_TYPE);
220 
221             return getUIFModelAndView(instanceEditorForm, OLEConstants.ITEM_PAGE);
222         } else {
223             return getUIFModelAndView(instanceEditorForm, OLEConstants.HOLDINGS_PAGE);
224         }
225     }
226 
227     /**
228      * This method adds the existingItem records from docStore in to oleItems and it will be set in InstanceEditorForm.
229      * @param form
230      * @param result
231      * @param request
232      * @param response
233      * @return ModelAndView
234      */
235     @RequestMapping(method = RequestMethod.POST,params = "methodToCall=addNewItem")
236     public ModelAndView addItemRecord(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
237                                       HttpServletRequest request, HttpServletResponse response){
238         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
239         List<Item> existingItemsFromDoc = instanceEditorForm.getInstance().getItems().getItem();
240         List<Item> oleItems = new ArrayList<Item>();
241 
242         for(int i=0;i<existingItemsFromDoc.size();i++){
243             oleItems.add(existingItemsFromDoc.get(i));
244         }
245         oleItems.add(new Item());
246         instanceEditorForm.setItemRecordMetaData(new InstanceRecordMetaData());
247         instanceEditorForm.getInstance().getItems().setItem(oleItems);
248         instanceEditorForm.setHdnIndex(oleItems.size());
249         int hdnIndex = instanceEditorForm.getHdnIndex();
250         instanceEditorForm.setSelectedItem(instanceEditorForm.getInstance().getItems().getItem().get(hdnIndex-1));
251         return getUIFModelAndView(instanceEditorForm, OLEConstants.ITEM_PAGE);
252     }
253 
254     /**
255      * This method will get new itemData
256      * @param form
257      * @param result
258      * @param request
259      * @param response
260      * @return
261      */
262     @RequestMapping(method = RequestMethod.POST,params = "methodToCall=getNewItemData")
263     public ModelAndView getNewItemData(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
264                                        HttpServletRequest request, HttpServletResponse response){
265         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
266         List<Item> existingItemsFromDoc = instanceEditorForm.getInstance().getItems().getItem();
267         List<Item> oleItems = new ArrayList<Item>();
268 
269         for(int i=0;i<existingItemsFromDoc.size();i++){
270             oleItems.add(existingItemsFromDoc.get(i));
271         }
272         instanceEditorForm.setHdnIndex(oleItems.size());
273         int hdnIndex = instanceEditorForm.getHdnIndex();
274         instanceEditorForm.setSelectedItem(instanceEditorForm.getInstance().getItems().getItem().get(hdnIndex-1));
275         return getUIFModelAndView(instanceEditorForm, OLEConstants.ITEM_PAGE);
276     }
277 
278     /**
279      *  Used for Test-case
280      * @param result
281      * @param request
282      * @param response
283      * @param instanceEditorForm
284      * @return ModelAndView
285      */
286     protected ModelAndView callSuper(BindingResult result, HttpServletRequest request, HttpServletResponse response, InstanceEditorForm instanceEditorForm) {
287         return super.updateComponent(instanceEditorForm, result, request, response);
288     }
289 
290     /**
291      *  Gets the docstoreHelperService attribute
292      * @return  Returns DocstoreHelperService
293      */
294     private DocstoreHelperService getDocstoreHelperService() {
295         if (null == docstoreHelperService) {
296             return new DocstoreHelperService();
297         }
298         return docstoreHelperService;
299     }
300 
301     /**
302      *    Sets the docstoreHelperService attribute values.
303      * @param docstoreHelperService
304      */
305     public void setDocstoreHelperService(DocstoreHelperService docstoreHelperService) {
306         this.docstoreHelperService = docstoreHelperService;
307     }
308 
309     /**
310      *  Gets the InstanceEditorFormDataHandler attribute.
311      * @return Returns InstanceEditorFormDataHandler.
312      */
313     private InstanceEditorFormDataHandler getInstanceEditorFormDataHandler() {
314         if (null == instanceEditorFormDataHandler) {
315             instanceEditorFormDataHandler = new InstanceEditorFormDataHandler();
316         }
317         return instanceEditorFormDataHandler;
318     }
319 
320     /**
321      *  This method returns AdditionalAttributes instance from the list of Extension.
322      * @param extensionList
323      * @return  AdditionalAttributes
324      */
325     private AdditionalAttributes getFirstAdditionalAttributes(List<Extension> extensionList) {
326         for (Extension ext : extensionList) {
327             for (Object obj : ext.getContent()) {
328                 if (obj instanceof AdditionalAttributes) {
329                     return (AdditionalAttributes) obj;
330                 }
331             }
332         }
333         return null;
334     }
335 
336     /**
337      * Sets the discoveryHelperService attribute value.
338      * @param discoveryHelperService
339      */
340     public void setDiscoveryHelperService(DiscoveryHelperService discoveryHelperService) {
341         this.discoveryHelperService = discoveryHelperService;
342     }
343 
344     /**
345      *  Gets the discoveryHelperService attribute.
346      * @return Returns DiscoveryHelperService.
347      */
348     public DiscoveryHelperService getDiscoveryHelperService() {
349         if (null == discoveryHelperService) {
350             return new DiscoveryHelperService();
351         }
352         return discoveryHelperService;
353     }
354 
355     /*@RequestMapping(params = "methodToCall=addExtentOfOwnership")
356     public ModelAndView addExtentOfOwnership(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
357                                              HttpServletRequest request, HttpServletResponse response) {
358         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
359         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
360         index++;
361         List<ExtentOfOwnershipForUI> extentOfOwnershipForUI = instanceEditorForm.getSelectedHolding().getExtentOfOwnershipForUI();
362         extentOfOwnershipForUI.add(index, new ExtentOfOwnershipForUI());
363         return super.updateComponent(instanceEditorForm, result, request, response);
364     }
365 
366     @RequestMapping(params = "methodToCall=removeExtentOfOwnership")
367     public ModelAndView removeExtentOfOwnership(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
368                                                 HttpServletRequest request, HttpServletResponse response) {
369         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
370         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
371         List<ExtentOfOwnershipForUI> extentOfOwnershipForUI = instanceEditorForm.getSelectedHolding().getExtentOfOwnershipForUI();
372         if (extentOfOwnershipForUI.size() > 1)
373             extentOfOwnershipForUI.remove(index);
374         return super.updateComponent(instanceEditorForm, result, request, response);
375     }*/
376 
377     @RequestMapping(params = "methodToCall=addAccessInformation")
378     public ModelAndView addAccessInformation(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
379                                              HttpServletRequest request, HttpServletResponse response) {
380         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
381         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
382         index++;
383         List<Uri> accessInformation = instanceEditorForm.getSelectedHolding().getUri();
384         accessInformation.add(index, new Uri());
385         return super.updateComponent(instanceEditorForm, result, request, response);
386     }
387 
388     @RequestMapping(params = "methodToCall=removeAccessInformation")
389     public ModelAndView removeAccessInformation(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
390                                                 HttpServletRequest request, HttpServletResponse response) {
391         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
392         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
393         List<Uri> accessInformation = instanceEditorForm.getSelectedHolding().getUri();
394         if (accessInformation.size() > 1)
395             accessInformation.remove(index);
396         return super.updateComponent(instanceEditorForm, result, request, response);
397     }
398 
399     @RequestMapping(params = "methodToCall=addHoldingNotes")
400     public ModelAndView addHoldingNotes(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
401                                              HttpServletRequest request, HttpServletResponse response) {
402         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
403         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
404         index++;
405         List<Note> holdingsNote = instanceEditorForm.getSelectedHolding().getNote();
406         holdingsNote.add(index, new Note());
407         return super.updateComponent(instanceEditorForm, result, request, response);
408     }
409 
410     @RequestMapping(params = "methodToCall=removeHoldingNotes")
411     public ModelAndView removeHoldingNotes(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
412                                                 HttpServletRequest request, HttpServletResponse response) {
413         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
414         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
415         List<Note> holdingsNote = instanceEditorForm.getSelectedHolding().getNote();
416         if (holdingsNote.size() > 1)
417             holdingsNote.remove(index);
418         return super.updateComponent(instanceEditorForm, result, request, response);
419     }
420 
421     /**
422      * This method will add the controlField record based on the selected Line index and updates the component.
423      * @param form
424      * @param result
425      * @param request
426      * @param response
427      * @return  ModelAndView
428      */
429     @RequestMapping(params = "methodToCall=addControlField")
430     public ModelAndView addControlField(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
431                                         HttpServletRequest request, HttpServletResponse response) {
432         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
433         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
434         index++;
435         List<MarcEditorControlField> marcEditorControlFieldList = instanceEditorForm.getSelectedSourceHolding().getControlFields();
436         marcEditorControlFieldList.add(index, new MarcEditorControlField());
437         return super.updateComponent(instanceEditorForm, result, request, response);
438     }
439 
440     /**
441      *  This method will remove the controlField based on the index position and updates the component.
442      * @param form
443      * @param result
444      * @param request
445      * @param response
446      * @return  ModelAndView
447      */
448     @RequestMapping(params = "methodToCall=removeControlField")
449     public ModelAndView removeControlField(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
450                                            HttpServletRequest request, HttpServletResponse response) {
451         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
452         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
453         List<MarcEditorControlField> editorControlFieldList = instanceEditorForm.getSelectedSourceHolding().getControlFields();
454         if (editorControlFieldList.size() > 1)
455             editorControlFieldList.remove(index);
456         return super.updateComponent(instanceEditorForm, result, request, response);
457     }
458 
459     /**
460      *  This method will add the datField record based on the selected Line index and updates the component.
461      * @param form
462      * @param result
463      * @param request
464      * @param response
465      * @return ModelAndView
466      */
467     @RequestMapping(params = "methodToCall=addDataField")
468     public ModelAndView addDataField(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
469                                      HttpServletRequest request, HttpServletResponse response) {
470         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
471         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
472         index++;
473         List<MarcEditorDataField> editorDataFieldList = instanceEditorForm.getSelectedSourceHolding().getDataFields();
474         editorDataFieldList.add(index, new MarcEditorDataField());
475         return super.updateComponent(instanceEditorForm, result, request, response);
476     }
477 
478     /**
479      *    This method will remove the dataField based on the index position and updates the component.
480      * @param form
481      * @param result
482      * @param request
483      * @param response
484      * @return ModelAndView
485      */
486     @RequestMapping(params = "methodToCall=removeDataField")
487     public ModelAndView removeDataField(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
488                                         HttpServletRequest request, HttpServletResponse response) {
489         InstanceEditorForm instanceEditorForm = (InstanceEditorForm) form;
490         int index = Integer.parseInt(form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
491         List<MarcEditorDataField> marcEditorDataFieldList = instanceEditorForm.getSelectedSourceHolding().getDataFields();
492         if (marcEditorDataFieldList.size() > 1)
493             marcEditorDataFieldList.remove(index);
494         return super.updateComponent(instanceEditorForm, result, request, response);
495     }
496 
497 
498 }
499