Example usage for java.util Vector iterator

List of usage examples for java.util Vector iterator

Introduction

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

Prototype

public synchronized Iterator<E> iterator() 

Source Link

Document

Returns an iterator over the elements in this list in proper sequence.

Usage

From source file:net.aepik.alasca.core.ldap.Schema.java

/**
 * Ajoute un ensemble d'objets au schema.
 * @param v Un ensemble d'objets du schema.
 * @return True si l'opration a russi, false sinon.
 *      Si l'opration n'a pas russi, aucun objet n'aura t ajout.
 *//* w w  w.j  a v a 2s.com*/
public boolean addObjects(Vector<SchemaObject> v) {
    SchemaObject[] o = new SchemaObject[v.size()];
    Iterator<SchemaObject> it = v.iterator();
    int position = 0;
    while (it.hasNext()) {
        o[position] = it.next();
        position++;
    }
    return addObjects(o);
}

From source file:com.sshtools.common.automate.RemoteIdentification.java

/**
 *
 *
 * @param ident//  ww w.  j  av  a 2s.  c o m
 *
 * @return
 *
 * @throws RemoteIdentificationException
 */
public String getName(String ident) throws RemoteIdentificationException {
    boolean pass = false;
    Iterator it = rules.iterator();
    Vector passed = new Vector();
    RemoteIdentificationRule rule;
    String rulename = null;

    // Check all the rules
    while (it.hasNext()) {
        rule = (RemoteIdentificationRule) it.next();

        if (rule.testRule(ident)) {
            passed.add(rule);
        }
    }

    if (passed.size() > 0) {
        // Select the highest priority rule where 0=highest 10=lowest
        it = passed.iterator();

        RemoteIdentificationRule ret = null;

        while (it.hasNext()) {
            rule = (RemoteIdentificationRule) it.next();

            if (ret == null) {
                ret = rule;
            } else {
                if (rule.getPriority() < ret.getPriority()) {
                    ret = rule;
                }
            }
        }

        if (ret.getName() != null) {
            return ret.getName();
        } else {
            return defaultName;
        }
    } else {
        throw new RemoteIdentificationException(
                "No rules exist to identify the remote host with ident string " + ident);
    }
}

From source file:org.kuali.rice.krad.service.impl.PersistenceStructureServiceOjbImpl.java

/**
 * @see org.kuali.rice.krad.service.PersistenceService#getNestedForeignKeyMap(java.lang.Class)
 *//*from w w w.  ja v  a 2s  .  c o m*/

@Override
public Map getNestedForeignKeyMap(Class persistableObjectClass) {
    Map fkMap = new HashMap();
    ClassDescriptor classDescriptor = getClassDescriptor(persistableObjectClass);
    Vector objectReferences = classDescriptor.getObjectReferenceDescriptors();
    for (Iterator iter = objectReferences.iterator(); iter.hasNext();) {
        ObjectReferenceDescriptor objectReferenceDescriptor = (ObjectReferenceDescriptor) iter.next();
        ClassDescriptor referenceDescriptor = this.getClassDescriptor(objectReferenceDescriptor.getItemClass());

        FieldDescriptor[] fkFields = objectReferenceDescriptor.getForeignKeyFieldDescriptors(classDescriptor);
        FieldDescriptor[] pkFields = referenceDescriptor.getPkFields();
        for (int i = 0; i < pkFields.length; i++) {
            FieldDescriptor pkField = pkFields[i];
            fkMap.put(objectReferenceDescriptor.getAttributeName() + "." + pkField.getAttributeName(),
                    fkFields[i].getAttributeName());
        }
    }

    return fkMap;
}

From source file:nl.nn.adapterframework.jdbc.XmlQuerySender.java

