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:de.unibayreuth.bayeos.goat.table.OctetMatrixTableModel.java

private void setColumnNames(Vector nodes) {
    colNames = new ArrayList();
    colNames.add("VON");
    Iterator it = nodes.iterator();
    while (it.hasNext()) {
        colNames.add(((ObjektNode) it.next()).getDe());
    }//w w w .  jav  a2  s. c  o m
}

From source file:biz.webgate.dominoext.poi.component.kernel.simpleviewexport.CSVExportProcessor.java

private String convertValue(Object obj, ExportColumn expCol, DateTimeHelper dth) {
    if (obj instanceof Double) {
        return ((Double) obj).toString();
    }/*from ww w  .  j  a va  2  s.c  o m*/
    if (obj instanceof Integer) {
        return ((Integer) obj).toString();
    }

    if (obj instanceof Date) {
        switch (expCol.getTimeDateFormat()) {
        case ViewColumn.FMT_DATE:
            return dth.getDFDate().format((Date) obj);
        case ViewColumn.FMT_TIME:
            return dth.getDFTime().format((Date) obj);
        default:
            return dth.getDFDateTime().format((Date) obj);
        }
    }
    if (obj instanceof DateTime) {
        try {
            Date dtObj = ((DateTime) obj).toJavaDate();
            switch (expCol.getTimeDateFormat()) {
            case ViewColumn.FMT_DATE:
                return dth.getDFDate().format(dtObj);
            case ViewColumn.FMT_TIME:
                return dth.getDFTime().format(dtObj);
            default:
                return dth.getDFDateTime().format(dtObj);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return "" + obj;
        }
    }
    if (obj instanceof Vector<?>) {
        Vector<?> vec = (Vector<?>) obj;
        StringBuilder sb = new StringBuilder();
        for (Iterator<?> it = vec.iterator(); it.hasNext();) {
            sb.append("" + it.next());
            if (it.hasNext()) {
                sb.append(";");
            }
        }
        return sb.toString();
    }

    return "" + obj;
}

From source file:com.brightcove.test.upload.HLS.NonEncrypted.MediaAPIUploadViaAppleStreamingIntegrationTest.java

/**
 * Test video upload with Multi rendition on Apple Streaming account.
 * @throws MediaAPIError//from  w  w w  .j  a va2s .co  m
 * @throws URISyntaxException
 * @throws JSONException
 * @throws BadEnvironmentException
 * @throws MalformedURLException
 */
@Test
public void testUploadOnAppleStreamingAccountWithMultiRendition() throws MediaAPIError, URISyntaxException,
        JSONException, BadEnvironmentException, MalformedURLException {
    Options uploadOpts = new Options();
    uploadOpts.setMBR(true);
    videoFile = new IngestFile(getAbsoluteVideoFilePath(SOURCE_FILE_NAME), uploadOpts);
    videoId = uploadVideo(videoFile, mAccountInfo, mEnvironment);
    assertNotNull("Exceed the maxWait time to upload the video on publisherid : " + mAccountInfo.getId(),
            videoId);
    ParameterList paramList = new ParameterList(mAccountInfo, "find_video_by_id", "video_id",
            videoId.toString(), "", "IOSRenditions");
    WaiterHelper renditionComplete = new WaiterHelper();
    renditionComplete.renditionWaiter(mAccountInfo, mEnvironment, paramList, noOfIOSRenditionVideoContain,
            1200000L);

    // Verify Video Exist
    ExistenceCheck existenceCheck = new ExistenceCheck(mEnvironment);
    existenceCheck.assertVideoExists(videoId, mAccountInfo);

    //Verify the rendition url's
    String url = retriveMasterOrRenditionURL(mAccountInfo, mEnvironment, videoId);
    assertTrue("URL : " + url + " from rendition file doesn't match startWith(http://) condition",
            url.startsWith("http://"));
    assertTrue("URL : " + url + " from rendition file doesn't match contains(.m3u8) condition",
            url.contains("master.m3u8"));

    /**
     * Need to verify the apple rendition URL is displayed correctly.
     */
    //url=url.replace("c.brightcove.com", mEnvironment.getServer("c.brightcove.com"));

    Vector renditionUrl = retriveRenditionURL(mAccountInfo, mEnvironment, videoId);
    Iterator iRendition = renditionUrl.iterator();
    while (iRendition.hasNext()) {
        AppleStreamingCheck appleCheck = new AppleStreamingCheck();
        appleCheck.assertRenditionFileURLCheckForAppleStreaming(iRendition.next().toString());
    }
}

From source file:org.zaproxy.zap.extension.pscanrules.CookieHttpOnlyScanner.java

@Override
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) {
    IteratorChain iterator = new IteratorChain();
    Vector<String> cookies1 = msg.getResponseHeader().getHeaders(HttpHeader.SET_COOKIE);

    if (cookies1 != null) {
        iterator.addIterator(cookies1.iterator());
    }//from   w w  w .java 2 s  .  c  o m

    Vector<String> cookies2 = msg.getResponseHeader().getHeaders(HttpHeader.SET_COOKIE2);

    if (cookies2 != null) {
        iterator.addIterator(cookies2.iterator());
    }

    Set<String> ignoreList = CookieUtils.getCookieIgnoreList(getModel());

    while (iterator.hasNext()) {
        String headerValue = (String) iterator.next();
        if (!CookieUtils.hasAttribute(headerValue, HTTP_ONLY_COOKIE_ATTRIBUTE)) {
            if (!ignoreList.contains(CookieUtils.getCookieName(headerValue))) {
                this.raiseAlert(msg, id, headerValue);
            }
        }
    }
}

From source file:edu.amc.sakai.user.EntryContainerRdnToUserTypeMapper.java

