List of usage examples for java.lang Long Long
@Deprecated(since = "9") public Long(String s) throws NumberFormatException
From source file:org.kuali.mobility.push.dao.PushDaoImplTest.java
@Test public void testRemovePush() { Push push = getDao().findPushById(new Long(2)); boolean removed = getDao().removePush(push); assertTrue("Should have removed a push, didn't.", removed); }
From source file:com.wsl.marketconsolescraper.ScraperConfiguration.java
/** @return delay between scraping the Market console, in milliseconds */ public long getPeriod() { return new Long(properties.getProperty("period")); }
From source file:com.lazyloading.tag.handler.LazyHandler.java
/** * Default request handler of the Ajax requests made by the Lazy Loading table * Change the Enc/Dec secret key in production environment * //w ww . j a v a2s . c o m * @param json Request parameters which keep track of Lazy Loading table * @param request HttpServletRequest * @param response HttpServletResponse * @return List<?> List of ? Objects * @throws Exception */ @RequestMapping(value = "/lazyLoading.htm") public @ResponseBody List<?> lazyLoading(@RequestBody String json, HttpServletRequest request, HttpServletResponse response) throws Exception { try { Gson gson = new GsonBuilder().create(); Template template = gson.fromJson(json, Template.class); if (template.getGetPage() == null) throw new JspException("Reuested page no cannot be null"); Long requestedPage = template.getGetPage(); Long end = new Long(template.getGetPage()) * new Long(template.getRecordsPerPage()); Long begin = end - new Long(template.getRecordsPerPage()); //DECRYPT THE REQUESTED ATTRS. Change the Secret key in production deployment String decryptedReqyestAttr = EncDec.decrypt("L!A@Z#Y$L%O^A*D(I)N_G", template.getRequestAttr()); //CONVERT REUEST ATTRIBUTES IN HASHMAP HashMap<String, String> requestMap = new HashMap<String, String>(); try { for (String keyVal : decryptedReqyestAttr.split(",")) { String[] split = keyVal.split("="); if (split.length > 1) { split[1] = split[1].equals("null") ? null : split[1]; requestMap.put(split[0], split[1]); } else { requestMap.put(split[0], null); } } } catch (Exception e) { throw new JspException("ERROR: lazyLoading 'requestAttrs' should be in attribute=value pair"); } List<?> requestedList = new ArrayList(); requestedList = LazyLoading.lazyLoadData(begin, end, template.getModelClass(), request, requestMap); List<Object> paginatedList = new ArrayList<Object>(); Long indexCounter = 0L; try { for (Object obj : requestedList) { Method lazyMethod = obj.getClass().getMethod("setLazyPageNo", Long.class); lazyMethod.invoke(obj, new Long(template.getGetPage())); //Searchable page numbers helps Angular Filter to paginate records //records are coupled with commas to differentiate between 1, 11, 2, 22, 23 ... so on lazyMethod = obj.getClass().getMethod("setSearchablePageNo", String.class); lazyMethod.invoke(obj, "," + template.getGetPage() + ","); //CALCLCULATE INDEX Long index = (template.getGetPage() - 1) * new Long(template.getRecordsPerPage()) + indexCounter; indexCounter++; lazyMethod = obj.getClass().getMethod("set$index", Long.class); lazyMethod.invoke(obj, index); paginatedList.add(obj); } } catch (NullPointerException e) { throw new JspException("ERROR: Lazy loading. The load method returned null as a list."); } return (paginatedList); } catch (Exception e) { throw new Exception(e); } }
From source file:org.lamop.riche.webservices.AuthorRESTWS.java
@RequestMapping(method = RequestMethod.GET, headers = "Accept=application/json") public @ResponseBody Person get(@PathParam("id") int id) { System.out.println("GET ID " + id); return servicePerson.getEntity(new Long(id)); }
From source file:es.pode.administracion.presentacion.repositoriosExternos.modificarRepositoriosExternos.ModificarNodoSQIControllerImpl.java
public void cargarNodoSQI(ActionMapping mapping, CargarNodoSQIForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try {// w ww .j a v a2 s .com Long id = new Long(request.getParameter("id")); if (id == null) { throw new ValidatorException("{errors.modificarnodoSQI.idNulo}"); } Long[] ids = new Long[1]; if (logger.isDebugEnabled()) logger.debug("Estamos en cargarNodoSQI con id [ " + id + " ]"); ids[0] = id; NodoSQIVO[] nodos = this.getSrvGestionSqiService().consultaNodosSQI(ids); NodoSQIVO nodo = nodos[0]; form.setId(id); form.setClave(nodo.getClave()); form.setDescripcionNodo(nodo.getDescripcionNodo()); form.setGestorSesion(nodo.getGestorSesion()); form.setIdentificadorSesion(nodo.getIdentificadorSesion()); form.setLenguajeConsulta(nodo.getLenguajeConsulta()); form.setLenguajeRespuesta(nodo.getLenguajeRespuesta()); form.setNombreNodo(nodo.getNombreNodo()); form.setUrlServicio(nodo.getUrlServicio()); form.setUsuario(nodo.getUsuario()); } catch (ValidatorException e) { logger.equals("Error al recuperar: " + e); throw e; } catch (Exception e) { logger.equals("Error al recuperar el nodoSQI: " + e); throw e; } }
From source file:net.sf.sail.webapp.dao.sds.impl.SdsCurnitListCommandHttpRestImpl.java
/** * @see net.sf.sail.webapp.dao.sds.SdsCommand#execute() *//*from ww w .j av a 2 s . c o m*/ @SuppressWarnings("unchecked") public List<SdsCurnit> execute(HttpGetRequest httpRequest) { Document doc = convertXmlInputStreamToXmlDocument(this.transport.get(httpRequest)); if (doc == null) { return EMPTY_SDSCURNIT_LIST; } List<Element> nodeList; try { nodeList = XPath.newInstance("/curnits/curnit").selectNodes(doc); } catch (JDOMException e) { if (logger.isErrorEnabled()) { logger.error(e.getMessage(), e); } return EMPTY_SDSCURNIT_LIST; } List<SdsCurnit> sdsCurnitList = new LinkedList<SdsCurnit>(); for (Element curnitNode : nodeList) { SdsCurnit sdsCurnit = new SdsCurnit(); sdsCurnit.setName(curnitNode.getChild("name").getValue()); sdsCurnit.setSdsObjectId(new Long(curnitNode.getChild("id").getValue())); sdsCurnit.setUrl(curnitNode.getChild("url").getValue()); sdsCurnitList.add(sdsCurnit); } return sdsCurnitList; }
From source file:com.bill99.yn.webmgmt.functional.rest.TaskRestFT.java
/** * //./*w w w . jav a2s . co m*/ */ @Test @Category(Smoke.class) public void createUpdateAndDeleteTask() { // create Task task = TaskData.randomTask(); URI taskUri = restTemplate.postForLocation(resoureUrl, task); System.out.println(taskUri.toString()); Task createdTask = restTemplate.getForObject(taskUri, Task.class); assertThat(createdTask.getTitle()).isEqualTo(task.getTitle()); // update String id = StringUtils.substringAfterLast(taskUri.toString(), "/"); task.setId(new Long(id)); task.setTitle(TaskData.randomTitle()); restTemplate.put(taskUri, task); Task updatedTask = restTemplate.getForObject(taskUri, Task.class); assertThat(updatedTask.getTitle()).isEqualTo(task.getTitle()); // delete restTemplate.delete(taskUri); try { restTemplate.getForObject(taskUri, Task.class); fail("Get should fail while feth a deleted task"); } catch (HttpStatusCodeException e) { assertThat(e.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); } }
From source file:com.microsoft.tfs.core.httpclient.util.IdleConnectionHandler.java
/** * Registers the given connection with this handler. The connection will be * held until {@link #remove(HttpConnection)} or * {@link #closeIdleConnections(long)} is called. * * @param connection/*from ww w . j a va 2s .c o m*/ * the connection to add * * @see #remove(HttpConnection) */ public void add(final HttpConnection connection) { final Long timeAdded = new Long(System.currentTimeMillis()); if (log.isDebugEnabled()) { log.debug("Adding connection " + connection.getID() + " at: " + timeAdded); } connectionToAdded.put(connection, timeAdded); }
From source file:de.uzk.hki.da.pkg.NativeJavaTarArchiveBuilder.java
public void unarchiveFolder(File srcTar, File destFolder) throws Exception { FileInputStream fin = new FileInputStream(srcTar); BufferedInputStream in = new BufferedInputStream(fin); TarArchiveInputStream tIn = new TarArchiveInputStream(in); HashMap<String, Long> modDateMap = new HashMap<String, Long>(); TarArchiveEntry entry;/*from ww w . ja va 2 s . c o m*/ do { entry = tIn.getNextTarEntry(); if (entry == null) break; logger.debug(entry.getName()); String dstName = destFolder.getAbsolutePath() + "/" + entry.getName(); File entryFile = new File(dstName); if (entry.isDirectory()) { entryFile.mkdirs(); modDateMap.put(dstName, new Long(entry.getModTime().getTime())); } else { new File(entryFile.getAbsolutePath().substring(0, entryFile.getAbsolutePath().lastIndexOf('/'))) .mkdirs(); FileOutputStream out = new FileOutputStream(entryFile); IOUtils.copy(tIn, out); out.close(); entryFile.setLastModified(entry.getModTime().getTime()); } } while (true); tIn.close(); in.close(); fin.close(); for (Map.Entry<String, Long> moddi : modDateMap.entrySet()) { String key = moddi.getKey(); Long value = moddi.getValue(); (new File(key)).setLastModified(value); } }
From source file:com.eventsourcing.hlc.HybridTimestamp.java
@Override public int compareTo(HybridTimestamp o) { int ntpComparison = compare(logicalTime, o.logicalTime); if (ntpComparison == 0) { return new Long(logicalCounter).compareTo(o.logicalCounter); } else {//from www. j a v a 2s . co m return ntpComparison; } }