Example usage for java.lang Byte Byte

List of usage examples for java.lang Byte Byte

Introduction

In this page you can find the example usage for java.lang Byte Byte.

Prototype

@Deprecated(since = "9")
public Byte(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Byte object that represents the byte value indicated by the String parameter.

Usage

From source file:com.jaspersoft.jasperserver.test.ReportSchedulingTestTestNG.java

private void testListJobs(long jobId_01, long jobId_02, String userName) {
    // test Mail Notification
    ReportJobModel criteria = new ReportJobModel();
    ReportJobMailNotificationModel mailNotificationModel = new ReportJobMailNotificationModel();
    mailNotificationModel.setSubject("updated subject");
    criteria.setMailNotificationModel(mailNotificationModel);
    ArrayList<Long> expectedJob01 = new ArrayList<Long>();
    expectedJob01.add(jobId_01);//from w ww  . j av  a  2 s  .c o m
    compareResult(criteria, expectedJob01);
    // test base report job
    criteria = new ReportJobModel();
    criteria.setLabel("foo");
    compareResult(criteria, expectedJob01);
    // test output format
    criteria = new ReportJobModel();
    Set<Byte> outputFormats = new HashSet<Byte>();
    outputFormats.add(ReportJob.OUTPUT_FORMAT_PDF);
    criteria.setOutputFormatsSet(outputFormats);
    ArrayList<Long> expectedJobBOTH = new ArrayList<Long>();
    expectedJobBOTH.add(jobId_01);
    expectedJobBOTH.add(jobId_02);
    compareResult(criteria, expectedJobBOTH);
    // test user name
    criteria = new ReportJobModel();
    criteria.setUsername(userName);
    compareResult(criteria, expectedJobBOTH);

    // test trigger
    criteria = new ReportJobModel();
    ReportJobCalendarTriggerModel reportJobCalendarTriggerModel = new ReportJobCalendarTriggerModel();
    TreeSet months = new TreeSet();
    months.add(new Byte((byte) 1));
    months.add(new Byte((byte) 2));
    months.add(new Byte((byte) 3));
    reportJobCalendarTriggerModel.setMonths(months);
    criteria.setTriggerModel(reportJobCalendarTriggerModel);
    ArrayList<Long> expectedJob02 = new ArrayList<Long>();
    expectedJob02.add(jobId_02);
    compareResult(criteria, expectedJob02);
    // test data source
    criteria = new ReportJobModel();
    ReportJobSourceModel reportJobSourceModel = new ReportJobSourceModel();
    reportJobSourceModel.setReportUnitURI("/test/reportURI");
    criteria.setSourceModel(reportJobSourceModel);
    compareResult(criteria, expectedJob01);
    // test repository destination
    criteria = new ReportJobModel();
    ReportJobRepositoryDestinationModel reportJobRepositoryDestinationModel = new ReportJobRepositoryDestinationModel();
    reportJobRepositoryDestinationModel.setSequentialFilenames(false);
    criteria.setContentRepositoryDestinationModel(reportJobRepositoryDestinationModel);
    compareResult(criteria, expectedJob02);
    // test ftp info
    criteria = new ReportJobModel();
    reportJobRepositoryDestinationModel = new ReportJobRepositoryDestinationModel();
    FTPInfoModel ftpInfoModel = new FTPInfoModel();
    ftpInfoModel.setUserName("JohnSmith");
    reportJobRepositoryDestinationModel.setOutputFTPInfoModel(ftpInfoModel);
    criteria.setContentRepositoryDestinationModel(reportJobRepositoryDestinationModel);
    compareResult(criteria, expectedJob02);
    // should return none
    criteria.setMailNotificationModel(mailNotificationModel);
    compareResult(criteria, new ArrayList<Long>());
    // text email
    criteria = new ReportJobModel();
    mailNotificationModel = new ReportJobMailNotificationModel();
    ArrayList<String> toAddress = new ArrayList<String>();
    toAddress.add("peter@pan.com");
    mailNotificationModel.setToAddresses(toAddress);
    criteria.setMailNotificationModel(mailNotificationModel);
    compareResult(criteria, expectedJob02);
}

From source file:org.wso2.carbon.dataservices.core.description.query.SQLQuery.java

private void setTinyIntValue(int queryType, String value, String paramType, PreparedStatement sqlQuery, int i)
        throws SQLException {
    Byte val = null;
    if (value != null) {
        val = new Byte(value);
    }/*  ww w .j a v a2s  .c om*/
    if (QueryTypes.IN.equals(paramType)) {
        if (queryType == SQLQuery.DS_QUERY_TYPE_NORMAL) {
            if (value == null) {
                sqlQuery.setNull(i + 1, java.sql.Types.TINYINT);
            } else {
                sqlQuery.setByte(i + 1, val);
            }
        } else {
            if (value == null) {
                ((CallableStatement) sqlQuery).setNull(i + 1, java.sql.Types.TINYINT);
            } else {
                ((CallableStatement) sqlQuery).setByte(i + 1, val);
            }
        }
    } else if (QueryTypes.INOUT.equals(paramType)) {
        if (value == null) {
            ((CallableStatement) sqlQuery).setNull(i + 1, java.sql.Types.TINYINT);
        } else {
            ((CallableStatement) sqlQuery).setByte(i + 1, val);
        }
        ((CallableStatement) sqlQuery).registerOutParameter(i + 1, java.sql.Types.TINYINT);
    } else {
        ((CallableStatement) sqlQuery).registerOutParameter(i + 1, java.sql.Types.TINYINT);
    }
}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link EvaluationTimeEnum}.
 *///from  w w  w .  jav  a  2  s.  c o m
