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:edu.lternet.pasta.dml.database.DatabaseAdapter.java

/**
 * Creates a SQL command to insert data. If some error happens, null will be
 * returned.//from w w w.  ja v a 2 s  .  c  o  m
 * 
 * @param attributeList  AttributeList which will be inserted
 * @param tableName      The name of the table which the data will be inserted into
 * @param oneRowData     The data vector which contains data to be inserted
 * @return A SQL String that can be run to insert one row of data into table
 */
public String generateInsertSQL(AttributeList attributeList, String tableName, Vector oneRowData)
        throws DataNotMatchingMetadataException, SQLException {
    String sqlString = null;
    int NULLValueCounter = 0;
    int hasValueCounter = 0;

    if (attributeList == null) {
        throw new SQLException("The attribute list is null and couldn't generate insert sql statement");
    }

    if (oneRowData == null || oneRowData.isEmpty()) {
        throw new SQLException("The the data is null and couldn't generte insert sql statement");
    }

    StringBuffer sqlAttributePart = new StringBuffer();
    StringBuffer sqlDataPart = new StringBuffer();
    sqlAttributePart.append(INSERT);
    sqlAttributePart.append(SPACE);
    sqlAttributePart.append(tableName);
    sqlAttributePart.append(LEFTPARENTH);
    sqlDataPart.append(SPACE);
    sqlDataPart.append(VALUES);
    sqlDataPart.append(SPACE);
    sqlDataPart.append(LEFTPARENTH);
    Attribute[] list = attributeList.getAttributes();

    if (list == null || list.length == 0) {
        throw new SQLException("The attributes is null and couldn't generate insert sql statement");
    }

    int size = list.length;
    // column name part
    boolean firstAttribute = true;

    for (int i = 0; i < size; i++) {
        // if data vector
        Object obj = oneRowData.elementAt(i);
        String value = null;

        if (obj == null) {
            NULLValueCounter++;
            continue;
        } else {
            value = (String) obj;
            if (value.trim().equals("")) {
                continue;
            }
        }

        Attribute attribute = list[i];

        if (attribute == null) {
            throw new SQLException("Attribute list contains a null attribute");
        }
        String[] missingValues = attribute.getMissingValueCode();
        boolean isMissingValue = isMissingValue(value, missingValues);
        if (isMissingValue) {
            continue;
        }
        String name = attribute.getDBFieldName();
        String attributeType = getAttributeType(attribute);

        if (!firstAttribute) {
            sqlAttributePart.append(COMMA);
            sqlDataPart.append(COMMA);
        }

        sqlAttributePart.append(name);
        Domain domain = attribute.getDomain();

        /* If attributeType is "datetime", convert to a timestamp
         * and wrap single quotes around the value. But only if we
         * have a format string!
         */
        if (attributeType.equalsIgnoreCase("datetime")) {
            String formatString = ((DateTimeDomain) domain).getFormatString();

            // Transform the datetime format string for database compatibility
            formatString = transformFormatString(formatString);

            // Transform the datetime value for database compatibility
            value = transformDatetime(value);

            value = escapeSpecialCharacterInData(value);
            sqlDataPart.append(TO_DATE_FUNCTION);
            sqlDataPart.append(LEFTPARENTH);

            sqlDataPart.append(SINGLEQUOTE);
            sqlDataPart.append(value);
            sqlDataPart.append(SINGLEQUOTE);

            sqlDataPart.append(COMMA);

            sqlDataPart.append(SINGLEQUOTE);
            sqlDataPart.append(formatString);
            sqlDataPart.append(SINGLEQUOTE);

            sqlDataPart.append(RIGHTPARENTH);
            hasValueCounter++;
            log.debug("datetime value expression= " + sqlDataPart.toString());
        }
        /* If domain is null or it is not NumericDomain we assign it text type
         * and wrap single quotes around the value.
         */
        else if (attributeType.equals("string")) {
            value = escapeSpecialCharacterInData(value);
            sqlDataPart.append(SINGLEQUOTE);
            sqlDataPart.append(value);
            sqlDataPart.append(SINGLEQUOTE);
            hasValueCounter++;
        }
        /* Else we have a NumericDomain. Determine whether it is a float or
         * integer.
         */
        else {

            String dataType = mapDataType(attributeType);

            try {
                if (dataType.equals("FLOAT")) {
                    Float floatObj = new Float(value);
                    float floatNum = floatObj.floatValue();
                    sqlDataPart.append(floatNum);
                } else {
                    Integer integerObj = new Integer(value);
                    int integerNum = integerObj.intValue();
                    sqlDataPart.append(integerNum);
                }
            } catch (Exception e) {
                log.error("Error determining numeric value: " + e.getMessage());
                throw new DataNotMatchingMetadataException(
                        "Data value '" + value + "' is NOT the expected data type of '" + dataType + "'");
            }
            hasValueCounter++;
        }

        firstAttribute = false;
    }

    // If all data is null, return null value for sql string.
    if (NULLValueCounter == list.length || hasValueCounter == 0) {
        return sqlString;
    }

    sqlAttributePart.append(RIGHTPARENTH);
    sqlDataPart.append(RIGHTPARENTH);
    sqlDataPart.append(SEMICOLON);

    // Combine the two parts
    sqlAttributePart.append(sqlDataPart.toString());
    sqlString = sqlAttributePart.toString();

    return sqlString;
}

