Example usage for java.lang Long toString

List of usage examples for java.lang Long toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Long 's value.

Usage

From source file:com.redhat.rhn.frontend.action.monitoring.ProbeList.java

/**
 * {@inheritDoc}/*  w w  w  . j a  v  a 2 s. c  o m*/
 */
@Override
protected void processRequestAttributes(RequestContext rctx) {
    super.processRequestAttributes(rctx);
    String stateparam = rctx.getParam(PROBE_STATE, false);
    if (StringUtils.isEmpty(stateparam)) {
        stateparam = "all";
    } else {
        rctx.getRequest().setAttribute(PROBE_STATE, stateparam);
    }
    stateparam = stateparam.toLowerCase();
    // Add all/warning/ok/Class css classname
    rctx.getRequest().setAttribute(stateparam + "Class", "active");

    // Setup the probe state summary
    Map counts = new HashMap();
    counts.put(PROBE_COUNT_CRITICAL, "0");
    counts.put(PROBE_COUNT_WARNING, "0");
    counts.put(PROBE_COUNT_PENDING, "0");
    counts.put(PROBE_COUNT_UNKNOWN, "0");
    counts.put(PROBE_COUNT_OK, "0");
    counts.put(PROBE_COUNT_ALL, "0");

    List stateCount = MonitoringManager.getInstance().listProbeStateSummary(rctx.getCurrentUser());
    Iterator i = stateCount.iterator();
    long stateSum = 0;
    while (i.hasNext()) {
        Map row = (Map) i.next();
        Long cnt = (Long) row.get("state_count");
        stateSum = stateSum + cnt.longValue();
        String state = ((String) row.get("state")).toLowerCase();
        counts.put(state + "Count", cnt.toString());
    }
    counts.put(PROBE_COUNT_ALL, Long.toString(stateSum));

    i = counts.keySet().iterator();
    while (i.hasNext()) {
        String key = (String) i.next();
        rctx.getRequest().setAttribute(key, counts.get(key));
    }
}

From source file:net.nelz.simplesm.test.dao.TestDAOImpl.java

@UpdateMultiCache(namespace = "Bravo", expiration = 300)
@ReturnDataUpdateContent/*from   www. j  a va 2  s  . c o m*/
public List<String> updateTimestamValues(@ParameterValueKeyProvider final List<Long> keys) {
    try {
        Thread.sleep(100);
    } catch (InterruptedException ex) {
    }
    final Long now = new Date().getTime();
    final List<String> results = new ArrayList<String>();
    for (final Long key : keys) {
        results.add(now.toString() + "-M-" + key.toString());
    }
    return results;
}

From source file:com.ignorelist.kassandra.steam.scraper.JsonApiTagLoader.java