private String selectQuery(Connection connection, String correlationID, String tableName, Vector columns,
        String where, String order) throws SenderException, JdbcException {
    try {/*  w ww.  j av a2  s .c om*/
        String query = "SELECT ";
        if (columns != null) {
            Iterator iter = columns.iterator();
            boolean firstColumn = true;
            while (iter.hasNext()) {
                Column column = (Column) iter.next();
                if (firstColumn) {
                    query = query + column.getName();
                    firstColumn = false;
                } else {
                    query = query + "," + column.getName();
                }
            }
        } else {
            query = query + "*";
        }
        query = query + " FROM " + tableName;
        if (where != null) {
            query = query + " WHERE " + where;
        }
        if (order != null) {
            query = query + " ORDER BY " + order;
        }
        PreparedStatement statement = getStatement(connection, correlationID, query, false);
        statement.setQueryTimeout(getTimeout());
        setBlobSmartGet(true);
        return executeSelectQuery(statement, null, null);
    } catch (SQLException e) {
        throw new SenderException(getLogPrefix() + "got exception executing a SELECT SQL command", e);
    }
}

From source file:org.kuali.rice.krad.service.impl.PersistenceStructureServiceOjbImpl.java

/**
 * @see org.kuali.rice.krad.service.PersistenceService#getReferencesForForeignKey(java.lang.Class,
 *      java.lang.String)// w  w  w  .  j  av  a  2 s  .c  o  m
 */

@Override
public Map getReferencesForForeignKey(Class persistableObjectClass, String attributeName) {
    Map referenceClasses = new HashMap();
    if (PersistableBusinessObject.class.isAssignableFrom(persistableObjectClass)) {
        ClassDescriptor classDescriptor = getClassDescriptor(persistableObjectClass);
        Vector objectReferences = classDescriptor.getObjectReferenceDescriptors();
        for (Iterator iter = objectReferences.iterator(); iter.hasNext();) {
            ObjectReferenceDescriptor referenceDescriptor = (ObjectReferenceDescriptor) iter.next();

            /*
             * iterate through the fk keys for the reference object and if
             * matches the attributeName add the class as a reference
             */
            FieldDescriptor[] refFkNames = referenceDescriptor.getForeignKeyFieldDescriptors(classDescriptor);
            for (int i = 0; i < refFkNames.length; i++) {
                FieldDescriptor fkField = refFkNames[i];
                if (fkField.getAttributeName().equals(attributeName)) {
                    referenceClasses.put(referenceDescriptor.getAttributeName(),
                            referenceDescriptor.getItemClass());
                }
            }
        }
    }
    return referenceClasses;
}

From source file:org.apache.axis.message.SOAPHeader.java

public Iterator examineMustUnderstandHeaderElements(String actor) {
    if (actor == null)
        return null;

    Vector result = new Vector();
    List headers = getChildren();
    if (headers != null) {
        for (int i = 0; i < headers.size(); i++) {
            SOAPHeaderElement she = (SOAPHeaderElement) headers.get(i);
            if (she.getMustUnderstand()) {
                String candidate = she.getActor();
                if (actor.equals(candidate)) {
                    result.add(headers.get(i));
                }/*from   ww w.  j a  va2  s  .co  m*/
            }
        }
    }
    return result.iterator();
}

From source file:org.soaplab.services.Reporter.java

