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:org.davidmendoza.esu.web.BaseController.java

protected void paginate(Map<String, Object> params, Model model, Long page) {
    if (page != null) {
        params.put("page", page);
        model.addAttribute("page", page);
    } else {/*w  w  w. j av  a2 s. c  om*/
        page = 1L;
        model.addAttribute("page", page);
    }
    // pagination start
    Long totalItems = (Long) params.get("totalItems");
    Integer max = (Integer) params.get("max");
    List<Long> pageList = pagination(page, totalItems, max);
    List<?> list = (List<?>) params.get("list");
    Long first = ((page - 1) * max) + 1;
    Long last = first + (list.size() - 1);
    String[] pagination = new String[] { first.toString(), last.toString(), totalItems.toString() };
    model.addAttribute("pagination", pagination);
    model.addAttribute("pages", pageList);
    // pagination end
}

From source file:com.redhat.rhn.frontend.action.channel.manage.repo.RepoDetailsAction.java

private String getStringId(SslCryptoKey sck) {
    String strId = "";
    if (sck != null) {
        Long id = sck.getId();
        if (id != null) {
            strId = id.toString();
        }//from  www .jav  a 2s .  c om
    }
    return strId;
}

From source file:dcstore.web.ImagesWeb.java

public String getImgPath(Long idProduct, Long idImage, String mode) {
    String path = this.getImgDir();
    path += idProduct.toString() + "-" + idImage.toString() + "-" + mode + ".jpg";
    return path;//from   www .j ava 2 s. c  om
}

From source file:eu.trentorise.smartcampus.permissionprovider.controller.BasicProfileController.java

@RequestMapping(method = RequestMethod.GET, value = "/basicprofile/me")
public @ResponseBody BasicProfile findProfile(HttpServletResponse response) throws IOException {
    try {/*from w  ww  .  j  a v  a 2 s . c o  m*/
        Long user = getUserId();
        if (user == null) {
            response.setStatus(HttpServletResponse.SC_FORBIDDEN);
            return null;
        }
        return profileManager.getBasicProfileById(user.toString());
    } catch (Exception e) {
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        return null;
    }
}

From source file:com.greenline.guahao.web.module.home.controllers.mobile.patient.MobilePatientController.java

/**
 * html5 ?//from w w  w  .  j av a  2 s  .  c o m
 * 
 * @param model
 * @param patientId
 * @return String
 */
@MethodRemark(value = "remark=html?method=get")
@RequestMapping(value = MobileConstants.M_PAIENT_INFO_PATH, method = RequestMethod.GET)
public String patient(ModelMap model, @RequestParam("pid") String patientId) {
    // id
    String decodePatientId = DESUtil.DESDecode(patientId, EncodeKeyConstants.PATIENT_ENCODE_KEY);
    if (!StringUtils.isNumeric(decodePatientId)) {
        model.put("message", MobileMsgConstants.L_ERROR);
        return MobileConstants.M_ERROR;
    } else {
        PatientInfoDO patientInfoDO = patientManager.getPatientByPatientId(Long.parseLong(decodePatientId));
        if (null != patientInfoDO) {
            Long userId = UserCookieUtil.getUserId(request);
            if (!userId.toString().equals(String.valueOf(patientInfoDO.getUser_id()))) {
                // ??
                model.put("message", MobileMsgConstants.L_ERROR);
                return MobileConstants.M_ERROR;
            } else {
                PatientInfoDO patient = patientManager.getPatientByPatientId(Long.valueOf(decodePatientId));
                if (null == patient) {
                    model.put("message", MobileMsgConstants.L_ERROR);
                    return MobileConstants.M_ERROR;
                }
                patient.setEncodePatientId(patientId);
                patient.setEncodeUserId(DESUtil.DESEncode(String.valueOf(patient.getUser_id()),
                        EncodeKeyConstants.USER_ENCODE_KEY));
                model.put("patient", patient);
                model.put("redict", patientManager.getRelationDictDef());
            }
        }
    }
    return MobileConstants.M_PAIENT_INFO;
}

From source file:eu.trentorise.smartcampus.permissionprovider.controller.BasicProfileController.java

@RequestMapping(method = RequestMethod.GET, value = "/accountprofile/me")
public @ResponseBody AccountProfile findAccountProfile(HttpServletResponse response) throws IOException {
    try {//from   w  w  w. j ava 2  s .com
        Long user = getUserId();
        if (user == null) {
            response.setStatus(HttpServletResponse.SC_FORBIDDEN);
            return null;
        }
        return profileManager.getAccountProfileById(user.toString());
    } catch (Exception e) {
        e.printStackTrace();
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        return null;
    }
}

