View Javadoc

1   /*
2    * Copyright 2011 The Kuali Foundation.
3    *
4    * Licensed under the Educational Community License, Version 2.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/ecl2.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.service.impl;
17  
18  import org.apache.commons.lang.StringEscapeUtils;
19  import org.kuali.ole.select.businessobject.BibInfoBean;
20  import org.kuali.ole.select.service.PopulateBibInfoService;
21  import org.kuali.ole.select.testing.PreOrderService;
22  import org.kuali.ole.select.testing.WSException_Exception;
23  
24  public class PreOrderServiceImpl implements PreOrderService {
25  
26      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PreOrderServiceImpl.class);
27      private PopulateBibInfoService populateBibInfoService;
28      private BibInfoBean bibInfoBean;
29  
30      @Override
31      /*
32       * public String createPreOrderForCitation(String citationString, String routeRequesterReceipt, String requestorsNote, String
33       * requestorsFirstName, String requestorsLastName, String requestorsAddress1, String requestorsAddress2, String requestorsCity,
34       * String requestorsState, String requestorsZipCode, String requestorsCountryCode, String requestorsPhone, String
35       * requestorsEmail, String requestorsSMS, String requestorType) throws WSException_Exception {
36       */
37      public String createPreOrderForCitation(String citationString, String routeRequesterReceipt, String requestorsNote,
38                                              String requestorType, String requestorId) throws WSException_Exception {
39          String docNumber = null;
40          try {
41              PopulateBibInfoService populateBibInfoService = getPopulateBibInfoService();
42  
43              BibInfoBean bibInfoBean = getBibInfoBean();
44              /*
45               * setRequestorDetail(requestorsNote, requestorsFirstName, requestorsLastName, requestorsAddress1, requestorsAddress2,
46               * requestorsCity, requestorsState, requestorsZipCode, requestorsCountryCode, requestorsPhone, requestorsEmail,
47               * requestorsSMS, requestorType);
48               */
49              setRequestorDetail(requestorsNote, requestorType, requestorId);
50              docNumber = populateBibInfoService.processBibInfoForCitation(citationString, bibInfoBean);
51          } catch (Exception E) {
52  
53          }
54          return docNumber;
55      }
56  
57      private BibInfoBean getBibInfoBean() {
58          bibInfoBean = new BibInfoBean();
59          return bibInfoBean;
60      }
61  
62      private PopulateBibInfoService getPopulateBibInfoService() {
63          if (null == populateBibInfoService) {
64              populateBibInfoService = new PopulateBibInfoServiceImpl();
65          }
66          return populateBibInfoService;
67      }
68  
69      public void setPopulateBibInfoService(PopulateBibInfoService populateBibInfoService) {
70          this.populateBibInfoService = populateBibInfoService;
71      }
72  
73      @Override
74      /*
75       * public String createPreOrderForOpenURL(String openUrlString,String routeRequestorReceipt, String requestorsNote,String
76       * requestorsFirstName, String requestorsLastName, String requestorsAddress1, String requestorsAddress2, String requestorsCity,
77       * String requestorsState, String requestorsZipCode, String requestorsCountryCode, String requestorsPhone, String
78       * requestorsEmail, String requestorsSMS, String requestorType) throws WSException_Exception {
79       */
80      public String createPreOrderForOpenURL(String openUrlString, String routeRequestorReceipt, String requestorsNote,
81                                             String requestorType, String requestorId) throws WSException_Exception {
82          PopulateBibInfoService populateBibInfoService = new PopulateBibInfoServiceImpl();
83          BibInfoBean bibInfoBean = getBibInfoBean();
84          /*
85           * setRequestorDetail(requestorsNote,requestorsFirstName, requestorsLastName, requestorsAddress1, requestorsAddress2,
86           * requestorsCity, requestorsState, requestorsZipCode, requestorsCountryCode, requestorsPhone, requestorsEmail,
87           * requestorsSMS, requestorType);
88           */
89          setRequestorDetail(requestorsNote, requestorType, requestorId);
90          String docNumber = null;
91          try {
92              docNumber = populateBibInfoService.processBibInfoForOperURL(openUrlString, bibInfoBean);
93          } catch (Exception E) {
94  
95          }
96          return docNumber;
97      }
98  
99      @Override
100     /*
101      * public String createPreOrderForForm(String title, String author, String edition, String series, String publisher, String
102      * placeOfPublication, String yearOfPublication, String standardNumber, String typeOfStandardNumber, String
103      * routeRequestorReceipt, String requestorsNote, String requestorsFirstName, String requestorsLastName, String
104      * requestorsAddress1, String requestorsAddress2, String requestorsCity, String requestorsState, String requestorsZipCode,
105      * String requestorsCountryCode, String requestorsPhone, String requestorsEmail, String requestorsSMS, String requestorType)
106      * throws WSException_Exception {
107      */
108     public String createPreOrderForForm(String title, String author, String edition, String series, String publisher,
109                                         String placeOfPublication, String yearOfPublication, String standardNumber, String typeOfStandardNumber,
110                                         String requestorsNote, String requestorType, String requestorId) throws WSException_Exception {
111         PopulateBibInfoService populateBibInfoService = getPopulateBibInfoService();
112         BibInfoBean bibInfoBean = getBibInfoBean();
113         StringEscapeUtils stringEscapeUtils = new StringEscapeUtils();
114         title = stringEscapeUtils.escapeHtml(title);
115         author = stringEscapeUtils.escapeHtml(author);
116         edition = stringEscapeUtils.escapeHtml(edition);
117         publisher = stringEscapeUtils.escapeHtml(publisher);
118         placeOfPublication = stringEscapeUtils.escapeHtml(placeOfPublication);
119         requestorId = stringEscapeUtils.escapeHtml(requestorId);
120         /*
121          * setRequestorDetail(requestorsNote, requestorsFirstName, requestorsLastName, requestorsAddress1, requestorsAddress2,
122          * requestorsCity, requestorsState, requestorsZipCode, requestorsCountryCode, requestorsPhone, requestorsEmail,
123          * requestorsSMS, requestorType);
124          */
125         setRequestorDetail(requestorsNote, requestorType, requestorId);
126         String docNumber = null;
127         try {
128             /*
129              * docNumber = populateBibInfoService.processBibInfoForForm(bibInfoBean, title, author, edition, series, publisher,
130              * placeOfPublication, yearOfPublication, standardNumber, typeOfStandardNumber, routeRequestorReceipt);
131              */
132             docNumber = populateBibInfoService
133                     .processBibInfoForForm(bibInfoBean, title, author, edition, series, publisher, placeOfPublication,
134                             yearOfPublication, standardNumber, typeOfStandardNumber, requestorId);
135 
136             LOG.info("docNumber in createPreOrderForForm>>>>>>>>>>>>>>" + docNumber);
137         } catch (Exception E) {
138 
139         }
140         return docNumber;
141     }
142 
143     /*@Override
144     public String createPreOrderForForm(String input) throws Exception {
145         String[] inputArr = input.split("||");
146         for (int i = 0; i < inputArr.length; i++) {
147 
148         }
149 
150         PopulateBibInfoService populateBibInfoService = getPopulateBibInfoService();
151         BibInfoBean bibInfoBean = getBibInfoBean();
152         StringEscapeUtils stringEscapeUtils=new StringEscapeUtils();
153         String title = stringEscapeUtils.escapeHtml(inputArr[0]);
154         String author = stringEscapeUtils.escapeHtml(inputArr[1]);
155         String edition = stringEscapeUtils.escapeHtml(inputArr[2]);
156         String publisher = stringEscapeUtils.escapeHtml(inputArr[4]);
157         String placeOfPublication = stringEscapeUtils.escapeHtml(inputArr[5]);
158         setRequestorDetail(inputArr[10], inputArr[11],
159                 inputArr[12], inputArr[13], inputArr[14], inputArr[15], inputArr[16],
160                 inputArr[17], inputArr[18], inputArr[19], inputArr[20],
161                 inputArr[21], inputArr[22]);
162         String docNumber = populateBibInfoService.processBibInfoForForm(bibInfoBean,
163                 title, author, edition, inputArr[3], publisher, placeOfPublication,
164                 inputArr[6], inputArr[7], inputArr[8],
165                 inputArr[9]);
166         return docNumber;
167     }*/
168 
169     /*
170      * private void setRequestorDetail(String requestorsNote, String requestorsFirstName, String requestorsLastName, String
171      * requestorsAddress1, String requestorsAddress2, String requestorsCity, String requestorsState, String requestorsZipCode,
172      * String requestorsCountryCode, String requestorsPhone, String requestorsEmail, String requestorsSMS, String requestorType)
173      * throws WSException_Exception { bibInfoBean.setRequestersNotes(requestorsNote);
174      * bibInfoBean.setRequestorsFirstName(requestorsFirstName); bibInfoBean.setRequestorsLastName(requestorsLastName);
175      * bibInfoBean.setRequestorsAddress1(requestorsAddress1); bibInfoBean.setRequestorsAddress2(requestorsAddress2);
176      * bibInfoBean.setRequestorsCity(requestorsCity); bibInfoBean.setRequestorsState(requestorsState);
177      * bibInfoBean.setRequestorsZipCode(requestorsZipCode); bibInfoBean.setRequestorsCountryCode(requestorsCountryCode);
178      * bibInfoBean.setRequestorsPhone(requestorsPhone); bibInfoBean.setRequestorsEmail(requestorsEmail);
179      * bibInfoBean.setRequestorsSMS(requestorsSMS); bibInfoBean.setRequestorType(requestorType); }
180      */
181     private void setRequestorDetail(String requestorsNote, String requestorType, String requestorId)
182             throws WSException_Exception {
183         bibInfoBean.setRequestersNotes(requestorsNote);
184         bibInfoBean.setRequestorType(requestorType);
185         bibInfoBean.setRequestorId(requestorId);
186     }
187 
188 }