List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:io.fabric8.api.registry.ApiFinder.java
public static String getHttpUrl(Pod pod, Container container, J4pClient jolokia) { // lets find the HTTP port if (container != null) { List<ContainerPort> ports = container.getPorts(); for (ContainerPort port : ports) { Integer containerPort = port.getContainerPort(); if (containerPort != null) { String name = port.getName(); if (name != null) { name = name.toLowerCase(); }/*from w ww .j a v a2 s . c o m*/ boolean httpPortNumber = containerPort == 80 || containerPort == 443 || containerPort == 8080 || containerPort == 8181; boolean httpName = Objects.equals("http", name) || Objects.equals("https", name); String protocolName = containerPort == 443 || Objects.equals("https", name) ? "https" : "http"; if (httpPortNumber || (httpName && containerPort.intValue() > 0)) { PodStatus currentState = pod.getStatus(); if (currentState != null) { String podIP = currentState.getPodIP(); if (Strings.isNotBlank(podIP)) { return protocolName + "://" + podIP + ":" + containerPort; } // lets try use the host port and host name String host = currentState.getHostIP(); Integer hostPort = port.getHostPort(); if (Strings.isNotBlank(host) && hostPort != null) { return protocolName + "://" + host + ":" + hostPort; } } } } } } return null; }
From source file:com.liangc.hq.base.utils.BizappUtils.java
/** * filter on a list of AIAppdefResourceValue. Either get the ignored * resources or non-ignored./* w ww . j a va 2 s . co m*/ * * @param resources List of AIAppdefResources to filter */ public static List<AIAppdefResourceValue> filterAIResourcesByStatus(List resources, Integer status) { if (status == null || status.intValue() == -1) return resources; List resourceList = new PageList(); Iterator sIterator = resources.iterator(); while (sIterator.hasNext()) { AIAppdefResourceValue rValue = (AIAppdefResourceValue) sIterator.next(); if (rValue.getQueueStatus() == status.intValue()) { resourceList.add(rValue); } } return resourceList; }
From source file:com.aurel.track.admin.customize.localize.LocalizeBL.java
/** * Saves a localization entry//w ww . j ava 2 s . com * @param newLocalizedText * @param fieldName * @param primaryKey * @param originalLocalizedResources * @param localeStr */ public static void save(String newLocalizedText, String fieldName, Integer primaryKey, List<TLocalizedResourcesBean> originalLocalizedResources, String localeStr) { String oldLocalizedText = null; TLocalizedResourcesBean localizedResourceBean = null; if (originalLocalizedResources != null && !originalLocalizedResources.isEmpty()) { if (originalLocalizedResources.size() > 1) { //theoretically the list should contain maximal 1 TLocalizedResourcesBean, //but it can be that (previous buggy import) there are more than one. The duplicates should be removed localizedResourcesDAO.deleteLocalizedResourcesForFieldNameAndKeyAndLocale(fieldName, primaryKey, localeStr); } else { localizedResourceBean = originalLocalizedResources.get(0); if (localizedResourceBean != null) { oldLocalizedText = localizedResourceBean.getLocalizedText(); } } } boolean newSpecified = newLocalizedText != null && !"".equals(newLocalizedText.trim()); boolean oldSpecified = oldLocalizedText != null && !"".equals(oldLocalizedText.trim()); boolean saveNeeded = false; if (newSpecified && oldSpecified) { //both exist if (EqualUtils.notEqual(newLocalizedText, oldLocalizedText)) { localizedResourceBean.setLocalizedText(newLocalizedText); localizedResourceBean.setTextChangedBool(true); localizedResourcesDAO.save(localizedResourceBean); saveNeeded = true; } } else { if (newSpecified && !oldSpecified) { //not existed before or it was empty string if (localizedResourceBean == null) { //not existed localizedResourceBean = new TLocalizedResourcesBean(); localizedResourceBean.setPrimaryKeyValue(primaryKey); localizedResourceBean.setFieldName(fieldName); localizedResourceBean.setTextChangedBool(true); localizedResourceBean.setLocale(localeStr); } localizedResourceBean.setLocalizedText(newLocalizedText); localizedResourceBean.setTextChangedBool(true); localizedResourcesDAO.save(localizedResourceBean); saveNeeded = true; } else { if (!newSpecified && oldSpecified) { if (localizedResourceBean != null) { //remove if new is null or empty localizedResourcesDAO.delete(localizedResourceBean.getObjectID()); saveNeeded = true; } } } } if (saveNeeded) { //FIXME: clear cache? ResourceBundle.clearCache(); if (primaryKey != null) { //actualize the lucene index with the changed localization if (fieldName.startsWith(LocalizationKeyPrefixes.FIELD_SYSTEMSELECT_KEY_PREFIX)) { int beginIndex = LocalizationKeyPrefixes.FIELD_SYSTEMSELECT_KEY_PREFIX.length(); String fieldIDStr = fieldName.substring(beginIndex, beginIndex + 1); Integer fieldID = null; try { fieldID = Integer.valueOf(fieldIDStr); } catch (Exception e) { } if (fieldID != null) { int luceneField = 0; ILocalizedLabelBean localizedLabelBean = null; switch (fieldID.intValue()) { case SystemFields.ISSUETYPE: luceneField = LuceneUtil.LOOKUPENTITYTYPES.LISTTYPE; localizedLabelBean = LookupContainer.getItemTypeBean(primaryKey); break; case SystemFields.STATE: luceneField = LuceneUtil.LOOKUPENTITYTYPES.STATE; localizedLabelBean = LookupContainer.getStatusBean(primaryKey); break; case SystemFields.PRIORITY: luceneField = LuceneUtil.LOOKUPENTITYTYPES.PRIORITY; localizedLabelBean = LookupContainer.getPriorityBean(primaryKey); break; case SystemFields.SEVERITY: luceneField = LuceneUtil.LOOKUPENTITYTYPES.SEVERITY; localizedLabelBean = LookupContainer.getSeverityBean(primaryKey); break; } if (localizedLabelBean != null) { LocalizedListIndexer.getInstance().updateLabelBean(localizedLabelBean, luceneField); } } } else { if (fieldName.startsWith(LocalizationKeyPrefixes.FIELD_CUSTOMSELECT_KEY_PREFIX)) { TOptionBean optionBean = OptionBL.loadByPrimaryKey(primaryKey); if (optionBean != null) { LocalizedListIndexer.getInstance().updateLabelBean(optionBean, LuceneUtil.LOOKUPENTITYTYPES.CUSTOMOPTION); } } } } } }
From source file:CounterServer.java
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(true); int count = 1; Integer i = (Integer) session.getAttribute(COUNTER_KEY); if (i != null) { count = i.intValue() + 5; }/*w ww. java 2 s .c o m*/ session.setAttribute(COUNTER_KEY, new Integer(count)); DataInputStream in = new DataInputStream(req.getInputStream()); resp.setContentType("application/octet-stream"); ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(byteOut); out.writeInt(count); out.flush(); byte[] buf = byteOut.toByteArray(); resp.setContentLength(buf.length); ServletOutputStream servletOut = resp.getOutputStream(); servletOut.write(buf); servletOut.close(); }
From source file:de.suse.swamp.core.data.datatypes.personDatabit.java
public personDatabit(String name, String desc, String value, Integer state) throws Exception { super(name, desc, value, state.intValue()); setModified(true);// ww w . ja va 2 s. c o m }
From source file:com.bringcommunications.etherpay.Payment_Processor.java
public static boolean has_message(Payment_Processor_Client client) { if (payment_processor != null) { Integer count = payment_processor.client_map.get(client); if (count != null) return (count.intValue() != 0); }/*from ww w . ja v a 2 s. c o m*/ return false; }
From source file:Counter.java
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(true); resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); int count = 1; Integer i = (Integer) session.getAttribute(COUNTER_KEY); if (i != null) { count = i.intValue() + 1; }//from w w w .j a v a 2 s. c om session.setAttribute(COUNTER_KEY, new Integer(count)); out.println("<html>"); out.println("<head>"); out.println("<title>Session Counter</title>"); out.println("</head>"); out.println("<body>"); out.println("Your session ID is <b>" + session.getId()); out.println("</b> and you have hit this page <b>" + count + "</b> time(s) during this browser session"); out.println("<form method=GET action=\"" + req.getRequestURI() + "\">"); out.println("<input type=submit " + "value=\"Hit page again\">"); out.println("</form>"); out.println("</body>"); out.println("</html>"); out.flush(); }
From source file:FibonacciTest.java
public int calculateOnlyWithCache(int x) { Integer v1 = values.get(new Integer(x - 1)); Integer v2 = values.get(new Integer(x - 2)); Integer key = new Integer(x); Integer result = values.get(key); if (result != null) return result.intValue(); if ((v1 == null) || (v2 == null)) throw new IllegalArgumentException("values not in cache"); result = new Integer(v1.intValue() + v2.intValue()); values.putIfAbsent(key, result);/*ww w . j a va2 s. c o m*/ return result.intValue(); }
From source file:CounterRewrite.java
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(true); resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); int count = 1; Integer i = (Integer) session.getAttribute(COUNTER_KEY); if (i != null) { count = i.intValue() + 1; }/*from ww w .java 2 s. c o m*/ session.setAttribute(COUNTER_KEY, new Integer(count)); out.println("<html>"); out.println("<head>"); out.println("<title>Session Counter</title>"); out.println("</head>"); out.println("<body>"); out.println("Your session ID is <b>" + session.getId()); out.println("</b> and you have hit this page <b>" + count + "</b> time(s) during this browser session"); String url = req.getRequestURI(); out.println("<form method=GET action=\"" + resp.encodeURL(url) + "\">"); out.println("<input type=submit " + "value=\"Hit page again\">"); out.println("</form>"); out.println("</body>"); out.println("</html>"); out.flush(); }
From source file:freemarker.GoodsController.java
@RequestMapping(value = "/goods/{id}", method = RequestMethod.POST) @ResponseBody//w w w. j a v a2s .co m public List<Good> post(@PathVariable("id") Integer id, @RequestBody Good good) { goods.add(id.intValue(), good); return goods; }