View Javadoc
1   package org.kuali.ole.select.maintenance;
2   
3   import org.kuali.ole.docstore.common.client.DocstoreClientLocator;
4   import org.kuali.ole.docstore.common.document.License;
5   import org.kuali.ole.select.bo.OleLicenseRequestBo;
6   import org.kuali.ole.sys.context.SpringContext;
7   import org.kuali.rice.core.api.config.property.ConfigContext;
8   import org.kuali.rice.kew.api.KewApiConstants;
9   import org.kuali.rice.krad.maintenance.MaintainableImpl;
10  
11  /**
12   * Created with IntelliJ IDEA.
13   * User: Juliya Monica.S
14   * Date: 3/17/13
15   * Time: 1:07 PM
16   * To change this template use File | Settings | File Templates.
17   */
18  public class OleLicenseRequestMaintenanceImpl extends MaintainableImpl {
19  
20      private DocstoreClientLocator docstoreClientLocator;
21      public DocstoreClientLocator getDocstoreClientLocator() {
22          if (null == docstoreClientLocator) {
23              return  SpringContext.getBean(DocstoreClientLocator.class);
24          }
25          return docstoreClientLocator;
26      }
27  
28  
29      /* This method is used to view the E-Resource document
30      * @param oleLicenseRequestBo
31      * @return  redirectUrl
32              */
33      public String getUrl(OleLicenseRequestBo oleLicenseRequestBo) {
34          String oleurl = ConfigContext.getCurrentContextConfig().getProperty("ole.url");
35          //String olePortal = oleurl.substring(0,oleurl.indexOf("portal.jsp"));
36          //String requisitionDocNumber = request.getParameter(OLEConstants.OleLicenseRequest.REQUISITION_DOC_NUM);
37          String redirectUrl = "";
38          String eResourceDocNumber = "";
39          if (oleLicenseRequestBo != null) {
40              eResourceDocNumber = oleLicenseRequestBo.geteResourceDocNumber();
41              redirectUrl = oleurl + "/" + KewApiConstants.Namespaces.MODULE_NAME + "/" +
42                      KewApiConstants.DOC_HANDLER_REDIRECT_PAGE + "?" + KewApiConstants.COMMAND_PARAMETER + "=" +
43                      KewApiConstants.DOCSEARCH_COMMAND + "&" + KewApiConstants.DOCUMENT_ID_PARAMETER + "="
44                      + eResourceDocNumber;
45          }
46          return redirectUrl;
47      }
48  
49      /* This method is used to view the agreement linked to the license request
50      * @param oleLicenseRequestBo
51      * @return  redirectUrl
52              */
53      public String viewAgreement(OleLicenseRequestBo oleLicenseRequestBo) {
54          String url = ConfigContext.getCurrentContextConfig().getProperty("ole.docstore.Documentrest.url");
55          String redirectUrl = "";
56          if (oleLicenseRequestBo != null && oleLicenseRequestBo.getAgreementId() != null) {
57  //            redirectUrl = url + "?docAction=checkOut&uuid=" + oleLicenseRequestBo.getAgreementId();
58              redirectUrl = url + "license/" + oleLicenseRequestBo.getAgreementId();
59          }
60          return redirectUrl;
61      }
62  
63      /* This method is used to get E-Resource Document Number
64      * @param oleLicenseRequestBo
65      * @return  eResourceDocNumber
66      */
67      public String getDocNum(OleLicenseRequestBo oleLicenseRequestBo) {
68          String oleurl = ConfigContext.getCurrentContextConfig().getProperty("ole.url");
69          String eResourceDocNumber = "";
70          if (oleLicenseRequestBo != null) {
71              eResourceDocNumber = oleLicenseRequestBo.geteResourceDocNumber();
72          }
73          return eResourceDocNumber;
74      }
75  
76  }