Example usage for java.lang Integer longValue

List of usage examples for java.lang Integer longValue

Introduction

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

Prototype

public long longValue() 

Source Link

Document

Returns the value of this Integer as a long after a widening primitive conversion.

Usage

From source file:nl.b3p.viewer.search.AttributeSourceSearchClient.java

private void getResults(String query, Integer solrConfigId, JSONArray processedResults) {

    try {//ww  w  .  j ava2  s.  c o m
        EntityManager em = Stripersist.getEntityManager();

        SolrConf conf = em.find(SolrConf.class, solrConfigId.longValue());
        List<String> queryAttributes = conf.getIndexAttributes();
        List<String> resultAttributes = conf.getResultAttributes();

        SimpleFeatureType ft = conf.getSimpleFeatureType();

        org.geotools.data.FeatureSource gtFS = ft.openGeoToolsFeatureSource();

        FeatureToJson ftoj = new FeatureToJson(false, false, false, true, null);
        Query q = createQuery(queryAttributes, gtFS, query);
        q.setMaxFeatures(FeatureToJson.MAX_FEATURES);
        JSONArray features = ftoj.getJSONFeatures(null, ft, gtFS, q, null, null, em, null, null);

        for (Object feature : features) {
            JSONObject newFeature = new JSONObject();
            JSONObject oldFeature = (JSONObject) feature;
            String label = "";
            for (String name : resultAttributes) {
                Object value = oldFeature.optString(name, "");
                newFeature.put(name, value);
                label += " " + value;
            }
            Geometry g = (Geometry) oldFeature.get(ft.getGeometryAttribute());
            Envelope env = g.getEnvelopeInternal();

            Map bbox = new HashMap();
            bbox.put("minx", env.getMinX());
            bbox.put("miny", env.getMinY());
            bbox.put("maxx", env.getMaxX());
            bbox.put("maxy", env.getMaxY());

            newFeature.put("location", bbox);
            newFeature.put("type", conf.getName());
            newFeature.put("label", label);
            processedResults.put(newFeature);
        }

    } catch (Exception ex) {
        log.error("Error searching", ex);
    }
}

From source file:DateTime.java

/** Formats the value as an RFC 3339 date/time string. */
public String toStringRfc3339() {

    StringBuilder sb = new StringBuilder();

    Calendar dateTime = new GregorianCalendar(GMT);
    long localTime = value;
    Integer tzShift = this.tzShift;
    if (tzShift != null) {
        localTime += tzShift.longValue() * 60000;
    }//from w w w .  j a  v  a 2 s  .  c  om
    dateTime.setTimeInMillis(localTime);

    appendInt(sb, dateTime.get(Calendar.YEAR), 4);
    sb.append('-');
    appendInt(sb, dateTime.get(Calendar.MONTH) + 1, 2);
    sb.append('-');
    appendInt(sb, dateTime.get(Calendar.DAY_OF_MONTH), 2);

    if (!dateOnly) {

        sb.append('T');
        appendInt(sb, dateTime.get(Calendar.HOUR_OF_DAY), 2);
        sb.append(':');
        appendInt(sb, dateTime.get(Calendar.MINUTE), 2);
        sb.append(':');
        appendInt(sb, dateTime.get(Calendar.SECOND), 2);

        if (dateTime.isSet(Calendar.MILLISECOND)) {
            sb.append('.');
            appendInt(sb, dateTime.get(Calendar.MILLISECOND), 3);
        }
    }

    if (tzShift != null) {

        if (tzShift.intValue() == 0) {

            sb.append('Z');

        } else {

            int absTzShift = tzShift.intValue();
            if (tzShift > 0) {
                sb.append('+');
            } else {
                sb.append('-');
                absTzShift = -absTzShift;
            }

            int tzHours = absTzShift / 60;
            int tzMinutes = absTzShift % 60;
            appendInt(sb, tzHours, 2);
            sb.append(':');
            appendInt(sb, tzMinutes, 2);
        }
    }

    return sb.toString();
}

From source file:com.bibisco.manager.CharacterManager.java

public static MainCharacterDTO loadMainCharacter(Integer lIntIdCharacter) {

    MainCharacterDTO lMainCharacterDTO = null;

    mLog.debug("Start loadMainCharacter(Integer)");
    SqlSessionFactory lSqlSessionFactory = SqlSessionFactoryManager.getInstance().getSqlSessionFactoryProject();
    SqlSession lSqlSession = lSqlSessionFactory.openSession();
    try {//w w w .j  a  v a  2  s  .  c om

        CharactersMapper lCharactersMapper = lSqlSession.getMapper(CharactersMapper.class);
        CharactersWithBLOBs lCharacters = lCharactersMapper.selectByPrimaryKey(lIntIdCharacter.longValue());

        lMainCharacterDTO = createMainCharacterDTOFromCharacters(lCharacters);

    } catch (Throwable t) {
        mLog.error(t);
        throw new BibiscoException(t, BibiscoException.SQL_EXCEPTION);
    } finally {
        lSqlSession.close();
    }

    mLog.debug("End loadMainCharacter(Integer)");

    return lMainCharacterDTO;

}

From source file:com.akhahaha.giftr.service.data.dao.queryBuilder.ProductQueryBuilder.java

public void setMaxPrice(Integer maxPrice) {
    this.maxPrice = maxPrice.longValue();
}

From source file:com.akhahaha.giftr.service.data.dao.queryBuilder.ProductQueryBuilder.java

