Example usage for java.lang Long longValue

List of usage examples for java.lang Long longValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public long longValue() 

Source Link

Document

Returns the value of this Long as a long value.

Usage

From source file:org.squale.squalecommon.enterpriselayer.facade.quality.MeasureFacade.java

/**
 * Ajoute le nombre de lignes d'un projet pour une grille donne
 * /*from w w w  .  j a  v a2 s  . c o m*/
 * @param session la session
 * @param idProject l'id du projet
 * @param pAuditId l'id de l'audit
 * @param volumByGrid la map du nombre de lignes par grille
 * @param nbLines le nombre de ligne  ajouter pour la grille
 * @throws JrafDaoException si erreur
 */
private static void setApplicationVolumetryByGrid(ISession session, Long idProject, Long pAuditId,
        Map volumByGrid, Long nbLines) throws JrafDaoException {
    // Rcupration des grilles
    AuditGridDAOImpl auditGridDao = AuditGridDAOImpl.getInstance();
    // On rcupre la grille associe au projet pour cet audit
    AuditGridBO auditGrid = auditGridDao.findWhere(session, idProject, pAuditId);
    // on ajoute la valeur au nb de ligne pour la grille du projet
    Long nbLinesforGrid = (Long) volumByGrid.get(auditGrid.getGrid().getName());
    // Si on a dj eu un projet associ  cette grille, on fait la somme des lignes
    if (null != nbLinesforGrid) {
        volumByGrid.put(auditGrid.getGrid().getName(),
                new Long(nbLinesforGrid.longValue() + nbLines.longValue()));
    } else {
        volumByGrid.put(auditGrid.getGrid().getName(), nbLines);
    }

}

From source file:com.redhat.rhn.frontend.action.systems.sdc.SystemOverviewAction.java

protected void proccessSatApplet(User user, Server s, RequestContext rctx) {
    Long appValue = rctx.getParamAsLong("applet");

    if (appValue != null && appValue.longValue() == 1) {
        Action a = ActionManager.createBaseAction(user, s, ActionFactory.TYPE_RHN_APPLET_USE_SATELLITE);
        ActionManager.storeAction(a);/*from  www . j  a  v a 2 s  .c o  m*/
        createSuccessMessage(rctx.getRequest(), "sdc.details.overview.applet.scheduled",
                "/rhn/systems/details/history/Event.do?sid=" + s.getId() + "&aid=" + a.getId());
    }
}

From source file:com.redhat.rhn.frontend.action.systems.sdc.SystemOverviewAction.java

protected void processPing(User user, Server s, RequestContext rctx) {
    Long pingValue = rctx.getParamAsLong("ping");

    if (pingValue != null && pingValue.longValue() == 1) {
        s.getPushClient().setLastPingTime(new Date(System.currentTimeMillis()));
        s.getPushClient().setNextActionTime(null);
        SystemManager.storeServer(s);/*from   w w w  . j av  a2s .co  m*/
        createSuccessMessage(rctx.getRequest(), "sdc.details.overview.osa.status.pinged", s.getName());
    }

}

From source file:org.openmrs.web.servlet.ShowGraphServletTest.java

/**
 * @see ShowGraphServlet#getFromDate(String)
 *///from  w w w.ja v a2  s.  c  o m
@Test
@Verifies(value = "should return same date as given string parameter", method = "getFromDate(String)")
public void getFromDate_shouldReturnSameDateAsGivenStringParameter() throws Exception {
    Long time = new Date().getTime() - 100000;
    Date fromDate = new ShowGraphServlet().getFromDate(Long.toString(time));
    Assert.assertEquals(time.longValue(), fromDate.getTime());
}

From source file:gate.corpora.DocumentContentImpl.java

/** Check that both start and end are valid offsets and that
  * they constitute a valid offset range
  *//*  ww w  . ja v a 2s .  c o m*/
boolean isValidOffsetRange(Long start, Long end) {
    return isValidOffset(start) && isValidOffset(end) && start.longValue() <= end.longValue();
}

From source file:com.acc.fulfilmentprocess.strategy.impl.SplitByAvailableCount.java

