View Javadoc
1   package org.kuali.ole.describe.controller;
2   
3   import org.apache.log4j.Logger;
4   import org.kuali.ole.DocumentUniqueIDPrefix;
5   import org.kuali.ole.OLEConstants;
6   import org.kuali.ole.describe.bo.BoundwithSelection;
7   import org.kuali.ole.describe.bo.DocumentSelectionTree;
8   import org.kuali.ole.describe.bo.DocumentTreeNode;
9   import org.kuali.ole.describe.bo.TransferRightToLeft;
10  import org.kuali.ole.describe.form.BoundwithForm;
11  import org.kuali.ole.docstore.common.document.BibTree;
12  import org.kuali.ole.docstore.common.document.Holdings;
13  import org.kuali.ole.docstore.common.exception.DocstoreException;
14  import org.kuali.ole.docstore.model.enums.DocType;
15  import org.kuali.ole.select.util.TransferUtil;
16  import org.kuali.rice.core.api.util.tree.Node;
17  import org.kuali.rice.core.api.util.tree.Tree;
18  import org.kuali.rice.krad.util.GlobalVariables;
19  import org.kuali.rice.krad.util.KRADConstants;
20  import org.kuali.rice.krad.web.form.UifFormBase;
21  import org.springframework.stereotype.Controller;
22  import org.springframework.validation.BindingResult;
23  import org.springframework.web.bind.annotation.ModelAttribute;
24  import org.springframework.web.bind.annotation.RequestMapping;
25  import org.springframework.web.servlet.ModelAndView;
26  import javax.servlet.http.HttpServletRequest;
27  import javax.servlet.http.HttpServletResponse;
28  import java.util.ArrayList;
29  import java.util.HashMap;
30  import java.util.List;
31  
32  /**
33   * Created with IntelliJ IDEA.
34   * User: ?
35   * Date: 12/29/12
36   * Time: 12:03 PM
37   * To change this template use File | Settings | File Templates.
38   */
39  @Controller
40  @RequestMapping(value = "/transferController")
41  public class TransferController
42          extends BoundwithController {
43      private static final Logger LOG = Logger.getLogger(TransferController.class);
44  
45      @Override
46      @RequestMapping(params = "methodToCall=start")
47      public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
48                                HttpServletRequest request, HttpServletResponse response) {
49          LOG.debug("Inside the workbenchForm--TransferController start method");
50          if (request.getSession().getAttribute(OLEConstants.LEFT_LIST) != null && request.getSession().getAttribute(OLEConstants.RIGHT_LIST) != null) {
51              request.getSession().removeAttribute(OLEConstants.LEFT_LIST);
52              request.getSession().removeAttribute(OLEConstants.RIGHT_LIST);
53          }
54          return super.start(form, result, request, response);
55      }
56  
57  
58      @RequestMapping(params = "methodToCall=selectRootNodeItems")
59      public ModelAndView selectRootNodeItems(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
60                                              HttpServletRequest request, HttpServletResponse response) throws Exception {
61          List<String> bibIdentifierListForTree1 = new ArrayList<String>();
62          List<String> bibInstanceListForTree1 = new ArrayList<String>();
63          List<String> bibInstanceListAllForTree1 = new ArrayList<String>();
64          List<String> bibItemListForTree1 = new ArrayList<String>();
65          List<String> bibIdentifierListForTree2 = new ArrayList<String>();
66          List<String> destBibIdentifierListForTree2 = new ArrayList<String>();
67          List<String> bibInstanceListForTree2 = new ArrayList<String>();
68          List<String> destInstanceIdentifierListForTree2 = new ArrayList<String>();
69          List<String> itemsSelectedListForRightTree = new ArrayList<String>();
70          List<String> bibIdentifiersSelectedListForLeftTree = new ArrayList<String>();
71          List<String> bibIdentifiersListWhenInstanceSelectedForLeftTree = new ArrayList<String>();
72          List<String> instanceIdentifiersListWhenItemSelectedForLeftTree = new ArrayList<String>();
73          List<String> instanceIdentifiersToDelete = new ArrayList<String>();
74          boolean transferInstance = true;
75          boolean transferItem = true;
76          //  StringBuffer stringBufferLeftTree=new StringBuffer();
77          //StringBuffer stringBufferRightTree=new StringBuffer();
78  
79          //String isLeftBibsSelected="false";
80          //String isRightItemsSelected="false";
81          String status1 = "";
82          String status2 = "";
83  
84          BoundwithForm transferForm = (BoundwithForm) form;
85          /*boolean hasPermission = performTransferHoldingOrItem(GlobalVariables.getUserSession().getPrincipalId());
86          if (!hasPermission) {
87              //transferForm.setMessage("<font size='3' color='red'> Current user is not authorized to perform this action.</font>");
88              GlobalVariables.getMessageMap().putErrorForSectionId("TransferTreeSection1", "info.authorization");
89              return navigate(transferForm, result, request, response);
90          }*/
91          transferForm.setTransferLeftTree(true);
92          transferForm.setTransferRighttree(false);
93          //transferForm.setInDelete("false");
94          transferForm.setInDeleteLeftTree("false");
95          transferForm.setInDeleteRightTree("false");
96          // List<OleWorkBibDocument>  oleWorkBibDocumentList=transferForm.getWorkBibDocumentList();
97          Tree<DocumentTreeNode, String> leftTree = transferForm.getLeftTree();
98          Node<DocumentTreeNode, String> leftTreeRootElement = leftTree.getRootElement();
99          Tree<DocumentTreeNode, String> rightTree = transferForm.getRightTree();
100         Node<DocumentTreeNode, String> rightTreeRootElement = rightTree.getRootElement();
101         List<String> bibIdentifiersToDelete = new ArrayList<String>();
102         String deleteResponseFromDocStore = "";
103         if(transferForm.getDocType().equalsIgnoreCase(OLEConstants.BIB_DOC_TYPE)) {
104 
105         status1 = selectCheckedNodesTree1(leftTreeRootElement, bibIdentifierListForTree1, bibInstanceListForTree1,
106                 bibItemListForTree1, bibIdentifiersSelectedListForLeftTree,
107                 bibIdentifiersListWhenInstanceSelectedForLeftTree, instanceIdentifiersListWhenItemSelectedForLeftTree,
108                 bibIdentifiersToDelete, instanceIdentifiersToDelete);
109         selectCheckedNodesTree2(rightTreeRootElement, bibIdentifierListForTree2, itemsSelectedListForRightTree,
110                 destBibIdentifierListForTree2, destInstanceIdentifierListForTree2);
111         } else if(transferForm.getDocType().equalsIgnoreCase(OLEConstants.HOLDING_DOC_TYPE)) {
112             selectCheckedNodesForItemTransferTree1(leftTreeRootElement, bibInstanceListForTree1, bibInstanceListAllForTree1, bibItemListForTree1,
113                     instanceIdentifiersListWhenItemSelectedForLeftTree, instanceIdentifiersToDelete); //source
114             selectCheckedNodesForItemTransferTree2(rightTreeRootElement, bibInstanceListForTree2, itemsSelectedListForRightTree, destInstanceIdentifierListForTree2);//dest
115         }
116         LOG.debug("bibIdentifiersToDelete " + bibIdentifiersToDelete);
117 
118         //  isLeftBibsSelected= stringBufferLeftTree.toString();
119 
120         if (leftTreeRootElement == null) {
121             //transferForm.setMessage("No records copied for left tree");
122             //GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO,"error.transfer.empty.records", "right");
123             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "error.transfer.empty.records", "left");
124         } else if (rightTreeRootElement == null) {
125             //transferForm.setMessage("No records copied for right tree");
126             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "error.transfer.empty.records", "right");
127         } else if (bibIdentifiersSelectedListForLeftTree.size() > 0) {
128             //transferForm.setMessage("Bib(s) selected in Left Tree which is invalid");
129             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "error.transfer.invalid", "Bib", "left");
130         } else if (bibInstanceListForTree1.size() > 0 && transferForm.getDocType().equalsIgnoreCase(OLEConstants.HOLDING_DOC_TYPE)) {
131             //transferForm.setMessage("Bib(s) selected in Left Tree which is invalid");
132             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "error.transfer.invalid", "Holding", "left");
133         } else if (bibInstanceListForTree1.size() == 0 && bibItemListForTree1.size() == 0) {
134             //transferForm.setMessage("Nothing selected in left tree");
135             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "error.transfer.selected.none", "left");
136         } else if (itemsSelectedListForRightTree.size() > 0) {
137             //transferForm.setMessage("Item(s) selected in Right Tree which is invalid");
138             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "error.transfer.invalid", "Item", "right");
139         } else if (destBibIdentifierListForTree2.size() == 0 && destInstanceIdentifierListForTree2.size() == 0) {
140             //transferForm.setMessage("Nothing selected in right tree");
141             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "error.transfer.selected.none", "right");
142         } else if (bibInstanceListForTree1.size() > 0 && bibItemListForTree1.size() > 0) {
143             //transferForm.setMessage("Instances and items both selected in left tree: Transfer failed");
144             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "error.transfer.selected.multiple", "Instances", "items", "left");
145         } else if (destBibIdentifierListForTree2.size() > 0 && destInstanceIdentifierListForTree2.size() > 0) {
146             //transferForm.setMessage("Bibs and instances both selected in right tree: Transfer failed");
147             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "error.transfer.selected.multiple", "Bibs", "instances", "right");
148         } else if (destBibIdentifierListForTree2.size() > 1) {
149             //transferForm.setMessage("Only one bib can be selected in right tree");
150             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "error.transfer.selected.invalid", "bib", "right");
151         } else if (destInstanceIdentifierListForTree2.size() > 1) {
152             //transferForm.setMessage("Only one instance can be selected in right tree");
153             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "error.transfer.selected.invalid", "instance", "right");
154         } else if (bibInstanceListForTree1.size() > 0 && destInstanceIdentifierListForTree2.size() > 0) {
155             //transferForm.setMessage("Instances of left tree cant be transferred to instances of right tree: Transfer failed");
156             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "error.transfer.left", "Instances", "Instances");
157         } else if (bibItemListForTree1.size() > 0 && destBibIdentifierListForTree2.size() > 0) {
158             //transferForm.setMessage("Items of left tree cant be transferred to Bibs of right tree: Transfer failed");
159             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "error.transfer.left", "Items", "Bibs");
160         }
161         //        else if(!status1.equalsIgnoreCase("success")){
162         //            System.out.println("in if checking status1");
163         //             transferForm.setMessage(status1);
164         //        }
165         else if (bibInstanceListForTree1.size() > 0) {
166             for (String bibUuid : bibIdentifiersListWhenInstanceSelectedForLeftTree) {
167                 if (destBibIdentifierListForTree2.contains(bibUuid)) {
168                     //transferForm.setMessage("Transfer of instances should not happen between same left bib and right bib. Transfer of instances failed");
169                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "error.transfer.bib");
170                     transferInstance = false;
171                     break;
172                 }
173             }
174             if (transferInstance) {
175                 String destBibIdentifier = destBibIdentifierListForTree2.get(0);
176                 if (bibIdentifiersToDelete.size() > 0) {
177                     transferForm.setDocFormat(OLEConstants.MARC_FORMAT);
178                     transferForm.setDocCategory(OLEConstants.WORK_CATEGORY);
179                     transferForm.setDocType(OLEConstants.BIB_DOC_TYPE);
180 //                    String bibIdentifiers = Joiner.on(",").join(bibIdentifiersToDelete);
181 //                    deleteResponseFromDocStore = TransferUtil.getInstance().getDeleteResponseFromDocStore("deleteVerify", bibIdentifiers,
182 //                            transferForm);
183                     transferForm.setBibInstanceListForTree1(bibInstanceListForTree1);
184                     transferForm.setDestBibIdentifier(destBibIdentifier);
185 //                    transferForm.setDeleteVerifyResponse(deleteResponseFromDocStore);
186 //                    TransferUtil.getInstance().deleteVerify(transferForm, deleteResponseFromDocStore);
187 
188                     // According to OLE-6912 no need to check the item which exist in Requisition or  PO or Loan
189                     transferForm.setDeleteVerifyResponse("success");
190 //                    transferForm.setDeleteVerifyResponse(TransferUtil.getInstance().checkItemExistsInOleForBibs(bibIdentifiersToDelete));
191                     transferForm.setDeleteIds(bibIdentifiersToDelete);
192                     TransferUtil.getInstance().deleteVerify(transferForm, bibIdentifiersToDelete);
193                     // Holding wouldn't transfer, if item is attached with Loan, PO, etc.
194                     if (transferForm.getDeleteVerifyResponse().equalsIgnoreCase(OLEConstants.OLEBatchProcess.RESPONSE_STATUS_FAILED)) {
195                         GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, OLEConstants.TRANSFER_FAIL_MESSAGE_ITEM_ATTACHED_OLE);
196                     }
197                     return getUIFModelAndView(transferForm);
198                 }
199                 TransferUtil.getInstance().transferInstances(bibInstanceListForTree1, destBibIdentifier);
200                 TransferUtil.getInstance().copyToTree(transferForm, bibIdentifierListForTree1, OLEConstants.LEFT_TREE);
201                 TransferUtil.getInstance().copyToTree(transferForm, bibIdentifierListForTree2, OLEConstants.RIGHT_TREE);
202                 //transferForm.setMessage("Instances transferred successfully");
203                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer", "Instances");
204             }
205         } else if (bibItemListForTree1.size() > 0) {
206             //If Transfer of items happen between same left holding and right holding.
207             for (String instanceUuid : instanceIdentifiersListWhenItemSelectedForLeftTree) {
208                 if (destInstanceIdentifierListForTree2.contains(instanceUuid)) {
209                     //transferForm.setMessage("Transfer of instances should not happen between same left bib and right bib. Transfer of instances failed");
210                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "error.transfer.item");
211                     transferItem = false;
212                     break;
213                 }
214             }
215             if (transferItem) {
216                 String destInstanceIdentifier = destInstanceIdentifierListForTree2.get(0);
217                 if (instanceIdentifiersToDelete.size() > 0) {
218                     transferForm.setDocFormat(OLEConstants.OLEML_FORMAT);
219                     transferForm.setDocCategory(OLEConstants.WORK_CATEGORY);
220                     transferForm.setDocType(OLEConstants.HOLDING_DOC_TYPE);
221                     transferForm.setBibItemListForTree1(bibItemListForTree1);
222                     transferForm.setDestInstanceIdentifier(destInstanceIdentifier);
223 
224                     // According to OLE-6912 no need to check the item which exist in Requisition or  PO or Loan
225                     transferForm.setDeleteVerifyResponse("success");
226 //                    transferForm.setDeleteVerifyResponse(TransferUtil.getInstance().checkItemExistsInOleForHoldings(instanceIdentifiersToDelete));
227                     transferForm.setDeleteIds(instanceIdentifiersToDelete);
228                     TransferUtil.getInstance().deleteVerify(transferForm, instanceIdentifiersToDelete);
229                     // Item wouldn't transfer, if item is attached with Loan, PO, etc.
230                     if (transferForm.getDeleteVerifyResponse().equalsIgnoreCase(OLEConstants.OLEBatchProcess.RESPONSE_STATUS_FAILED)) {
231                         GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, OLEConstants.TRANSFER_FAIL_MESSAGE_ITEM_ATTACHED_OLE);
232                     }
233                     return getUIFModelAndView(transferForm);
234                     //return deleteVerify(transferForm, deleteResponseFromDocStore);
235                 }
236                 TransferUtil.getInstance().transferItems(bibItemListForTree1, destInstanceIdentifier);
237                 if (transferForm.getDocType().equalsIgnoreCase((DocType.BIB.getDescription()))) {
238                     TransferUtil.getInstance().copyToTree(transferForm, bibIdentifierListForTree1, OLEConstants.LEFT_TREE);
239                     TransferUtil.getInstance().copyToTree(transferForm, bibIdentifierListForTree2, OLEConstants.RIGHT_TREE);
240                 } else if (transferForm.getDocType().equalsIgnoreCase((DocType.HOLDINGS.getCode()))) {
241                     TransferUtil.getInstance().copyToTree(transferForm, bibInstanceListAllForTree1, OLEConstants.LEFT_TREE);
242                     TransferUtil.getInstance().copyToTree(transferForm, bibInstanceListForTree2, OLEConstants.RIGHT_TREE);
243                 }
244                 //transferForm.setMessage("Items transferred successfully");
245                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer", "Items");
246             }
247         } else {
248             //transferForm.setMessage("Nothing selected or Selection is wrong");
249             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "error.transfer.bib");
250         }
251         return navigate(transferForm, result, request, response);
252         //        return getUIFModelAndView(transferForm);
253     }
254 
255     private void selectCheckedNodesForItemTransferTree2(Node<DocumentTreeNode, String> rightTreeRootElement, List<String> bibInstanceListForTree2, List<String> itemsSelectedListForRightTree, List<String> destInstanceIdentifierListForTree2) {
256         DocumentTreeNode documentTreeNode;
257         if (rightTreeRootElement != null) {
258             List<Node<DocumentTreeNode, String>> instanceList = rightTreeRootElement.getChildren();
259 
260             for (Node<DocumentTreeNode, String> instanceNode : instanceList) {
261                 documentTreeNode = instanceNode.getData();
262                 bibInstanceListForTree2.add(instanceNode.getNodeType());
263                 if (documentTreeNode.isSelect()) {
264                     String instanceUUID = instanceNode.getNodeType();
265                     destInstanceIdentifierListForTree2.add(instanceUUID);
266                 }
267                 List<Node<DocumentTreeNode, String>> itemList = instanceNode.getChildren();
268                 for (Node<DocumentTreeNode, String> itemNode : itemList) {
269                     documentTreeNode = itemNode.getData();
270                     if (documentTreeNode.isSelect()) {
271                         itemsSelectedListForRightTree.add(itemNode.getNodeType());
272                         break;
273                     }
274                 }
275 
276             }
277         }
278     }
279 
280     private void selectCheckedNodesForItemTransferTree1(Node<DocumentTreeNode, String> leftTreeRootElement,List<String>  bibInstanceListForTree1,List<String>  bibInstanceListAllForTree1,
281                                                         List<String> bibItemListForTree1,
282                                                         List<String> instanceIdentifiersListWhenItemSelectedForLeftTree,
283                                                         List<String> instanceIdentifiersToDelete) {
284         DocumentTreeNode documentTreeNode;
285         int itemCount = 0;
286         List<String> instanceidenifiersListTemp = new ArrayList<String>();
287         if (leftTreeRootElement != null) {
288             List<Node<DocumentTreeNode, String>> instanceList = leftTreeRootElement.getChildren();
289             for (Node<DocumentTreeNode, String> instanceNode : instanceList) {
290 
291                 String instanceUUID = "";
292                 documentTreeNode = instanceNode.getData();
293                 instanceUUID = instanceNode.getNodeType();
294                 bibInstanceListAllForTree1.add(instanceUUID);
295                 if (documentTreeNode.isSelect()) {
296                     LOG.info("documentTreeNode.isSelectTree1()-->" + documentTreeNode.isSelect());
297                     bibInstanceListForTree1.add(instanceUUID);
298                     break;
299                 }
300 
301                 List<Node<DocumentTreeNode, String>> itemList = null;
302                 instanceidenifiersListTemp.clear();
303 
304                 itemCount = 0;
305 
306                 itemList = instanceNode.getChildren();
307                 for (Node<DocumentTreeNode, String> itemNode : itemList) {
308                     //itemCount=0;
309                     documentTreeNode = itemNode.getData();
310                     if (documentTreeNode.isSelect()) {
311                         itemCount++;
312                         String itemUUID = itemNode.getNodeType();
313                         bibItemListForTree1.add(itemUUID);
314                         instanceIdentifiersListWhenItemSelectedForLeftTree.add(instanceUUID);
315                     }
316                 } //item loop end
317                 if (itemCount == itemList.size()) {
318                     instanceidenifiersListTemp.add(instanceUUID);
319                     LOG.debug("in if of no items instanceidenifiersListTemp " + instanceidenifiersListTemp);
320                     //status="Instance will remain with no items if this transfer takes place. Instance must have atleast one item. Transfer failed";
321                 }
322                 //instance loop end
323 
324                 instanceIdentifiersToDelete.addAll(instanceidenifiersListTemp);
325                 LOG.debug("instanceIdentifiersToDelete " + instanceIdentifiersToDelete);
326                 //                else if(itemCount==itemList.size()){
327                 //                    status="Instance will remain with no items if this transfer takes place. Instance must have atleast one item. Transfer failed";
328                 //                }
329             }//bib loop end
330         }
331 
332     }
333 
334 //    public void delete(ResponseDocument responseDocument) {
335 //    }
336 
337     @RequestMapping(params = "methodToCall=transferRightToLeft")
338     public ModelAndView transferRightToLeft(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
339                                             HttpServletRequest request, HttpServletResponse response) throws Exception {
340         BoundwithForm transferForm = (BoundwithForm) form;
341         /*boolean hasPermission = performTransferHoldingOrItem(GlobalVariables.getUserSession().getPrincipalId());
342         if (!hasPermission) {
343             //transferForm.setMessage("<font size='3' color='red'> Current user is not authorized to perform this action.</font>");
344             GlobalVariables.getMessageMap().putErrorForSectionId("TransferTreeSection2", "info.authorization");
345             return navigate(transferForm, result, request, response);
346         }*/
347         transferForm.setInDeleteLeftTree("false");
348         transferForm.setInDeleteRightTree("false");
349         transferForm.setTransferLeftTree(false);
350         transferForm.setTransferRighttree(true);
351         TransferRightToLeft transferRightToLeft = new TransferRightToLeft();
352         transferRightToLeft.transferRightToLeft(transferForm, result, request, response);
353         return navigate(transferForm, result, request, response);
354         //        return getUIFModelAndView(transferForm);
355     }
356 
357     private String selectCheckedNodesTree1(Node<DocumentTreeNode, String> rootElement,
358                                            List<String> bibIdentifierListForTree1, List<String> bibInstanceListForTree1,
359                                            List<String> bibItemListForTree1,
360                                            List<String> bibIdentifiersSelectedListForLeftTree,
361                                            List<String> bibIdentifiersListWhenInstanceSelectedForLeftTree,
362                                            List<String> instanceIdentifiersListWhenItemSelectedForLeftTree,
363                                            List<String> bibIdentifiersToDelete,
364                                            List<String> instanceIdentifiersToDelete) {
365 
366         BoundwithSelection boundwithSelection;
367         DocumentTreeNode documentTreeNode;
368         String status = "success";
369         String bibTitle = "";
370         int instanceCount = 0;
371         int itemCount = 0;
372         List<String> instanceidenifiersListTemp = new ArrayList<String>();
373         if (rootElement != null) {
374             List<Node<DocumentTreeNode, String>> list = rootElement.getChildren();
375             for (Node<DocumentTreeNode, String> marcNode : list) {
376                 instanceCount = 0;
377                 itemCount = 0;
378                 String instanceUUID = "";
379                 documentTreeNode = marcNode.getData();
380 
381                 bibTitle = documentTreeNode.getTitle();
382                 String bibUUID = marcNode.getNodeType();
383                 bibIdentifierListForTree1.add(bibUUID);
384                 LOG.info("documentTreeNode.isSelectTree1()-->" + documentTreeNode.isSelect());
385                 if (documentTreeNode.isSelect()) {
386                     bibIdentifiersSelectedListForLeftTree.add(bibUUID);
387                     break;
388                 }
389                 List<Node<DocumentTreeNode, String>> instanceList = marcNode.getChildren();
390                 List<Node<DocumentTreeNode, String>> itemList = null;
391                 instanceidenifiersListTemp.clear();
392                 for (Node<DocumentTreeNode, String> instanceNode : instanceList) {
393                     itemCount = 0;
394                     documentTreeNode = instanceNode.getData();
395                     instanceUUID = instanceNode.getNodeType();
396                     LOG.debug("instanceUUID out of select " + instanceUUID);
397                     if (documentTreeNode.isSelect()) {
398                         instanceCount++;
399 
400                         LOG.debug("instanceUUID " + instanceUUID);
401                         bibInstanceListForTree1.add(instanceUUID);
402                         //instanceidenifiersListTemp.add(instanceUUID);
403                         bibIdentifiersListWhenInstanceSelectedForLeftTree.add(bibUUID);
404                     }
405                     itemList = instanceNode.getChildren();
406                     for (Node<DocumentTreeNode, String> itemNode : itemList) {
407                         documentTreeNode = itemNode.getData();
408                         if (documentTreeNode.isSelect()) {
409                             itemCount++;
410                             String itemUUID = itemNode.getNodeType();
411                             LOG.debug("itemUUID " + itemUUID);
412                             bibItemListForTree1.add(itemUUID);
413                             instanceIdentifiersListWhenItemSelectedForLeftTree.add(instanceUUID);
414                         }
415                     }  //item loop end
416                     if (instanceNode.getNumberOfChildren() > 0 && itemCount == itemList.size()) {
417                         instanceidenifiersListTemp.add(instanceUUID);
418                         //status="Instance will remain with no items if this transfer takes place. Instance must have atleast one item. Transfer failed";
419                     }
420                 } //instance loop end
421                 if (marcNode.getNumberOfChildren() > 0 && instanceCount == instanceList.size()) {
422                     bibIdentifiersToDelete.add(bibUUID);
423                     LOG.debug("in if of no instances bibIdentifierToDelete " + bibIdentifiersToDelete);
424                 }
425                 instanceIdentifiersToDelete.addAll(instanceidenifiersListTemp);
426             }  //bib loop end
427         }
428         return status;
429     }
430 
431 
432     private void selectCheckedNodesTree2(Node<DocumentTreeNode, String> rootElement,
433                                          List<String> bibIdentifierListForTree2,
434                                          List<String> itemsSelectedListForRightTree,
435                                          List<String> destBibIdentifierListForTree2,
436                                          List<String> destInstanceIdentifierListForTree2) {
437 
438         BoundwithSelection boundwithSelection;
439         DocumentTreeNode documentTreeNode;
440         if (rootElement != null) {
441             List<Node<DocumentTreeNode, String>> list = rootElement.getChildren();
442             for (Node<DocumentTreeNode, String> marcNode : list) {
443                 documentTreeNode = marcNode.getData();
444                 String bibUUID = marcNode.getNodeType();
445                 bibIdentifierListForTree2.add(bibUUID);
446                 LOG.info("documentTreeNode.isSelectTree1()-->" + documentTreeNode.isSelect());
447                 if (documentTreeNode.isSelect()) {
448                     destBibIdentifierListForTree2.add(bibUUID);
449                 }
450                 List<Node<DocumentTreeNode, String>> instanceList = marcNode.getChildren();
451                 for (Node<DocumentTreeNode, String> instanceNode : instanceList) {
452                     documentTreeNode = instanceNode.getData();
453                     if (documentTreeNode.isSelect()) {
454                         String instanceUUID = instanceNode.getNodeType();
455                         destInstanceIdentifierListForTree2.add(instanceUUID);
456                     }
457                     List<Node<DocumentTreeNode, String>> itemList = instanceNode.getChildren();
458                     for (Node<DocumentTreeNode, String> itemNode : itemList) {
459                         documentTreeNode = itemNode.getData();
460                         if (documentTreeNode.isSelect()) {
461                             String itemUUID = itemNode.getNodeType();
462                             //stringBufferRightTree.append("true");
463                             itemsSelectedListForRightTree.add(itemUUID);
464                             break;
465                         }
466                     }
467 
468                 }
469             }
470         }
471     }
472 
473     String listToCsv(List<String> listOfStrings, char separator) {
474         StringBuilder sb = new StringBuilder();
475 
476         // all but last
477         for (int i = 0; i < listOfStrings.size() - 1; i++) {
478             sb.append(listOfStrings.get(i));
479             sb.append(separator);
480         }
481         // last string, no separator
482         sb.append(listOfStrings.get(listOfStrings.size() - 1));
483         return sb.toString();
484     }
485 
486     @RequestMapping(params = "methodToCall=delete")
487     public ModelAndView delete(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
488                                HttpServletRequest request, HttpServletResponse httpResponse) throws Exception {
489         StringBuilder uuidList = new StringBuilder();
490         BoundwithForm transferForm = (BoundwithForm) form;
491         DocumentSelectionTree documentSelectionTree = new DocumentSelectionTree();
492         //        uuidList.append(boundwithForm.getDocId());
493         //boundwithForm.setInDelete("false");
494         transferForm.setInDeleteLeftTree("false");
495         transferForm.setInDeleteRightTree("false");
496 //        WorkInstanceDocument workInstanceDocumentForTree1 = transferForm.getWorkInstanceDocumentForTree1();
497 
498         String deleteVerifyResponse = transferForm.getDeleteVerifyResponse();
499         if (deleteVerifyResponse.contains("Failed")) {
500             /*transferForm.setSelectedInstance(
501                     "Unable to delete the instance " + workInstanceDocumentForTree1.getHoldingsDocument()
502                                                                                    .getLocationName()
503                     + "\t \n because it exists in OLE database");*/
504 //            String message = workInstanceDocumentForTree1.getHoldingsDocument().getLocationName();
505             String message = "location";
506             GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.delete.failure", message);
507         } else if (deleteVerifyResponse.contains("success")) {
508             String treeId = transferForm.getActionParamaterValue("treeId");
509             if (transferForm.getDocType().equalsIgnoreCase(OLEConstants.BIB_DOC_TYPE)) {
510                 if (transferForm.getDestBibIdentifier() != null && transferForm.getDestBibIdentifier().length() > 0) {
511                     TransferUtil.getInstance().transferInstances(transferForm.getBibInstanceListForTree1(),
512                             transferForm.getDestBibIdentifier());
513                     //transferForm.setMessage("Instance transferred successfully. Bib is deleted.");
514                     for (String id : transferForm.getDeleteIds()) {
515                         try {
516                             getDocstoreClientLocator().getDocstoreClient().deleteBib(id);
517                             if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
518                                 HashMap leftList = (HashMap) request.getSession().getAttribute(OLEConstants.LEFT_LIST);
519                                 if (leftList.size() == 1) {
520                                     clearTree(transferForm, result, request, httpResponse);
521                                 }
522                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.instance.success");
523                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.instance.success.bib.delete");
524                             } else {
525                                 HashMap rightList = (HashMap) request.getSession().getAttribute(OLEConstants.RIGHT_LIST);
526                                 if (rightList.size() == 1) {
527                                     clearTree(transferForm, result, request, httpResponse);
528                                 }
529                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.instance.success");
530                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.instance.success.bib.delete");
531                             }
532                         } catch (Exception e) {
533                             DocstoreException docstoreException = (DocstoreException) e;
534                             if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
535                                 GlobalVariables.getMessageMap().getInfoMessages().clear();
536 
537                                 if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
538                                     GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.instance.success");
539                                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, docstoreException.getErrorCode());
540                                 } else {
541                                     GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.instance.success");
542                                     GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, docstoreException.getErrorCode());
543                                 }
544                             } else {
545                                 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
546                             }
547                         }
548                     }
549                     transferForm.setDestBibIdentifier(null);
550                 } else {
551                     TransferUtil.getInstance().transferItems(transferForm.getBibItemListForTree1(),
552                             transferForm.getDestInstanceIdentifier());
553                     //transferForm.setMessage("Item transferred successfully. Bib and Instance are deleted.");
554                     Holdings holdings = null;
555                     for (String id : transferForm.getDeleteIds()) {
556                         try {
557                             holdings = getDocstoreClientLocator().getDocstoreClient().retrieveHoldings(id);
558                         } catch (Exception e) {
559                             DocstoreException docstoreException = (DocstoreException) e;
560                             if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
561                                 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, docstoreException.getErrorCode());
562                             } else {
563                                 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
564                             }
565                         }
566                         BibTree bibTree = null;
567                         try {
568                             bibTree = getDocstoreClientLocator().getDocstoreClient().retrieveBibTree(holdings.getBib().getId());
569                         } catch (Exception e) {
570                             DocstoreException docstoreException = (DocstoreException) e;
571                             if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
572                                 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, docstoreException.getErrorCode());
573                             } else {
574                                 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
575                             }
576                         }
577                         if (bibTree.getHoldingsTrees() != null && bibTree.getHoldingsTrees().size() > 1) {
578                             if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
579                                 HashMap leftList = (HashMap) request.getSession().getAttribute(OLEConstants.LEFT_LIST);
580                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.item.success");
581                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.item.success.holdings.delete");
582                             } else {
583                                 HashMap rightList = (HashMap) request.getSession().getAttribute(OLEConstants.RIGHT_LIST);
584                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.item.success");
585                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.item.success.holdings.delete");
586                             }
587                             for (String holdingId : transferForm.getDeleteIds()) {
588                                 try {
589                                     getDocstoreClientLocator().getDocstoreClient().deleteHoldings(holdingId);
590 
591                                 } catch (Exception e) {
592                                     DocstoreException docstoreException = (DocstoreException) e;
593                                     if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
594                                         GlobalVariables.getMessageMap().getInfoMessages().clear();
595                                         if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
596                                             GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.item.success");
597                                             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, docstoreException.getErrorCode());
598                                         } else {
599                                             GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.item.success");
600                                             GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, docstoreException.getErrorCode());
601                                         }
602                                     } else {
603                                         GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
604                                     }
605                                 }
606                             }
607                         } else {
608                             if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
609                                 HashMap leftList = (HashMap) request.getSession().getAttribute(OLEConstants.LEFT_LIST);
610                                 if (leftList.size() == 1) {
611                                     clearTree(transferForm, result, request, httpResponse);
612                                 }
613                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.item.success");
614                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.item.success.bib.instance.delete");
615                             } else {
616                                 HashMap rightList = (HashMap) request.getSession().getAttribute(OLEConstants.RIGHT_LIST);
617                                 if (rightList.size() == 1) {
618                                     clearTree(transferForm, result, request, httpResponse);
619                                 }
620                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.item.success");
621                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.item.success.bib.instance.delete");
622                             }
623                             try {
624                                 getDocstoreClientLocator().getDocstoreClient().deleteBib(holdings.getBib().getId());
625 
626                             } catch (Exception e) {
627                                 DocstoreException docstoreException = (DocstoreException) e;
628                                 if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
629                                     GlobalVariables.getMessageMap().getInfoMessages().clear();
630                                     if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
631                                         GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.item.success");
632                                         GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, docstoreException.getErrorCode());
633                                     } else {
634                                         GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.item.success");
635                                         GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, docstoreException.getErrorCode());
636                                     }
637                                 } else {
638                                     GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
639                                 }
640                             }
641                         }
642                     }
643                 }
644             } else if (transferForm.getDocType().equalsIgnoreCase(OLEConstants.HOLDING_DOC_TYPE)) {
645                 TransferUtil.getInstance().transferItems(transferForm.getBibItemListForTree1(), transferForm.getDestInstanceIdentifier());
646 
647                 for (String id : transferForm.getDeleteIds()) {
648 
649                     try {
650                         getDocstoreClientLocator().getDocstoreClient().deleteHoldings(id);
651                         if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
652                             HashMap leftList = (HashMap) request.getSession().getAttribute(OLEConstants.LEFT_LIST);
653                             if (leftList.size() == 1) {
654                                 clearTree(transferForm, result, request, httpResponse);
655                             }
656                             leftList.remove(DocumentUniqueIDPrefix.getDocumentId(id));
657                             request.getSession().setAttribute(OLEConstants.LEFT_LIST, leftList);
658                             GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.item.success");
659                             GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.item.success.holdings.delete");
660                         } else {
661                             HashMap rightList = (HashMap) request.getSession().getAttribute(OLEConstants.RIGHT_LIST);
662                             if (rightList.size() == 1) {
663                                 clearTree(transferForm, result, request, httpResponse);
664                             }
665                             rightList.remove(DocumentUniqueIDPrefix.getDocumentId(id));
666                             request.getSession().setAttribute(OLEConstants.RIGHT_LIST, rightList);
667                             GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.item.success");
668                             GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer.item.success.holdings.delete");
669                         }
670                     } catch (Exception e) {
671                         DocstoreException docstoreException = (DocstoreException) e;
672                         if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
673                             GlobalVariables.getMessageMap().getInfoMessages().clear();
674 
675                             if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
676                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION,  "info.transfer.item.success");
677                                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, docstoreException.getErrorCode());
678                             } else {
679                                 GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer.item.success");
680                                 GlobalVariables.getMessageMap().putErrorForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, docstoreException.getErrorCode());
681                             }
682                         } else {
683                             GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
684                         }
685                     }
686                 }
687             }
688 //            String deleteResponseFromDocStore = TransferUtil.getInstance().getDeleteResponseFromDocStore("delete", uuidList.toString(),
689 //                    transferForm);
690             transferForm.setShowBoundwithTree(false);
691         }
692         return getUIFModelAndView(transferForm);
693     }
694 
695     @RequestMapping(params = "methodToCall=OnlyTransfer")
696     public ModelAndView OnlyTransfer(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
697                                      HttpServletRequest request, HttpServletResponse httpResponse) throws Exception {
698         BoundwithForm transferForm = (BoundwithForm) form;
699         String treeId = transferForm.getActionParamaterValue("treeId");
700         if (transferForm.getDocType().equalsIgnoreCase(OLEConstants.BIB_DOC_TYPE)) {
701             if (transferForm.getDestBibIdentifier() != null && transferForm.getDestBibIdentifier().length() > 0) {
702                 TransferUtil.getInstance().transferInstances(transferForm.getBibInstanceListForTree1(),
703                         transferForm.getDestBibIdentifier());
704                 //transferForm.setMessage("Instance transferred successfully.");
705                 if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
706                     GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer", "Instance");
707                 } else {
708                     GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer", "Instance");
709                 }
710                 transferForm.setDestBibIdentifier(null);
711             } else {
712                 TransferUtil.getInstance().transferItems(transferForm.getBibItemListForTree1(),
713                         transferForm.getDestInstanceIdentifier());
714                 //transferForm.setMessage("Item transferred successfully.");
715                 if (treeId.equalsIgnoreCase(OLEConstants.LEFT_TREE)) {
716                     GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_RIGHT_TREE_SECTION, "info.transfer", "Item");
717                 } else {
718                     GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer", "Item");
719                 }
720             }
721         } else if (transferForm.getDocType().equalsIgnoreCase(OLEConstants.HOLDING_DOC_TYPE)) {
722             TransferUtil.getInstance().transferItems(transferForm.getBibItemListForTree1(),
723                     transferForm.getDestInstanceIdentifier());
724             //transferForm.setMessage("Item transferred successfully.");
725             GlobalVariables.getMessageMap().putInfoForSectionId(OLEConstants.TRANSFER_LEFT_TREE_SECTION, "info.transfer", "Item");
726         }
727         //boundwithForm.setInDelete("false");
728         transferForm.setInDeleteLeftTree("false");
729         transferForm.setInDeleteRightTree("false");
730         return getUIFModelAndView(transferForm);
731     }
732 
733     /**
734      * Enable, disable the next and previous and also show the message for number of entries
735      * @param boundwithForm
736      * @return
737      */
738     public void setPageNextPreviousAndEntriesInfo(BoundwithForm boundwithForm) {
739         this.totalRecCount = boundwithForm.getSearchResponse().getTotalRecordCount();
740         this.start = boundwithForm.getSearchResponse().getStartIndex();
741         this.pageSize = boundwithForm.getSearchResponse().getPageSize();
742         boundwithForm.setPreviousFlag(getWorkbenchPreviousFlag());
743         boundwithForm.setNextFlag(getWorkbenchNextFlag());
744         boundwithForm.setPageShowEntries(getWorkbenchPageShowEntries());
745     }
746 
747 }