List of usage examples for java.lang Long valueOf
@HotSpotIntrinsicCandidate public static Long valueOf(long l)
From source file:foam.nanos.auth.email.EmailVerificationWebAgent.java
@Override public void execute(X x) { String message = "Your email has now been verified."; PrintWriter out = x.get(PrintWriter.class); DAO userDAO = (DAO) x.get("localUserDAO"); EmailTokenService emailToken = (EmailTokenService) x.get("emailToken"); HttpServletRequest request = x.get(HttpServletRequest.class); HttpServletResponse response = x.get(HttpServletResponse.class); String token = request.getParameter("token"); String userId = request.getParameter("userId"); String redirect = request.getParameter("redirect"); User user = (User) userDAO.find(Long.valueOf(userId)); try {// www. ja v a 2s. c o m if (token == null || "".equals(token)) { throw new Exception("Token not found"); } if ("".equals(userId) || !StringUtils.isNumeric(userId)) { throw new Exception("User not found."); } if (user.getEmailVerified()) { throw new Exception("Email already verified."); } emailToken.processToken(x, user, token); } catch (Throwable t) { message = "Problem verifying your email.<br>" + t.getMessage(); } finally { if (config_ == null) { config_ = EnvironmentConfigurationBuilder.configuration().resources().resourceLoaders() .add(new TypedResourceLoader("dao", new DAOResourceLoader(x, (String) user.getGroup()))) .and().and().build(); } EmailTemplate emailTemplate = DAOResourceLoader.findTemplate(x, "verify-email-link", (String) user.getGroup()); JtwigTemplate template = JtwigTemplate.inlineTemplate(emailTemplate.getBody(), config_); JtwigModel model = JtwigModel.newModel(Collections.<String, Object>singletonMap("msg", message)); out.write(template.render(model)); if (!redirect.equals("null")) { try { response.addHeader("REFRESH", "2;URL=" + redirect); } catch (Exception e) { e.printStackTrace(); } } } }
From source file:com.clustercontrol.selfcheck.monitor.JVMHeapMonitor.java
/** * ????/*from ww w. ja v a2 s. c om*/ */ @Override public String toString() { int jvmMinHeapThreshold = HinemosPropertyUtil .getHinemosPropertyNum(JVM_FREEHEAP_THRESHOLD, Long.valueOf(32)).intValue(); return "monitoring jvm free heap (threshold = " + jvmMinHeapThreshold + " [mbyte] )"; }
From source file:com.wabacus.system.datatype.LongType.java
public Object getColumnValue(ResultSet rs, int iindex, AbsDatabaseType dbtype) throws SQLException { return Long.valueOf(rs.getLong(iindex)); }
From source file:eionet.cr.dao.readers.HarvestSourceDTOReader.java
@Override public void readRow(ResultSet rs) throws SQLException, ResultSetReaderException { HarvestSourceDTO harvestSourceDTO = new HarvestSourceDTO(); harvestSourceDTO.setSourceId(new Integer(rs.getInt("HARVEST_SOURCE_ID"))); harvestSourceDTO.setUrl(rs.getString("URL")); harvestSourceDTO.setUrlHash(Long.valueOf(rs.getLong("URL_HASH"))); harvestSourceDTO.setEmails(rs.getString("EMAILS")); harvestSourceDTO.setTimeCreated(rs.getTimestamp("TIME_CREATED")); harvestSourceDTO.setStatements(new Integer(rs.getInt("STATEMENTS"))); harvestSourceDTO.setCountUnavail(new Integer(rs.getInt("COUNT_UNAVAIL"))); harvestSourceDTO.setLastHarvest(rs.getTimestamp("LAST_HARVEST")); harvestSourceDTO.setIntervalMinutes(rs.getInt("INTERVAL_MINUTES")); harvestSourceDTO.setOwner(rs.getString("SOURCE_OWNER")); harvestSourceDTO.setMediaType(rs.getString("MEDIA_TYPE")); String isPrioritySourceStr = rs.getString("PRIORITY_SOURCE"); if (StringUtils.isNotBlank(isPrioritySourceStr)) { harvestSourceDTO.setPrioritySource(YesNoBoolean.parse(isPrioritySourceStr)); }/*from w ww.j a va2s.co m*/ String lastHarvestFailedStr = rs.getString("LAST_HARVEST_FAILED"); if (StringUtils.isNotBlank(lastHarvestFailedStr)) { harvestSourceDTO.setLastHarvestFailed(YesNoBoolean.parse(lastHarvestFailedStr)); } String isPermErrorStr = rs.getString("PERMANENT_ERROR"); if (StringUtils.isNotBlank(isPermErrorStr)) { harvestSourceDTO.setPermanentError(YesNoBoolean.parse(isPermErrorStr)); } String isSparqlEndpointStr = rs.getString("IS_SPARQL_ENDPOINT"); if (StringUtils.isNotBlank(isSparqlEndpointStr)) { harvestSourceDTO.setSparqlEndpoint(YesNoBoolean.parse(isSparqlEndpointStr)); } resultList.add(harvestSourceDTO); }
From source file:com.metabroadcast.common.webapp.query.DateTimeInQueryParser.java
public DateTime parse(String value) throws MalformedDateTimeException { if (!StringUtils.isBlank(value) && StringUtils.isNumeric(value)) { return new DateTime(Long.valueOf(value) * 1000, DateTimeZones.UTC); }//www .j a va 2s . c o m Matcher matcher = EXPRESSION.matcher(value); if (matcher.matches()) { String operator = matcher.group(1); if (operator == null) { return clock.now(); } else { Period period = periodFrom(matcher.group(2)); if ("plus".equals(operator)) { return clock.now().plus(period); } else { return clock.now().minus(period); } } } throw new MalformedDateTimeException(); }
From source file:com.eugene.fithealthmaingit.FatSecretSearchAndGet.FatSecretSearchMethod.java
private static String[] generateOauthParams(int i) { return new String[] { "oauth_consumer_key=" + Globals.APP_KEY, "oauth_signature_method=HMAC-SHA1", "oauth_timestamp=" + Long.valueOf(System.currentTimeMillis() * 1000).toString(), "oauth_nonce=" + nonce(), "oauth_version=1.0", "format=json", "page_number=" + i, "max_results=" + 20 }; }
From source file:domainregistry.HypertyService.java
public void createUserHyperty(Connection connectionClient, HypertyInstance newHyperty) { long expiresLimit = Long.valueOf(System.getenv(EXPIRES)).longValue(); String userID = newHyperty.getUserID(); String hypertyID = newHyperty.getHypertyID(); if (validateExpiresField(newHyperty.getExpires(), expiresLimit)) { newHyperty.setExpires((int) expiresLimit); log.info("Expires was set to the max value allowed by the Domain Registry: " + expiresLimit); }//from w ww . j a v a 2s .c om if (connectionClient.userExists(userID)) { checkHypertyExistence(connectionClient, newHyperty); return; } if (connectionClient.hypertyExists(hypertyID)) throw new CouldNotCreateOrUpdateHypertyException(); else newHyperty(connectionClient, newHyperty); }
From source file:com.turn.ttorrent.bcodec.BEValue.java
public BEValue(long value) { this.value = Long.valueOf(value); }
From source file:com.bfd.harpc.main.ConfigHelper.java
/** * ??//from w w w . j ava2 s . co m * <p> * * @param configObject * ? * @param configPrefix * ?? * @param configuration * {@link PropertiesConfiguration} * @throws RpcException */ public static void initConfig(Object configObject, String configPrefix, PropertiesConfiguration configuration) throws RpcException { Method[] methods = configObject.getClass().getMethods(); for (Method method : methods) { if (method.getName().length() > 3 && method.getName().startsWith("set") && method.getParameterTypes().length == 1) { String attribute = method.getName().substring(3); char ch = attribute.charAt(0); attribute = Character.toLowerCase(ch) + attribute.substring(1); String value = configuration.getProperty(configPrefix + attribute, ""); try { if (StringUtils.isNotEmpty(value)) { Type type = method.getParameterTypes()[0]; if (type == boolean.class) { method.invoke(configObject, Boolean.valueOf(value)); } else if (type == int.class) { method.invoke(configObject, Integer.valueOf(value)); } else if (type == long.class) { method.invoke(configObject, Long.valueOf(value)); } else { method.invoke(configObject, value); } } } catch (Exception e) { LOGGER.error("Init config error", e); throw new RpcException(RpcException.CONFIG_EXCEPTION, e); } } } }
From source file:org.nekorp.workflow.desktop.servicio.bridge.DamageDetailBridge.java
@Override public void unload(DamageDetailsVB origen, DamageDetail destino) { BeanUtils.copyProperties(origen, destino, new String[] { "id" }); if (StringUtils.isEmpty(origen.getId())) { destino.setId(null);/*www. ja v a 2 s.c o m*/ } else { destino.setId(Long.valueOf(origen.getId())); } }