public static Map getEvaluationTimeMap() {
    if (evaluationTimeMap == null) {
        Map map = new HashMap(19);
        map.put(EVALUATION_TIME_NOW, new Byte(JRExpression.EVALUATION_TIME_NOW));
        map.put(EVALUATION_TIME_REPORT, new Byte(JRExpression.EVALUATION_TIME_REPORT));
        map.put(EVALUATION_TIME_PAGE, new Byte(JRExpression.EVALUATION_TIME_PAGE));
        map.put(EVALUATION_TIME_COLUMN, new Byte(JRExpression.EVALUATION_TIME_COLUMN));
        map.put(EVALUATION_TIME_GROUP, new Byte(JRExpression.EVALUATION_TIME_GROUP));
        map.put(EVALUATION_TIME_BAND, new Byte(JRExpression.EVALUATION_TIME_BAND));
        map.put(EVALUATION_TIME_AUTO, new Byte(JRExpression.EVALUATION_TIME_AUTO));
        map.put(new Byte(JRExpression.EVALUATION_TIME_NOW), EVALUATION_TIME_NOW);
        map.put(new Byte(JRExpression.EVALUATION_TIME_REPORT), EVALUATION_TIME_REPORT);
        map.put(new Byte(JRExpression.EVALUATION_TIME_PAGE), EVALUATION_TIME_PAGE);
        map.put(new Byte(JRExpression.EVALUATION_TIME_COLUMN), EVALUATION_TIME_COLUMN);
        map.put(new Byte(JRExpression.EVALUATION_TIME_GROUP), EVALUATION_TIME_GROUP);
        map.put(new Byte(JRExpression.EVALUATION_TIME_BAND), EVALUATION_TIME_BAND);
        map.put(new Byte(JRExpression.EVALUATION_TIME_AUTO), EVALUATION_TIME_AUTO);
        evaluationTimeMap = Collections.unmodifiableMap(map);
    }

    return evaluationTimeMap;
}

From source file:lasige.steeldb.jdbc.BFTRowSet.java

