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:ext.msg.model.Message.java

public static boolean deleteMessageBySenderRevicer(Long senderId, Long consumeId, Long groupId,
        Collection<?> msgTypes) {
    List<Message> resultList = JPA.em().createQuery(
            "from Message m where m.senderOnly = :senderId and m.consumeOnly = :consumeId and m.msgType in (:msgTypes)",
            Message.class).setParameter("senderId", senderId.toString())
            .setParameter("consumeId", consumeId.toString()).setParameter("msgTypes", msgTypes).getResultList();
    if (CollectionUtils.isEmpty(resultList)) {
        return false;
    }/*from   www  .j  a  va2  s.  c  o  m*/
    for (Message message : resultList) {
        if (StringUtils.isNotBlank(message.content)) {
            JsonNode jn = play.libs.Json.parse(message.content);
            Long cGroupId = jn.findPath("groupId").asLong(0);
            if (groupId.equals(cGroupId) && message.isHandler == false)
                JPA.em().remove(message);
        }
    }
    return true;
}

From source file:com.qsoft.components.gallery.utils.GalleryUtils.java

private static MultipartEntity addParamsForUpload(File file, String imageType, String imageName,
        Long equipmentId, Long userId, String locationDTO, Long equipmentHistoryId)
        throws UnsupportedEncodingException {
    MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
    mpEntity.addPart(ConstantImage.IMAGE_FILE, new FileBody(file));
    mpEntity.addPart(ConstantImage.IMAGE_TYPE, new StringBody(imageType.toUpperCase()));
    mpEntity.addPart(ConstantImage.IMAGE_NAME, new StringBody(imageName.toUpperCase()));
    if (equipmentId != null) {
        mpEntity.addPart(ConstantImage.EQUIPMENT_ID, new StringBody(equipmentId.toString()));
    }/*from   ww  w .j av  a  2 s .  co  m*/
    if (userId != null) {
        mpEntity.addPart(ConstantImage.USER_ID, new StringBody(userId.toString()));
    }
    if (equipmentHistoryId != null) {
        mpEntity.addPart(ConstantImage.EQUIPMENTHISTORY_ID, new StringBody(equipmentHistoryId.toString()));
    }
    mpEntity.addPart(ConstantImage.IMAGE_LOCATION_DTO, new StringBody(locationDTO));

    return mpEntity;
}

From source file:io.github.retz.web.JobRequestHandler.java

static String downloadFile(spark.Request req, spark.Response res) throws Exception {
    Optional<Job> job = getJobAndVerify(req);
    String file = req.queryParams("path");
    LOG.debug("download: path={}", file);

    if (job.isPresent() && job.get().url() != null) { // If url() is null, the job hasn't yet been started at Mesos
        MesosHTTPFetcher.downloadHTTPFile(job.get().url(), file,
                (Triad<Integer, String, Pair<Long, InputStream>> triad) -> {
                    Integer statusCode = triad.left();
                    res.status(statusCode);
                    if (statusCode == 200) {
                        Long length = triad.right().left();
                        InputStream io = triad.right().right();
                        Long maxFileSize = scheduler.get().maxFileSize();
                        if (length < 0) {
                            throw new IOException("content length is negative: " + length);
                        } else if (0 <= maxFileSize && maxFileSize < length) { // negative maxFileSize indicates no limit
                            throw new DownloadFileSizeExceeded(length, maxFileSize);
                        }//from ww  w. j ava 2s . c o  m
                        res.raw().setHeader("Content-Length", length.toString());
                        LOG.debug("start streaming of {} bytes for {}", length, file);
                        IOUtils.copyLarge(io, res.raw().getOutputStream(), 0, length);
                        LOG.debug("end streaming for {}", file);
                    } else {
                        res.body(triad.center());
                    }
                });
        return "";
    } else {
        res.status(404);
        return "";
    }
}

From source file:com.facebook.ads.sdk.ReachFrequencyPrediction.java

public static ReachFrequencyPrediction fetchById(Long id, APIContext context) throws APIException {
    return fetchById(id.toString(), context);
}

From source file:com.facebook.ads.sdk.Hotel.java

public static Hotel fetchById(Long id, APIContext context) throws APIException {
    return fetchById(id.toString(), context);
}

From source file:com.facebook.ads.sdk.Event.java

public static Event fetchById(Long id, APIContext context) throws APIException {
    return fetchById(id.toString(), context);
}

From source file:com.qsoft.components.gallery.utils.GalleryUtils.java

public static String orderImage(String url, List<ImageDTO> imageDTO, Long equipmentId) throws IOException {
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);//from  www .  j av a2  s  .  c  o m
    HttpClient httpclient = new DefaultHttpClient();
    ImageListDTO imageListDTO = new ImageListDTO(imageDTO);
    String strImageDto = new Gson().toJson(imageListDTO);
    HttpPost post = new HttpPost(url);
    //        HttpGet httpGet = new HttpGet(url + "?equipmentId=" + equipmentId + "&orderList=" + strImageDto);
    List<NameValuePair> pairs = new ArrayList<NameValuePair>();
    pairs.add(new BasicNameValuePair("equipmentId", equipmentId.toString()));
    pairs.add(new BasicNameValuePair("orderList", strImageDto));
    post.setEntity(new UrlEncodedFormEntity(pairs));
    String result = "";
    HttpResponse response = httpclient.execute(post);
    HttpEntity entity = response.getEntity();
    if (entity != null) {
        InputStream instream = entity.getContent();
        result = convertStreamToString(instream);
        instream.close();
    }
    return result;
}

From source file:com.apress.prospringintegration.serviceactivator.Counter.java

@ServiceActivator
public void handleCounter(Long count) {
    System.out.println(count.toString());
}

From source file:com.jaspersoft.jasperserver.war.cascade.handlers.converters.LongDataConverter.java

@Override
public String valueToString(Long value) {
    return value != null ? value.toString() : "";
}

From source file:com.facebook.ads.sdk.CustomConversion.java

public static CustomConversion fetchById(Long id, APIContext context) throws APIException {
    return fetchById(id.toString(), context);
}