List of usage examples for org.apache.commons.httpclient.methods PostMethod addParameter
public void addParameter(String paramString1, String paramString2) throws IllegalArgumentException
From source file:org.eclipse.mylyn.internal.jira.core.service.web.JiraWebClient.java
private void addCustomField(JiraClient client, PostMethod post, CustomField customField) { for (String value : customField.getValues()) { String key = customField.getKey(); if (includeCustomField(key)) { if (value != null && (JiraFieldType.DATE.getKey().equals(key) || JiraFieldType.DATETIME.getKey().equals(key))) { try { Date date = JiraRssHandler.getDateTimeFormat().parse(value); DateFormat format; if (JiraFieldType.DATE.getKey().equals(key)) { format = client.getConfiguration().getDateFormat(); } else { format = client.getConfiguration().getDateTimeFormat(); }/*from w w w . ja v a 2 s . c o m*/ value = format.format(date); } catch (ParseException e) { // XXX ignore } } post.addParameter(customField.getId(), value == null ? "" : value); //$NON-NLS-1$ } } }
From source file:org.eclipse.mylyn.internal.jira.core.service.web.JiraWebClient.java
private void addFields(JiraClient client, JiraIssue issue, PostMethod post, String[] fields) { for (String field : fields) { if ("duedate".equals(field)) { //$NON-NLS-1$ if (issue.getDue() != null) { DateFormat format = client.getConfiguration().getDateFormat(); post.addParameter("duedate", format.format(issue.getDue())); //$NON-NLS-1$ } else { post.addParameter("duedate", ""); //$NON-NLS-1$ //$NON-NLS-2$ }//from w w w . j a va 2 s.co m } else if (field.startsWith("customfield_")) { //$NON-NLS-1$ for (CustomField customField : issue.getCustomFields()) { addCustomField(client, post, customField); } } else { String[] values = issue.getFieldValues(field); if (values == null) { // method.addParameter(field, ""); } else { for (String value : values) { post.addParameter(field, value); } } } } }
From source file:org.eclipse.mylyn.internal.jira.core.service.web.JiraWebSession.java
private HostConfiguration login(HttpClient httpClient, IProgressMonitor monitor) throws JiraException { RedirectTracker tracker = new RedirectTracker(); String url = baseUrl + "/login.jsp"; //$NON-NLS-1$ for (int i = 0; i <= MAX_REDIRECTS; i++) { AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); if (credentials == null) { // TODO prompt user? credentials = new AuthenticationCredentials("", ""); //$NON-NLS-1$ //$NON-NLS-2$ }/*from w w w. ja va 2 s . c o m*/ PostMethod login = new PostMethod(url); login.setFollowRedirects(false); login.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); login.setRequestHeader("Content-Type", getContentType()); //$NON-NLS-1$ login.addParameter("os_username", credentials.getUserName()); //$NON-NLS-1$ login.addParameter("os_password", credentials.getPassword()); //$NON-NLS-1$ login.addParameter("os_destination", "/success"); //$NON-NLS-1$ //$NON-NLS-2$ tracker.addUrl(url); try { HostConfiguration hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); int statusCode = WebUtil.execute(httpClient, hostConfiguration, login, monitor); if (needsReauthentication(httpClient, login, monitor)) { continue; } else if (statusCode != HttpStatus.SC_MOVED_TEMPORARILY && statusCode != HttpStatus.SC_MOVED_PERMANENTLY) { throw new JiraServiceUnavailableException("Unexpected status code during login: " + statusCode); //$NON-NLS-1$ } tracker.addRedirect(url, login, statusCode); this.characterEncoding = login.getResponseCharSet(); Header locationHeader = login.getResponseHeader("location"); //$NON-NLS-1$ if (locationHeader == null) { throw new JiraServiceUnavailableException("Invalid redirect, missing location"); //$NON-NLS-1$ } url = locationHeader.getValue(); tracker.checkForCircle(url); if (!insecureRedirect && isSecure() && url.startsWith("http://")) { //$NON-NLS-1$ tracker.log("Redirect to insecure location during login to repository: " + client.getBaseUrl()); //$NON-NLS-1$ insecureRedirect = true; } if (url.endsWith("/success")) { //$NON-NLS-1$ String newBaseUrl = url.substring(0, url.lastIndexOf("/success")); //$NON-NLS-1$ if (baseUrl.equals(newBaseUrl) || !client.getConfiguration().getFollowRedirects()) { // success addAuthenticationCookie(httpClient, login); return hostConfiguration; } else { // need to login to make sure HttpClient picks up the session cookie baseUrl = newBaseUrl; url = newBaseUrl + "/login.jsp"; //$NON-NLS-1$ } } } catch (IOException e) { throw new JiraServiceUnavailableException(e); } finally { login.releaseConnection(); } } tracker.log( "Exceeded maximum number of allowed redirects during login to repository: " + client.getBaseUrl()); //$NON-NLS-1$ throw new JiraServiceUnavailableException("Exceeded maximum number of allowed redirects during login"); //$NON-NLS-1$ }
From source file:org.eclipse.mylyn.internal.web.tasks.WebRepositoryConnector.java
public static HttpMethod getLoginMethod(Map<String, String> params, TaskRepository repository) { String requestMethod = repository.getProperty(PROPERTY_LOGIN_REQUEST_METHOD); String requestTemplate = repository.getProperty(PROPERTY_LOGIN_REQUEST_URL); String requestUrl = evaluateParams(requestTemplate, params, repository); if (REQUEST_GET.equals(requestMethod)) { return new GetMethod(requestUrl); // method.setFollowRedirects(false); }/*from ww w.ja v a 2 s . co m*/ int n = requestUrl.indexOf('?'); if (n == -1) { return new PostMethod(requestUrl); } PostMethod postMethod = new PostMethod(requestUrl.substring(0, n)); // TODO this does not take into account escaped values n = requestTemplate.indexOf('?'); String[] requestParams = requestTemplate.substring(n + 1).split("&"); //$NON-NLS-1$ for (String requestParam : requestParams) { String[] nv = requestParam.split("="); //$NON-NLS-1$ if (nv.length == 1) { postMethod.addParameter(nv[0], ""); //$NON-NLS-1$ } else { String value = evaluateParams(nv[1], getParams(repository, params), false); postMethod.addParameter(nv[0], value); } } return postMethod; }
From source file:org.eclipse.orion.server.cf.commands.LoginCommand.java
public IStatus doIt() { try {/* w w w.j ava2 s. c o m*/ URI infoURI = URIUtil.toURI(target.getUrl()); infoURI = infoURI.resolve("/v2/info"); GetMethod getMethod = new GetMethod(infoURI.toString()); getMethod.addRequestHeader(new Header("Accept", "application/json")); getMethod.addRequestHeader(new Header("Content-Type", "application/json")); String response; try { CFActivator.getDefault().getHttpClient().executeMethod(getMethod); response = getMethod.getResponseBodyAsString(); } finally { getMethod.releaseConnection(); } JSONObject result = new JSONObject(response); // login String authorizationEndpoint = result.getString("authorization_endpoint"); URI loginURI = new URI(authorizationEndpoint); loginURI = URIUtil.append(loginURI, "/oauth/token"); PostMethod postMethod = new PostMethod(loginURI.toString()); postMethod.addRequestHeader(new Header("Accept", "application/json")); postMethod.addRequestHeader(new Header("Content-Type", "application/x-www-form-urlencoded")); postMethod.addRequestHeader(new Header("Authorization", "Basic Y2Y6")); postMethod.addParameter("grant_type", "password"); postMethod.addParameter("password", this.password); postMethod.addParameter("username", this.username); postMethod.addParameter("scope", ""); try { int code = CFActivator.getDefault().getHttpClient().executeMethod(postMethod); response = postMethod.getResponseBodyAsString(); if (code != HttpServletResponse.SC_OK) { try { result = new JSONObject(response); return new ServerStatus(Status.ERROR, code, "", result, null); } catch (Exception e) { result = null; return new ServerStatus(Status.ERROR, code, "Unexpected error", null); } } } finally { postMethod.releaseConnection(); } target.getCloud().setAccessToken(new JSONObject(response)); } catch (Exception e) { String msg = NLS.bind("An error occured when performing operation {0}", commandName); //$NON-NLS-1$ logger.error(msg, e); return new Status(IStatus.ERROR, CFActivator.PI_CF, msg, e); } return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK); }
From source file:org.elissa.server.Repository.java
public String saveNewModel(String newModel, String name, String summary, String type, String stencilset, String svg) {/* w ww.ja v a 2s.com*/ String result = ""; String url = baseUrl + "backend/poem/repository/new?stencilset=" + stencilset; try { HttpClient client = new HttpClient(); PostMethod method = new PostMethod(url); // configure the form parameters method.addParameter("data", newModel); method.addParameter("title", name); method.addParameter("summary", summary); method.addParameter("type", type); method.addParameter("svg", svg); // execute the POST method int statusCode = client.executeMethod(method); if (statusCode != -1) { Header header = method.getResponseHeader("location"); result = header.getValue(); // hack for reverse proxies: result = result.substring(result.lastIndexOf("http://")); if (result.startsWith(baseUrl)) { result = result.substring(baseUrl.length()); } } else { // TODO handle error } } catch (Exception e) { e.printStackTrace(); } return result; }
From source file:org.elissa.server.Repository.java
public void addTag(String modelUrl, String tagName) { if (modelUrl.endsWith("/self")) { modelUrl = modelUrl.substring(0, modelUrl.lastIndexOf("/self")); }//from w w w . j a va2 s . c om String modelTagsUrl = modelUrl + "/tags"; HttpClient client = new HttpClient(); PostMethod method = new PostMethod(modelTagsUrl); // configure the form parameters method.addParameter("tag_name", tagName); // execute the POST method int statusCode; try { statusCode = client.executeMethod(method); if (statusCode != -1) { // TODO return result } else { // TODO handle error } } catch (HttpException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.executequery.http.spi.DefaultRemoteHttpClient.java
public RemoteHttpResponse httpPostRequest(String host, String path, Map<String, String> params) { PostMethod method = null; HttpConnectionManager httpConnectionManager = createConnectionManager(); try {/* w ww . j a v a 2s . c o m*/ HttpClient client = createHttpClientForManager(host, httpConnectionManager); method = new PostMethod(path); for (Entry<String, String> entry : params.entrySet()) { method.addParameter(entry.getKey(), entry.getValue()); } RemoteHttpResponse remoteHttpResponse = executeMethod(method, client); if (isRedirection(remoteHttpResponse.getResponseCode())) { return handleRedirection(method); } else { return remoteHttpResponse; } } finally { releaseMethod(method); releaseConnectionManager(httpConnectionManager); } }
From source file:org.exjello.mail.Exchange2003Connection.java
private void signOn() throws Exception { HttpClient client = getClient();// w ww. j av a 2s . c o m URL serverUrl = new URL(server); String host = serverUrl.getHost(); int port = serverUrl.getPort(); if (port == -1) port = serverUrl.getDefaultPort(); AuthScope authScope = new AuthScope(host, port); if (username.indexOf("\\") < 0) { client.getState().setCredentials(authScope, new UsernamePasswordCredentials(username, password)); } else { // Try to connect with NTLM authentication String domainUser = username.substring(username.indexOf("\\") + 1, username.length()); String domain = username.substring(0, username.indexOf("\\")); client.getState().setCredentials(authScope, new NTCredentials(domainUser, password, host, domain)); } boolean authenticated = false; OptionsMethod authTest = new OptionsMethod(server + "/exchange"); try { authenticated = (client.executeMethod(authTest) < 400); } finally { try { InputStream stream = authTest.getResponseBodyAsStream(); byte[] buf = new byte[65536]; try { if (session.getDebug()) { PrintStream log = session.getDebugOut(); log.println("Response Body:"); int count; while ((count = stream.read(buf, 0, 65536)) != -1) { log.write(buf, 0, count); } log.flush(); log.println(); } else { while (stream.read(buf, 0, 65536) != -1) ; } } catch (Exception ignore) { } finally { try { stream.close(); } catch (Exception ignore2) { } } } finally { authTest.releaseConnection(); } } if (!authenticated) { PostMethod op = new PostMethod(server + SIGN_ON_URI); op.setRequestHeader("Content-Type", FORM_URLENCODED_CONTENT_TYPE); op.addParameter("destination", server + "/exchange"); op.addParameter("flags", "0"); op.addParameter("username", username); op.addParameter("password", password); try { int status = client.executeMethod(op); if (status >= 400) { throw new IllegalStateException("Sign-on failed: " + status); } } finally { try { InputStream stream = op.getResponseBodyAsStream(); byte[] buf = new byte[65536]; try { if (session.getDebug()) { PrintStream log = session.getDebugOut(); log.println("Response Body:"); int count; while ((count = stream.read(buf, 0, 65536)) != -1) { log.write(buf, 0, count); } log.flush(); log.println(); } else { while (stream.read(buf, 0, 65536) != -1) ; } } catch (Exception ignore) { } finally { try { stream.close(); } catch (Exception ignore2) { } } } finally { op.releaseConnection(); } } } findInbox(); }
From source file:org.extensiblecatalog.ncip.v2.millennium.MillenniumCancelRequestItemService.java
/** * Handles a NCIP CancelItem service by returning new date. * //from w w w . j ava2s. co m * @param initData * the CancelRequestItemInitiationData * @param serviceManager * provides access to remote services * @return CancelItemResponseData */ @Override public CancelRequestItemResponseData performService(CancelRequestItemInitiationData initData, ServiceContext serviceContext, RemoteServiceManager serviceManager) { MillenniumRemoteServiceManager millenniumSvcMgr = (MillenniumRemoteServiceManager) serviceManager; MillenniumConfiguration MillenniumConfig = millenniumSvcMgr.buildConfiguration(); String IIIClassicBaseUrl = MillenniumConfig.getURL(); String baseUrl = "https://" + IIIClassicBaseUrl + "/patroninfo"; //.html~S0"; //LOG.debug("LookupUser - baseURL: " + baseUrl); boolean foundUserId = false; boolean foundUserPass = false; List<Problem> problems = null; final CancelRequestItemResponseData responseData = new CancelRequestItemResponseData(); String userIdentifierType = null; final String getLDAPUserVarString = MillenniumConfig.getLdapUserVariable(); String[] getLDAPUserVarList = getLDAPUserVarString.split(","); final String getLDAPPasswordVarString = MillenniumConfig.getLdapPasswordVariable(); String[] getLDAPPasswordVarList = getLDAPPasswordVarString.split(","); final String getPatronUserVarString = MillenniumConfig.getPatronUserVariable(); String[] getPatronUserVarList = getPatronUserVarString.split(","); final String getPatronPasswordVarString = MillenniumConfig.getPatronPasswordVariable(); String[] getPatronPasswordVarList = getPatronPasswordVarString.split(","); boolean foundLDAPUser = false; boolean foundPatronUser = false; //boolean foundService = false; boolean foundCancel = false; //for (int x = 0; x < millenniumServicesList.length; x++) { // if (millenniumServicesList[x].trim().equals("CancelItem")) { // foundService = true; // } //} //if (foundService) { final String[] millenniumFunctionsList = MillenniumConfig.getFunctions().split(","); for (int x = 0; x < millenniumFunctionsList.length; x++) { if (millenniumFunctionsList[x].trim().equals("Cancel")) { foundCancel = true; } } if (foundCancel) { authenticatedUserName = new ArrayList<String>(); authenticatedUserPassword = new ArrayList<String>(); for (AuthenticationInput authenticationInput : initData.getAuthenticationInputs()) { //LOG.debug("authenticationInput: " + authenticationInput.getAuthenticationInputData()); //LOG.debug("Type: " + authenticationInput.getAuthenticationInputType().getValue()); if ((authenticationInput.getAuthenticationInputType().getValue().toUpperCase() .equals("LDAPUSERNAME")) || (authenticationInput.getAuthenticationInputType().getValue().toUpperCase() .equals("USERNAME"))) { userIdentifierType = authenticationInput.getAuthenticationInputType().getValue(); LOG.debug("RequestItem - userIdentifierType: " + userIdentifierType); if (authenticationInput.getAuthenticationInputData().trim().length() > 0) { authenticatedUserName.add(authenticationInput.getAuthenticationInputData()); foundUserId = true; } } if ((authenticationInput.getAuthenticationInputType().getValue().toUpperCase() .equals("LDAPPASSWORD")) || (authenticationInput.getAuthenticationInputType().getValue().toUpperCase() .equals("PASSWORD")) || (authenticationInput.getAuthenticationInputType().getValue().toUpperCase() .equals("PIN"))) { if (authenticationInput.getAuthenticationInputData().trim().length() > 0) { authenticatedUserPassword.add(authenticationInput.getAuthenticationInputData()); foundUserPass = true; } } } if (foundUserId && foundUserPass) { //LOG.debug("1 - User: " + authenticatedUserName.size() + "=" + getLDAPUserVarList.length + "Pass: " + authenticatedUserPassword.size() + "=" + getLDAPPasswordVarList.length); testAuthUser = new ArrayList<PairGroup>(); testAuthPass = new ArrayList<PairGroup>(); authUserName = new ArrayList<PairGroup>(); authPassword = new ArrayList<PairGroup>(); htmlProperty authenticateStatus = null; if ((authenticatedUserName.size() == getLDAPUserVarList.length) && (authenticatedUserPassword.size() == getLDAPPasswordVarList.length)) { for (int x = 0; x < authenticatedUserName.size(); x++) { //LOG.debug("User pair: " + getLDAPUserVarList[x] + ", " + authenticatedUserName.get(x)); PairGroup userPair = millenniumSvcMgr.setPairGroup(getLDAPUserVarList[x], authenticatedUserName.get(x)); testAuthUser.add(userPair); } for (int y = 0; y < authenticatedUserPassword.size(); y++) { //LOG.debug("pass pair: " + getLDAPPasswordVarList[y] + ", " + authenticatedUserPassword.get(y)); PairGroup passPair = millenniumSvcMgr.setPairGroup(getLDAPPasswordVarList[y], authenticatedUserPassword.get(y)); testAuthPass.add(passPair); } authenticateStatus = millenniumSvcMgr.Authenticate(testAuthUser, testAuthPass, baseUrl); if (authenticateStatus.recordStatus.returnStatus) { authUserName = testAuthUser; authPassword = testAuthPass; foundLDAPUser = true; } } //LOG.debug("2 - FoundLDAPUser: " + foundLDAPUser); if ((foundLDAPUser == false) && ((authenticatedUserName.size() == getPatronUserVarList.length) && (authenticatedUserPassword.size() == getPatronPasswordVarList.length))) { testAuthUser = new ArrayList<PairGroup>(); testAuthPass = new ArrayList<PairGroup>(); for (int x = 0; x < authenticatedUserName.size(); x++) { PairGroup userPair = millenniumSvcMgr.setPairGroup(getPatronUserVarList[x], authenticatedUserName.get(x)); testAuthUser.add(userPair); } for (int y = 0; y < authenticatedUserPassword.size(); y++) { PairGroup passPair = millenniumSvcMgr.setPairGroup(getPatronPasswordVarList[y], authenticatedUserPassword.get(y)); testAuthPass.add(passPair); } authenticateStatus = millenniumSvcMgr.Authenticate(testAuthUser, testAuthPass, baseUrl); if (authenticateStatus.recordStatus.returnStatus) { authUserName = testAuthUser; authPassword = testAuthPass; foundPatronUser = true; } } String itemBarCode = initData.getRequestId().getRequestIdentifierValue(); LOG.debug("CancelRequestItem - itemBarCode: " + itemBarCode); int barCodeIndex = 0; if (foundLDAPUser || foundPatronUser) { LOG.debug("CancelRequestItem - Login Success!"); boolean getHoldItems = false; String strSessionId = authenticateStatus.sessionId; String redirectedUrl = authenticateStatus.url; LOG.debug("CancelRequestItem - redirectedUrl: " + redirectedUrl); authenticatedUserId = authenticateStatus.userid; LOG.debug("CancelRequestItem - authenticatedUserId: " + authenticatedUserId); String html = authenticateStatus.html; String pageItem = authenticateStatus.pageItem.toLowerCase().trim(); //LOG.debug("CancelRequestItem - itempage: " + authenticateStatus.pageItem); //LOG.debug("CancelRequestItem - SNo: " + SNo); String SNo = MillenniumConfig.getSearchScope(); if (pageItem.equals("holds") || html .contains("<a href=\"/patroninfo~" + SNo + "/" + authenticatedUserId + "/holds")) { getHoldItems = true; } LOG.debug("CancelRequestItem - Found - Hold Items: " + getHoldItems); if (getHoldItems) { LOG.debug("CancelRequestItem - Found Items Currently Hold"); StatusString getItemsStatus = millenniumSvcMgr .getAuthenticationItemsPage(authenticatedUserId, strSessionId, "holds"); if (getItemsStatus.recordStatus.returnStatus) { LOG.debug("CancelRequestItem - Success received hold items page. HTML char: " + getItemsStatus.statusValue.length()); ArrayList<AuthenticationItemsInfo> itemsHoldList = null;//millenniumSvcMgr.getItemsCheckedOut(authenticatedUserId, strSessionId, "holds"); UserItemInfo itemsHoldStatus = millenniumSvcMgr .getItemsHolds(getItemsStatus.statusValue, foundCancel); if (itemsHoldStatus.recordStatus.returnStatus) { LOG.debug("CancelRequestItem - Success received items hold page array information"); itemsHoldList = itemsHoldStatus.itemsList; boolean foundBarCode = false; for (int x = 0; x < itemsHoldList.size(); x++) { if (itemsHoldList.get(x).bRecord.contains(itemBarCode)) { foundBarCode = true; barCodeIndex = x; } } if (foundBarCode) { LOG.debug("CancelRequestItem - Found item barcode in items hold page at index: " + barCodeIndex); LOG.debug("CancelRequestItem - Mark id: " + itemsHoldList.get(barCodeIndex).iMark); //LOG.debug("CancelRequestItem - Mark Value: " + itemsHoldList.get(barCodeIndex).iMarkValue); //LOG.debug("CancelRequestItem - right of redirectedUrl: " + strFunction.Rightstr(redirectedUrl, "/")); String url = null; if (strFunction.Rightstr(redirectedUrl, "/").equals("holds")) { url = redirectedUrl; } else { url = redirectedUrl.replace(pageItem, "holds"); } LOG.debug("CancelRequestItem - url: " + url); PostMethod postMethod = new PostMethod(url); postMethod.addParameter( itemsHoldList.get(barCodeIndex).iMark.replace("cancel", "loc"), ""); postMethod.addParameter(itemsHoldList.get(barCodeIndex).iMark, "on"); postMethod.addParameter("updateholdssome", "YES"); StatusString holdStatus = millenniumSvcMgr.LogInWebActionForm(postMethod, strSessionId); if (holdStatus.recordStatus.returnStatus) { //LOG.debug("html " + holdStatus.statusValue); LOG.debug("html lenght: " + holdStatus.statusValue.length()); UserItemInfo cancelItemsHoldStatus = millenniumSvcMgr .getItemsHolds(holdStatus.statusValue, foundCancel); if (cancelItemsHoldStatus.recordStatus.returnStatus) { ArrayList<AuthenticationItemsInfo> cancelItemsHoldList = cancelItemsHoldStatus.itemsList; if (cancelItemsHoldList.size() < itemsHoldList.size()) { LOG.debug( "CancelRequestItem - Success cancel item: " + itemBarCode); ItemId itemId = new ItemId(); itemId.setItemIdentifierValue(itemBarCode); responseData.setItemId(itemId); } else { LOG.error("CancelRequestItem - False cancel item: " + itemBarCode); problems = ServiceHelper.generateProblems( Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, "Couldn't cancel item", null, "Couldn't cancel item: " + itemBarCode); } } else { LOG.error( "CancelRequestItem - Couldn't receive cancel hold item page!"); problems = ServiceHelper.generateProblems( Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, "Failed to get Cancel Item page", null, cancelItemsHoldStatus.recordStatus.returnMsg); } } else { LOG.error("CancelRequestItem - Couldn't receive hold item page!"); //LOG.debug("Error: " + renewStatus.recordStatus.returnMsg); problems = ServiceHelper.generateProblems( Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, "Failed to get Cancel Item page", null, holdStatus.recordStatus.returnMsg); } } else { LOG.error("CancelRequestItem - Couldn't find the bRecord: " + itemBarCode + " in Hold Items Page of user: " + authenticatedUserName); problems = ServiceHelper.generateProblems( Version1LookupItemProcessingError.UNKNOWN_ITEM, "BarCode not Found", null, "Couldn't find the bRecord: " + itemBarCode + " in Hold Items Page of user: " + authenticatedUserName); } } else { LOG.error("CancelRequestItem - False received hold items page array information"); problems = ServiceHelper.generateProblems( Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, "Failed to get Items Array", null, itemsHoldStatus.recordStatus.returnMsg); } // if (itemsCheckOutStatus.recordStatus.returnStatus) } else { LOG.error("CancelRequestItem - False received items page"); problems = ServiceHelper.generateProblems( Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, "False received items page", null, getItemsStatus.recordStatus.returnMsg); } // if (getItemsStatus.recordStatus.returnStatus) } else { LOG.error("CancelRequestItem - Couldn't found Hold Item page"); problems = ServiceHelper.generateProblems( Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, "Items page not found", null, "Couldn't found Item page!"); } // if (getHoldItems) } else { LOG.error("CancelRequestItem - Incorrect User Id or Password!"); problems = ServiceHelper.generateProblems( Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, "User Authentication Failed", null, "False to login - Incorrect User Id or Password!"); } // if (foundLDAPUser || foundPatronUser) } else { LOG.error("User Id or Password is missing!"); problems = ServiceHelper.generateProblems( Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, "Missing User Id or Password", null, "User Id or Password is missing!"); } } else { LOG.error("CancelRequestItem - Function CancelItem is not support!"); problems = ServiceHelper.generateProblems(Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, "Function is not support", null, "Function is not support!"); } // if (foundRenew) //} else { // LOG.error("CancelRequestItem - Services is not support!"); // problems = ServiceHelper.generateProblems(Version1LookupUserProcessingError.USER_AUTHENTICATION_FAILED, // "Services is not support", null, "Services is not support!"); //} // if (foundService) if (problems != null) { responseData.setProblems(problems); if (foundLDAPUser || foundPatronUser) { baseUrl = "https://" + IIIClassicBaseUrl + "/logout"; millenniumSvcMgr.LogOut(baseUrl); } return responseData; } else { LOG.debug("CancelItem - Success received all information"); user.setUserIdentifierValue(authUserName.get(0).secondValue); try { user.setUserIdentifierType(UserIdentifierType.find(null, userIdentifierType)); } catch (ServiceException e) { e.printStackTrace(); } responseData.setUserId(user); baseUrl = "https://" + IIIClassicBaseUrl + "/logout"; millenniumSvcMgr.LogOut(baseUrl); return responseData; } }