/**
 * Retrieves the value of the designated column in the current row
 * of this <code>CachedRowSetImpl</code> object as a
 * <code>byte</code> value./*from w  w w . ja v  a 2 s.  c o m*/
 *
 * @param columnIndex the first column is <code>1</code>, the second
 *        is <code>2</code>, and so on; must be <code>1</code> or larger
 *        and equal to or less than the number of columns in the rowset
 * @return the column value as a <code>byte</code> in the Java programming
 * language; if the value is SQL <code>NULL</code>, the result is <code>0</code>
 * @throws SQLException if (1) the given column index is out of bounds,
 *            (2) the cursor is not on one of this rowset's rows or its
 *            insert row, or (3) the designated column does not store an
 *            SQL <code><b>TINYINT</b>, SMALLINT, INTEGER, BIGINT, REAL,
 *            FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
 *            or <code>LONGVARCHAR</code> value. The bold SQL type
 *            designates the recommended return type.
 * @see #getByte(String)
 */
public byte getByte(int columnIndex) throws SQLException {
    Object value;

    // sanity check.
    checkIndex(columnIndex);
    // make sure the cursor is on a valid row
    checkCursor();

    setLastValueNull(false);
    value = getCurrentRow().getColumnObject(columnIndex);

    // check for SQL NULL
    if (value == null) {
        setLastValueNull(true);
        return (byte) 0;
    }
    try {
        return ((new Byte(value.toString())).byteValue());
    } catch (NumberFormatException ex) {
        throw new SQLException(
                MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.bytefail").toString(),
                        new Object[] { value.toString().trim(), columnIndex }));
    }
}

From source file:com.sun.honeycomb.adm.client.AdminClientImpl.java

public int startUpgrade(byte cellid, boolean spDvdb)
        throws MgmtException, ConnectException, PermissionException {
    if (!loggedIn())
        throw new PermissionException();
    String spDvd;/*from  ww  w.  java  2s  . c om*/
    if (spDvdb) {
        spDvd = "true";
    } else {
        spDvd = "false";
    }

    String msg = AdminResourcesConstants.MSG_KEY_START_UPGRADE;

    Object[] params = { Long.toString(_sessionId) };
    this.extLog(ExtLevel.EXT_INFO, msg, params, "startUpgrade");

    return getUpgrade(cellid).startUpgrade(new StatusLoginCallback(this), spDvd, new Byte(cellid)).intValue();
}

From source file:com.sun.honeycomb.adm.client.AdminClientImpl.java

public int finishUpgrade(byte cellid, int type, boolean success)
        throws MgmtException, ConnectException, PermissionException {
    if (!loggedIn())
        throw new PermissionException();
    BigInteger intresponse;/*from  w w w .  ja  va  2 s .  c  o m*/
    if (success) {
        intresponse = BigInteger.valueOf(0);
    } else {
        intresponse = BigInteger.valueOf(1);
    }

    return getUpgrade(cellid).finishUpgrade(new StatusLoginCallback(this), BigInteger.valueOf(type),
            intresponse, new Byte(cellid)).intValue();

}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link JRHyperlinkHelper#getHyperlinkType(String)}.
 *///from  www  . j av a  2 s  .  com
public static Map getHyperlinkTypeMap() {
    if (hyperlinkTypeMap == null) {
        Map map = new HashMap(16);
        map.put(HYPERLINK_TYPE_NONE, new Byte(JRHyperlink.HYPERLINK_TYPE_NONE));
        map.put(HYPERLINK_TYPE_REFERENCE, new Byte(JRHyperlink.HYPERLINK_TYPE_REFERENCE));
        map.put(HYPERLINK_TYPE_LOCAL_ANCHOR, new Byte(JRHyperlink.HYPERLINK_TYPE_LOCAL_ANCHOR));
        map.put(HYPERLINK_TYPE_LOCAL_PAGE, new Byte(JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE));
        map.put(HYPERLINK_TYPE_REMOTE_ANCHOR, new Byte(JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR));
        map.put(HYPERLINK_TYPE_REMOTE_PAGE, new Byte(JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE));
        map.put(new Byte(JRHyperlink.HYPERLINK_TYPE_NONE), HYPERLINK_TYPE_NONE);
        map.put(new Byte(JRHyperlink.HYPERLINK_TYPE_REFERENCE), HYPERLINK_TYPE_REFERENCE);
        map.put(new Byte(JRHyperlink.HYPERLINK_TYPE_LOCAL_ANCHOR), HYPERLINK_TYPE_LOCAL_ANCHOR);
        map.put(new Byte(JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE), HYPERLINK_TYPE_LOCAL_PAGE);
        map.put(new Byte(JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR), HYPERLINK_TYPE_REMOTE_ANCHOR);
        map.put(new Byte(JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE), HYPERLINK_TYPE_REMOTE_PAGE);
        hyperlinkTypeMap = Collections.unmodifiableMap(map);
    }

    return hyperlinkTypeMap;
}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link JRHyperlinkHelper#getHyperlinkTarget(String)}.
 *//*from www  .  j  a v a  2s  .  co  m*/