From source file:controller.administrator.DriverController.java

@RequestMapping(value = "/drivermain", method = RequestMethod.POST)
public ModelAndView drivermain(@RequestParam Map<String, String> map) {
    String id;// w w w  .j ava  2s . co  m
    DriverBean driverbean = new DriverBean();
    Long identifier = incrementer.nextLongValue();
    try {
        id = map.get("firstName").substring(0, 2) + identifier.toString().trim();
    } catch (Exception e) {
        ModelAndView model = new ModelAndView("AddDriver");
        model.addObject("warning", "First Name must contain more than two characters");
        return model;
    }
    driverbean.setDriverid(id);
    driverbean.setFirstName(map.get("firstName"));
    driverbean.setLastName(map.get("lastName"));
    driverbean.setLicenseNumber(map.get("licenseNumber"));
    driverbean.setVehicleNumber(map.get("vehicleNumber"));
    driverbean.setContactNumber(map.get("contactNumber"));

    DriverAddressBean dabean = new DriverAddressBean();
    dabean.setDriverid(id);
    dabean.setCity(map.get("city"));
    dabean.setFirstLineOfAddress(map.get("firstLineOfAddress"));
    dabean.setSecondLineOfAddress(map.get("secondLineOfAddress"));
    try {
        dabean.setHouseNumber(Integer.parseInt(map.get("houseNumber")));
    } catch (Exception e) {
        ModelAndView model = new ModelAndView("AddDriver");
        model.addObject("warning", "House Number should be Integer");
        return model;
    }
    dabean.setPinCode(map.get("pinCode"));
    dabean.setState(map.get("state"));
    System.out.println(map.get("state"));
    String result = driverservice.addDriver(driverbean, dabean);
    System.out.println(result);
    if (result.equals("FAIL")) {
        ModelAndView model = new ModelAndView("AddDriver");
        model.addObject("warning", "Please Provide Complete Information");
        return model;
    } else if (result.equals("ERROR")) {
        ModelAndView model = new ModelAndView("AddDriver");
        model.addObject("warning", "Vehicle number given by u is not present");
        return model;
    }

    else {
        ModelAndView model = new ModelAndView("Admin");
        model.addObject("message", "Driver Details Successfully Added");
        return model;
    }

}

From source file:org.dawnsci.marketplace.services.FileService.java

public void uploadRepository(Long id, MultipartFile file) {
    try {/*from w  w w . ja  v a  2 s  .c o  m*/
        File saveSolutionFile = saveSolutionFile(id, file);
        // the p2-repository will be unpacked into the solution root folder
        File p2repo = getSolutionFile(id.toString());
        // delete the old stuff
        FileUtils.deleteDirectory(new File(p2repo, "features"));
        FileUtils.deleteDirectory(new File(p2repo, "plugins"));
        FileUtils.deleteQuietly(new File(p2repo, "content.jar"));
        FileUtils.deleteQuietly(new File(p2repo, "artifacts.jar"));
        FileUtils.deleteQuietly(new File(p2repo, "content.xml"));
        FileUtils.deleteQuietly(new File(p2repo, "artifacts.xml"));
        // unpack to root folder
        ZipUtil.unpack(saveSolutionFile, p2repo);
        // and delete the uploaded zip-file
        FileUtils.deleteQuietly(saveSolutionFile);
    } catch (Exception e) {
        throw new InternalErrorException(e);
    }
}

From source file:com.intuit.tank.client.v1.report.ReportServiceClientV1.java

/**
 * Gets the contents of a file as a Stream starting at the specified start point
 * /* ww  w. j a va 2  s  . co  m*/
 * @param filePath
 *            the filePath to fetch as a child of the logs dir.
 * @param start
 *            the number of bytes to skip. Pass null or 0L to get entire file.
 * @return the stream of the file
 */
public InputStream getFile(String filePath, Long start) {
    UriBuilder uriBuilder = UriBuilder.fromUri(urlBuilder.buildUrl(filePath));
    if (start != null) {
        uriBuilder.queryParam("from", start.toString());
    }
    WebResource webResource = client.resource(uriBuilder.build());
    ClientResponse response = webResource.accept(MediaType.APPLICATION_OCTET_STREAM).get(ClientResponse.class);
    exceptionHandler.checkStatusCode(response);
    return response.getEntityInputStream();
}

From source file:cz.zcu.kiv.crce.client.base.metadata.IdentityCapabilityVO.java

public void setSize(Long size) {
    if (this.size == null) {
        this.size = new AttributeVO(Constants.ATTRIBUTE__SIZE, size.toString());
    } else {//from ww  w .ja v  a2s  .  c  om
        this.size.setValue(size.toString());
    }
}