From source file:edu.ku.brc.af.ui.forms.formatters.DataObjFieldFormatSinglePanel.java

/**
 * @param formatter/*from w  w w. j a  v a  2 s .  co  m*/
 */
protected void setFormatterFromTextPane(final DataObjSwitchFormatter formatter) {
    // visit every character in the document text looking for fields
    // store characters not associated with components (jbutton) to make up the separator text
    DefaultStyledDocument doc = (DefaultStyledDocument) formatEditor.getStyledDocument();
    String text = formatEditor.getText();
    int docLen = doc.getLength();
    int lastFieldPos = 0;

    Vector<DataObjDataField> fields = new Vector<DataObjDataField>();
    //int cnt = 0;
    for (int i = 0; i < docLen; ++i) {
        Element element = doc.getCharacterElement(i);
        AttributeSet attrs = element.getAttributes();
        Object obj = attrs.getAttribute(StyleConstants.ComponentAttribute);
        //System.out.print(String.format("i: %d, lastFieldPos: %d cnt: %d, F: %s", i, lastFieldPos, cnt, (obj instanceof FieldDefinitionComp ? "Y" : "N")));
        if (obj instanceof FieldDefinitionComp) {
            //System.out.println(cnt+"  "+(obj instanceof FieldDefinitionComp));
            // found button at the current position
            // create corresponding field
            String sepStr = (lastFieldPos <= i - 1) ? text.substring(lastFieldPos, i) : "";

            FieldDefinitionComp fieldDefBtn = (FieldDefinitionComp) obj;
            DataObjDataField fmtField = fieldDefBtn.getValue();
            fmtField.setSep(sepStr);
            fields.add(fmtField);

            //System.out.print(" Sep: ["+sepStr+"]");

            lastFieldPos = i + 1;
            //cnt++;
        }
    }

    // XXX: what do we do with the remaining of the text? right now we ignore it
    // That's because we can't create an empty formatter field just to use the separator... 

    DataObjDataField[] fieldsArray = new DataObjDataField[fields.size()];
    for (int i = 0; i < fields.size(); ++i) {
        fieldsArray[i] = fields.elementAt(i);
    }

    DataObjDataFieldFormat singleFormatter = fieldsArray.length == 0 ? null
            : new DataObjDataFieldFormat("", tableInfo.getClassObj(), false, "", "", fieldsArray);
    formatter.setSingle(singleFormatter);
}

From source file:edu.umd.cfar.lamp.viper.util.StringHelp.java

/**
 * Split using a separator, but allow for the separator to occur
 * in nested parentheses without splitting.
 * <PRE>//from  w  w  w  .  ja  v a 2s.  c o  m
 *   E.g.   "1", 2*("2,3"), "4"
 *      would split into
 *        -- "1"
 *        -- 2*("2,3")
 *        -- "4"
 * </PRE>
 * If the data has an odd number of "s, it will append a " character
 * to the end. In order to include a quote character without delimiting
 * a string, use the \". For a \, use \\.
 * @param line the string to split
 * @param sep the seperator character, e.g. a comma
 * @return the split string
 */
