Example usage for java.util Vector addAll

List of usage examples for java.util Vector addAll

Introduction

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

Prototype

public boolean addAll(Collection<? extends E> c) 

Source Link

Document

Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator.

Usage

From source file:com.android.aft.AFCuteJsonParser.AFCuteJsonParser.java

private Vector<AFJsonAction<?>> getActionsPossibleAtValue(AFCuteJsonParserContext ctx, String name) {
    Vector<AFJsonAction<?>> actions = new Vector<AFJsonAction<?>>();

    // Get action for current value name
    Vector<AFJsonAction<?>> v;

    String curName = ctx.getCurrent().getName();
    if (curName == null)
        curName = "";

    v = mActions.get(ctx.getCurrent().getName());
    if (v != null)
        actions.addAll(v);

    // Get anonymous action
    if (!curName.equals("")) {
        v = mActions.get("");
        if (v != null)
            actions.addAll(v);/*from   w  ww .  j  a  v  a 2s  .co  m*/
    }

    return actions;
}

From source file:org.parosproxy.paros.core.scanner.VariantODataIdQuery.java

@Override
public Vector<NameValuePair> getParamList() {
    Vector<NameValuePair> params = new Vector<>();

    if (resourceParameter != null) {
        params.add(new NameValuePair(NameValuePair.TYPE_QUERY_STRING, resourceParameter.getParameterName(),
                resourceParameter.getValue(), 1));
    }/*from w ww . j  av a 2  s.c  om*/

    if (listParams != null) {
        params.addAll(listParams);
    }

    return params;
}

From source file:de.tud.kom.p2psim.impl.skynet.visualization.SkyNetVisualization.java

public void setAvailableMetrics(Vector<String> names) {
    Vector<String> temp = new Vector<String>();
    temp.addAll(names);
    temp.add("Online Peers");
    temp.add("Available Attributes");
    temp.add("Memory Usage");
    Collections.sort(temp);//from  w  ww  . ja va2  s  .co m

    JMenu met = mb.getMenu(1);
    met.setEnabled(true);
    JMenu avgMet = new JMenu("Average Metrics");
    JMenu genMet = new JMenu("General Metrics");
    JMenu recMet = new JMenu("Metrics for Receiving");
    JMenu sentMet = new JMenu("Metrics for Sending");
    JCheckBoxMenuItem item = null;
    for (String name : temp) {
        if (name.startsWith("Aver")) {
            item = new JCheckBoxMenuItem(name, false);
            item.addActionListener(this);
            avgMet.add(item);
        } else if (name.startsWith("Rec")) {
            item = new JCheckBoxMenuItem(name, false);
            item.addActionListener(this);
            recMet.add(item);
        } else if (name.startsWith("Sent")) {
            item = new JCheckBoxMenuItem(name, false);
            item.addActionListener(this);
            sentMet.add(item);
        } else {
            item = new JCheckBoxMenuItem(name, false);
            item.addActionListener(this);
            genMet.add(item);
        }
    }
    avgMet.add(new JSeparator(SwingConstants.HORIZONTAL));
    avgMet.add(createMenuItem("Display all Average Metrics"));
    avgMet.add(createMenuItem("Remove all Average Metrics"));

    genMet.add(new JSeparator(SwingConstants.HORIZONTAL));
    genMet.add(createMenuItem("Display all General Metrics"));
    genMet.add(createMenuItem("Remove all General Metrics"));

    recMet.add(new JSeparator(SwingConstants.HORIZONTAL));
    recMet.add(createMenuItem("Display all Metrics for Receiving"));
    recMet.add(createMenuItem("Remove all Metrics for Receiving"));

    sentMet.add(new JSeparator(SwingConstants.HORIZONTAL));
    sentMet.add(createMenuItem("Display all Metrics for Sending"));
    sentMet.add(createMenuItem("Remove all Metrics for Sending"));

    met.add(avgMet);
    met.add(genMet);
    met.add(recMet);
    met.add(sentMet);

    met.add(new JSeparator(SwingConstants.HORIZONTAL));
    met.add(createMenuItem("Display all Metrics"));
    met.add(createMenuItem("Remove all Metrics"));

    mb.add(met);
    repaint();
    log.warn("Created Menu 'Available Metrics'");
}