public static Map getHyperlinkTargetMap() {
    if (hyperlinkTargetMap == null) {
        Map map = new HashMap(11);
        map.put(HYPERLINK_TARGET_SELF, new Byte(JRHyperlink.HYPERLINK_TARGET_SELF));
        map.put(HYPERLINK_TARGET_BLANK, new Byte(JRHyperlink.HYPERLINK_TARGET_BLANK));
        map.put(HYPERLINK_TARGET_PARENT, new Byte(JRHyperlink.HYPERLINK_TARGET_PARENT));
        map.put(HYPERLINK_TARGET_TOP, new Byte(JRHyperlink.HYPERLINK_TARGET_TOP));
        map.put(new Byte(JRHyperlink.HYPERLINK_TARGET_SELF), HYPERLINK_TARGET_SELF);
        map.put(new Byte(JRHyperlink.HYPERLINK_TARGET_BLANK), HYPERLINK_TARGET_BLANK);
        map.put(new Byte(JRHyperlink.HYPERLINK_TARGET_PARENT), HYPERLINK_TARGET_PARENT);
        map.put(new Byte(JRHyperlink.HYPERLINK_TARGET_TOP), HYPERLINK_TARGET_TOP);
        hyperlinkTargetMap = Collections.unmodifiableMap(map);
    }

    return hyperlinkTargetMap;
}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link EdgeEnum}.
 *//*from   w ww  .j  a v a 2  s.  co m*/
public static Map getChartEdgeMap() {
    if (chartEdgeMap == null) {
        Map map = new HashMap(11);
        map.put(EDGE_TOP, new Byte(JRChart.EDGE_TOP));
        map.put(EDGE_BOTTOM, new Byte(JRChart.EDGE_BOTTOM));
        map.put(EDGE_LEFT, new Byte(JRChart.EDGE_LEFT));
        map.put(EDGE_RIGHT, new Byte(JRChart.EDGE_RIGHT));
        map.put(new Byte(JRChart.EDGE_TOP), EDGE_TOP);
        map.put(new Byte(JRChart.EDGE_BOTTOM), EDGE_BOTTOM);
        map.put(new Byte(JRChart.EDGE_LEFT), EDGE_LEFT);
        map.put(new Byte(JRChart.EDGE_RIGHT), EDGE_RIGHT);
        chartEdgeMap = Collections.unmodifiableMap(map);
    }

    return chartEdgeMap;
}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link SortOrderEnum}.
 *//*from ww w.ja  v a2 s  .c o m*/
public static Map getSortOrderMap() {
    if (sortOrderMap == null) {
        Map map = new HashMap(6);
        map.put(SORT_ORDER_ASCENDING, new Byte(JRSortField.SORT_ORDER_ASCENDING));
        map.put(SORT_ORDER_DESCENDING, new Byte(JRSortField.SORT_ORDER_DESCENDING));
        map.put(new Byte(JRSortField.SORT_ORDER_ASCENDING), SORT_ORDER_ASCENDING);
        map.put(new Byte(JRSortField.SORT_ORDER_DESCENDING), SORT_ORDER_DESCENDING);
        sortOrderMap = Collections.unmodifiableMap(map);
    }

    return sortOrderMap;
}