View Javadoc
1   /*
2    * Copyright 2013 The Kuali Foundation.
3    *
4    * Licensed under the Educational Community License, Version 1.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl1.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.select.businessobject.inquiry;
17  
18  import org.kuali.ole.OLEConstants;
19  import org.kuali.ole.deliver.bo.OLEPatronEntityViewBo;
20  import org.kuali.ole.deliver.bo.OleBorrowerType;
21  import org.kuali.ole.deliver.bo.OLEPatronEntityViewBo;
22  import org.kuali.ole.sys.businessobject.inquiry.KfsInquirableImpl;
23  import org.kuali.rice.kim.impl.identity.name.EntityNameBo;
24  import org.kuali.rice.kns.lookup.HtmlData;
25  import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData;
26  import org.kuali.rice.krad.bo.BusinessObject;
27  import java.util.*;
28  
29  public class OlePatronDocumentInquirableImpl extends KfsInquirableImpl {
30  
31      @Override
32      public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
33          AnchorHtmlData htmlData = new AnchorHtmlData();
34          if (businessObject instanceof OLEPatronEntityViewBo && attributeName.equals(OLEConstants.REQUESTOR_PATRON_ID) ) {
35              OLEPatronEntityViewBo olePatronEntityViewBo = (OLEPatronEntityViewBo)businessObject;
36              String patronId = olePatronEntityViewBo.getPatronId();
37              olePatronEntityViewBo.setRequestorPatronId(patronId);
38              String href = OLEConstants.ASSIGN_REQUESTOR_INQUIRY + patronId;
39              href = "kr/" + href;
40              htmlData.setHref(href);
41              return htmlData;
42          }
43          else {
44              OLEPatronEntityViewBo oleRequestorPatronDocument = (OLEPatronEntityViewBo)businessObject;
45              String patronId = oleRequestorPatronDocument.getPatronId();
46              oleRequestorPatronDocument.setRequestorPatronId(patronId);
47          }
48          return htmlData;
49      }
50  
51  }