From source file:it.classhidra.core.controller.wsController.java

public String PerformActionSOAP(String id_action, String ssoid, String inputXML, String isCodedInput,
        String isCodedOutput) {/* w w  w  .  ja  va 2 s .  co m*/

    HashMap wsParameters = new HashMap();

    wsParameters.put(bsController.CONST_ID, id_action);
    wsParameters.put(bsController.CONST_SSOID, ssoid);

    String outputXML = "";
    Vector errors = new Vector();
    auth_init auth = null;
    if (auth == null)
        auth = new auth_init();

    StatisticEntity stat = null;
    try {
        stat = new StatisticEntity("ws", auth.get_user_ip(), auth.get_matricola(), auth.get_language(),
                id_action, null, new Date(), null, null);
    } catch (Exception e) {
    }

    if (isCodedInput != null && isCodedInput.toUpperCase().equals("TRUE")) {
        try {
            inputXML = new String(Base64.decodeBase64(inputXML.getBytes()));
        } catch (Exception e) {
        }
    }

    if (id_action != null) {

        Vector _streams = new Vector();
        Vector _streams_orig = (Vector) bsController.getAction_config().get_streams_apply_to_actions().get("*");

        if (_streams_orig != null)
            _streams.addAll(_streams_orig);
        Vector _streams4action = (Vector) bsController.getAction_config().get_streams_apply_to_actions()
                .get(id_action);
        if (_streams4action != null)
            _streams.addAll(_streams4action);

        i_action action_instance = null;

        try {
            try {
                performStream_Enter(_streams, id_action, action_instance, wsParameters);
            } catch (Exception e) {
                throw e;
            }

            action_instance = bsController.getAction_config().actionFactory(id_action);

            i_bean bean_instance = bsController.getAction_config()
                    .beanFactory(action_instance.get_infoaction().getName());
            if (bean_instance != null) {
                bean_instance.reimposta();
                i_bean fromXML = null;
                try {
                    fromXML = (i_bean) util_beanMessageFactory.message2bean(inputXML);
                } catch (Exception e) {
                }
                if (fromXML != null)
                    bean_instance.reInit(fromXML);
            }

            action_instance.onPreSet_bean();
            action_instance.set_bean(bean_instance);
            action_instance.onPostSet_bean();

            action_instance.onPreInit(wsParameters);
            action_instance.init(wsParameters);
            action_instance.onPostInit(wsParameters);

            redirects redirect = null;
            if (action_instance.get_infoaction().getSyncro().toLowerCase().equals("true")) {
                action_instance.onPreSyncroservice(wsParameters);
                redirect = action_instance.syncroservice(wsParameters);
                action_instance.onPostSyncroservice(redirect, wsParameters);
            } else {
                action_instance.onPreActionservice(wsParameters);
                redirect = action_instance.actionservice(wsParameters);
                action_instance.onPostActionservice(redirect, wsParameters);
            }

            //                  redirects redirect = action_instance.actionservice(wsParameters);         

            if (action_instance != null && action_instance.get_bean() != null) {
                String output4SOAP = (String) action_instance.get_bean().get(bsConstants.CONST_ID_OUTPUT4SOAP);
                if (output4SOAP == null)
                    outputXML = util_beanMessageFactory.bean2xml(action_instance.get_bean(),
                            action_instance.get_bean().get_infobean().getName(), true);
                else
                    outputXML = output4SOAP;
            }

            try {
                performStream_Exit(_streams, id_action, action_instance, wsParameters);
            } catch (Exception e) {
                throw e;
            }

            if (redirect != null) {
                String id_current = check_DO(redirect.get_uri());
                if (id_current != null) {
                    outputXML = PerformActionSOAP(id_action, ssoid, outputXML, isCodedInput, isCodedOutput);
                }
            }

        } catch (bsControllerException e) {
            errors.add(e.toString());
        } catch (Exception ex) {
            errors.add(ex.toString());
        } catch (Throwable t) {
            errors.add(t.toString());
        }

    }

    if (errors.size() > 0) {
        outputXML += util_beanMessageFactory.bean2xml(errors);
    }

    if (isCodedOutput != null && isCodedOutput.toUpperCase().equals("TRUE")) {
        try {
            outputXML = new String(Base64.encodeBase64(outputXML.getBytes()));
        } catch (Exception e) {
        }
    }
    if (stat != null) {
        stat.setFt(new Date());
        bsController.putToStatisticProvider(stat);
    }

    return outputXML;
}