@Override
public GameInfo load(Long gameId, EnumSet<TagType> types) {
    GameInfo gameInfo = new GameInfo();
    gameInfo.setId(gameId);/*from ww w  .  j  av a 2  s.  c o m*/
    try {
        InputStream inputStream = cache.get(gameId.toString());
        try {
            final Data gameData = loadAppData(inputStream);
            gameInfo.setName(gameData.getName());
            if (types.contains(TagType.CATEGORY)) {
                Iterables.addAll(gameInfo.getTags().get(TagType.CATEGORY),
                        Iterables.transform(gameData.getCategories(), new Function<Category, String>() {
                            @Override
                            public String apply(Category input) {
                                return input.getDescription();
                            }
                        }));
            }
            if (types.contains(TagType.GENRE)) {
                Iterables.addAll(gameInfo.getTags().get(TagType.GENRE),
                        Iterables.transform(gameData.getGenres(), new Function<Genre, String>() {
                            @Override
                            public String apply(Genre input) {
                                return input.getDescription();
                            }
                        }));
            }
        } catch (IOException ex) {
            Logger.getLogger(JsonApiTagLoader.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            IOUtils.closeQuietly(inputStream);
        }
    } catch (ExecutionException ex) {
        Logger.getLogger(JsonApiTagLoader.class.getName()).log(Level.SEVERE, null, ex);
    }
    return gameInfo;
}

From source file:com.redhat.rhn.frontend.servlets.PxtCookieManager.java

/**
 * Creates a new pxt cookie with the specified session id and timeout.
 *
 * @param pxtSessionId The id of the pxt session for which the cookie is being created.
 *
 * @param request The current request./* w ww .j ava 2  s .  c om*/
 *
 * @param timeout The max age of the cookie in seconds.
 *
 * @return a new pxt cookie.
 */
public Cookie createPxtCookie(Long pxtSessionId, HttpServletRequest request, int timeout) {

    String cookieName = getCookieName(request);
    String cookieValue = pxtSessionId + "x" + SessionManager.generateSessionKey(pxtSessionId.toString());

    Cookie pxtCookie = new Cookie(cookieName, cookieValue);
    // BZ #454876
    // when not using setDomain, default "Host" will be set for the cookie
    // there's no need to use domain and besides that it causes trouble,
    //  when accessing the server within the local network (without FQDN)
    // pxtCookie.setDomain(request.getServerName());
    pxtCookie.setMaxAge(timeout);
    pxtCookie.setPath(DEFAULT_PATH);
    pxtCookie.setSecure(ConfigDefaults.get().isSSLAvailable());

    return pxtCookie;
}

From source file:com.brightcove.test.upload.MediaAPIParentClass.java

public List createListParamForFindVideoByIdCommand(Account accInfo, Long videoId, String mediaDeliveryType,
        String fields) {/*w  w  w.  java2s. c  om*/
    return createListParam(accInfo, "video_id", videoId.toString(), "find_video_by_id", mediaDeliveryType,
            fields);
}

From source file:com.book.identification.rest.VolumeResource.java

private String buildQuery(List<Long> ids) {
    StringBuilder stringBuilder = new StringBuilder();
    for (Long id : ids) {
        stringBuilder.append("volumeInfo.categoriess.entityId: " + id.toString() + " ");
    }//www.  j  a va2s.  c o m
    return stringBuilder.toString();
}

From source file:fi.laverca.examples.AnonAuthentication.java

/**
 * Authenticates to the MSSP with the FiCom anonymous profile
 * /*from   ww w.  jav  a2  s.com*/
 * @param phoneNumber MSISDN of the user
 */
@Override
public void authenticate(final String phoneNumber) {

    // Generate IDs
    final Long currentTimeMillis = System.currentTimeMillis();
    final String apTransId = "A" + currentTimeMillis;
    final String eventId = "A"
            + currentTimeMillis.toString().substring(currentTimeMillis.toString().length() - 4);

    byte[] authnChallenge = new DTBS(apTransId, DTBS.ENCODING_UTF8).toBytes();

    // Add additional services
    LinkedList<Service> additionalServices = new LinkedList<Service>();

    Service eventIdService = FiComAdditionalServices.createEventIdService(eventId);
    Service noSpamService = FiComAdditionalServices.createNoSpamService(FIXED_NOSPAMCODE, false);
    Service personIdService = FiComAdditionalServices
            .createPersonIdService(FiComAdditionalServices.PERSON_ID_GENDER);

    additionalServices.add(personIdService);

    // Create response handler
    FiComResponseHandler handler = new FiComResponseHandler() {
        @Override
        public void onResponse(FiComRequest req, FiComResponse resp) {
            log.info("Got response");
            displayResponse(eventId, resp, null);
        }

        @Override
        public void onError(FiComRequest req, Throwable throwable) {
            log.info("Got error");
            displayResponse(eventId, null, throwable);
        }

        @Override
        public void onOutstandingProgress(FiComRequest req, ProgressUpdate prgUpdate) {
            log.info("Got progress update");
        }
    };

    // Attempt to authenticate
    try {
        log.info("Authenticating");
        this.req = client.authenticateAnon(apTransId, authnChallenge, phoneNumber, noSpamService,
                eventIdService, additionalServices, handler);

        // Display Event ID
        this.displayResponse(eventId, null, null);
    } catch (IOException ioe) {
        this.displayResponse(eventId, null, ioe);
        log.info("Error establishing connection: " + ioe.getMessage());
    }

}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindTableAltIndexTenantId.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFBamMssCFBindTableAltIndexTenantId.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }/* w  ww. ja  v a 2  s .  c  o  m*/

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFBamTableObj) {
        Long altIndexTenantId = ((ICFBamTableObj) genDef).getOptionalAltIndexTenantId();
        if (altIndexTenantId == null) {
            ret = null;
        } else {
            ret = altIndexTenantId.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamTableObj");
    }

    return (ret);
}

From source file:com.brightcove.upload.ExpressTrial.ExpressTrialUploadViaMediaModuleTest.java

@Test
public void uploadMBR() throws MediaAPIError, URISyntaxException, JSONException, BadEnvironmentException,
        HttpException, IOException, ParserConfigurationException, SAXException {
    // upload a file
    Long videoId = mMediaManager.createVideo(mVideoFile, mAccount, mEnvironment, false);
    mLog.debug("videoId: " + videoId);
    assertNotNull(videoId);//from   w w w .j av  a  2 s .c om
    AccountWithVideo awv = new AccountWithVideo(account, new Video(videoId.toString()));
    awv.writeArtifact("account_with_video.json");

}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamMssCF.CFBamMssCFBindChainDefSchemaTenantId.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFBamMssCFBindChainDefSchemaTenantId.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//from w w w .j a  v a 2  s .c o  m

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFBamChainObj) {
        Long defSchemaTenantId = ((ICFBamChainObj) genDef).getOptionalDefSchemaTenantId();
        if (defSchemaTenantId == null) {
            ret = null;
        } else {
            ret = defSchemaTenantId.toString();
        }
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFBamChainObj");
    }

    return (ret);
}