List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:com.aurel.track.admin.server.siteConfig.incomingEmail.IncomingEmailBL.java
/** * Updates the site bean (server configuration bean) with new information from * the incoming e-mail configuration transfer object. * * @param siteBean contains all data for the server configuration * @param incomingEmailTO transfer object with POP3 or IMAP server configuration data * *//* w w w. ja v a2 s .c o m*/ public static void updateIncomingEmail(TSiteBean siteBean, IncomingEmailTO incomingEmailTO) { siteBean.setIsEmailSubmissionOn(incomingEmailTO.isEmailSubmissionEnabled()); if (siteBean.getIsEmailSubmissionOn()) { siteBean.setMailReceivingProtocol(incomingEmailTO.getProtocol()); siteBean.setMailReceivingServerName(incomingEmailTO.getServerName()); siteBean.setMailReceivingSecurityConnection(incomingEmailTO.getSecurityConnection()); Integer popPort = incomingEmailTO.getPort(); if (popPort == null || popPort.intValue() < 1) { if ("pop3".equals(incomingEmailTO.getProtocol())) { incomingEmailTO.setPort(new Integer(110)); // set port to default value } if ("imap".equals(incomingEmailTO.getProtocol())) { incomingEmailTO.setPort(new Integer(143)); // set port to default value } } siteBean.setMailReceivingPort(incomingEmailTO.getPort()); siteBean.setMailReceivingUser(incomingEmailTO.getUser()); if (incomingEmailTO.getPassword() != null && incomingEmailTO.getPassword().trim().length() > 0) { siteBean.setMailReceivingPassword(incomingEmailTO.getPassword()); } siteBean.setIsUnknownSenderOn(incomingEmailTO.isUnknownSenderEnabled()); if (siteBean.getIsUnknownSenderOn()) { siteBean.setIsUnknownSenderRegistrationOn(incomingEmailTO.isUnknownSenderRegistrationEnabled()); } siteBean.setDefaultProject(incomingEmailTO.getDefaultProject()); siteBean.setKeepMessagesOnServer(Boolean.toString(incomingEmailTO.isKeepMessagesOnServer())); } siteBean.setAllowedEmailPattern(incomingEmailTO.getAllowedEmailPattern()); }
From source file:com.yahoo.ads.pb.util.Convert.java
/** * Convert integer list to array./* w w w.j a v a 2s . co m*/ * * @param integerList * @isSorted True to sort the converted array * @return */ public static int[] toPrimitive(List<Integer> integerList, boolean isSorted) { if (integerList == null || integerList.isEmpty()) { return null; } int[] result = new int[integerList.size()]; int i = 0; for (Integer value : integerList) { result[i++] = value.intValue(); } if (isSorted) { Arrays.sort(result); } return result; }
From source file:com.aurel.track.admin.server.siteConfig.incomingEmail.IncomingEmailBL.java
/** * This method returns a transfer object for the incoming e-mail * configuration (POP3 or IMAP). The transfer object can be used to move * data between the application layer and the user interface. * * @param siteBean contains all data for the server configuration * @param locale the locale used for translating the radio group texts. * * @return the transfer object for the incoming e-mail configuration *//*from w ww .j a v a 2 s .c o m*/ public static IncomingEmailTO getIncomingEmailTO(TSiteBean siteBean, Locale locale) { IncomingEmailTO incomingEmailTO = new IncomingEmailTO(); incomingEmailTO.setEmailSubmissionEnabled(siteBean.getIsEmailSubmissionOn()); String protocol = siteBean.getMailReceivingProtocol(); if (protocol == null || protocol.length() == 0) { protocol = "pop3"; siteBean.setMailReceivingProtocol(protocol); } Integer popPort = siteBean.getMailReceivingPort(); if (popPort == null || popPort.intValue() < 1) { if ("pop3".equals(protocol)) { siteBean.setMailReceivingPort(new Integer(110)); // set port to default value } if ("imap".equals(protocol)) { siteBean.setMailReceivingPort(new Integer(143)); // set port to default value } } incomingEmailTO.setProtocol(siteBean.getMailReceivingProtocol()); incomingEmailTO.setServerName(siteBean.getMailReceivingServerName()); incomingEmailTO.setPort(siteBean.getMailReceivingPort()); incomingEmailTO.setUser(siteBean.getMailReceivingUser()); incomingEmailTO.setPassword(siteBean.getMailReceivingPassword()); Integer mailReceivingSecurityConnection = siteBean.getMailReceivingSecurityConnection(); if (mailReceivingSecurityConnection != null) { incomingEmailTO.setSecurityConnection(siteBean.getMailReceivingSecurityConnection()); } else { incomingEmailTO.setSecurityConnection(TSiteBean.SECURITY_CONNECTIONS_MODES.NEVER); } incomingEmailTO.setKeepMessagesOnServer( new Boolean(siteBean.getPreferenceProperty(TSiteBean.KEEP_MESSAGES_ON_SERVER))); incomingEmailTO.setUnknownSenderEnabled(siteBean.getIsUnknownSenderOn()); incomingEmailTO.setUnknownSenderRegistrationEnabled(siteBean.getIsUnknownSenderRegistrationOn()); incomingEmailTO.setDefaultProject(siteBean.getDefaultProject()); incomingEmailTO.setAllowedEmailPattern(siteBean.getAllowedEmailPattern()); if (locale != null) { incomingEmailTO.setSecurityConnectionsModes(OutgoingEmailBL.getSecurityConnectionsModes(locale)); } return incomingEmailTO; }
From source file:com.swiftcorp.portal.common.util.WebUtils.java
public static int getUserWorkingLevel(HttpServletRequest request) { int workingLevel = GlobalConstants.SYSTEM_LEVEL; HttpSession session = request.getSession(); Integer ulObj = (Integer) session.getAttribute(SESSION_KEYS.WORKING_LEVEL); if (ulObj != null) { workingLevel = ulObj.intValue(); }// w w w. j a va 2 s.co m return workingLevel; }
From source file:AIR.Common.Configuration.AppSettingsHelper.java
private static int getInt32(String key, Integer defaultValue) { String rawValue = get(key);/*from w w w .j a va2 s . c om*/ if (!StringUtils.isEmpty(rawValue)) { int value = Integer.parseInt(rawValue); return value; } return defaultValue != null ? defaultValue.intValue() : 0; }
From source file:Main.java
private static final <E> int getFreq(final E obj, final Map<E, Integer> freqMap) { Integer count = freqMap.get(obj); if (count != null) { return count.intValue(); }/*w w w . j a v a2s.c o m*/ return 0; }
From source file:Main.java
/** * <p>Converts an Integer to a Boolean using the convention that {@code zero} * is {@code false}.</p>//from w w w.j ava 2s . c o m * * <p>{@code null} will be converted to {@code null}.</p> * * <p>NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean. </p> * * <pre> * BooleanUtils.toBoolean(Integer.valueOf(0)) = Boolean.FALSE * BooleanUtils.toBoolean(Integer.valueOf(1)) = Boolean.TRUE * BooleanUtils.toBoolean(Integer.valueOf(null)) = null * </pre> * * @param value the Integer to convert * @return Boolean.TRUE if non-zero, Boolean.FALSE if zero, * {@code null} if {@code null} input */ public static Boolean toBooleanObject(Integer value) { if (value == null) { return null; } return value.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE; }
From source file:com.aurel.track.fieldType.bulkSetters.DateBulkSetter.java
/** * Shift a date by a number of days //from w ww . j ava 2 s . c o m * @param originalDate * @param daysOffset * @return */ protected static Date shiftByDays(Date originalDate, Integer daysOffset) { if (daysOffset != null && daysOffset.intValue() != 0) { Calendar calendar = Calendar.getInstance(); calendar.setTime(originalDate); calendar.add(Calendar.DATE, daysOffset.intValue()); while (WorkDaysConfigImplementation.isNonWorkingDay(calendar.getTime(), null)) { calendar.add(Calendar.DATE, 1); } return calendar.getTime(); } return originalDate; }
From source file:jp.terasoluna.fw.web.taglib.TagUtil.java
/** * ?XR?[vvXR?[v?p?B/*from w ww. j av a2s .c o m*/ * vXR?[v???O??B * * @param scopeName ?XR?[v * @return XR?[v? * @throws JspException vXR?[v??? */ public static int getScope(String scopeName) throws JspException { if (scopeName == null) { throw new JspException(); } Integer scope = SCOPES.get(scopeName.toLowerCase()); if (scope == null) { throw new JspException(); } return scope.intValue(); }
From source file:com.ms.app.web.commons.tools.CurrencyFormattor.java
/** * /*from w w w.j ava 2 s.c om*/ */ public static Integer formatPrice(Integer price) { if (price == null) { return null; } return price.intValue() / 100; }