public void setMinPrice(Integer minPrice) {
    this.minPrice = minPrice.longValue();
}

From source file:com.bibisco.manager.CharacterManager.java

public static SecondaryCharacterDTO loadSecondaryCharacter(Integer lIntIdCharacter) {

    SecondaryCharacterDTO lSecondaryCharacterDTO = null;

    mLog.debug("Start loadSecondaryCharacter(Integer)");
    SqlSessionFactory lSqlSessionFactory = SqlSessionFactoryManager.getInstance().getSqlSessionFactoryProject();
    SqlSession lSqlSession = lSqlSessionFactory.openSession();
    try {//from   w w  w  .jav  a  2s .com

        CharactersMapper lCharactersMapper = lSqlSession.getMapper(CharactersMapper.class);
        CharactersWithBLOBs lCharacters = lCharactersMapper.selectByPrimaryKey(lIntIdCharacter.longValue());
        lSecondaryCharacterDTO = createSecondaryCharacterDTOFromCharacters(lCharacters);
        lSecondaryCharacterDTO.setDescription(lCharacters.getSecondaryCharacterDescription());

    } catch (Throwable t) {
        mLog.error(t);
        throw new BibiscoException(t, BibiscoException.SQL_EXCEPTION);
    } finally {
        lSqlSession.close();
    }

    mLog.debug("End loadSecondaryCharacter(Integer)");

    return lSecondaryCharacterDTO;
}

From source file:org.pentaho.di.trans.steps.accessinput.AccessInputMeta.java

/**
 * Returns kettle type from Microsoft Access database also convert data to prepare kettle value
 *
 * @param : MS Access column/*from   ww  w  .j  a v  a 2 s.  c o  m*/
 * @param : destination field name
 * @param : MS Access column value
 * @return valuemeta and data
 */
public static ValueMetaAndData getValueMetaAndData(Column c, String name, Object data) {

    ValueMetaAndData valueMetaData = new ValueMetaAndData();
    // get data
    Object o = data;

    // Get column type
    DataType type = c.getType();

    int sourceValueType = ValueMetaInterface.TYPE_STRING;

    // Find corresponding Kettle type for each MS Access type
    // We have to take of Meta AND data
    switch (type) {
    case BINARY:
        sourceValueType = ValueMeta.TYPE_BINARY;
        break;
    case BOOLEAN:
        sourceValueType = ValueMeta.TYPE_BOOLEAN;
        if (o != null) {
            o = Boolean.valueOf(o.toString());
        }

        break;
    case DOUBLE:
        sourceValueType = ValueMeta.TYPE_NUMBER;

        break;
    case FLOAT:
        sourceValueType = ValueMeta.TYPE_BIGNUMBER;
        if (o != null) {
            o = new BigDecimal(Float.toString((Float) o));
        }

        break;
    case INT:
        sourceValueType = ValueMeta.TYPE_NUMBER;
        if (o != null) {
            o = Double.parseDouble(o.toString());
        }
        break;
    case BYTE:
        sourceValueType = ValueMeta.TYPE_NUMBER;
        if (o != null) {
            o = Double.parseDouble(o.toString());
        }
        break;
    case LONG:
        sourceValueType = ValueMeta.TYPE_INTEGER;
        if (o != null) {
            Integer i = (Integer) o;
            o = i.longValue();
        }

        break;
    case MEMO:
        // Should be considered as String

        break;
    case MONEY:
        sourceValueType = ValueMeta.TYPE_BIGNUMBER;

        break;
    case NUMERIC:
        sourceValueType = ValueMeta.TYPE_BIGNUMBER;

        break;
    case SHORT_DATE_TIME:
        sourceValueType = ValueMeta.TYPE_DATE;

        break;
    default:
        // Default it's string
        if (o != null) {
            o = o.toString();
        }
        break;
    }

    ValueMetaInterface sourceValueMeta = new ValueMeta(name == null ? c.getName() : name, sourceValueType);
    sourceValueMeta.setLength(c.getLength(), c.getPrecision());

    // set value meta data and return it
    valueMetaData.setValueMeta(sourceValueMeta);
    if (o != null) {
        valueMetaData.setValueData(o);
    }

    return valueMetaData;
}

From source file:org.oscarehr.match.vacancy.VacancyTemplateData.java

public void addRange(Integer min, Integer max) {
    if (min == null) {
        min = Integer.MIN_VALUE;//  w  w w  . j av  a2s  .c  o m
    }
    if (max == null) {
        max = Integer.MAX_VALUE;
    }
    ranges.add(new Range(min.longValue(), max.longValue()));
}

From source file:com.mmj.app.biz.service.impl.CommentsServiceImpl.java

@Override
public Long add(VoteDO... t) {
    t = ArrayUtils.removeNullElement(t);
    if (Argument.isEmptyArray(t)) {
        return 0l;
    }//w w  w.j  a v a 2s  .co  m
    Integer count = voteDao.insert(t);
    if (t.length == 1) {
        return count.longValue();
    }
    return count == 0 ? 0l : 1l;
}

From source file:com.mmj.app.biz.service.impl.CommentsServiceImpl.java

@Override
public Long add(ReportDO... t) {
    t = ArrayUtils.removeNullElement(t);
    if (Argument.isEmptyArray(t)) {
        return 0l;
    }//w  ww  .ja v  a 2 s  .  c  o  m
    Integer count = reportDao.insert(t);
    if (t.length == 1) {
        return count.longValue();
    }
    return count == 0 ? 0l : 1l;
}