Example usage for java.util Vector add

List of usage examples for java.util Vector add

Introduction

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

Prototype

public synchronized boolean add(E e) 

Source Link

Document

Appends the specified element to the end of this Vector.

Usage

From source file:com.sbu.controller.ServletSaveJobController.java

protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    request.setCharacterEncoding("UTF-8");
    HttpSession session = request.getSession();

    int id = Integer.parseInt(request.getParameter("id"));
    String username = request.getParameter("email");
    Employer user = employerService.getEmployer(id);
    Feed feed = new Feed();
    List<Feed> feeds = new ArrayList();
    Jobpositions jobposition = new Jobpositions();

    jobposition.setCategory(request.getParameter("category"));
    jobposition.setDegree(request.getParameter("certificate"));
    jobposition.setLanguages(request.getParameter("familiar"));
    jobposition.setMajor(request.getParameter("major"));
    jobposition.setPosTitle(request.getParameter("posname"));
    jobposition.setSalary(request.getParameter("minsalary"));
    jobposition.setSex(request.getParameter("sex"));
    jobposition.setSkills(request.getParameter("Skills"));
    jobposition.setDate(request.getParameter("Date"));
    jobposition.setWorkTime(request.getParameter("workhours"));
    jobposition.setUniversity(request.getParameter("uni"));
    jobposition.setDescription(request.getParameter("description"));
    jobposition.setEmployeridEmployer(user);
    jobPositionService.addJobpositions(jobposition);
    //feed/*from w  w  w  . j  av a  2  s  . c  om*/
    feed.setEmployeridEmployer(user);
    feed.setDescription(request.getParameter("description"));
    feed.setTitle(request.getParameter("posname"));
    feed.setDegree(request.getParameter("certificate"));
    feed.setMajor(request.getParameter("major"));
    feed.setSkills(request.getParameter("Skills"));
    feed.setSalary(request.getParameter("minsalary"));
    feed.setWorkTime(request.getParameter("workhours"));
    feed.setDate(request.getParameter("Date"));
    feedService.addFeed(feed);

    feeds = feedService.getAllFeed();

    /**Recommendation**/

    List<Employee> emps = employeeService.getAllEmployees();
    Vector<Employee> recomm = new Vector<>();

    for (int j = 0; j < emps.size(); j++) {

        if (user.getAddress().contains(emps.get(j).getCity())) {
            recomm.add(emps.get(j));
        }

    }

    /**Recommendation**/
    session.setAttribute("recomm", recomm);
    session.setAttribute("id", id);
    session.setAttribute("email", username);
    session.setAttribute("feedcontent", feeds);
    session.setAttribute("User", user);
    getServletContext().getRequestDispatcher("/Feed_Employer.jsp").forward(request, response);

}

From source file:edu.ku.brc.specify.config.FeedBackDlg.java

@Override
protected FeedBackSenderItem getFeedBackSenderItem(final Class<?> cls, final Exception exception) {
    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,f:p:g", "p,4px,p,4px,p,4px,p,4px,f:p:g"));

    Vector<String> taskItems = new Vector<String>();
    for (Taskable task : TaskMgr.getInstance().getAllTasks()) {
        taskItems.add(task.getTitle());
    }//  ww  w. j  a  v a  2  s.  c o m

    String[] OTHERS = { "WEBSITE", "CSTSUP", "INSTL", "DOC", "WHTPR", "HLP" };
    for (String key : OTHERS) {
        taskItems.add(UIRegistry.getResourceString("FeedBackDlg." + key));
    }
    Collections.sort(taskItems);

    final JComboBox taskCBX = createComboBox(taskItems);
    final JTextField subjectTF = createTextField();
    final JTextField issueTF = createTextField();
    final JTextArea commentsTA = createTextArea(15, 60);

    int y = 1;
    pb.add(createI18NLabel("FeedBackDlg.INFO"), cc.xyw(1, y, 4));
    y += 2;

    pb.add(createI18NFormLabel("FeedBackDlg.SUB"), cc.xy(1, y));
    pb.add(subjectTF, cc.xyw(3, y, 2));
    y += 2;

    pb.add(createI18NFormLabel("FeedBackDlg.COMP"), cc.xy(1, y));
    pb.add(taskCBX, cc.xy(3, y));
    y += 2;

    //pb.add(createFormLabel("Question/Issue"), cc.xy(1, y));
    //pb.add(issueTF,                           cc.xyw(3, y, 2)); y += 2;

    pb.add(createI18NFormLabel("FeedBackDlg.COMM"), cc.xy(1, y));
    y += 2;
    pb.add(createScrollPane(commentsTA, true), cc.xyw(1, y, 4));
    y += 2;

    Taskable currTask = SubPaneMgr.getInstance().getCurrentSubPane().getTask();
    taskCBX.setSelectedItem(currTask != null ? currTask : TaskMgr.getDefaultTaskable());

    pb.setDefaultDialogBorder();
    CustomDialog dlg = new CustomDialog((Frame) null, UIRegistry.getResourceString("FeedBackDlg.TITLE"), true,
            pb.getPanel());

    centerAndShow(dlg);

    if (!dlg.isCancelled()) {
        String taskTitle = (String) taskCBX.getSelectedItem();
        if (taskTitle != null) {
            for (Taskable task : TaskMgr.getInstance().getAllTasks()) {
                if (task.getTitle().equals(taskTitle)) {
                    taskTitle = task.getName();
                }
            }
        } else {
            taskTitle = "No Task Name";
        }
        FeedBackSenderItem item = new FeedBackSenderItem(taskTitle, subjectTF.getText(), issueTF.getText(),
                commentsTA.getText(), "", cls != null ? cls.getName() : "");
        return item;
    }
    return null;
}

