Example usage for java.util Vector elementAt

List of usage examples for java.util Vector elementAt

Introduction

In this page you can find the example usage for java.util Vector elementAt.

Prototype

public synchronized E elementAt(int index) 

Source Link

Document

Returns the component at the specified index.

Usage

From source file:com.globalsight.everest.usermgr.UserLdapHelper.java

/**
 * Get email address arrays for the given user objects.
 *///  w  w  w.  j av  a 2s.  com
static String[] getEmails(Vector p_users) {
    String[] emails = null;

    if (p_users != null) {
        int size = p_users.size();
        emails = new String[size];
        String tmp;

        for (int i = 0; i < size; i++) {
            tmp = ((User) p_users.elementAt(i)).getEmail();
            // ignore empty email -- ???
            if (tmp != null && tmp.length() != 0) {
                emails[i] = tmp;
            }
        }
    }

    return emails;
}

From source file:forseti.JSubirArchivo.java

@SuppressWarnings("rawtypes")
public int processFiles(Vector archivos) {
    int numFiles = 0, thisFile = 0;

    try {//from  w ww. j  a  v a 2 s  . c  om
        FileItem actual = null;

        for (int i = 0; i < archivos.size(); i++) {
            actual = (FileItem) archivos.elementAt(i);
            String fileName = actual.getName();
            // construimos un objeto file para recuperar el trayecto completo
            File file = new File(fileName);
            String ext = "." + getExt(thisFile).toLowerCase();
            boolean frz = isFrz(thisFile);
            //System.out.println("Archivo: " + fileName + " Ext esperada: " + ext);

            // Verifica que el archivo sea de la extension esperada
            if (file.getName().toLowerCase().indexOf(ext) != -1) {
                // nos quedamos solo con el nombre y descartamos el path
                file = new File(m_Path + file.getName());
                // escribimos el fichero colgando del nuevo path
                actual.write(file);
                MyUploadedFiles part = (MyUploadedFiles) m_Files.elementAt(thisFile);
                part.m_File = file.getName();

                numFiles += 1;
            } else if (frz) //Si era forzozo 
                m_Error += " " + JUtil.Msj("GLB", "GLB", "GLB", "ARCHIVO", 4) + " " + file.getName() + " - "
                        + ext;

            thisFile += 1;

        }

    } catch (Exception e) {
        if (e != null)
            m_Error += " " + JUtil.Msj("GLB", "GLB", "GLB", "ARCHIVO", 3) + " " + e.getMessage(); //"Error al subir archivos: " + e.getMessage();
    }

    return numFiles;
}

From source file:de.unibayreuth.bayeos.goat.table.MassenTableModel.java

public boolean updateRows(final ObjektNode objektNode, final int rows[], final Vector values) {
    boolean bol = false;
    try {//  w  ww .j  a v a 2s .co  m

        // get update columns
        Integer status = (Integer) values.elementAt(0);

        // get keys
        Vector vonDates = new Vector();
        for (int r = 0; r < rows.length; r++) {
            vonDates.add(getValueAt(rows[r], 0));
        }
        Vector params = new Vector();
        params.add(objektNode.getId());
        params.add(vonDates);
        params.add(status);

        bol = ((Boolean) xmlClient.execute("MassenTableHandler.updateRows", params)).booleanValue();

        // Update display values 
        for (int r = 0; r < rows.length; r++) {
            setValueAt(new Byte(status.byteValue()), rows[r], 2);
        }

        fireTableDataChanged();

    } catch (XmlRpcException x) {
        MsgBox.error(x.getMessage());
        return false;
    }

    return bol;
}

From source file:hermes.browser.model.PropertySetTableModel.java

@Override
public void setValueAt(Object value, int y, int x) {
    Vector row = (Vector) rows.elementAt(y);
    String propertyName;// w  ww  . j  a v  a2s. c  om
    Object propertyValue;

    if (x == 0) {
        propertyName = (String) value;
        propertyValue = row.elementAt(1);

        if (isValidProperty(propertyName)) {
            row.set(0, value);
        } else {
            log.error(propertyName + " is not a valid property for " + bean.getClass().getName());
        }
    } else {
        propertyName = (String) row.elementAt(0);
        propertyValue = value;
        row.set(1, value);
    }

    log.debug("set (cached) " + propertyName + "=" + propertyValue.toString());

    fireTableCellUpdated(y, x);
}

