List of usage examples for java.lang Long Long
@Deprecated(since = "9") public Long(String s) throws NumberFormatException
From source file:com.ibuildapp.romanblack.FanWallPlugin.data.JSONParser.java
/** * Parses JSON comments data.// w ww. j av a 2 s . c om * * @param data JSON data to parse. * @return comments array */ public static ArrayList<FanWallMessage> parseMessagesString(String data) { try { String resp = data; if (resp == null) { return null; } if (resp.length() == 0) { return null; } JSONObject mainObject = new JSONObject(resp); JSONArray messagesJSON = mainObject.getJSONArray("posts"); ArrayList<FanWallMessage> parsedMessages = new ArrayList<FanWallMessage>(); for (int i = 0; i < messagesJSON.length(); i++) { JSONObject messageJSON = messagesJSON.getJSONObject(i); FanWallMessage tmpMessage = new FanWallMessage(); tmpMessage.setId(new Long(messageJSON.getString("post_id")).longValue()); tmpMessage.setAuthor(messageJSON.getString("user_name")); tmpMessage.setDate(new Date(new Long(messageJSON.getString("create")).longValue())); tmpMessage.setUserAvatarUrl(messageJSON.getString("user_avatar")); tmpMessage.setText(messageJSON.getString("text")); try { tmpMessage.setPoint(new Float(messageJSON.getString("latitude")).floatValue(), new Float(messageJSON.getString("longitude")).floatValue()); } catch (NumberFormatException nFEx) { Log.e("", ""); } try { tmpMessage.setParentId(new Integer(messageJSON.getString("parent_id")).intValue()); } catch (NumberFormatException nFEx) { Log.e("", ""); } try { tmpMessage.setReplyId(new Integer(messageJSON.getString("reply_id")).intValue()); } catch (NumberFormatException nFEx) { Log.e("", ""); } tmpMessage.setTotalComments(new Integer(messageJSON.getString("total_comments")).intValue()); JSONArray imagesJSON = messageJSON.getJSONArray("images"); if (imagesJSON.length() > 0) { tmpMessage.setImageUrl(imagesJSON.getString(0)); } tmpMessage.setAccountId(messageJSON.getString("account_id")); tmpMessage.setAccountType(messageJSON.getString("account_type")); parsedMessages.add(tmpMessage); } return parsedMessages; } catch (JSONException jSSONEx) { return null; } }
From source file:org.socialsignin.spring.data.dynamodb.query.ScanExpressionCountQuery.java
@Override public Long getSingleResult() { assertScanCountEnabled(isScanCountEnabled()); return new Long(dynamoDBOperations.count(domainClass, scanExpression)); }
From source file:org.jfree.chart.demo.EventFrequencyDemo1.java
private static CategoryDataset createDataset() { DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset(); Day day = new Day(12, 6, 2002); Day day1 = new Day(14, 6, 2002); Day day2 = new Day(15, 6, 2002); Day day3 = new Day(10, 7, 2002); Day day4 = new Day(20, 7, 2002); Day day5 = new Day(22, 8, 2002); defaultcategorydataset.setValue(new Long(day.getMiddleMillisecond()), "Series 1", "Requirement 1"); defaultcategorydataset.setValue(new Long(day.getMiddleMillisecond()), "Series 1", "Requirement 2"); defaultcategorydataset.setValue(new Long(day1.getMiddleMillisecond()), "Series 1", "Requirement 3"); defaultcategorydataset.setValue(new Long(day2.getMiddleMillisecond()), "Series 2", "Requirement 1"); defaultcategorydataset.setValue(new Long(day3.getMiddleMillisecond()), "Series 2", "Requirement 3"); defaultcategorydataset.setValue(new Long(day4.getMiddleMillisecond()), "Series 3", "Requirement 2"); defaultcategorydataset.setValue(new Long(day5.getMiddleMillisecond()), "Series 1", "Requirement 4"); return defaultcategorydataset; }
From source file:org.openregistry.core.web.SponsorConverter.java
@Override protected Object toObject(final String string, final Class targetClass) throws Exception { return personRepository.findByInternalId(new Long(string)); }
From source file:dao.CarryonDefaultAddQuery.java
/** * Adds keywords for a given user/*w w w . j av a 2 s. c o m*/ * @param conn - the connection * @param yourKeyword - your keywords * @param loginid - the loginid * @throws BaseDaoException - when error occurs **/ public void run(Connection conn, String entryid, String loginid) throws BaseDaoException { Long myloginid = new Long(loginid); try { PreparedStatement stmt = conn .prepareStatement("insert into defcarryon values(" + myloginid + ", '" + entryid + "')"); stmt.executeUpdate(); } catch (Exception e) { logger.warn("Error occured while executing CarryonDefaultAddQuery ", e); throw new BaseDaoException("Error occured while executing CarryonDefaultAddQuery ", e); } }
From source file:com.redhat.rhn.frontend.dto.BaseDto.java
/** * Adds the id of this object to a given set. For adding IdCombos to a set, * @see com.redhat.rhn.frontend.dto.IdComboDto * @param set The set to which we are adding an element. *///from w ww. j a va 2 s .co m public void addToSet(RhnSet set) { set.addElement(new Long(getId().longValue())); }
From source file:dao.CollabrumDefaultAddQuery.java
/** * Adds keywords for a given user/*from w w w . ja v a 2 s .c o m*/ * @param conn - the connection * @param yourKeyword - your keywords * @param loginid - the loginid * @throws BaseDaoException - when error occurs **/ public void run(Connection conn, String entryid, String collabrumId) throws BaseDaoException { Long collId = new Long(collabrumId); try { PreparedStatement stmt = conn .prepareStatement("insert into defcollblob values(" + collId + ", '" + entryid + "')"); stmt.executeUpdate(); } catch (Exception e) { logger.warn("Error occured while executing CollabrumDefaultAddQuery ", e); throw new BaseDaoException("Error occured while executing CollabrumDefaultAddQuery ", e); } }
From source file:com.clican.pluto.cms.ui.ext.converter.DataModelConverter.java
public Object getAsObject(FacesContext context, UIComponent component, String value) { if (StringUtils.isEmpty(value)) { return null; } else {/*from w w w.j a v a 2s . c om*/ DataModelService dataModelService = (DataModelService) Constants.ctx.getBean("dataModelService"); return dataModelService.loadDataModel(modelClass, new Long(value)); } }
From source file:com.hs.mail.imap.dao.MySqlUserDao.java
public User getUser(long id) { String sql = "SELECT * FROM user WHERE id = ?"; return (User) queryForObject(sql, new Object[] { new Long(id) }, userMapper); }
From source file:com.trailmagic.user.hibernate.HibernateGroupFactory.java
public Group getById(final long id) { return (Group) m_hibernateTemplate.execute(new HibernateCallback() { public Object doInHibernate(Session session) { return session.get(Group.class, new Long(id)); }/* www .j av a 2 s . c om*/ }); }