@Override
public Object getGroupingObject(final AbstractOrderEntryModel orderEntry) {
    if (orderEntry.getDeliveryPointOfService() != null) {
        final Long stock = getCommerceStockService().getStockLevelForProductAndPointOfService(
                orderEntry.getProduct(), orderEntry.getDeliveryPointOfService());
        return Boolean.valueOf(stock == null || stock.longValue() >= orderEntry.getQuantity().longValue());
    } else {/*from ww w . j av  a  2  s  .c o  m*/
        Long stock = Long.valueOf(0);
        if (orderEntry.getOrder().getStore() != null) {
            stock = getCommerceStockService().getStockLevelForProductAndBaseStore(orderEntry.getProduct(),
                    orderEntry.getOrder().getStore());
        }
        return Boolean.valueOf(stock == null || stock.longValue() >= orderEntry.getQuantity().longValue());
    }
}

From source file:com.redhat.rhn.manager.kickstart.IpAddressRange.java

/**
 *
 * @param minIn IpNumber to set min IpAddress
 * @param maxIn IpNumber to set max IpAddress
 *//*  w  w w. j a va 2s.co  m*/
public IpAddressRange(Long minIn, Long maxIn) {
    this.min = new IpAddress(minIn.longValue());
    this.max = new IpAddress(maxIn.longValue());
    this.ksid = new Long(0);
}

From source file:gate.corpora.DocumentContentImpl.java

/** Check that an offset is valid */
boolean isValidOffset(Long offset) {
    if (offset == null)
        return false;

    long o = offset.longValue();
    long len = content.length();
    if (o > len || o < 0)
        return false;

    return true;/*from  w  w w . j av  a2s.com*/
}

From source file:eu.scidipes.toolkits.pawebapp.web.AdminController.java

@RequestMapping("/templates/deletebundle")
public String deleteTemplateBundle(final String bundleName, final RedirectAttributes redirectAttrs) {

    final Long datasetCount = datasetRepo.countDatasetsByBundle(bundleName);

    if (datasetCount.longValue() > 0) {
        LOG.info("Cannot delete bundle '{}' in use by {} datasets", bundleName, datasetCount.toString());
        redirectAttrs.addFlashAttribute("errorKey", DELETE_FAIL_IN_USE);
        return "redirect:/admin/templates/";
    }/* ww  w. java  2 s  . c om*/

    boolean success = false;

    try {
        final FormsBundle bundleToDelete = libraryAPI.getEmptyStructureForBundle(bundleName);

        /* Attempt to delete the template source file first: */
        final String processorName = bundleToDelete.getProcessorName();

        final PreservationDatasourceProcessor processor = SourceProcessorManager.INSTANCE.getProcessors()
                .get(processorName);

        final StringBuilder sourcePath = new StringBuilder();
        sourcePath.append(SOURCE_ROOT_PATH + File.separatorChar);
        sourcePath.append(processor.getClass().getSimpleName() + File.separatorChar);
        sourcePath.append(bundleToDelete.getTemplateSource());

        final File source = new File(sourcePath.toString());

        if (source.delete()) {
            LOG.info("Successfully deleted source file: {}", source);
            success = libraryAPI.deleteBundle(bundleToDelete);
        }

    } catch (final PreservationException e) {
        LOG.error(e.toString(), e);
    }

    if (success) {
        LOG.info("Successfully deleted bundle: {}", bundleName);
        redirectAttrs.addFlashAttribute("msgKey", DELETE_SUCCESS);
        return "redirect:/admin/templates/";
    } else {
        redirectAttrs.addFlashAttribute("errorKey", DELETE_FAIL);
        return "redirect:/admin/templates/";
    }

}

From source file:org.tonguetied.web.LanguageValidatorTest.java

public LanguageValidatorTest(final Long id, final LanguageCode code, final String name,
        final String fieldName) {
    this.language = new Language();
    if (id != null)
        this.language.setId(id.longValue());
    this.language.setCode(code);
    this.language.setName(name);
    this.fieldName = fieldName;
}