Example usage for java.util ArrayList toArray

List of usage examples for java.util ArrayList toArray

Introduction

In this page you can find the example usage for java.util ArrayList toArray.

Prototype

public Object[] toArray() 

Source Link

Document

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

Usage

From source file:easycare.alc.service.report.HstPrescriptionReportBean.java

public String getSignatureDetails() {
    ArrayList<String> names = Lists.newArrayList(hstPrescription.getPhysicianFirstName(),
            hstPrescription.getPhysicianLastName());

    if (hstPrescription.getPhysicianTitle() != null) {
        names.add(0, messageSource.getTitleMessage(hstPrescription.getPhysicianTitle()));
    }/*from  w  w  w .j a va  2 s  .co m*/

    String fullName = StringUtils.join(names, " ");

    ArrayList<String> args = Lists.newArrayList(fullName, hstPrescription.getPhysicianLicenseNumber());
    return messageSource.getMessage(REPORT_PDF_SIGNATURE_DETAILS_KEY, args.toArray());
}

From source file:net.ageto.gyrex.impex.common.steps.impl.filename.FirstFilenameInAlphabeticalOrder.java

@SuppressWarnings("unchecked")
@Override//from   w ww.j  av a2 s .  co  m
protected StatusStep process() {

    // file path
    String filepath = (String) getInputParam(
            FirstFilenameInAlphabeticalOrderDefinition.InputParamNames.INPUT_FILEPATH.name());

    // file extensions
    ArrayList<String> fileExtension = (ArrayList<String>) getInputParam(
            FirstFilenameInAlphabeticalOrderDefinition.InputParamNames.INPUT_FILE_EXTENSION_FILTER.name());

    String[] fileExtensionsArray = fileExtension == null ? null : (String[]) fileExtension.toArray();

    // recursive, include subdirectories
    Boolean recursive = (Boolean) getInputParam(
            FirstFilenameInAlphabeticalOrderDefinition.InputParamNames.INPUT_INCLUDE_SUBDIRECTORIES.name());

    // all files from the given file path
    Collection<File> listFiles = FileUtils.listFiles(new File(filepath), fileExtensionsArray,
            BooleanUtils.toBoolean(recursive));

    if (listFiles.size() == 0) {
        processWarn("No file was found in folder \"{0}\" with file extension \"{1}\".", filepath,
                StringUtils.defaultIfEmpty(StringUtils.join(fileExtensionsArray, " "), "*"));
        // cancel process
        return StatusStep.CANCEL;
    }

    // fetch first file (alphabetical order)
    for (File file : listFiles) {
        setOutputParam(FirstFilenameInAlphabeticalOrderDefinition.OutputParamNames.OUTPUT_FILENAME.name(),
                file.getAbsolutePath());
        processInfo("File \"{0}\" was found in folder \"{1}\" with file extension \"{2}\".",
                file.getAbsolutePath(), filepath,
                StringUtils.defaultIfEmpty(StringUtils.join(fileExtensionsArray, " "), "*"));
        break;
    }

    processInfo("{0} has been completed successfully.", ID);

    return StatusStep.OK;
}

From source file:com.projity.grouping.core.transform.filtering.NodeFilter.java

public Object[] filterArray(Object[] list) {
    if (list == null)
        return null;
    ArrayList filtered = new ArrayList(list.length);
    for (int i = 0; i < list.length; i++) {
        Object obj = list[i];//from  w w w  .j  a  v a2s. c  o m
        if (evaluate(obj))
            filtered.add(obj);
    }
    return filtered.toArray();
}

From source file:fr.juanwolf.mysqlbinlogreplicator.service.MysqlBinLogService.java

void getColumnName() {
    log.info("Retrieving columns informations from the database.");
    List<String> tableExpected = new ArrayList<>(domainClassAnalyzer.getMappingTablesExpected());
    tableExpected.addAll(domainClassAnalyzer.getNestedTables());
    columnMap = new HashMap<>();
    for (String tableName : tableExpected) {
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("tableschema", schemaExpected);
        paramMap.put("tablename", tableName);
        List<Map<String, Object>> columnsMap = namedParameterJdbcTemplate.queryForList(SQL, paramMap);
        ArrayList<String> columnsList = new ArrayList<>();
        for (Map<String, Object> column : columnsMap) {
            columnsList.add((String) column.get("COLUMN_NAME"));
        }//from  w  ww  . ja va  2s .co m
        log.debug("Columns found for {} : {}", tableName, Arrays.toString(columnsList.toArray()));
        columnMap.put(tableName, columnsList.toArray());
    }
}

From source file:de.teambluebaer.patientix.helper.RestfulHelper.java

/**
 * Method which post data to the server/*w  w  w.jav  a  2s .co m*/
 *
 * @param restMethod Method which to be set
 * @param pM         Parameter-Map for the post request
 */
