List of usage examples for java.lang Long valueOf
@HotSpotIntrinsicCandidate public static Long valueOf(long l)
From source file:com.clustercontrol.maintenance.factory.MaintenanceEvent.java
/** * ?//from www . j av a 2s . com */ @Override protected int _delete(Long boundary, boolean status, String ownerRoleId) { m_log.debug("_delete() start : status = " + status); int ret = -1; String ownerRoleId2 = null; //ID?ADMINISTRATORS?? if (RoleIdConstant.isAdministratorRole(ownerRoleId)) { //SQL? if (status) { // for HA (????)?????(0) : ret = QueryUtil.deleteEventLogByGenerationDate(boundary, HinemosPropertyUtil.getHinemosPropertyNum(_QUERY_TIMEOUT_KEY, Long.valueOf(0)).intValue()); } else { // for HA (????)?????(0) : //status=false???????? ret = QueryUtil.deleteEventLogByGenerationDateConfigFlg(boundary, HinemosPropertyUtil.getHinemosPropertyNum(_QUERY_TIMEOUT_KEY, Long.valueOf(0)).intValue()); } } //??? else { ownerRoleId2 = ownerRoleId; //SQL? if (status) { // for HA (????)?????(0) : ret = QueryUtil.deleteEventLogByGenerationDateAndOwnerRoleId(boundary, HinemosPropertyUtil.getHinemosPropertyNum(_QUERY_TIMEOUT_KEY, Long.valueOf(0)).intValue(), ownerRoleId); } else { // for HA (????)?????(0) : //status=false???????? ret = QueryUtil.deleteEventLogByGenerationDateConfigFlgAndOwnerRoleId(boundary, HinemosPropertyUtil.getHinemosPropertyNum(_QUERY_TIMEOUT_KEY, Long.valueOf(0)).intValue(), ownerRoleId); } } // cache? // status=true??status=false?ConfirmFlg?1(?)?? new JpaTransactionManager().addCallback(new EventCacheModifyCallback(boundary, status, ownerRoleId2)); // m_log.debug("_delete() count : " + ret); return ret; }
From source file:de.hybris.platform.acceleratorservices.config.impl.AbstractConfigLookup.java
@Override public long getLong(final String key, final long defaultValue) { final String property = getProperty(key); if (property != null && !property.isEmpty()) { try {/* w w w .j av a 2s . c om*/ final Long longValue = Long.valueOf(property); if (longValue != null) { return longValue.longValue(); } } catch (final NumberFormatException ex) { if (LOG.isDebugEnabled()) { LOG.debug("Failed to parse long property value for key [" + key + "] value was [" + property + "]", ex); } } } return defaultValue; }
From source file:be.ugent.tiwi.sleroux.newsrec.newsreclib.newsFetch.storm.bolts.trendDetect.NthLastModifiedTimeTracker.java
private void initLastModifiedTimesMillis() { long nowCached = now(); for (int i = 0; i < lastModifiedTimesMillis.maxSize(); i++) { lastModifiedTimesMillis.add(Long.valueOf(nowCached)); }/*from ww w . j a v a 2s . c om*/ }
From source file:cn.sixlab.sixutil.StrUtil.java
/** * ??/*from w w w .j a v a2s . com*/ * * @param str ? * @return {@code str}true {@code str}?false */ public static Boolean isNotNaturalNumber(String str) { try { long value = Long.valueOf(str); if (value >= 0) { return false; } return true; } catch (Exception e) { return true; } }
From source file:com.glaf.jbpm.util.SqlParamUtils.java
@SuppressWarnings("unchecked") public static List<Object> getValues(Map<String, Object> paramMap, SqlExecutor executor) { java.util.Date now = new java.util.Date(); List<Object> values = new java.util.ArrayList<Object>(); Object parameter = executor.getParameter(); if (parameter instanceof Map) { Map<String, Object> params = (Map<String, Object>) parameter; Set<Entry<String, Object>> entrySet = params.entrySet(); for (Entry<String, Object> entry : entrySet) { String key = entry.getKey(); Object value = entry.getValue(); if (key != null && value != null) { if (value instanceof String) { String tmp = (String) value; if (StringUtils.isNotEmpty(tmp)) { if (tmp.equals("now()")) { value = new java.sql.Date(now.getTime()); } else if (tmp.equals("date()")) { value = new java.sql.Date(now.getTime()); } else if (tmp.equals("time()")) { value = new java.sql.Time(now.getTime()); } else if (tmp.equals("timestamp()")) { value = new java.sql.Timestamp(now.getTime()); } else if (tmp.equals("dateTime()")) { value = new java.sql.Timestamp(now.getTime()); } else if (tmp.equals("currentTimeMillis()")) { value = Long.valueOf(System.currentTimeMillis()); } else if (tmp.equals("#{rowId}")) { value = paramMap.get("rowId"); } else if (tmp.equals("#{processInstanceId}")) { value = ParamUtils.getString(paramMap, "processInstanceId"); } else if (tmp.equals("#{processName}")) { value = ParamUtils.getString(paramMap, "processName"); } else if (tmp.equals("#{status}")) { value = paramMap.get("status"); } else if (tmp.startsWith("#P{") && tmp.endsWith("}")) { tmp = StringTools.replaceIgnoreCase(tmp, "#P{", ""); tmp = StringTools.replaceIgnoreCase(tmp, "}", ""); value = paramMap.get(tmp); } else if (tmp.startsWith("#{") && tmp.endsWith("}")) { value = DefaultExpressionEvaluator.evaluate(tmp, paramMap); }//from w w w. j a v a 2s . c o m } } } values.add(value); } } return values; }
From source file:org.ambraproject.annotation.action.CreateFlagActionTest.java
@Test public void testCreateFlag() throws Exception { UserProfile user = new UserProfile("authIdForCreateFlagAction", "email@createFlagAction.org", "displayNameForCreateFlagAction"); dummyDataStore.store(user);/* ww w.java2s . c o m*/ login(user); Annotation annotation = new Annotation(user, AnnotationType.REPLY, 2134l); Long annotationId = Long.valueOf(dummyDataStore.store(annotation)); String comment = "This is spam!"; action.setTarget(annotationId); action.setReasonCode("spam"); action.setComment(comment); String result = action.execute(); assertEquals(result, Action.SUCCESS, "Action didn't return success"); assertEquals(action.getActionErrors().size(), 0, "Action returned error messages: " + StringUtils.join(action.getActionErrors(), ";")); assertEquals(action.getFieldErrors().size(), 0, "Action returned field errors: " + StringUtils.join(action.getFieldErrors().values(), ";")); assertNotNull(action.getFlagId(), "Action had null flag id"); Flag storedFlag = dummyDataStore.get(Flag.class, action.getFlagId()); assertNotNull(storedFlag, "action didn't store flag to the database"); assertEquals(storedFlag.getReason(), FlagReasonCode.SPAM, "Stored flag had incorrect reason code"); assertEquals(storedFlag.getComment(), comment, "stored flag had incorrect comment"); assertNotNull(storedFlag.getFlaggedAnnotation(), "stored flag had no annotation"); assertEquals(storedFlag.getFlaggedAnnotation().getID(), annotationId, "stored flag had incorrect annotation"); }
From source file:cz.muni.fi.editor.database.test.CmisDAOTest.java
@Test public void getById() { Assert.assertEquals(Long.valueOf(3L), cmisObjectDAO.getById(3L).getId()); }
From source file:com.clustercontrol.selfcheck.monitor.DBConnectionCountMonitor.java
/** * ????// ww w . j av a 2 s . c om */ @Override public String toString() { int threshold = HinemosPropertyUtil.getHinemosPropertyNum(DB_CONNECTION_COUNT_THRESHOLD, Long.valueOf(80)) .intValue(); return "monitoring database connection (threshold = " + threshold + ")"; }
From source file:org.mapstruct.itest.jsr330.Jsr330BasedMapperTest.java
@Test public void shouldCreateSpringBasedMapper() { Source source = new Source(); Target target = mapper.sourceToTarget(source); assertThat(target).isNotNull();/*ww w. j av a2 s .c om*/ assertThat(target.getFoo()).isEqualTo(Long.valueOf(42)); assertThat(target.getDate()).isEqualTo("1980"); }
From source file:org.syncope.core.init.JobInstanceLoader.java
private static Long getIdFromJobName(final String name, final String pattern, final int prefixLength) { Long result = null;/* w w w. ja v a 2s . co m*/ Matcher jobMatcher = Pattern.compile(pattern).matcher(name); if (jobMatcher.matches()) { try { result = Long.valueOf(name.substring(prefixLength)); } catch (NumberFormatException e) { LOG.error("Unparsable id: {}", name.substring(prefixLength), e); } } return result; }