From source file:vacationscheduler.UpcomingReservations.java

public UpcomingReservations() {
    initComponents();//from w  w  w .  j a va  2  s  .  c  o m
    UpdateDataSet();
    makeTable("Select * From Reservations");

    ////////////////////////////////////////////////////////////////////////
    //              FIll Up Owner combo box
    ////////////////////////////////////////////////////////////////////////
    Vector<Owner> allOwners = OwnersFactory.getAllOwners();
    Vector<String> userNames = new Vector();
    userNames.add("");
    for (int i = 0; i < allOwners.size(); i++) {
        userNames.add(allOwners.get(i).getUserName());
    }

    Combobox_UserNameFilter.setModel(new DefaultComboBoxModel(userNames));

    ////////////////////////////////////////////////////////////////////////
    //              FIll Up Locations combo box
    ////////////////////////////////////////////////////////////////////////
    Vector<String> allResorts = new <String>Vector();
    allResorts.add("");
    allResorts.addAll(LocationsFactory.GetAllLocations());

    Set<String> uniqueResorts = new HashSet<String>();
    uniqueResorts.addAll(allResorts);

    ComboBox_ResortFilter.setModel(new DefaultComboBoxModel(uniqueResorts.toArray()));
    ComboBox_ResortFilter.setSelectedItem("");

    ////////////////////////////////////////////////////////////////////////
    //              FIll Up Upgrade Status combo box
    ////////////////////////////////////////////////////////////////////////
    Vector<String> allUpgradeStates = new <String>Vector();

    allUpgradeStates.add("");

    String queryToGetAllUpgradeStates = "Select Upgrade_Status from reservations";

    Connection con = RuthDBConnection.getConnection();
    try {
        Statement st = con.createStatement();
        ResultSet rs = st.executeQuery(queryToGetAllUpgradeStates);

        while (rs.next()) {
            allUpgradeStates.add(rs.getString("Upgrade_Status"));
        }
        con.close();

    } catch (Exception e) {
        System.out.println(e);

    }

    Set<String> uniqueUpgrades = new HashSet<String>();
    uniqueUpgrades.addAll(allUpgradeStates);

    ComboBox_UpgradeStateFilter.setModel(new DefaultComboBoxModel(uniqueUpgrades.toArray()));

    this.setVisible(true);
    jtable_upcomingReservations.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {
            int rowClicked = jtable_upcomingReservations.rowAtPoint(e.getPoint());
            String confirmationNumberClicked = reservations.get(rowClicked).getConfimationNumber();
            System.out.println("confirmation number = " + confirmationNumberClicked);
            new ReservationForm(confirmationNumberClicked);
        }

        @Override
        public void mousePressed(MouseEvent e) {
        }

        @Override
        public void mouseReleased(MouseEvent e) {
        }

        @Override
        public void mouseEntered(MouseEvent e) {
        }

        @Override
        public void mouseExited(MouseEvent e) {
        }
    });

    updateUsingFilters();
}

From source file:org.openmrs.module.chartsearch.web.dwr.DWRChartSearchService.java

