List of usage examples for java.lang Integer equals
public boolean equals(Object obj)
From source file:de.appsolve.padelcampus.utils.imaging.TinifyImageUtil.java
private boolean recoverAccountException(AccountException e) { if (!StringUtils.isEmpty(e.getMessage()) && e.getMessage() .equalsIgnoreCase("Your monthly limit has been exceeded (HTTP 429/TooManyRequests)")) { Integer keyPosition = TINIFY_KEYS.indexOf(Tinify.key()); if (keyPosition.equals(TINIFY_KEYS.size() - 1)) { return false; }//from w ww . j a va 2 s. com Tinify.setKey(TINIFY_KEYS.get(keyPosition + 1)); return true; } return false; }
From source file:org.connid.bundles.openam.OpenAMConnection.java
public boolean isAlive() throws IOException { Integer statusCode = new Integer(httpClientMethods.getMethod(urlFactory.testUrl())); return statusCode.equals(HttpStatus.SC_OK); }
From source file:transaction.script.ProjectTrScript.java
public static boolean query(IDfSession session, String query, Integer minAffectedValue, Integer maxAffectedValue) throws DfException { logger.info("Query to execute is: " + query); List<Map<String, Object>> rowsList = Utils.getAllRows(session, query); Map<String, Object> map = rowsList.get(0); boolean result; int affectedCase = Utils.checkAffectedParams(minAffectedValue, maxAffectedValue); String dqlQueryReturnVal = Utils.checkDQLQueryReturnedType(map); switch (affectedCase) { case IConstants.AffectedTypes.INFINITY_RANGE: result = IConstants.DQLQueryReturnVals.CREATED.equals(dqlQueryReturnVal) ? minAffectedValue <= rowsList.size() && Utils.isNotNullId((String) map.get(dqlQueryReturnVal)) : minAffectedValue <= (Integer) (map.get(dqlQueryReturnVal)); break;/* ww w .j a v a 2 s . co m*/ case IConstants.AffectedTypes.VALUE: result = IConstants.DQLQueryReturnVals.CREATED.equals(dqlQueryReturnVal) ? minAffectedValue.equals(rowsList.size()) && Utils.isNotNullId((String) map.get(dqlQueryReturnVal)) : minAffectedValue.equals(map.get(dqlQueryReturnVal)); break; case IConstants.AffectedTypes.RANGE: result = IConstants.DQLQueryReturnVals.CREATED.equals(dqlQueryReturnVal) ? minAffectedValue <= rowsList.size() && maxAffectedValue >= rowsList.size() && Utils.isNotNullId((String) map.get(dqlQueryReturnVal)) : minAffectedValue <= (Integer) (map.get(dqlQueryReturnVal)) && maxAffectedValue >= (Integer) (map.get(dqlQueryReturnVal)); break; default: return false; } logger.info("Result of execution is " + result); return result; }
From source file:ja.lingo.application.gui.main.settings.appearance.AppearanceGui.java
private void setSelectedFontSize(int fontSize) { ComboBoxModel model = fontSizeComboBox.getModel(); for (int i = 0; i < model.getSize(); i++) { Integer value = (Integer) model.getElementAt(i); if (value.equals(fontSize)) { fontSizeComboBox.setSelectedItem(value); return; }//from w ww. j a v a 2 s .c o m } // TODO refactoring needed: move out default size + allowed sizes LOG.warn("Incorrect font size: " + fontSize + ", setting size to default"); setSelectedFontSize(DEFAULT_FONT_SIZE); // NOTE potential recursion appearance on re-factoring }
From source file:ditl.sim.pnt.FloatingReport.java
public Listener<BufferEvent> bufferEventListener() { return new Listener<BufferEvent>() { @Override/*ww w . j av a2 s. c o m*/ public void handle(long time, Collection<BufferEvent> events) throws IOException { for (BufferEvent event : events) { if (event.type() == BufferEvent.ADD) { Integer msgId = event.msgId(); if (msgId.equals(msg_id)) { Integer id = event.id(); Long t = entry_times.get(id); if (t != null) { succ += 1; infected.add(id); append(time - t); } } } } } }; }
From source file:com.redhat.rhn.frontend.dto.ActivationKeyDto.java
/** * Disable (or enable) the key/*w ww .j ava2 s. c o m*/ * @param value 1 if the key is disabled */ public void setKeyDisabled(Integer value) { if (value == null || (!value.equals(new Integer(1)))) { this.keyDisabled = false; } else { this.keyDisabled = true; } return; }
From source file:com.jeet.cli.Admin.java
private static void downloadFile(Map fileMap) { System.out.print("Enter File Index(0 to cancel): "); String choise = null;/* ww w.j ava 2s. com*/ try { choise = bufferRead.readLine(); } catch (IOException ioe) { System.err.println("Error in reading option."); System.err.println("Please try again."); downloadFile(fileMap); } if (choise != null && NumberUtils.isDigits(choise)) { Integer choiseInt = Integer.parseInt(choise); if (fileMap.containsKey(choiseInt)) { try { String key = fileMap.get(choiseInt).toString(); File file = FileUtil.downloadAndDecryptFile(key); String downloadFilePath = Constants.DOWNLOAD_FOLDER + fileMap.get(choiseInt).toString(); downloadFilePath = downloadFilePath.replaceAll("/", "\\\\"); Files.copy(file.toPath(), (new File(downloadFilePath)).toPath(), StandardCopyOption.REPLACE_EXISTING); System.out.println("File Downloaded to: " + downloadFilePath); } catch (Exception ex) { ex.printStackTrace(); System.err.println("Error in downlaoding file."); } askFileListInputs(fileMap); } else if (choiseInt.equals(0)) { System.out.println("Download file canceled."); askFileListInputs(fileMap); } else { System.err.println("Please select from provided options only."); downloadFile(fileMap); } } else { System.err.println("Please enter digits only."); downloadFile(fileMap); } }
From source file:org.bozzo.ipplan.web.ZoneController.java
@RequestMapping(method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE }) public HttpEntity<ZoneResource> addZone(@PathVariable Integer infraId, @RequestBody @NotNull Zone zone) { Preconditions.checkArgument(infraId.equals(zone.getInfraId())); logger.info("add new zone: {}", zone); Zone zon = repository.save(zone);//from ww w . ja v a 2s .com return new ResponseEntity<>(assembler.toResource(zon), HttpStatus.CREATED); }
From source file:edu.umd.cs.submitServer.servlets.UploadProjectStarterFiles.java
/** * The doPost method of the servlet. <br> * //from w w w.ja v a2 s. c om * This method is called when a form has its tag value method equals to * post. * * @param request * the request send by the client to the server * @param response * the response send by the server to the client * @throws ServletException * if an error occurred * @throws IOException * if an error occurred */ @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { MultipartRequest multipartRequest = (MultipartRequest) request.getAttribute(MULTIPART_REQUEST); Project project = (Project) request.getAttribute(PROJECT); Connection conn = null; FileItem fileItem = null; try { conn = getConnection(); fileItem = multipartRequest.getFileItem(); long sizeInBytes = fileItem.getSize(); if (sizeInBytes == 0) { throw new ServletException("Trying upload file of size 0"); } // copy the fileItem into a byte array InputStream is = fileItem.getInputStream(); ByteArrayOutputStream bytes = new ByteArrayOutputStream((int) sizeInBytes); IO.copyStream(is, bytes); byte[] bytesForUpload = bytes.toByteArray(); // set the byte array as the archive project.setArchiveForUpload(bytesForUpload); FormatDescription desc = FormatIdentification.identify(bytesForUpload); if (desc == null || !desc.getMimeType().equals("application/zip")) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "You MUST submit starter files that are either zipped or jarred"); return; } Integer archivePK = project.getArchivePK(); if (archivePK == null || archivePK.equals(0)) { // If there is no archive, then upload and create a new one project.uploadCachedArchive(conn); project.update(conn); } else { // Otherwise, update the archive we already have project.updateCachedArchive(bytesForUpload, conn); } String redirectUrl = request.getContextPath() + "/view/instructor/projectUtilities.jsp?projectPK=" + project.getProjectPK(); response.sendRedirect(redirectUrl); } catch (SQLException e) { throw new ServletException(e); } finally { releaseConnection(conn); } }
From source file:org.bozzo.ipplan.web.AddressPlanController.java
@RequestMapping(method = RequestMethod.POST) public HttpEntity<AddressPlanResource> addAddressPlan(@PathVariable @NotNull Integer infraId, @RequestBody @NotNull AddressPlan plan) { Preconditions.checkArgument(infraId.equals(plan.getInfraId())); logger.info("add new address plan: {}", plan); AddressPlan ap = this.repository.save(plan); return new ResponseEntity<>(assembler.toResource(ap), HttpStatus.CREATED); }