public static String[] splitBySeparatorQuoteAndParen(String line, char sep) {
    boolean withinQuotes = false;
    String newLine = new String(line);
    Vector temp = new Vector();
    StringBuffer nextString = new StringBuffer();
    int nesting = 0;

    for (int i = 0; i < newLine.length(); i++) {
        char c = newLine.charAt(i);

        if (c == '\\') {
            if ((++i >= newLine.length()) && (nextString.length() > 0)) {
                temp.addElement(nextString.toString());
                break;
            } else {
                switch (newLine.charAt(i)) {
                case 'n':
                    nextString.append('\n');
                    break;

                case '"':
                    nextString.append('"');
                    break;

                default:
                    nextString.append(newLine.charAt(i));
                }
            }
        } else if (c == '"') {
            withinQuotes = !withinQuotes;
            nextString.append('"');
        } else if (!withinQuotes) {
            if (c == '(') {
                nesting++;
                nextString.append('(');
            } else if (c == ')') {
                nesting--;
                nextString.append(')');
            } else {
                if ((nesting == 0) && (c == sep)) {
                    temp.addElement(nextString.toString());
                    nextString.delete(0, nextString.length());
                } else {
                    nextString.append(newLine.charAt(i));
                }
            }
        } else {
            nextString.append(newLine.charAt(i));
        }
    }

    if (withinQuotes) {
        nextString.append('"');
    }

    temp.addElement(nextString.toString());

    String[] result = new String[temp.size()];

    for (int i = 0; i < result.length; i++) {
        result[i] = (String) temp.elementAt(i);
    }
    return (result);
}

From source file:org.apache.flex.forks.velocity.runtime.configuration.Configuration.java

/**
 * Get an array of strings associated with the given configuration
 * key.//from   w w  w  .  j a v  a  2s . co m
 *
 * @param key The configuration key.
 * @return The associated string array if key is found.
 * @exception ClassCastException is thrown if the key maps to an
 * object that is not a String/Vector.
 */
public String[] getStringArray(String key) {
    Object value = get(key);

    // What's your vector, Victor?
    Vector vector;
    if (value instanceof String) {
        vector = new Vector(1);
        vector.addElement(value);
    } else if (value instanceof Vector) {
        vector = (Vector) value;
    } else if (value == null) {
        if (defaults != null) {
            return defaults.getStringArray(key);
        } else {
            return new String[0];
        }
    } else {
        throw new ClassCastException('\'' + key + "' doesn't map to a String/Vector object");
    }

    String[] tokens = new String[vector.size()];
    for (int i = 0; i < tokens.length; i++) {
        tokens[i] = (String) vector.elementAt(i);
    }

    return tokens;
}

From source file:Gen.java