public Map<String, Object> findObsAndCount(Integer patientId, String phrase, boolean includeRetired,
        List<String> includeClassNames, List<String> excludeClassNames, List<String> includeDatatypeNames,
        List<String> excludeDatatypeNames, Integer start, Integer length, boolean getMatchCount,
        List<String> selectedCategories) throws APIException {
    // Map to return
    Map<String, Object> resultsMap = new HashMap<String, Object>();
    Vector<Object> objectList = new Vector<Object>();

    try {/*from   w  w w.  jav a2  s. c  o m*/
        long matchCount = 0;
        if (getMatchCount) {
            // get the count of matches
            matchCount += searcher.getDocumentListCount(patientId, phrase);
        }

        // if we have any matches or this isn't the first ajax call when
        // the caller
        // requests for the count
        if (matchCount > 0 || !getMatchCount) {
            objectList.addAll(
                    findBatchOfObs(patientId, phrase, includeRetired, includeClassNames, excludeClassNames,
                            includeDatatypeNames, excludeDatatypeNames, start, length, selectedCategories));
        }

        resultsMap.put("count", matchCount);
        resultsMap.put("objectList", objectList);

    } catch (Exception e) {
        log.error("Error while searching for observations", e);
        objectList.clear();
        objectList
                .add(Context.getMessageSourceService().getMessage("Obs.search.error") + " - " + e.getMessage());
        resultsMap.put("count", 0);
        resultsMap.put("objectList", objectList);
    }

    return resultsMap;
}

From source file:fr.gouv.finances.cp.xemelios.importers.batch.BatchRealImporter.java

private ImportContent files(final String extension, final String titreEtat) {
    ImportContent ic = new ImportContent();
    Vector<File> ret = new Vector<File>();
    ret.addAll(files);
    // on regarde si l'un des fichiers a importer est un zip
    for (int i = 0; i < ret.size(); i++) {
        if (ret.get(i).getName().toLowerCase().endsWith(".zip")) {
            if (ret.get(i).exists()) {
                ZipFile zf = null;
                try {
                    zf = new ZipFile(ret.get(i));
                    for (Enumeration<? extends ZipEntry> enumer = zf.entries(); enumer.hasMoreElements();) {
                        ZipEntry ze = enumer.nextElement();
                        if (!ze.isDirectory()) {
                            String fileName = ze.getName();
                            String entryName = fileName.toLowerCase();
                            fileName = fileName.replace(File.pathSeparatorChar, '_')
                                    .replace(File.separatorChar, '_').replace(':', '|').replace('\'', '_')
                                    .replace('/', '_');
                            logger.debug(entryName);
                            if (PJRef.isPJ(ze)) {
                                PJRef pj = new PJRef(ze);
                                File tmpFile = pj.writeTmpFile(FileUtils.getTempDir(), zf);
                                ic.pjs.add(pj);
                                filesToDrop.add(tmpFile);
                            } else if ((entryName.endsWith(extension.toLowerCase())
                                    || entryName.endsWith(".xml")) && !fileName.startsWith("_")) {
                                // on decompresse le fichier dans le
                                // repertoire temporaire, comme ca il sera
                                // supprime en quittant
                                InputStream is = zf.getInputStream(ze);
                                BufferedInputStream bis = new BufferedInputStream(is);
                                File output = new File(FileUtils.getTempDir(), fileName);
                                BufferedOutputStream bos = new BufferedOutputStream(
                                        new FileOutputStream(output));
                                byte[] buffer = new byte[1024];
                                int read = bis.read(buffer);
                                while (read > 0) {
                                    bos.write(buffer, 0, read);
                                    read = bis.read(buffer);
                                }/*from w  w w . j av a2  s . c  o  m*/
                                bos.flush();
                                bos.close();
                                bis.close();
                                ic.filesToImport.add(output);
                                filesToDrop.add(output);
                            }
                        }
                    }
                    zf.close();
                } catch (ZipException zEx) {
                    System.out.println(
                            "Le fichier " + ret.get(i).getName() + " n'est pas une archive ZIP valide.");
                } catch (IOException ioEx) {
                    ioEx.printStackTrace();
                } finally {
                    if (zf != null) {
                        try {
                            zf.close();
                        } catch (Throwable t) {
                        }
                    }
                }
            }
        } else if (ret.get(i).getName().toLowerCase().endsWith(".gz")) {
            try {
                String fileName = ret.get(i).getName();
                fileName = fileName.substring(0, fileName.length() - 3);
                File output = new File(FileUtils.getTempDir(), fileName);
                GZIPInputStream gis = new GZIPInputStream(new FileInputStream(ret.get(i)));
                BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(output));
                byte[] buffer = new byte[1024];
                int read = gis.read(buffer);
                while (read > 0) {
                    bos.write(buffer, 0, read);
                    read = gis.read(buffer);
                }
                bos.flush();
                bos.close();
                gis.close();
                ic.filesToImport.add(output);
                filesToDrop.add(output);
            } catch (IOException ioEx) {
                // nothing to do
            }
        } else {
            ic.filesToImport.add(ret.get(i));
            // dans ce cas l, on ne le supprime pas
        }
    }
    return ic;
}