From source file:com.pironet.tda.SunJDKParserTest.java

/**
 * Test of isFoundClassHistograms method, of class com.pironet.tda.SunJDKParser.
 *//*from  w w w. jav  a 2  s.c  o  m*/
public void testIsFoundClassHistograms() throws IOException {
    System.out.println("isFoundClassHistograms");
    DumpParser instance = null;
    InputStream fis = null;
    try {
        fis = getClass().getResourceAsStream("/data/testwithhistogram.log");
        Map<String, Map<String, String>> dumpMap = new HashMap<>();
        instance = DumpParserFactory.get().getDumpParserForLogfile(fis, dumpMap, false, 0);

        Vector<MutableTreeNode> topNodes = new Vector<>();
        while (instance.hasMoreDumps()) {
            topNodes.add(instance.parseNext());
        }

        boolean expResult = true;
        boolean result = instance.isFoundClassHistograms();
        assertEquals(expResult, result);
    } finally {
        IOUtils.closeQuietly(instance);
        IOUtils.closeQuietly(fis);
    }
}

From source file:main.Draft_text_categorization.java

/**
 * //from  ww  w .j a  va 2  s .  com
 * @param file
 * @return
 */
public static Vector<String> fileToVector(InputStream file) {

    String word = "";
    try {
        word = IOUtils.toString(file, "ISO-8859-1");
    } catch (IOException e) {
        // TODO Auto-generated catch block
        System.out.println("Error al leer el fichero:" + e.getMessage());
    }

    Vector<String> doc = new Vector<>();
    word = word.trim().toLowerCase();
    word = word.replace("(", "");
    word = word.replace(")", "");
    word = word.replace(",", "");
    word = word.replace(".", "");
    word = word.replace(":", "");
    word = word.replace("'", "");
    word = word.replace("\"", "");
    word = word.replace("-", "");
    word = word.replace("=", "");
    word = word.replace("", "a");
    word = word.replace("", "e");
    word = word.replace("i", "i");
    word = word.replace("", "o");
    word = word.replace("", "u");
    word = word.replace("", "n");
    word = word.replace("{", "");
    word = word.replace("}", "");
    word = word.replace("", "");
    word = word.replace("?", "");
    word = word.replace("\n", " ");
    word = word.replace("\r", "");
    String[] tokens = word.split(" ");
    for (String w1 : tokens) {

        if (!w1.equals("") && !w1.equals(" ") && !w1.contains(" "))
            doc.add(w1);
    }
    return doc;
}

From source file:fr.sanofi.fcl4transmart.model.classes.dataType.ClinicalData.java

/**
 *Returns a list of files to display in the file viewer list
 *//* w  w w .j  av  a 2  s .  c  o m*/
public Vector<File> getFiles() {
    Vector<File> v = new Vector<File>();
    for (File f : this.rawFiles) {
        v.add(f);
    }
    if (this.cmf != null)
        v.add(this.cmf);
    if (this.wmf != null)
        v.add(this.wmf);
    for (String k : this.mappingFiles.keySet()) {
        v.add(this.mappingFiles.get(k));
    }
    if (this.dimFile != null)
        v.add(this.dimFile);
    if (this.logFile != null)
        v.add(this.logFile);
    if (this.QCLog != null)
        v.add(this.QCLog);
    return v;
}

From source file:fr.sanofi.fcl4transmart.model.classes.dataType.ClinicalData.java

public Vector<String> getRawFilesNames() {
    Vector<String> rawFilesNames = new Vector<String>();
    for (File f : this.rawFiles) {
        rawFilesNames.add(f.getName());
    }/*  w ww .  jav  a2  s . co  m*/
    return rawFilesNames;
}

From source file:net.sf.jabref.SearchManagerNoGUI.java