/**
 * Returns the user type associated with a matching
 * RDN encountered when iterating through the specified 
 * <code>LDAPEntry</code>'s containing <code>DN</code>'s 
 * <code>RDN<code>s. If recurseRdnIfNoMapping is false, 
 * the most local RDN will be used for matching. 
 * {@link #mapRdn(String, String))} implements the actual 
 * value mapping./*from w w w .  j  a  v a 2  s . c om*/
 * 
 * @param ldapEntry the user's <code>LDAPEntry</code>
 * @param mapper a source of mapping configuration
 * @return the entry's mapped RDN
 */
public String mapLdapEntryToSakaiUserType(LDAPEntry ldapEntry, LdapAttributeMapper mapper) {

    if (M_log.isDebugEnabled()) {
        M_log.debug("mapLdapEntryToSakaiUserType(): [entry DN = " + ldapEntry.getDN() + "]");
    }

    String dnString = ldapEntry.getDN();
    DN dn = new DN(dnString);
    DN containerDN = dn.getParent();
    Vector<RDN> containerRDNs = containerDN.getRDNs();
    Iterator<RDN> containerRDNsIterator = containerRDNs.iterator();
    RDN rdn = containerRDNsIterator.next();
    String mappedValue = mapRdn(rdn.getType(), rdn.getValue());

    if (mappedValue == null && recurseRdnIfNoMapping) {
        while (containerRDNsIterator.hasNext()) {
            rdn = containerRDNsIterator.next();
            mappedValue = mapRdn(rdn.getType(), rdn.getValue());
            if (mappedValue != null) {
                return mappedValue;
            }
        }
    }
    return mappedValue;
}

From source file:org.zaproxy.zap.extension.pscanrules.CookieSecureFlagScanner.java

@Override
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) {
    if (!msg.getRequestHeader().isSecure()) {
        // If SSL isn't used then the Secure flag has not to be checked
        return;/*  ww  w  .j a  v a  2  s .com*/
    }

    IteratorChain iterator = new IteratorChain();
    Vector<String> cookies1 = msg.getResponseHeader().getHeaders(HttpHeader.SET_COOKIE);

    if (cookies1 != null) {
        iterator.addIterator(cookies1.iterator());
    }

    Vector<String> cookies2 = msg.getResponseHeader().getHeaders(HttpHeader.SET_COOKIE2);

    if (cookies2 != null) {
        iterator.addIterator(cookies2.iterator());
    }

    Set<String> ignoreList = CookieUtils.getCookieIgnoreList(getModel());

    while (iterator.hasNext()) {
        String headerValue = (String) iterator.next();
        if (!CookieUtils.hasAttribute(headerValue, SECURE_COOKIE_ATTRIBUTE)) {
            if (!ignoreList.contains(CookieUtils.getCookieName(headerValue))) {
                this.raiseAlert(msg, id, headerValue);
            }
        }
    }
}

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

private void setColumnClasses(Vector nodes) {
    colClasses = new ArrayList();
    colClasses.add(java.util.Date.class);
    Iterator it = nodes.iterator();
    while (it.hasNext()) {
        it.next();/*w  w  w. ja v a 2 s.com*/
        colClasses.add(Double.class);

    }
}

From source file:com.xpn.xwiki.plugin.svg.SVGPlugin.java

protected String[] expandSources(Vector sources) {
    Vector expandedSources = new Vector();
    Iterator iter = sources.iterator();
    while (iter.hasNext()) {
        String v = (String) iter.next();
        File f = new File(v);
        if (f.exists() && f.isDirectory()) {
            File[] fl = f.listFiles(new SVGConverter.SVGFileFilter());
            for (File element : fl) {
                expandedSources.addElement(element.getPath());
            }/*from  w ww.  j a  v  a 2s.c  o m*/
        } else {
            expandedSources.addElement(v);
        }
    }

    String[] s = new String[expandedSources.size()];
    expandedSources.copyInto(s);
    return s;
}

From source file:org.primefaces.jsfplugin.mojo.TagMojo.java

private void writePropertySetters(BufferedWriter writer, Vector attributes) throws IOException {
    for (Iterator iterator = attributes.iterator(); iterator.hasNext();) {
        Attribute attribute = (Attribute) iterator.next();
        if (isIgnored(attribute, uicomponentAttributes))
            continue;

        if (attribute.isLiteral()) {
            writer.write("\tpublic void set" + attribute.getName().substring(0, 1).toUpperCase()
                    + attribute.getName().substring(1) + "(java.lang.String value){\n");
            writer.write("\t\tthis._" + attribute.getName() + " = value;\n");
            writer.write("\t}\n\n");
        } else {//w  w  w .j  a  va  2 s.  c  om
            if (isMethodExpression(attribute)) {
                writer.write("\tpublic void set" + attribute.getName().substring(0, 1).toUpperCase()
                        + attribute.getName().substring(1) + "(javax.el.MethodExpression expression){\n");
                writer.write("\t\tthis._" + attribute.getName() + " = expression;\n");
                writer.write("\t}\n\n");
            } else {
                writer.write("\tpublic void set" + attribute.getName().substring(0, 1).toUpperCase()
                        + attribute.getName().substring(1) + "(javax.el.ValueExpression expression){\n");
                writer.write("\t\tthis._" + attribute.getName() + " = expression;\n");
                writer.write("\t}\n\n");
            }
        }
    }
}

From source file:org.kepler.gui.OntLibrarySearcher.java

private Iterator<TreePath> hashTableGet(String id) {
    Vector<TreePath> ids = _hashTable.get(id);
    if (ids == null) {
        return new Vector<TreePath>().iterator();
    }/*from www . j  ava2 s.  com*/
    return ids.iterator();
}