List of usage examples for java.util Vector size
public synchronized int size()
From source file:ext.tmt.utils.EPMUtil.java
/** * EPM//from w ww. j a v a 2 s. c om * update the primary content * @param newDoc * @param filename * @return * @throws WTException * @throws PropertyVetoException * @throws FileNotFoundException * @throws IOException */ public static EPMDocument changeDocumentPrimary(EPMDocument newDoc, String filename) throws WTException, PropertyVetoException, FileNotFoundException, IOException { ContentHolder contentholder = (ContentHolder) newDoc; contentholder = ContentHelper.service.getContents(contentholder); Vector contentListForTarget = ContentHelper.getContentListAll(contentholder); for (int i = 0; i < contentListForTarget.size(); i++) { ContentItem contentItem = (ContentItem) contentListForTarget.elementAt(i); if (contentItem.getRole().toString().equals("PRIMARY")) { System.out.println("Delete Current Primary content!"); ContentServerHelper.service.deleteContent(contentholder, contentItem); break; } } ApplicationData applicationdata = ApplicationData.newApplicationData(contentholder); applicationdata.setRole(ContentRoleType.toContentRoleType("PRIMARY")); applicationdata.setCategory(DEFAULT_CATEGORY); applicationdata = ContentServerHelper.service.updateContent(contentholder, applicationdata, filename); newDoc = (EPMDocument) PersistenceHelper.manager.refresh(newDoc); return newDoc; }
From source file:app.com.example.wungmathing.sunshine.FetchWeatherTask.java
String[] convertContentValuesToUXFormat(Vector<ContentValues> cvv) { // return strings to keep UI functional for now String[] resultStrs = new String[cvv.size()]; for (int i = 0; i < cvv.size(); i++) { ContentValues weatherValues = cvv.elementAt(i); String highAndLow = formatHighLows(weatherValues.getAsDouble(WeatherEntry.COLUMN_MAX_TEMP), weatherValues.getAsDouble(WeatherEntry.COLUMN_MIN_TEMP)); resultStrs[i] = getReadableDateString(weatherValues.getAsLong(WeatherEntry.COLUMN_DATE)) + " - " + weatherValues.getAsString(WeatherEntry.COLUMN_SHORT_DESC) + " - " + highAndLow; }//from www . j a v a2s . c o m return resultStrs; }
From source file:gsn.http.A3DWebServiceImpl.java
public String[] getSensors() { Iterator<VSensorConfig> vsIterator = Mappings.getAllVSensorConfigs(); Vector<String> sensors = new Vector<String>(); while (vsIterator.hasNext()) { VSensorConfig sensorConfig = vsIterator.next(); sensors.add(sensorConfig.getName()); }// w w w.j a va2 s . c o m String v_sensors[] = new String[sensors.size()]; for (int i = 0; i < sensors.size(); i++) v_sensors[i] = sensors.get(i); return v_sensors; }
From source file:dao.DirectoryListUsersQuery.java
/** * This method lists all users for a directory * @param conn the connection/*from www . j av a 2s .co m*/ * @param directoryId the directory id * @return HashSet the set that has the list of users for this directory. * @throws BaseDaoException * @author Smitha Gudur (smitha@redbasin.com) * @version $Revision: 1.1 $ */ /* Uses tables - directory, dirallow, hdlogin */ public HashSet run(Connection conn, String directoryid) throws BaseDaoException { String sqlQuery = "select distinct CONCAT(hd.fname,' ',hd.lname) AS membername, " + "hd.login, hd.loginid, d1.directoryid, d1.dirname from directory d1, " + "dirallow d2, hdlogin hd where d2.loginid=hd.loginid " + "and d1.directoryid=d2.directoryid and d1.directoryid=" + directoryid + ""; try { PreparedStatement stmt = conn.prepareStatement(sqlQuery); ResultSet rs = stmt.executeQuery(); Vector columnNames = null; Directory directory = null; HashSet dirSet = new HashSet(); if (rs != null) { columnNames = dbutils.getColumnNames(rs); } else { return null; } while (rs.next()) { directory = (Directory) eop.newObject(DbConstants.DIRECTORY); for (int j = 0; j < columnNames.size(); j++) { directory.setValue((String) columnNames.elementAt(j), (String) rs.getString((String) columnNames.elementAt(j))); } dirSet.add(directory); } return dirSet; } catch (Exception e) { throw new BaseDaoException("Error occured DirectoryListUsersQuery run query " + sqlQuery, e); } }
From source file:com.example.android.sunshine.data.FetchWeatherTask.java
String[] convertContentValuesToUXFormat(Vector<ContentValues> cvv) { // return strings to keep UI functional for now String[] resultStrs = new String[cvv.size()]; for (int i = 0; i < cvv.size(); i++) { ContentValues weatherValues = cvv.elementAt(i); String highAndLow = formatHighLows( weatherValues.getAsDouble(WeatherContract.WeatherEntry.COLUMN_MAX_TEMP), weatherValues.getAsDouble(WeatherContract.WeatherEntry.COLUMN_MIN_TEMP)); resultStrs[i] = getReadableDateString(weatherValues.getAsLong(WeatherContract.WeatherEntry.COLUMN_DATE)) + " - " + weatherValues.getAsString(WeatherContract.WeatherEntry.COLUMN_SHORT_DESC) + " - " + highAndLow;/* www . j a v a 2 s. c o m*/ } return resultStrs; }
From source file:at.lame.hellonzb.parser.NzbParser.java
/** * Check all download files within this parser for consecutive * index numbers without any gaps. Throw exception if a gap was * found./* w w w .j ava2 s . c o m*/ */ private void checkFileSegments() { for (DownloadFile df : this.downloadFiles) { Vector<DownloadFileSegment> segs = df.getAllOriginalSegments(); for (int currIdx = 0; currIdx < segs.size(); currIdx++) { if ((segs.get(currIdx) == null) || (segs.get(currIdx).getIndex() != (currIdx + 1))) { // create new dummy segment DownloadFileSegment dummySeg = new DownloadFileSegment(df, 1, currIdx + 1, df.getGroups()); dummySeg.setArticleId("dummy"); df.addSegment(dummySeg); } } } }
From source file:dao.PendingfriendExistsQuery.java
public HashSet run(Connection conn, String loginid, String destloginid) { PreparedStatement stmt = null; ResultSet rs = null;/*from w ww . j a v a 2 s.c om*/ String sqlQuery = "select count(*) from pendingfriends where pendingfriends.loginid='" + loginid + "' and pendingfriends.destloginid='" + destloginid + "' or pendingfriends.loginid='" + destloginid + "' and pendingfriends.destloginid='" + loginid + "'"; try { stmt = conn.prepareStatement(sqlQuery); rs = stmt.executeQuery(); Vector columnNames = null; Pendingfriend pendingFriend = null; HashSet pendingSet = new HashSet(); if (rs != null) { columnNames = dbutils.getColumnNames(rs); } else { return null; } while (rs.next()) { pendingFriend = (Pendingfriend) eop.newObject(DbConstants.PENDING_FRIEND); for (int j = 0; j < columnNames.size(); j++) { logger.debug("columnNames = " + (String) columnNames.elementAt(j)); pendingFriend.setValue((String) columnNames.elementAt(j), (String) rs.getString((String) columnNames.elementAt(j))); } pendingSet.add(pendingFriend); } return pendingSet; } catch (Exception e) { logger.warn("Error occured while executing pendingfriends run query", e); throw new BaseDaoException("Error occured while executing pendingfriends run query " + sqlQuery, e); } }
From source file:dao.SearchInTagsQuery.java
/** * This method lists all the results for the search text from directories * @param conn the connection//from w ww. j a v a2 s . c o m * @param collabrumId the collabrumid * @return List the set that has the list of moderators for these collabrums. * @throws BaseDaoException - when error occurs **/ public List run(Connection conn, String sString) throws BaseDaoException { if ((RegexStrUtil.isNull(sString) || conn == null)) { return null; } ResultSet rs = null; StringBuffer sb = new StringBuffer("select * from tags where "); ArrayList columns = new ArrayList(); columns.add("tag"); sb.append(sqlSearch.getConstraint(columns, sString)); logger.info("search query string" + sb.toString()); try { PreparedStatement stmt = conn.prepareStatement(sb.toString()); rs = stmt.executeQuery(); Vector columnNames = null; Yourkeywords tag = null; List pendingList = new ArrayList(); if (rs != null) { columnNames = dbutils.getColumnNames(rs); } else { return null; } while (rs.next()) { tag = (Yourkeywords) eop.newObject(DbConstants.YOURKEYWORDS); for (int j = 0; j < columnNames.size(); j++) { tag.setValue((String) columnNames.elementAt(j), (String) rs.getString((String) columnNames.elementAt(j))); } pendingList.add(tag); } return pendingList; } catch (Exception e) { throw new BaseDaoException("Error occured while executing search in tag run query " + sb.toString(), e); } }
From source file:dao.MykeywordsUserQuery.java
public HashSet run(Connection conn, String sString) throws BaseDaoException { if ((RegexStrUtil.isNull(sString) || conn == null)) { return null; }//from www . j av a 2 s .com ResultSet rs = null; StringBuffer sb = new StringBuffer("select distinct keyword from mykeywords where "); ArrayList columns = new ArrayList(); columns.add("loginid"); sb.append(sqlSearch.getConstraint(columns, sString)); logger.info("MykeywordUserQuery = " + sb.toString()); try { PreparedStatement stmt = conn.prepareStatement(sb.toString()); rs = stmt.executeQuery(); Vector columnNames = null; Mykeywords mykeyword = null; HashSet pendingSet = new HashSet(); if (rs != null) { columnNames = dbutils.getColumnNames(rs); } else { return null; } while (rs.next()) { mykeyword = (Mykeywords) eop.newObject(DbConstants.MYKEYWORDS); for (int j = 0; j < columnNames.size(); j++) { mykeyword.setValue((String) columnNames.elementAt(j), (String) rs.getString((String) columnNames.elementAt(j))); } pendingSet.add(mykeyword); } return pendingSet; } catch (Exception e) { throw new BaseDaoException("Error occured while executing search in MykeywordsUserQuery run query ", e); } }
From source file:com.facebook.android.GraphExplorer.java
public void getFields(Vector<String> fieldsVector) { String fields = ""; int count = 0; for (String field : fieldsVector) { fields += field;/* ww w. jav a 2 s . c o m*/ if (++count < fieldsVector.size()) { fields += ","; } } params.putString("fields", fields); mSubmitButton.performClick(); }