List of usage examples for java.util Vector addElement
public synchronized void addElement(E obj)
From source file:org.ecoinformatics.datamanager.database.DelimitedReader.java
private Vector splitDelimitedRowStringIntoVector(String data) throws Exception { Vector result = new Vector(); if (data == null) { return result; }//from ww w. j a v a2s.c om String[] s = null; if (quoteCharacter == null && literalCharacter == null) { //In this path, there is no quote character, we can spit data directly if (!collapseDelimiters) { s = data.split(delimiter); } else { String newDelimiterWithRegExpress = delimiter + "+"; s = data.split(newDelimiterWithRegExpress); } } else { //In this path, we should skip any field delimiter in quote charcter. s = processQuoteCharacterOneRowData(data); } if (s != null) { int columnCounter = s.length; if (columnCounter > numCols) { throw new DataNotMatchingMetadataException( "Metadata sees data has " + numCols + " columns, but actually data has " + columnCounter + " columns. " + "Please make sure metadata is correct!"); } for (int j = 0; j < s.length; j++) { if (s[j] != null) { result.addElement(s[j].trim()); } else { result.addElement(""); } } //add any elements that aren't there so that all the records have the //same number of cols if (result.size() < numCols) { int vsize = result.size(); for (int j = 0; j < numCols - vsize; j++) { result.addElement(""); } } } return result; }
From source file:com.verisign.epp.codec.launch.EPPLaunchTst.java
/** * Tests the <code>EPPLaunchCreate</code> create command extension with use * of the notice information in Claims Create Form. The tests include the * following:<br>/*from w w w . j av a 2s . c o m*/ * <br> * <ol> * <li>Test create command for sunrise create using the notice information * </ol> */ public void testLaunchCreateNotice() { EPPCodecTst.printStart("testLaunchCreateNotice"); EPPDomainCreateCmd theCommand; EPPEncodeDecodeStats commandStats; theCommand = new EPPDomainCreateCmd("ABC-12345", "example.tld", new EPPAuthInfo("2fooBAR")); if (EPPFactory.getInstance().hasService(EPPDomainMapFactory.NS_CONTACT)) { theCommand.setRegistrant("jd1234"); Vector contacts = new Vector(); contacts.addElement(new EPPDomainContact("sh8013", EPPDomainContact.TYPE_ADMINISTRATIVE)); contacts.addElement(new EPPDomainContact("sh8013", EPPDomainContact.TYPE_TECHNICAL)); theCommand.setContacts(contacts); } // Test create command for claims create using the notice information theCommand.addExtension(new EPPLaunchCreate(new EPPLaunchPhase(EPPLaunchPhase.PHASE_CLAIMS), new EPPLaunchNotice("49FD46E6C4B45C55D4AC", new Date(), new Date()), EPPLaunchCreate.TYPE_APPLICATION)); commandStats = EPPCodecTst.testEncodeDecode(theCommand); System.out.println(commandStats); theCommand.setExtensions(null); // Test create command for claims create using the notice information and validatorID theCommand.addExtension(new EPPLaunchCreate(new EPPLaunchPhase(EPPLaunchPhase.PHASE_CLAIMS), new EPPLaunchNotice("49FD46E6C4B45C55D4AC", new Date(), new Date(), "tmch"), EPPLaunchCreate.TYPE_REGISTRATION)); commandStats = EPPCodecTst.testEncodeDecode(theCommand); System.out.println(commandStats); EPPCodecTst.printEnd("testLaunchCreateNotice"); }
From source file:com.verisign.epp.codec.launch.EPPLaunchTst.java
/** * Tests the <code>EPPLaunchCheck</code> check command extension. The tests * include the following:<br>//w ww. j a v a 2s . c om * <br> * <ol> * <li>Test claims check command for "claims" form and "claims" launch phase * <li>Test claims check response for "claims" launch phase * <li>Test availability check command the custom "idn-release" launch phase * </ol> */ public void testLaunchCheck() { EPPCodecTst.printStart("testLaunchCheck"); // Claims Check Command for "claims" Vector domains = new Vector(); domains.addElement("example1.tld"); domains.addElement("example2.tld"); EPPDomainCheckCmd theCommand = new EPPDomainCheckCmd("ABC-12345", domains); theCommand.addExtension( new EPPLaunchCheck(new EPPLaunchPhase(EPPLaunchPhase.PHASE_CLAIMS), EPPLaunchCheck.TYPE_CLAIMS)); EPPEncodeDecodeStats stats = EPPCodecTst.testEncodeDecode(theCommand); System.out.println(stats); // Claims Check Command for "claims" EPPResponse theResponse; EPPTransId respTransId = new EPPTransId("ABC-12345", "54322-XYZ"); theResponse = new EPPResponse(respTransId); EPPLaunchChkData theExt = new EPPLaunchChkData(new EPPLaunchPhase(EPPLaunchPhase.PHASE_CLAIMS)); theExt.addCheckResult(new EPPLaunchCheckResult("example1.tld", false)); theExt.addCheckResult(new EPPLaunchCheckResult("example2.tld", true, "2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R0000000001")); theExt.addCheckResult(new EPPLaunchCheckResult("example2.tld", true, "2013111200/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R0000000002", "tmch")); theResponse.addExtension(theExt); stats = EPPCodecTst.testEncodeDecode(theResponse); System.out.println(stats); // Test availability check command the custom "idn-release" launch phase theCommand = new EPPDomainCheckCmd("ABC-12345", domains); theCommand.addExtension(new EPPLaunchCheck(new EPPLaunchPhase(EPPLaunchPhase.PHASE_CUSTOM, "idn-release"), EPPLaunchCheck.TYPE_AVAILABILITY)); stats = EPPCodecTst.testEncodeDecode(theCommand); System.out.println(stats); EPPCodecTst.printEnd("testLaunchCheck"); }
From source file:com.verisign.epp.codec.launch.EPPLaunchTst.java
/** * Tests the <code>EPPLaunchCreate</code> create command extension with use * of the Generic Create Form:<br> * <br>/*from w w w. j av a2 s .c o m*/ * <ol> * <li>Test create command for landrush with no type defined * <li>Test create command for a landrush application * <li>Test create command for a landrush registration * </ol> */ public void testLaunchCreateGeneric() { EPPCodecTst.printStart("testLaunchCreateGeneric"); EPPDomainCreateCmd theCommand; EPPEncodeDecodeStats commandStats; // Test create command for a landrush with no type defined theCommand = new EPPDomainCreateCmd("ABC-12345", "example.tld", new EPPAuthInfo("2fooBAR")); if (EPPFactory.getInstance().hasService(EPPDomainMapFactory.NS_CONTACT)) { theCommand.setRegistrant("jd1234"); Vector contacts = new Vector(); contacts.addElement(new EPPDomainContact("sh8013", EPPDomainContact.TYPE_ADMINISTRATIVE)); contacts.addElement(new EPPDomainContact("sh8013", EPPDomainContact.TYPE_TECHNICAL)); theCommand.setContacts(contacts); } theCommand.addExtension(new EPPLaunchCreate(new EPPLaunchPhase(EPPLaunchPhase.PHASE_LANDRUSH))); commandStats = EPPCodecTst.testEncodeDecode(theCommand); System.out.println(commandStats); // Test create command for a landrush application theCommand.setExtensions(null); theCommand.addExtension(new EPPLaunchCreate(new EPPLaunchPhase(EPPLaunchPhase.PHASE_LANDRUSH), EPPLaunchCreate.TYPE_APPLICATION)); commandStats = EPPCodecTst.testEncodeDecode(theCommand); System.out.println(commandStats); // Test create command for a landrush registration theCommand.setExtensions(null); theCommand.addExtension(new EPPLaunchCreate(new EPPLaunchPhase(EPPLaunchPhase.PHASE_LANDRUSH), EPPLaunchCreate.TYPE_REGISTRATION)); commandStats = EPPCodecTst.testEncodeDecode(theCommand); System.out.println(commandStats); EPPCodecTst.printEnd("testLaunchCreateGeneric"); }
From source file:gskproject.Analyze.java
public void personWiseTableload() { multiMap = new HashMap<Object, Object[]>(); userList = new ArrayList<User>(); if (ddDepartment.getSelectedIndex() == 0) { userList = dbOps.getUser();//from w w w. j a va2 s .c o m } else { userList = dbOps.getUser(ddDepartment.getSelectedIndex()); } java.sql.Date from; java.sql.Date to; if (dtPFrom.getDate() == null && dtPTo.getDate() == null) { from = null; to = null; } else if (dtPFrom.getDate() == null) { from = null; to = new java.sql.Date(dtPTo.getDate().getTime()); } else if (dtPTo.getDate() == null) { from = new java.sql.Date(dtPFrom.getDate().getTime()); to = null; } else { from = new java.sql.Date(dtPFrom.getDate().getTime()); to = new java.sql.Date(dtPTo.getDate().getTime()); } Vector<String> columnNames = new Vector<String>(); columnNames.addElement("Person"); columnNames.addElement("Total No: of Cases"); columnNames.addElement("No:of Cases(Responsible Party)"); columnNames.addElement("Open Cases(Responsible party)"); columnNames.addElement("Open Cases Percentage(Resposible Party)"); columnNames.addElement("No:of Cases(Observer)"); columnNames.addElement("Open Cases(Observer)"); columnNames.addElement("Open Cases Percentage(Observer)"); if (from != null && to != null) { if (to.after(from)) { tableObservation = dbOps.getAnalyzeObservation(from, to); if (tableObservation.size() > 0) { for (User user : userList) { Object[] array = new Object[6]; array[0] = user.getUsername(); array[1] = 0; array[2] = 0; array[3] = 0; array[4] = 0; array[5] = 0; multiMap.put(user.getUserID(), array); } for (Vector row : tableObservation) { Object[] arrayRes = multiMap.get(row.get(7)); if (arrayRes != null) { arrayRes[2] = (int) arrayRes[2] + 1; arrayRes[1] = (int) arrayRes[1] + 1; if (row.get(8).equals("Open")) { arrayRes[3] = (int) arrayRes[3] + 1; } } Object[] arrayOb = multiMap.get(row.get(6)); if (arrayOb != null) { arrayOb[4] = (int) arrayOb[4] + 1; arrayOb[1] = (int) arrayOb[1] + 1; if (row.get(8).equals("Open")) { arrayOb[5] = (int) arrayOb[5] + 1; } } } tablePersonWise = new Vector<Vector>(); for (int i = 0; i < multiMap.size(); i++) { Vector<Object> row = new Vector<Object>(); int userID = userList.get(i).getUserID(); row.addElement(multiMap.get(userID)[0]); row.addElement((int) multiMap.get(userID)[2] + (int) multiMap.get(userID)[4]); row.addElement(multiMap.get(userID)[2]); row.addElement(multiMap.get(userID)[3]); if ((int) multiMap.get(userID)[2] != 0) { row.addElement(((Double.parseDouble(multiMap.get(userID)[3].toString()) / (int) multiMap.get(userID)[2]) * 100) + "%"); } else { row.addElement(0); } row.addElement(multiMap.get(userID)[4]); row.addElement(multiMap.get(userID)[5]); if ((int) multiMap.get(userID)[4] != 0) { row.addElement(((Double.parseDouble(multiMap.get(userID)[5].toString()) / (int) multiMap.get(userID)[4]) * 100) + "%"); } else { row.addElement(0); } tablePersonWise.addElement(row); } tblPersonVise.setModel(new DefaultTableModel(tablePersonWise, columnNames)); } else { JOptionPane.showMessageDialog(this, "There are no observation between above days!"); dtPFrom.setDate(null); dtPTo.setDate(null); } } else { JOptionPane.showMessageDialog(this, "Wrong Date Entry (from date > to date)!"); dtPFrom.setDate(null); dtPTo.setDate(null); } } else { tableObservation = dbOps.getAnalyzeObservation(from, to); if (tableObservation.size() > 0) { for (User user : userList) { Object[] array = new Object[6]; array[0] = user.getUsername(); array[1] = 0; array[2] = 0; array[3] = 0; array[4] = 0; array[5] = 0; multiMap.put(user.getUserID(), array); } for (Vector row : tableObservation) { Object[] arrayRes = multiMap.get(row.get(7)); if (arrayRes != null) { arrayRes[2] = (int) arrayRes[2] + 1; arrayRes[1] = (int) arrayRes[1] + 1; if (row.get(8).equals("Open")) { arrayRes[3] = (int) arrayRes[3] + 1; } } Object[] arrayOb = multiMap.get(row.get(6)); if (arrayOb != null) { arrayOb[4] = (int) arrayOb[4] + 1; arrayOb[1] = (int) arrayOb[1] + 1; if (row.get(8).equals("Open")) { arrayOb[5] = (int) arrayOb[5] + 1; } } } tablePersonWise = new Vector<Vector>(); for (int i = 0; i < multiMap.size(); i++) { Vector<Object> row = new Vector<Object>(); int userID = userList.get(i).getUserID(); row.addElement(multiMap.get(userID)[0]); row.addElement((int) multiMap.get(userID)[2] + (int) multiMap.get(userID)[4]); row.addElement(multiMap.get(userID)[2]); row.addElement(multiMap.get(userID)[3]); if ((int) multiMap.get(userID)[2] != 0) { row.addElement(((Double.parseDouble(multiMap.get(userID)[3].toString()) / (int) multiMap.get(userID)[2]) * 100) + "%"); } else { row.addElement(0); } row.addElement(multiMap.get(userID)[4]); row.addElement(multiMap.get(userID)[5]); if ((int) multiMap.get(userID)[4] != 0) { row.addElement(((Double.parseDouble(multiMap.get(userID)[5].toString()) / (int) multiMap.get(userID)[4]) * 100) + "%"); } else { row.addElement(0); } tablePersonWise.addElement(row); } tblPersonVise.setModel(new DefaultTableModel(tablePersonWise, columnNames)); } else { JOptionPane.showMessageDialog(this, "There are no observation between above days!"); dtPFrom.setDate(null); dtPTo.setDate(null); } } }
From source file:de.juwimm.cms.remote.UserServiceSpringImpl.java
/** * Returns all users regardings the active site, the given Group and the * given unit.<br>/*www. j a va2s .c o m*/ * * @param groupId * The Group * @param unitId * The Unit * @return Returns all UserValue Objects in an Array. Is empty if nobody was * found. * * @see de.juwimm.cms.remote.UserServiceSpring#getAllUser4GroupAndUnit(java.lang.Integer, * java.lang.Integer) */ @Override protected UserValue[] handleGetAllUser4GroupAndUnit(Integer groupId, Integer unitId) throws Exception { Vector<UserValue> vec = new Vector<UserValue>(); try { UserHbm userMe = super.getUserHbmDao().load(AuthenticationHelper.getUserName()); if (getUserHbmDao().isInUnit(unitId, userMe)) { UnitHbm unit = super.getUnitHbmDao().load(unitId); Iterator it = unit.getUsers().iterator(); while (it.hasNext()) { UserHbm user = (UserHbm) it.next(); if (user.isInGroup(groupId) && !!getUserHbmDao().isInRole(user, UserRights.SITE_ROOT, user.getActiveSite())) { vec.addElement(user.getUserValue()); } } } } catch (Exception e) { throw new UserException(e.getMessage()); } return vec.toArray(new UserValue[0]); }
From source file:com.netscape.cmscore.usrgrp.UGSubsystem.java
protected Enumeration<IGroup> buildGroups(LDAPSearchResults res) throws EUsrGrpException { Vector<IGroup> v = new Vector<IGroup>(); while (res.hasMoreElements()) { LDAPEntry entry = (LDAPEntry) res.nextElement(); v.addElement(buildGroup(entry)); }// w w w . j a v a 2s .c o m return v.elements(); }
From source file:org.apache.cactus.WebResponse.java
/** * @return the cookies returned by the server *//*from w w w. ja va 2s.co m*/ public Cookie[] getCookies() { Cookie[] returnCookies = null; // There can be several headers named "Set-Cookie", so loop through // all the headers, looking for cookies String headerName = this.connection.getHeaderFieldKey(0); String headerValue = this.connection.getHeaderField(0); Vector cookieVector = new Vector(); CookieSpec cookieSpec = CookiePolicy.getDefaultSpec(); for (int i = 1; (headerName != null) || (headerValue != null); i++) { LOGGER.debug("Header name = [" + headerName + "]"); LOGGER.debug("Header value = [" + headerValue + "]"); if ((headerName != null) && (headerName.toLowerCase().equals("set-cookie") || headerName.toLowerCase().equals("set-cookie2"))) { // Parse the cookie definition org.apache.commons.httpclient.Cookie[] cookies; try { cookies = cookieSpec.parse( CookieUtil.getCookieDomain(getWebRequest(), getConnection().getURL().getHost()), CookieUtil.getCookiePort(getWebRequest(), getConnection().getURL().getPort()), CookieUtil.getCookiePath(getWebRequest(), getConnection().getURL().getFile()), false, new Header(headerName, headerValue)); } catch (HttpException e) { throw new ChainedRuntimeException("Error parsing cookies", e); } // Transform the HttpClient cookies into Cactus cookies and // add them to the cookieVector vector for (int j = 0; j < cookies.length; j++) { Cookie cookie = new Cookie(cookies[j].getDomain(), cookies[j].getName(), cookies[j].getValue()); cookie.setComment(cookies[j].getComment()); cookie.setExpiryDate(cookies[j].getExpiryDate()); cookie.setPath(cookies[j].getPath()); cookie.setSecure(cookies[j].getSecure()); cookieVector.addElement(cookie); } } headerName = this.connection.getHeaderFieldKey(i); headerValue = this.connection.getHeaderField(i); } returnCookies = new Cookie[cookieVector.size()]; cookieVector.copyInto(returnCookies); return returnCookies; }
From source file:fsi_admin.JFsiTareas.java
@SuppressWarnings({ "rawtypes", "unchecked" }) public synchronized void actualizarSaldos() { // Primero recopila la informacion de las bases de datos. Vector BASES = new Vector(); JBDRegistradasSet bdr = new JBDRegistradasSet(null); bdr.ConCat(true);// w ww .jav a 2 s. c o m bdr.Open(); for (int i = 0; i < bdr.getNumRows(); i++) { String nombre = bdr.getAbsRow(i).getNombre(); BASES.addElement(nombre); } short res = 0; String mensaje = ""; Connection con; try { Calendar fecha = GregorianCalendar.getInstance(); FileWriter filewri = new FileWriter( "/usr/local/forseti/log/SLDS-" + JUtil.obtFechaTxt(fecha, "yyyy-MM-dd-hh-mm") + ".log", true); PrintWriter pw = new PrintWriter(filewri); for (int i = 0; i < BASES.size(); i++) { String nombre = (String) BASES.get(i); pw.println("----------------------------------------------------------------------------"); pw.println(" " + "ACTUALIZANDO LA BASE DE DATOS: " + nombre + " " + JUtil.obtFechaTxt(new Date(), "HH:mm:ss")); pw.println("----------------------------------------------------------------------------"); pw.flush(); System.out.println("ACTUALIZANDO LA BASE DE DATOS: " + nombre + " " + JUtil.obtFechaTxt(new Date(), "HH:mm:ss")); //Empieza por la de saldos con = JAccesoBD.getConexion(nombre); String sql[] = { "select * from sp_invserv_actualizar_existencias() as ( err integer, res varchar ) ", "select * from sp_prod_formulas_actualizar_niveles() as ( err integer, res varchar ) ", "select * from sp_invserv_actualizar_sdos() as ( err integer, res varchar ) ", "select * from sp_invserv_actualizar_polcant() as ( err integer, res varchar ) ", "select * from sp_cont_catalogo_actualizar_sdos() as ( err integer, res varchar ) ", "select * from sp_bancos_actualizar_sdos() as ( err integer, res varchar ) ", "select * from sp_provee_actualizar_sdos() as ( err integer, res varchar ) ", "select * from sp_client_actualizar_sdos() as ( err integer, res varchar ) " }; try { Statement s = con.createStatement(); for (int j = 0; j < sql.length; j++) { System.out.println("EJECUTANDO: " + sql[j]); pw.println("EJECUTANDO: " + sql[j] + "\n"); pw.flush(); ResultSet rs = s.executeQuery(sql[j]); if (rs.next()) { res = rs.getShort("ERR"); mensaje = rs.getString("RES"); } //outprintln("REGRESO: ERR: " + res + " RES: " + mensaje + " " + JUtil.obtFechaTxt(new Date(), "hh:mm:ss")); pw.println("REGRESO: ERR: " + res + " RES: " + mensaje + " " + JUtil.obtFechaTxt(new Date(), "HH:mm:ss")); pw.flush(); } s.close(); } catch (NullPointerException e) //Se captura cuando no existe una base de datos fsica pero el cabecero general de tbl_bd contiene una { System.out.println(e.toString()); pw.println(e.toString() + "\n"); pw.flush(); } catch (SQLException e) { System.out.println(e.toString()); pw.println(e.toString() + "\n"); pw.flush(); } finally { JAccesoBD.liberarConexion(con); } } // Fin for BA>SES pw.println("----------------------------- FIN DE LA ACTUALIZACION ----------------------------------"); pw.flush(); idsalida = 0; } catch (IOException e) { idsalida = 3; salida += "OCURRIERON ERRORES AL ABRIR O COPIAR ARCHIVOS... REVISA EL REGISTRO DE ACTUALIZACIONES<br>"; e.printStackTrace(); } }
From source file:net.rim.ejde.internal.packaging.PackagingManager.java
private Vector<String> getProtectionOptions(boolean forMakefile) { Vector<String> v = new Vector<String>(); Hashtable<String, String> classProtection, packageProtection; classProtection = _bbProject.getProperties()._hiddenProperties.getClassProtection(); packageProtection = _bbProject.getProperties()._hiddenProperties.getPackageProtection(); Object keys[] = packageProtection.keySet().toArray(); for (int i = 0; i < keys.length; ++i) { v.addElement("package:" + Util.doubleDollar(keys[i].toString()) + "=" + stripPath(packageProtection.get(keys[i]))); }/* www .ja v a 2 s . co m*/ keys = classProtection.keySet().toArray(); for (int i = 0; i < keys.length; ++i) { if (forMakefile) { v.addElement("class:" + Util.doubleDollar(keys[i].toString()) + "=" + stripPath(classProtection.get(keys[i]))); } else { // When we are not creating a makefile don't add double $$ to rapc cmd line v.addElement("class:" + keys[i].toString() + "=" + stripPath(classProtection.get(keys[i]))); } } return v; }