From source file:de.unibayreuth.bayeos.goat.table.MassenTableModel.java

public boolean load(ObjektNode objekt, TimeFilter tFilter, StatusFilter sFilter) {
    try {//from   w  ww  .  j  av a 2  s  .com

        Vector params = new Vector();
        params.add(objekt.getId());
        params.add(tFilter.getVector());
        params.add(sFilter.getVector());
        Vector vReturn = (Vector) xmlClient.execute("MassenTableHandler.getRows", params);
        // Rows als byte[]
        byte[] ba = (byte[]) vReturn.elementAt(1);

        statusList = new ArrayByteList(ba.length / rowLength);
        vonList = new ArrayIntList(ba.length / rowLength);
        wertList = new ArrayDoubleList(ba.length / rowLength);

        ByteBuffer b = ByteBuffer.wrap(ba);
        while (b.hasRemaining()) {
            vonList.add(b.getInt());
            wertList.add((double) b.getFloat());
            statusList.add(b.get());
        }
        vReturn = null;
        logger.debug("MassenTableModel filled with " + getRowCount() + " records.");
        return true;
    } catch (XmlRpcException e) {
        MsgBox.error(e.getMessage());
        return false;
    }
}

From source file:org.executequery.gui.table.NewTableConstraintsPanel.java

public void columnValuesChanged(int col, int row, String value) {

    Vector v = getKeys();
    String name = null;/*  w  w w .  j  av a 2s .com*/
    boolean hasName = false;

    sqlBuffer.setLength(0);

    for (int i = 0, n = v.size(); i < n; i++) {

        ColumnConstraint cc = (ColumnConstraint) v.elementAt(i);

        if (i == row && StringUtils.isNotBlank(value)) {

            name = value;
            hasName = true;

        } else if (cc.getName() != ColumnConstraint.EMPTY) {

            name = cc.getName();
            hasName = true;

        } else {

            hasName = false;
        }

        if (hasName) {

            sqlBuffer.append(COMMA).append(NEW_LINE_2).append(CONSTRAINT);
            sqlBuffer.append(name).append(SPACE);

            if (cc.getType() != -1) {

                if (cc.getType() == ColumnConstraint.UNIQUE_KEY) {
                    sqlBuffer.append(ColumnConstraint.UNIQUE).append(B_OPEN);
                    sqlBuffer.append(cc.getColumn()).append(B_CLOSE);
                }

                else {
                    sqlBuffer.append(cc.getTypeName()).append(KEY).append(B_OPEN);
                    sqlBuffer.append(cc.getColumn());
                    sqlBuffer.append(B_CLOSE);

                    if (cc.getType() == ColumnConstraint.FOREIGN_KEY) {
                        sqlBuffer.append(INDENT).append(REFERENCES);

                        if (cc.hasSchema())
                            sqlBuffer.append(cc.getRefSchema()).append(DOT);

                        sqlBuffer.append(cc.getRefTable()).append(B_OPEN).append(cc.getRefColumn())
                                .append(B_CLOSE);
                    }

                }

            }

        }

    }
    creator.setSQLText(sqlBuffer.toString(), TableModifier.CONSTRAINT_VALUES);
}

From source file:de.unibayreuth.bayeos.goat.table.MassenTableModel.java

public boolean updateRow(ObjektNode objektNode, int row, Vector values) {
    boolean bol = false;
    try {/*from  ww  w. ja va  2 s  . com*/

        // get update columns
        java.util.Date new_von = (java.util.Date) values.elementAt(0);
        Double wert = (Double) values.elementAt(1);
        Integer status = (Integer) values.elementAt(2);

        java.util.Date old_von = (java.util.Date) getValueAt(row, 0);

        Vector params = new Vector();
        params.add(objektNode.getId());
        params.add(old_von);
        params.add(status);
        params.add(wert);
        params.add(new_von);

        bol = ((Boolean) xmlClient.execute("MassenTableHandler.updateRow", params)).booleanValue();

        // Update display values 
        setValueAt(new_von, row, 0);
        setValueAt(wert, row, 1);
        setValueAt(new Byte(status.byteValue()), row, 2);
        fireTableDataChanged();

    } catch (XmlRpcException x) {
        MsgBox.error(x.getMessage());
        return false;
    }

    return bol;
}