public synchronized void postDataToServer(final String restMethod, final ArrayList<NameValuePair> pM) {
    if (DEBUG) {
        Log.d("pm", pM.toArray().toString());
        Log.d("restMethod", restMethod);
    }
    response = null;
    client = createHttpClient();

    try {
        if (DEBUG) {
            Log.d("POST_URL: ", POST_URL);
        }
        post = new HttpPost(POST_URL);
        post.setEntity(new UrlEncodedFormEntity(pM));
        Log.d("Http", new UrlEncodedFormEntity(pM).toString());
        response = client.execute(post);
        responseArray = IOUtils.toByteArray(response.getEntity().getContent());
        responseString = getStringFromInputStream(responseArray);
        responseCode = response.getStatusLine().getStatusCode();
    } catch (NullPointerException e) {
        e.printStackTrace();
        Log.d("Fehler: ", String.valueOf(true));
        Log.d("Fehler", e.toString());

    } catch (ClientProtocolException e) {
        e.printStackTrace();
        Log.d("Fehler: ", String.valueOf(true));
        Log.d("Fehler", e.toString());

    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
        Log.d("Fehler: ", String.valueOf(true));
        Log.d("Fehler", e.toString());

    } catch (IOException e) {
        e.printStackTrace();
        responseCode = 503;
        Log.d("Fehler: ", String.valueOf(true));
        Log.d("Fehler", e.toString());

    }
}

From source file:boundary.ReportProduce.java

public void setTable() {
    DefaultTableModel model = new DefaultTableModel();
    jTable1.setModel(model);/*  w ww . j  ava  2 s.  c  o  m*/
    model.addColumn("No.");
    model.addColumn("Title");
    model.addColumn("Status");
    model.addColumn("Recording Session No.");
    model.addColumn("Recording Date");

    for (Map.Entry<Integer, ArrayList<Object>> entry : ReportProduceControl
            .getRecordings(String.valueOf(jComboBox1.getSelectedItem())).entrySet()) {
        Integer key = entry.getKey();
        ArrayList<Object> value = entry.getValue();
        value.add(0, key);
        model.addRow(value.toArray());
    }

    jTable1.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (jTable1.getSelectedRow() > -1) {
                setSoundmanTbl((String) jTable1.getValueAt(jTable1.getSelectedRow(), 3));
                setMusicianTbl((String) jTable1.getValueAt(jTable1.getSelectedRow(), 3));
            }
        }
    });
}

From source file:com.espertech.esper.support.util.ArrayAssertionUtil.java

/**
 * Compare the objects in the two object arrays.
 * @param iterator returns the data to assertEqualsExactOrder against
 * @param expectedValues is the expected values
 *///from   w ww  . ja v  a2 s .  c om
public static void assertEqualsExactOrder(Iterator iterator, Object[] expectedValues) {
    ArrayList<Object> values = new ArrayList<Object>();
    while (iterator.hasNext()) {
        values.add(iterator.next());
    }

    try {
        iterator.next();
        TestCase.fail();
    } catch (NoSuchElementException ex) {
        // Expected exception - next called after hasNext returned false, for testing
    }

    Object[] data = null;
    if (values.size() > 0) {
        data = values.toArray();
    }

    assertEqualsExactOrder(data, expectedValues);
}

From source file:com.celements.menu.MenuService.java

public List<BaseObject> getSubMenuItems(Integer headerId) {
    TreeMap<Integer, BaseObject> menuItemsMap = new TreeMap<Integer, BaseObject>();
    addMenuItems(menuItemsMap, headerId);
    getContext().setDatabase("celements2web");
    addMenuItems(menuItemsMap, headerId);
    getContext().setDatabase(getContext().getOriginalDatabase());
    ArrayList<BaseObject> resultList = new ArrayList<BaseObject>();
    resultList.addAll(menuItemsMap.values());
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("getSubMenuItems_internal returning: " + Arrays.deepToString(resultList.toArray()));
    }/*  www.  j av  a2 s .c o  m*/
    LOGGER.debug("getSubMenuItems_internal end");
    return resultList;
}

From source file:com.celements.menu.MenuService.java

public List<BaseObject> getMenuHeaders() {
    LOGGER.trace("getMenuHeaders_internal start");
    TreeMap<Integer, BaseObject> menuHeadersMap = new TreeMap<Integer, BaseObject>();
    addMenuHeaders(menuHeadersMap);//  w w  w  .j  a v  a  2s  .c om
    getContext().setDatabase("celements2web");
    addMenuHeaders(menuHeadersMap);
    getContext().setDatabase(getContext().getOriginalDatabase());
    ArrayList<BaseObject> resultList = new ArrayList<BaseObject>();
    resultList.addAll(menuHeadersMap.values());
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("getMenuHeaders_internal returning: " + Arrays.deepToString(resultList.toArray()));
    }
    LOGGER.debug("getMenuHeaders_internal end");
    return resultList;
}

From source file:fr.inria.corese.rdftograph.driver.OrientDbDriver.java

@Override
public Object createRelationship(Value source, Value object, String predicate, Map<String, Object> properties) {
    Object result = null;/*from   ww  w . ja  va  2 s . c  o  m*/
    Vertex vSource = createOrGetNode(source);
    Vertex vObject = createOrGetNode(object);
    ArrayList<Object> p = new ArrayList<>();
    properties.keySet().stream().forEach((key) -> {
        p.add(key);
        p.add(properties.get(key));
    });
    p.add(EDGE_P);
    p.add(predicate);
    Edge e = vSource.addEdge(RDF_EDGE_LABEL, vObject, p.toArray());
    result = e.id();
    return result;
}