From source file:org.miradi.xml.TestXmpz2ForwardMigration.java

private Vector<ImmutablePair<Node, Node>> removeUUIDFields(Node node) {
    Vector<ImmutablePair<Node, Node>> nodesToRemove = new Vector<ImmutablePair<Node, Node>>();

    if (node.getNodeName().endsWith(BaseObject.TAG_UUID)) {
        nodesToRemove.add(new ImmutablePair<>(node, node.getParentNode()));
    }//w w  w.j a v  a 2  s. c  o m

    NodeList childNodes = node.getChildNodes();
    for (int index = 0; index < childNodes.getLength(); ++index) {
        Node childNode = childNodes.item(index);
        nodesToRemove.addAll(removeUUIDFields(childNode));
    }

    return nodesToRemove;
}

From source file:org.jumpmind.metl.core.runtime.resource.SftpDirectory.java

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override/* ww  w  .j  av  a2 s .  com*/
public List<FileInfo> listFiles(boolean closeSession, String... relativePaths) {
    ChannelSftp sftp = null;
    String separator = null;
    List<FileInfo> fileInfoList = new ArrayList<>();
    try {
        // Get a reusable channel if the session is not auto closed.
        sftp = (closeSession) ? openConnectedChannel() : openConnectedChannel(CHANNEL_1);
        sftp.cd(basePath);
        for (String relativePath : relativePaths) {
            if (!relativePath.equals(".") && !relativePath.equals("..")) {
                if (relativePath.isEmpty() || StringUtils.endsWith(relativePath, "/")) {
                    separator = "";
                } else {
                    separator = "/";
                }
                Vector list = new Vector();
                try {
                    list.addAll(sftp.ls(relativePath.isEmpty() ? "*" : relativePath));
                } catch (SftpException e) {
                    log.warn("List File Warning ==>" + e.getMessage());
                }
                for (Object object : list) {
                    LsEntry entry = (LsEntry) object;
                    if (!entry.getFilename().equals(".") && !entry.getFilename().equals("..")) {
                        fileInfoList.add(new FileInfo(relativePath + separator + entry.getFilename(),
                                entry.getAttrs().isDir(), entry.getAttrs().getMTime(),
                                entry.getAttrs().getSize()));
                    }
                }
            }
        }
        return fileInfoList;
    } catch (Exception e) {
        throw new RuntimeException(
                String.format("Failure in listFiles for SFTP.  Error ==> %s", e.getMessage()), e);
    } finally {
        if (closeSession) {
            close();
        }
    }
}

From source file:org.scratch.microwebserver.MicrowebserverActivity.java