public BibtexDatabase getDBfromMatches() {
    LOGGER.debug("Search term: " + searchTerm);
    if (specifiedYears()) {
        searchTerm = fieldYear();//  w  ww .j a  v a2  s  .  c o m
    }

    SearchQuery searchQuery = new SearchQuery(searchTerm,
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_CASE_SENSITIVE),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REG_EXP));

    if (!searchQuery.isValidQuery()) {
        LOGGER.warn("Search failed: illegal search expression");
        return base;
    }

    Collection<BibtexEntry> entries = database.getEntries();
    Vector<BibtexEntry> matchEntries = new Vector<>();
    for (BibtexEntry entry : entries) {
        boolean hit = searchQuery.isMatch(entry);
        entry.setSearchHit(hit);
        if (hit) {
            matchEntries.add(entry);
        }
    }

    base = ImportFormatReader.createDatabase(matchEntries);

    return base;
}

From source file:com.sbu.controller.Feed_Form_Startup_Edit_Contorller.java

protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    Startup User = new Startup();

    List<Member1> members = new ArrayList();

    request.setCharacterEncoding("UTF-8");
    int counter = 1;

    HttpSession session = request.getSession();

    int id = Integer.parseInt(request.getParameter("id"));
    User = startupService.getStartup(id);
    members = memberService.getAllMembers();
    Vector<Member1> filtered_members = new Vector<>();
    //filtered_members = memberService.getMemberByStartupId(id);

    for (int i = 0; i < members.size(); i++) {
        if (members.get(i).getStartupidStartup().getIdStartup() == id)
            filtered_members.add(members.get(i));
    }/*  w ww . j a v a  2s.  c om*/

    session.setAttribute("User", User);
    session.setAttribute("members", filtered_members);

    getServletContext().getRequestDispatcher("/accountsetting_Startup_Edit.jsp").forward(request, response);

}

From source file:be.e_contract.mycarenet.ehealth.common.WSSecuritySOAPHandler.java

private void handleOutboundMessage(SOAPMessageContext context)
        throws WSSecurityException, SAXException, IOException {
    LOG.debug("adding WS-Security header");
    SOAPMessage soapMessage = context.getMessage();
    SOAPPart soapPart = soapMessage.getSOAPPart();

    WSSecHeader wsSecHeader = new WSSecHeader();
    wsSecHeader.insertSecurityHeader(soapPart);

    WSSecTimestamp wsSecTimeStamp = new WSSecTimestamp();
    wsSecTimeStamp.setTimeToLive(60);//w w w.ja  v  a  2s.  co m
    wsSecTimeStamp.build(soapPart, wsSecHeader);

    Document assertionDocument = this.documentBuilder
            .parse(new InputSource(new StringReader(this.samlAssertion)));
    Element assertionElement = assertionDocument.getDocumentElement();
    String assertionId = assertionElement.getAttribute("AssertionID");
    Element importedAssertionElement = (Element) soapPart.importNode(assertionElement, true);
    Element securityHeaderElement = wsSecHeader.getSecurityHeader();
    securityHeaderElement.appendChild(importedAssertionElement);

    WSSecSignature wsSecSignature = new WSSecSignature();
    wsSecSignature.setSignatureAlgorithm(WSConstants.RSA);
    wsSecSignature.setKeyIdentifierType(WSConstants.CUSTOM_KEY_IDENTIFIER);
    wsSecSignature.setCustomTokenValueType(WSConstants.WSS_SAML_KI_VALUE_TYPE);
    wsSecSignature.setCustomTokenId(assertionId);
    Crypto crypto = new WSSecurityCrypto(this.privateKey, null);
    wsSecSignature.prepare(soapPart, crypto, wsSecHeader);
    Vector<WSEncryptionPart> signParts = new Vector<WSEncryptionPart>();
    SOAPConstants soapConstants = WSSecurityUtil.getSOAPConstants(soapPart.getDocumentElement());
    signParts.add(new WSEncryptionPart(soapConstants.getBodyQName().getLocalPart(),
            soapConstants.getEnvelopeURI(), "Content"));
    signParts.add(new WSEncryptionPart(wsSecTimeStamp.getId()));
    List<Reference> referenceList = wsSecSignature.addReferencesToSign(signParts, wsSecHeader);
    wsSecSignature.computeSignature(referenceList, false, null);
}

From source file:com.almarsoft.GroundhogReader.lib.DBUtils.java

public static Vector<Object> isHeaderInDatabase(Long number, String group, Context context) {
    int groupid = getGroupIdFromName(group, context);

    DBHelper db = new DBHelper(context);
    SQLiteDatabase dbread = db.getReadableDatabase();
    Vector<Object> retVal = null;

    String q = "SELECT _id, server_article_id FROM headers WHERE subscribed_group_id=" + groupid
            + " AND server_article_number=" + number;
    Cursor c = dbread.rawQuery(q, null);
    int count = c.getCount();

    if (count > 0) {
        c.moveToFirst();//from  w ww  .  j  a  va  2s  .c om
        retVal = new Vector<Object>(2);
        retVal.add(c.getLong(0));
        retVal.add(c.getString(1));
    }

    c.close();
    dbread.close();
    db.close();

    return retVal;
}