List of usage examples for java.lang Integer equals
public boolean equals(Object obj)
From source file:at.co.federmann.gtd.domain.Priority.java
public static Priority resolvePriority(Integer id) { if (id == null) { return null; }/* ww w.j a va2s .c o m*/ for (Priority priority : Priority.values()) { if (id.equals(priority.id)) { return priority; } } throw new IllegalArgumentException(StringUtils.join("No matching priority found for id ", id)); }
From source file:at.co.federmann.gtd.domain.Progress.java
public static Progress resolveProgress(Integer id) { if (id == null) { return null; }//from w w w. java 2 s. c o m for (Progress progress : Progress.values()) { if (id.equals(progress.getId())) { return progress; } } throw new IllegalArgumentException(StringUtils.join("No matching Progress found for ID ", id)); }
From source file:com.fruit.core.util.IWebUtils.java
public static void setCurrentLoginSysUser(HttpServletResponse response, HttpSession httpSession, SysUser sysUser, Integer autoLogin) { setCurrentLoginSysUserToSession(httpSession, sysUser); if (autoLogin.equals(1)) { //?7/* w ww. java 2s .c om*/ long expireTime = DateUtils.addDay(new Date(), 7).getTime(); //????MD5???cookie String userInfo = MD5Utils .GetMD5Code(sysUser.getName() + sysUser.getPwd() + expireTime + PropKit.get("app_key")); String userBase64 = Base64.encodeBase64String( new String(sysUser.getName() + ":" + expireTime + ":" + userInfo).getBytes()); CookieUtils.addCookie(response, "token", userBase64, 60 * 60 * 24 * 7); } }
From source file:com.kstenschke.shifter.models.shiftertypes.StringHtmlEncodable.java
/** * Shift to HTML encoded/decoded variant of given string * * @param word word to be shifted/* w w w . ja v a 2s . co m*/ * @return String */ public static String getShifted(String word) { Integer strLenOriginal = word.length(); String decoded = StringEscapeUtils.unescapeHtml(word); Integer strLenDecoded = decoded.length(); if (!strLenOriginal.equals(strLenDecoded)) return decoded; String encoded = StringEscapeUtils.escapeHtml(word); Integer strLenEncoded = encoded.length(); if (!strLenOriginal.equals(strLenEncoded)) return encoded; return word; }
From source file:com.kstenschke.shifter.models.shiftertypes.StringHtmlEncodable.java
/** * Check whether given character can be encoded to an HTML special char / or is already HTML encoded * * @param str String to be shifted currently * @return boolean./*w w w . j a v a 2s . co m*/ */ public static boolean isHtmlEncodable(String str) { Integer strLenOriginal = str.length(); String encoded = StringEscapeUtils.escapeHtml(str); String decoded = StringEscapeUtils.unescapeHtml(str); return !strLenOriginal.equals(encoded.length()) || !strLenOriginal.equals(decoded.length()); }
From source file:com.hpe.application.automation.bamboo.tasks.TestResultHelperAlm.java
protected static void AddALMArtifacts(final TaskContext taskContext, File resultFile, String linkSearchFilter, I18nBean i18nBean) {/*from ww w. j ava 2s. c o m*/ clearSavedALMRunLogPaths(taskContext); String taskName = taskContext.getConfigurationMap().get(CommonTaskConfigurationProperties.TASK_NAME); if (taskName.equals(i18nBean.getText(AlmLabManagementTaskConfigurator.TASK_NAME_VALUE))) { String taskRunLogPath = findRequiredStringFromLog(taskContext, linkSearchFilter); if (com.hpe.application.automation.tools.common.StringUtils.isNullOrEmpty(taskRunLogPath)) { taskContext.getBuildLogger().addErrorLogEntry(i18nBean.getText(CAN_NOT_SAVE_RUN_LOG_MESSAGE)); return; } createResultFile(taskContext, taskRunLogPath, ".*processRunId=", i18nBean); } else if (taskName.equals(i18nBean.getText(RunFromAlmTaskConfigurator.TASK_NAME_VALUE))) { List<String> links = null; if (resultFile != null && resultFile.exists()) { links = findRequiredStringsFromFile(taskContext.getBuildLogger(), resultFile); } if (links == null || links.size() < 1) { links = findRequiredStringsFromLog(taskContext.getBuildLogger(), linkSearchFilter); } Integer linksAmount = links.size(); if (linksAmount.equals(0)) { taskContext.getBuildLogger().addErrorLogEntry(i18nBean.getText(CAN_NOT_SAVE_RUN_LOG_MESSAGE)); return; } //taskContext.getBuildLogger().addBuildLogEntry("+++++++++++ " + links.size()); for (String link : links) { createResultFile(taskContext, link, ".*EntityID=", i18nBean); } } }
From source file:Main.java
/** * Converts an Integer to a boolean specifying the conversion values. * /*from w ww.j a v a2 s. c o m*/ * <pre> * BooleanUtils.toBoolean(new Integer(0), new Integer(1), new Integer(0)) = false * BooleanUtils.toBoolean(new Integer(1), new Integer(1), new Integer(0)) = true * BooleanUtils.toBoolean(new Integer(2), new Integer(1), new Integer(2)) = false * BooleanUtils.toBoolean(new Integer(2), new Integer(2), new Integer(0)) = true * BooleanUtils.toBoolean(null, null, new Integer(0)) = true * </pre> * * @param value the Integer to convert * @param trueValue the value to match for <code>true</code>, * may be <code>null</code> * @param falseValue the value to match for <code>false</code>, * may be <code>null</code> * @return <code>true</code> or <code>false</code> * @throws IllegalArgumentException if no match */ public static boolean toBoolean(Integer value, Integer trueValue, Integer falseValue) { if (value == null) { if (trueValue == null) { return true; } else if (falseValue == null) { return false; } } else if (value.equals(trueValue)) { return true; } else if (value.equals(falseValue)) { return false; } // no match throw new IllegalArgumentException("The Integer did not match either specified value"); }
From source file:com.ec2box.manage.util.SSHUtil.java
/** * return the next instance id based on ids defined in the session map * * @param sessionId session id/*ww w . j a va 2 s. c o m*/ * @param userSessionMap user session map * @return */ private static int getNextInstanceId(Long sessionId, Map<Long, UserSchSessions> userSessionMap) { Integer instanceId = 1; if (userSessionMap.get(sessionId) != null) { for (Integer id : userSessionMap.get(sessionId).getSchSessionMap().keySet()) { if (!id.equals(instanceId) && userSessionMap.get(sessionId).getSchSessionMap().get(instanceId) == null) { return instanceId; } instanceId = instanceId + 1; } } return instanceId; }
From source file:com.chiralbehaviors.CoRE.Ruleform.java
public static Boolean toBoolean(Integer value) { if (value == null) { return null; }//from ww w . j av a 2s . com return value.equals(Integer.valueOf(0)) ? Boolean.FALSE : Boolean.TRUE; }
From source file:com.github.horrorho.inflatabledonkey.cloud.escrow.EscrowOperationsRecover.java
static void validateSrpInitResponse(NSDictionary srpInitResponseBlob) { Integer version = PLists.optionalAs(srpInitResponseBlob, "version", NSNumber.class).map(NSNumber::intValue) .orElse(null);//w ww . ja va2 s.com if (!version.equals(1)) { throw new UnsupportedOperationException("unknown SRP_INIT version: " + version); } }