protected void connectService() {
    Intent serviceIntent = new Intent(this.getApplicationContext(), MicrowebserverService.class);

    sconn = new ServiceConnection() {

        @Override/* ww  w.  jav  a 2  s .  co  m*/
        public void onServiceConnected(ComponentName name, IBinder service) {
            if (name.getClassName().equals("org.scratch.microwebserver.MicrowebserverService")) {
                binder = ((MicrowebserverServiceBinder) service);

                //global adapter ;)
                lea = binder.getLogEntryAdapter();

                binder.registerServiceListener(MicrowebserverActivity.this);

                setContentView(R.layout.main);

                statusImage = (ImageView) findViewById(R.id.StatusImage);
                statusImage.setOnClickListener(MicrowebserverActivity.this);
                statusText = (TextView) findViewById(R.id.statusText);
                socketInfo = (TextView) findViewById(R.id.socketInfo);
                //logList=(ListView)findViewById(R.id.logList);
                logList.setAdapter(lea);

                runOnUiThread(new Runnable() {
                    public void run() {
                        logList.setSelection(lea.getCount());
                    }
                });

                Vector<WebService> wss = new Vector<WebService>();
                //add remote AND local (TODO !)
                wss.addAll(binder.getRegisteredRemoteWebServices());

                sea = new ServiceAdapter(getPackageManager(), wss);
                serviceList.setAdapter(sea);

                //pager
                pager = (ViewPager) findViewById(R.id.pager);
                pager.setAdapter(new APagerAdapter());

                //Bind the title indicator to the adapter
                TitlePageIndicator indicator = (TitlePageIndicator) findViewById(R.id.pagertitles);

                final float density = getResources().getDisplayMetrics().density;

                TypedValue tv = new TypedValue();

                try {
                    //fgcol (line/footer)
                    getApplicationContext().getTheme().resolveAttribute(android.R.attr.colorActivatedHighlight,
                            tv, true);
                    indicator.setFooterColor(getResources().getColor(tv.resourceId));
                    //logList.getDivider().setColorFilter(getResources().getColor(tv.resourceId),Mode.MULTIPLY);
                } catch (Resources.NotFoundException rnfe) {
                }

                indicator.setFooterLineHeight(1 * density); //1dp
                indicator.setFooterIndicatorHeight(2 * density); //2dp
                indicator.setFooterIndicatorStyle(IndicatorStyle.Underline);

                //textcol
                TypedValue tv2 = new TypedValue();

                try {
                    getApplicationContext().getTheme().resolveAttribute(android.R.attr.colorActivatedHighlight,
                            tv2, true);
                    indicator.setTextColor(getResources().getColor(tv2.resourceId));
                } catch (Resources.NotFoundException rnfe) {
                }

                //selectedtextcol
                TypedValue tv3 = new TypedValue();
                getApplicationContext().getTheme().resolveAttribute(android.R.attr.colorForeground, tv3, true);
                indicator.setSelectedColor(getResources().getColor(tv3.resourceId));

                indicator.setSelectedBold(true);

                indicator.setViewPager(pager);

                if (binder.isServerUp()) {
                    runOnUiThread(new Runnable() {
                        public void run() {
                            statusText.setText("Started");
                            socketInfo.setText(Arrays.toString(binder.getListeningAdresses().toArray()));
                            statusImage.setImageResource(R.drawable.indicator_started);
                        }
                    });
                } else {
                    runOnUiThread(new Runnable() {
                        public void run() {
                            statusText.setText("Stopped");
                            socketInfo.setText("");
                            statusImage.setImageResource(R.drawable.indicator_stopped);
                        }
                    });
                }
            }
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            if (name.getClassName().equals("comtec.tool.wifilogger.WifiLoggerService")) {
                // TODO: implement, do stuff here ?
            }
        }

    };

    startService(serviceIntent);

    if (!bindService(serviceIntent, sconn, BIND_AUTO_CREATE)) {
        Log.e(PropertyNames.LOGGERNAME.toString(), "ARGH !!!!");
        // TOOOOOOOAST ! or a dialog ... whatever this SHOULD not happen at
        // all ...
    } else {

    }
}