@SuppressWarnings("unchecked")
protected Iterator sortKeys(Set keys) {
    Vector<String> sorted = new Vector<String>(keys);
    Collections.sort(sorted);/*w w  w  . ja v a2  s.  c o  m*/
    return sorted.iterator();
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.users.UserMainHandler.java

/**
 * Get a locale ID to LANG_COUNTRY code map for performance purpose.
 *//*from ww w.j av  a2  s . co  m*/
private HashMap<Long, String> getAllLocales() throws Exception {
    HashMap<Long, String> result = new HashMap<Long, String>();
    Vector allLocales = ServerProxy.getLocaleManager().getAvailableLocales();
    for (Iterator it = allLocales.iterator(); it.hasNext();) {
        GlobalSightLocale gsl = (GlobalSightLocale) it.next();
        result.put(gsl.getIdAsLong(), gsl.toString());
    }
    return result;
}

From source file:org.squale.welcom.taglib.htmlarea.HtmlAreaTag.java

/**
 * init editor/*from  w  ww  . j av a2 s.c om*/
 * 
 * @throws JspException jsp exception
 */
private void initEditor() throws JspException {
    final TrimStringBuffer sb = new TrimStringBuffer();
    sb.append(OPEN_SCRIPT);
    initPlugins(sb);
    sb.append("var " + edName + " = null;");
    sb.append("function initEditor" + tagname + "(){");
    sb.append(edName + " = new HTMLArea('" + tagname + "');\n");

    if (editorType.equalsIgnoreCase(TEXT_EDITOR)) {
        sb.append(edName + ".config.pageStyle = \"@import url(" + path + "text.css);\";\n");
    }

    // customize toolbar
    if (toolbar != null) {
        String bars = edName + ".config.toolbar = [";

        for (int i = 0; i < toolbar.size(); i++) {
            String buttons = "[";
            final Vector v = (Vector) toolbar.get("bar" + i);

            for (final Iterator iter = v.iterator(); iter.hasNext();) {
                final String element = (String) iter.next();
                buttons += ("'" + element + "',");
            }

            buttons = buttons.substring(0, buttons.length() - 1) + "],";
            bars += buttons;
        }

        bars = bars.substring(0, bars.length() - 1) + "];";
        sb.append(bars + "\n");
    }

    // register plugins
    if (pluginList != null) {
        for (final Iterator iter = pluginList.iterator(); iter.hasNext();) {
            final String plg = (String) iter.next();

            if (plg.equals("CSS")) {
                sb.append(edName + ".config.pageStyle = \"@import url(" + cssurl + ");");
                if (WelcomConfigurator.getCharte() == Charte.V2_002) {
                    sb.append("@import url(css.do?value=css/welcom-002.css);");
                }
                if (WelcomConfigurator.getCharte() == Charte.V3_001) {
                    sb.append("@import url(css.do?value=css/welcom-001.css);");
                }
                sb.append("\";\n");
                sb.append(edName);
                sb.append(".registerPlugin(");
                sb.append(plg);
                sb.append(", {\n");
                sb.append("combos : [\n");
                sb.append("{id:'CSS_combo',\n");
                sb.append("label:'Styles',\n");
                sb.append("options: {");
                final String styleKey = "htmlarea.default.styles" + "."
                        + WelcomConfigurator.getCharte().getVersionMajor() + "."
                        + WelcomConfigurator.getCharte().getVersionMinor();
                sb.append(Util.formatQuote(WelcomConfigurator.getMessage(styleKey)));
                sb.append("   },\n");
                sb.append("context: 'body'\n");
                sb.append("}]});\n");
            } else if (plg.equals("DocumentEditor")) {
                sb.append(edName + ".registerPlugin(" + plg + ",'" + edName + "');\n");
            } else {
                sb.append(edName + ".registerPlugin(" + plg + ");\n");
            }
        }
    }

    saveInitFunction("initEditor" + tagname + "()");

    debugFeatures(sb);

    ResponseUtils.write(pageContext, sb.toString());
}

From source file:com.adito.reverseproxy.ReverseProxyMethodHandler.java

void addCustomHeaders(ReverseProxyWebForward webForward, ProxiedHttpMethod method) {

    /**//from w ww . j av  a  2  s. c  o  m
     * Add any custom headers to the request
     */
    Map customHeaders = webForward.getCustomHeaders();
    String header;
    for (Iterator it = customHeaders.entrySet().iterator(); it.hasNext();) {
        Map.Entry entry = (Map.Entry) it.next();
        header = (String) entry.getKey();
        Vector v = (Vector) entry.getValue();
        for (Iterator it2 = v.iterator(); it2.hasNext();) {
            method.getProxiedRequest().addHeaderField(header, (String) it2.next());
        }
    }
}