public static void genWeb() throws Exception {

    String GEN_WEBINF = GEN_ROOT + FILE_SEPARATOR + "war" + FILE_SEPARATOR + "WEB-INF";

    String WAR_NAME = System.getProperty("warname") != null && !System.getProperty("warname").equals("")
            ? System.getProperty("warname")
            : MAPPING_JAR_NAME.substring(0, MAPPING_JAR_NAME.length() - "jar".length()) + "war";
    if (!WAR_NAME.endsWith(".war"))
        WAR_NAME += ".war";

    String PROPS_EMBED = System.getProperty("propsembed") != null
            && !System.getProperty("propsembed").equals("") ? System.getProperty("propsembed") : null;

    deleteDir(GEN_ROOT + FILE_SEPARATOR + "war");

    regenerateDir(GEN_WEBINF + FILE_SEPARATOR + "classes");
    regenerateDir(GEN_WEBINF + FILE_SEPARATOR + "lib");

    Vector<String> warJars = new Vector<String>();
    warJars.add(GEN_ROOT_LIB + FILE_SEPARATOR + MAPPING_JAR_NAME);

    InputStream inputStreamCore = Gen.class.getResourceAsStream("/biocep-core-tomcat.jar");
    if (inputStreamCore != null) {
        try {/*from   ww w .j  av  a  2  s  .co  m*/
            byte data[] = new byte[BUFFER_SIZE];
            FileOutputStream fos = new FileOutputStream(
                    GEN_WEBINF + FILE_SEPARATOR + "lib" + "/biocep-core.jar");
            int count = 0;
            while ((count = inputStreamCore.read(data, 0, BUFFER_SIZE)) != -1) {
                fos.write(data, 0, count);
            }
            fos.flush();
            fos.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {

        warJars.add("RJB.jar");

        warJars.add("lib/desktop/JRI.jar");

        FilenameFilter jarsFilter = new FilenameFilter() {
            public boolean accept(File arg0, String arg1) {
                return arg1.endsWith(".jar");
            }
        };

        {
            String[] derby_jdbc_jars = new File("lib/jdbc").list(jarsFilter);
            for (int i = 0; i < derby_jdbc_jars.length; ++i) {
                warJars.add("lib/jdbc" + FILE_SEPARATOR + derby_jdbc_jars[i]);
            }
        }

        {
            String[] pool_jars = new File("lib/pool").list(jarsFilter);
            for (int i = 0; i < pool_jars.length; ++i) {
                warJars.add("lib/pool" + FILE_SEPARATOR + pool_jars[i]);
            }
        }

        {
            String[] httpclient_jars = new File("lib/j2ee").list(jarsFilter);
            for (int i = 0; i < httpclient_jars.length; ++i) {
                warJars.add("lib/j2ee" + FILE_SEPARATOR + httpclient_jars[i]);
            }
        }
    }

    log.info(warJars);
    for (int i = 0; i < warJars.size(); ++i) {
        Copy copyTask = new Copy();
        copyTask.setProject(_project);
        copyTask.setTaskName("copy to war");
        copyTask.setTodir(new File(GEN_WEBINF + FILE_SEPARATOR + "lib"));
        copyTask.setFile(new File(warJars.elementAt(i)));
        copyTask.init();
        copyTask.execute();
    }

    unzip(Gen.class.getResourceAsStream("/jaxws.zip"), GEN_WEBINF + FILE_SEPARATOR + "lib",
            new EqualNameFilter("activation.jar", "jaxb-api.jar", "jaxb-impl.jar", "jaxb-xjc.jar",
                    "jaxws-api.jar", "jaxws-libs.jar", "jaxws-rt.jar", "jaxws-tools.jar", "jsr173_api.jar",
                    "jsr181-api.jar", "jsr250-api.jar", "saaj-api.jar", "saaj-impl.jar", "sjsxp.jar",
                    "FastInfoset.jar", "http.jar", "mysql-connector-java-5.1.0-bin.jar", "ojdbc-14.jar"),
            BUFFER_SIZE, false, "Unzipping psTools..", 17);

    PrintWriter pw_web_xml = new PrintWriter(GEN_WEBINF + FILE_SEPARATOR + "web.xml");
    pw_web_xml.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    pw_web_xml.println(
            "<web-app version=\"2.4\" xmlns=\"http://java.sun.com/xml/ns/j2ee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">");
    pw_web_xml.println(
            "<listener><listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class></listener>");

    for (String className : DirectJNI._rPackageInterfacesHash.keySet()) {
        String shortClassName = className.substring(className.lastIndexOf('.') + 1);
        pw_web_xml.println("<servlet><servlet-name>" + shortClassName
                + "_servlet</servlet-name><servlet-class>org.kchine.r.server.http.frontend.InterceptorServlet</servlet-class><load-on-startup>1</load-on-startup></servlet>");
    }

    pw_web_xml.println("<servlet><servlet-name>" + "WSServlet"
            + "</servlet-name><servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class><load-on-startup>1</load-on-startup></servlet>");

    pw_web_xml.println("<servlet><servlet-name>" + "MappingClassServlet"
            + "</servlet-name><servlet-class>org.kchine.r.server.http.frontend.MappingClassServlet</servlet-class><load-on-startup>1</load-on-startup></servlet>");

    for (String className : DirectJNI._rPackageInterfacesHash.keySet()) {
        String shortClassName = className.substring(className.lastIndexOf('.') + 1);
        pw_web_xml.println(
                "<servlet-mapping><servlet-name>" + shortClassName + "_servlet</servlet-name><url-pattern>/"
                        + shortClassName + "</url-pattern></servlet-mapping>");
    }

    pw_web_xml.println("<servlet-mapping><servlet-name>" + "MappingClassServlet"
            + "</servlet-name><url-pattern>" + "/mapping/classes/*" + "</url-pattern></servlet-mapping>");

    pw_web_xml.println("<session-config><session-timeout>30</session-timeout></session-config>");
    pw_web_xml.println("</web-app>");
    pw_web_xml.flush();
    pw_web_xml.close();

    PrintWriter pw_sun_jaxws_xml = new PrintWriter(GEN_WEBINF + FILE_SEPARATOR + "sun-jaxws.xml");
    pw_sun_jaxws_xml.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    pw_sun_jaxws_xml.println("<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>");

    for (String className : DirectJNI._rPackageInterfacesHash.keySet()) {
        String shortClassName = className.substring(className.lastIndexOf('.') + 1);
        pw_sun_jaxws_xml.println("   <endpoint    name='name_" + shortClassName + "'   implementation='"
                + className + "Web" + "' url-pattern='/" + shortClassName + "'/>");
    }

    pw_sun_jaxws_xml.println("</endpoints>");
    pw_sun_jaxws_xml.flush();
    pw_sun_jaxws_xml.close();

    if (PROPS_EMBED != null) {
        InputStream is = new FileInputStream(PROPS_EMBED);
        byte[] buffer = new byte[is.available()];
        is.read(buffer);
        RandomAccessFile raf = new RandomAccessFile(
                GEN_WEBINF + FILE_SEPARATOR + "classes" + FILE_SEPARATOR + "globals.properties", "rw");
        raf.setLength(0);
        raf.write(buffer);
        raf.close();
    }

    War warTask = new War();
    warTask.setProject(_project);
    warTask.setTaskName("war");
    warTask.setBasedir(new File(GEN_ROOT + FILE_SEPARATOR + "war"));
    warTask.setDestFile(new File(GEN_ROOT + FILE_SEPARATOR + WAR_NAME));
    warTask.setIncludes("**/*");
    warTask.init();
    warTask.execute();

}

From source file:org.accada.reader.rprm.core.ReaderDevice.java

/**
 * Returns a list of NTP servers used by the device to synchronize its
 * current UTC clock.//from  w  ww  . j  a  v a 2 s  .  co m
 * @return A list of NTP servers used by the device to synchronize its
 *         current UTC clock
 */
public final String[] getNTPservers() {
    int timeout = 1000;
    int validMs = 1000; // The number of milliseconds after which the
                        // ntpServers attribute will be refreshed.
    if (System.currentTimeMillis() - lastNTPServersRefreshTimestamp.getTime() > validMs) {
        if (ntpServerFinder != null) {
            Vector<InetAddress> servers = ntpServerFinder.findNTPServers(timeout);
            ntpServers = new String[servers.size()];
            for (int i = 0; i < servers.size(); i++) {
                ntpServers[i] = servers.elementAt(i).getHostAddress() + "/123";
            }
            lastNTPServersRefreshTimestamp = new Date();
        }
    }
    return ntpServers;
}

From source file:knop.psfj.FovDataSet.java

/**
 * Save the landmark points into a file.
 *
 * @param sourceList the source list//from  ww  w . ja  v  a  2s . c o  m
 * @param targetList the target list
 * @param filename the filename
 */
private void savePoints(Vector<Point> sourceList, Vector<Point> targetList, String filename) {

    try {
        final FileWriter fw = new FileWriter(filename);

        Point sourcePoint;
        Point targetPoint;
        String n;
        String xSource;
        String ySource;
        String xTarget;
        String yTarget;
        fw.write("Index\txSource\tySource\txTarget\tyTarget\n");
        for (int k = 0; (k < sourceList.size()); k++) {
            n = "" + k;
            while (n.length() < 5) {
                n = " " + n;
            }
            sourcePoint = (Point) sourceList.elementAt(k);
            xSource = "" + sourcePoint.x;
            while (xSource.length() < 7) {
                xSource = " " + xSource;
            }
            ySource = "" + sourcePoint.y;
            while (ySource.length() < 7) {
                ySource = " " + ySource;
            }
            targetPoint = (Point) targetList.elementAt(k);
            xTarget = "" + targetPoint.x;
            while (xTarget.length() < 7) {
                xTarget = " " + xTarget;
            }
            yTarget = "" + targetPoint.y;
            while (yTarget.length() < 7) {
                yTarget = " " + yTarget;
            }
            fw.write(n + "\t" + xSource + "\t" + ySource + "\t" + xTarget + "\t" + yTarget + "\n");
        }
        fw.close();
    } catch (IOException e) {
        IJ.error("IOException exception" + e);
    } catch (SecurityException e) {
        IJ.error("Security exception" + e);
    }
}

From source file:org.apache.axis.wsdl.toJava.JavaGeneratorFactory.java

/**
 * setFaultContext:// w  w  w .  j  av  a2s.  co m
 * Helper routine for the setFaultContext method above.
 * Examines the indicated fault and sets COMPLEX_TYPE_FAULT
 * EXCEPTION_DATA_TYPE and EXCEPTION_CLASS_NAME as appropriate.
 *
 * @param fault       FaultInfo to analyze
 * @param symbolTable SymbolTable
 */
private void setFaultContext(FaultInfo fault, SymbolTable symbolTable) {

    QName faultXmlType = null;
    Vector parts = new Vector();

    // Get the parts of the fault's message.
    // An IOException is thrown if the parts cannot be
    // processed.  Skip such parts for this analysis
    try {
        symbolTable.getParametersFromParts(parts, fault.getMessage().getOrderedParts(null), false,
                fault.getName(), null);
    } catch (IOException e) {
    }

    // Inspect each TypeEntry referenced in a Fault Message Part
    String exceptionClassName = null;

    for (int j = 0; j < parts.size(); j++) {
        TypeEntry te = ((Parameter) (parts.elementAt(j))).getType();

        // If the TypeEntry is an element, advance to the type.
        // This occurs if the message part uses the element= attribute
        TypeEntry elementTE = null;

        if (te instanceof Element) {
            elementTE = te;
            te = te.getRefType();
        }

        // remember the QName of the type.
        faultXmlType = te.getQName();

        // Determine if the te should be processed using the
        // simple type mapping or the complex type mapping
        // NOTE: treat array types as simple types
        if ((te.getBaseType() != null) || te.isSimpleType()
                || ((te.getDimensions().length() > 0) && (te.getRefType().getBaseType() != null))) {

            // Simple Type Exception
        } else {

            // Complex Type Exception
            Boolean isComplexFault = (Boolean) te.getDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT);

            if ((isComplexFault == null) || !isComplexFault.booleanValue()) {

                // Mark the type as a complex type fault
                te.setDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT, Boolean.TRUE);

                if (elementTE != null) {
                    te.setDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT, Boolean.TRUE);
                }

                // Mark all derived types as Complex Faults
                HashSet derivedSet = org.apache.axis.wsdl.symbolTable.Utils.getDerivedTypes(te, symbolTable);
                Iterator derivedI = derivedSet.iterator();

                while (derivedI.hasNext()) {
                    TypeEntry derivedTE = (TypeEntry) derivedI.next();

                    derivedTE.setDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT, Boolean.TRUE);
                }

                // Mark all base types as Complex Faults
                TypeEntry base = SchemaUtils.getComplexElementExtensionBase(te.getNode(), symbolTable);

                while (base != null) {
                    base.setDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT, Boolean.TRUE);

                    base = SchemaUtils.getComplexElementExtensionBase(base.getNode(), symbolTable);
                }
            }

            // The exception class name is the name of the type
            exceptionClassName = te.getName();
        }
    }

    String excName = getExceptionJavaNameHook(fault.getMessage().getQName()); //     for derived class
    if (excName != null) {
        exceptionClassName = excName;
    }

    // Set the name of the exception and
    // whether the exception is a complex type
    MessageEntry me = symbolTable.getMessageEntry(fault.getMessage().getQName());

    if (me != null) {
        me.setDynamicVar(JavaGeneratorFactory.EXCEPTION_DATA_TYPE, faultXmlType);

        if (exceptionClassName != null) {
            me.setDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT, Boolean.TRUE);
            me.setDynamicVar(JavaGeneratorFactory.EXCEPTION_CLASS_NAME, exceptionClassName);
        } else {
            me.setDynamicVar(JavaGeneratorFactory.EXCEPTION_CLASS_NAME, emitter.getJavaName(me.getQName()));
        }
    }
}

From source file:gov.nih.nci.evs.browser.utils.SourceTreeUtils.java

public LocalNameList vector2LocalNameList(Vector<String> v) {
    if (v == null)
        return null;
    LocalNameList list = new LocalNameList();
    for (int i = 0; i < v.size(); i++) {
        String vEntry = (String) v.elementAt(i);
        list.addEntry(vEntry);// w  w w .  jav a  2  s.  com
    }
    return list;
}

From source file:org.agnitas.backend.Data.java

/**
 * find an entry from the media record for this mailing
 * @param m instance of media record//from  ww  w  .  ja  v  a 2 s.c  o m
 * @param id the ID to look for
 * @param dflt a default value if no entry is found
 * @return the found entry or the default
 */
public String findMediadata(Media m, String id, String dflt) {
    String rc;

    Vector<String> v = m.findParameterValues(id);
    rc = null;
    if ((v != null) && (v.size() > 0))
        rc = v.elementAt(0);
    return rc == null ? dflt : rc;
}