From source file:de.unibayreuth.bayeos.goat.table.MassenTableModel.java

public boolean addRow(ObjektNode objektNode, Vector values) {
    boolean bol = false;
    try {/*from   ww  w .j  a  v a  2s.co m*/

        // Update display values 

        java.util.Date von = (java.util.Date) values.elementAt(0);
        Double wert = (Double) values.elementAt(1);
        Integer status = (Integer) values.elementAt(2);

        Vector params = new Vector();

        params.add(objektNode.getId());
        params.add(von);
        params.add(wert);
        params.add(status);

        bol = ((Boolean) xmlClient.execute("MassenTableHandler.addRow", params)).booleanValue();

        vonList.add((int) (von.getTime() / 1000));
        wertList.add(wert.doubleValue());
        statusList.add(status.byteValue());

        fireTableDataChanged();

    } catch (XmlRpcException x) {
        MsgBox.error(x.getMessage());
        return false;
    }

    return bol;

}

From source file:com.orange.mmp.mvc.actions.CertifAction.java

/**
 * ACTIONS//from  w w w .  ja v a  2  s .c  o m
 */

@SuppressWarnings("unchecked")
/* (non-Javadoc)
 * @see com.opensymphony.xwork2.ActionSupport#execute()
 */
@Override
public String execute() throws Exception {
    // List certificates
    try {
        Vector certs = MidletManager.getInstance().getCertificates();
        this.certifList = new ArrayList<X509Certificate>();
        if (certs.size() > 0) {
            for (int i = 0; i < certs.size(); i++) {
                Object aobj[] = (Object[]) (Object[]) certs.elementAt(i);
                X509Certificate thisCert = (X509Certificate) aobj[AppDescriptor.CERT];
                certifList.add(thisCert);
            }
        }
    } catch (Exception e) {
        addActionError(getText("error.certif.list", new String[] { e.getLocalizedMessage() }));
    }

    return super.execute();
}

From source file:com.sittinglittleduck.DirBuster.workGenerators.BruteForceURLFuzz.java

public void run() {
    // checks if the server surports heads requests

    if (manager.getAuto()) {
        try {/*from   w w w. ja  v a  2  s .  c o m*/
            URL headurl = new URL(firstPart);

            HeadMethod httphead = new HeadMethod(headurl.toString());

            // set the custom HTTP headers
            Vector HTTPheaders = manager.getHTTPHeaders();
            for (int a = 0; a < HTTPheaders.size(); a++) {
                HTTPHeader httpHeader = (HTTPHeader) HTTPheaders.elementAt(a);
                httphead.setRequestHeader(httpHeader.getHeader(), httpHeader.getValue());
            }
            int responceCode = httpclient.executeMethod(httphead);

            // if the responce code is method not implemented or fails
            if (responceCode == 501 || responceCode == 400) {
                // switch the mode to just GET requests
                manager.setAuto(false);
            }
        } catch (MalformedURLException e) {
            // TODO deal with error
        } catch (IOException e) {
            // TODO deal with error
        }
    }

    // deal with the dirs
    try {
        // get item from  queue
        DirToCheck tempDirToCheck = dirQueue.take();
        // get dir name
        currentDir = tempDirToCheck.getName();
        // get any extention that need to be checked
        extToCheck = tempDirToCheck.getExts();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    System.out.println("Starting fuzz on " + firstPart + urlFuzzStart + "{dir}" + urlFuzzEnd);
    started = currentDir;

    String baseCase = null;
    // store for the basecase object set to null;
    BaseCase baseCaseObj = null;

    try {
        // get fail responce code for a dir test

        baseCaseObj = GenBaseCase.genURLFuzzBaseCase(manager, firstPart + urlFuzzStart, urlFuzzEnd);

    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    // baseCaseObj = new BaseCase(null, failcode, true, failurl, baseCase);
    // call function to generate the brute force

    makeList(minLen, maxLen, baseCase, baseCaseObj);

    manager.youAreFinished();
}