@Override protected String doExpand(String macro) { count++; String[] args = macro.split(","); if (args.length != 1 && args.length != 2) throw new RuntimeException("Invalid macro: " + macro); String field = args[0].trim(); String param1 = field.replace(".", "_") + "_" + count + "_1"; String param2 = field.replace(".", "_") + "_" + count + "_2"; TimeZone timeZone = getTimeZoneFromArgs(args, 1); if (timeZone == null) { timeZone = TimeZone.getDefault(); } Calendar cal = Calendar.getInstance(timeZone); cal.setTime(AppBeans.get(TimeSource.class).currentTimestamp()); params.put(param1, DateUtils.truncate(cal, Calendar.DAY_OF_MONTH).getTime()); cal.add(Calendar.DAY_OF_MONTH, 1); params.put(param2, DateUtils.truncate(cal, Calendar.DAY_OF_MONTH).getTime()); return String.format("(%s >= :%s and %s < :%s)", field, param1, field, param2); }
public Date getDateOfRelease() { if (StringUtils.isEmpty(releaseDate)) { return null; } try { return DateUtils.parseDate(this.releaseDate, new String[]{"yyyy-MM-dd"}); } catch (ParseException e) { return null; } }
/** * 更改发布单 * * @param appId * @param formId 发布单ID * @param name 发布单名称 * @param remark 发布单备注 * @param planPubTime 计划发布时间 * @return */ @RequestMapping(value = "/apps/{appId}/releaseform/{formId}", method = RequestMethod.PUT) @ResponseBody public Object modifyReleaseForm(@PathVariable("appId") int appId, @PathVariable("formId") long formId, @RequestParam("name") String name, @RequestParam("remark") String remark, @RequestParam("planPubTime") String planPubTime) throws ParseException { Date planPubDate = null; if (StringUtils.isNotEmpty(planPubTime)) { planPubDate = DateUtils.parseDate(planPubTime, new String[]{"yyyy-MM-dd HH:mm:ss"}); } releaseFormService.modifyForm(appId, formId, name, remark, planPubDate); return releaseFormService.getReleaseForm(formId); }
/** * 使用创建日期来过滤发布单 * * @param releaseForms * @param createDate * @return */ private List<ReleaseForm> filterByCreateDate(List<ReleaseForm> releaseForms, Date createDate) { // 未限定 if (createDate == null) { return releaseForms; } List<ReleaseForm> filteredReleaseFormList = new ArrayList<>(); for (ReleaseForm form : releaseForms) { if (DateUtils.isSameDay(form.getCreateTime(), createDate)) { filteredReleaseFormList.add(form); } } return filteredReleaseFormList; }
/** * 使用发布日期来过滤发布单 * * @param releaseForms * @param releaseDate * @return */ private List<ReleaseForm> filterByReleaseDate(List<ReleaseForm> releaseForms, Date releaseDate) { // 未限定 if (releaseDate == null) { return releaseForms; } List<ReleaseForm> filteredReleaseFormList = new ArrayList<>(); for (ReleaseForm form : releaseForms) { if (DateUtils.isSameDay(form.getCreateTime(), releaseDate)) { filteredReleaseFormList.add(form); } } return filteredReleaseFormList; }
private CmsRelease fetchReleaseRecord(String nsPath, Date ts, int genTime) throws InterruptedException { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(CmsConstants.SEARCH_TS_PATTERN); Thread.sleep(3000); SearchQuery latestRelease = new NativeSearchQueryBuilder() .withIndices("cms-*") .withTypes("release").withFilter( FilterBuilders.andFilter( FilterBuilders.queryFilter(QueryBuilders.termQuery("nsPath.keyword", nsPath)), FilterBuilders.queryFilter(QueryBuilders.rangeQuery("created"). from(simpleDateFormat.format(DateUtils.addMinutes(ts, -(genTime + 10)))). to(simpleDateFormat.format(ts))))). withSort(SortBuilders.fieldSort("created").order(SortOrder.DESC)).build(); List<CmsReleaseSearch> ciList = indexer.getTemplate().queryForList(latestRelease, CmsReleaseSearch.class); if (!ciList.isEmpty()) { return ciList.get(0); } throw new RuntimeException("Cant find bom release for deployment plan generation event"); }
private static void updateAttemptMetrics(RMContainerImpl container) { // If this is a preempted container, update preemption metrics Resource resource = container.getContainer().getResource(); RMAppAttempt rmAttempt = container.rmContext.getRMApps() .get(container.getApplicationAttemptId().getApplicationId()) .getCurrentAppAttempt(); if (ContainerExitStatus.PREEMPTED == container.finishedStatus .getExitStatus()) { rmAttempt.getRMAppAttemptMetrics().updatePreemptionInfo(resource, container); } if (rmAttempt != null) { long usedMillis = container.finishTime - container.creationTime; long memorySeconds = resource.getMemory() * usedMillis / DateUtils.MILLIS_PER_SECOND; long vcoreSeconds = resource.getVirtualCores() * usedMillis / DateUtils.MILLIS_PER_SECOND; long gcoreSeconds = resource.getGpuCores() * usedMillis / DateUtils.MILLIS_PER_SECOND; rmAttempt.getRMAppAttemptMetrics() .updateAggregateAppResourceUsage(memorySeconds,vcoreSeconds, gcoreSeconds); } }
synchronized AggregateAppResourceUsage getRunningAggregateAppResourceUsage() { long currentTimeMillis = System.currentTimeMillis(); // Don't walk the whole container list if the resources were computed // recently. if ((currentTimeMillis - lastMemoryAggregateAllocationUpdateTime) > MEM_AGGREGATE_ALLOCATION_CACHE_MSECS) { long memorySeconds = 0; long vcoreSeconds = 0; long gcoreSeconds = 0; for (RMContainer rmContainer : this.liveContainers.values()) { long usedMillis = currentTimeMillis - rmContainer.getCreationTime(); Resource resource = rmContainer.getContainer().getResource(); memorySeconds += resource.getMemory() * usedMillis / DateUtils.MILLIS_PER_SECOND; vcoreSeconds += resource.getVirtualCores() * usedMillis / DateUtils.MILLIS_PER_SECOND; gcoreSeconds += resource.getGpuCores() * usedMillis / DateUtils.MILLIS_PER_SECOND; } lastMemoryAggregateAllocationUpdateTime = currentTimeMillis; lastMemorySeconds = memorySeconds; lastVcoreSeconds = vcoreSeconds; lastGcoreSeconds = gcoreSeconds; } return new AggregateAppResourceUsage(lastMemorySeconds, lastVcoreSeconds, lastGcoreSeconds); }
@Override public String exec(final Tuple tuple) throws IOException { if (tuple == null || tuple.size() == 0) { return null; } Object dateString = tuple.get(0); if (dateString == null) { return null; } try { Date date = DateUtils.parseDate(dateString.toString(), new String[]{"yyyy-MM-dd HH:mm:ss"}); return DateFormatUtils.format(date, formatPattern); } catch (ParseException e) { e.printStackTrace(); } return null; }
public static Reference createReference() { final Reference reference = new Reference(); reference.setSize(REF_BASES_COUNT); reference.setName("Test.Reference.0.0.1"); reference.setPath("/contents/tests/references/" + reference.getId()); reference.setCreatedDate(DateUtils.truncate(new Date(), Calendar.DAY_OF_MONTH)); reference.setCreatedBy(AuthUtils.getCurrentUserId()); reference.setType(BiologicalDataItemResourceType.FILE); reference.setIndex(createIndex(BiologicalDataItemFormat.REFERENCE_INDEX, BiologicalDataItemResourceType.FILE, "")); final String[] dictionary = new String[]{"A1", "A2", "X"}; for (String name : dictionary) { final Chromosome chromosome = new Chromosome(name, CHROMOSOME_LENGTH); chromosome.setPath(String.format("/references/%s/chromosomes/%s/sequences.nib", reference.getId(), name)); reference.getChromosomes().add(chromosome); } return reference; }
@Override public int delAppHistory4index(List<Integer> appIds) { // String hql = // "delete AppHistory4Index where appStatus=3 and indexStatus=-1 and appId in (:appIds)"; // 删除前一天生成索引的数据,避免数据过多 String hql = "delete AppHistory4Index where (indexStatus=-1 and appId in (:appIds) ) or lastIndexTime<:lastIndexTime"; Session session = null; try { session = this.sessions.openSession(); Query query = session.createQuery(hql); query.setParameterList("appIds", appIds); query.setTimestamp("lastIndexTime", DateUtils.addDays(new Date(), -1));// 删除前一天索引后的数据 return query.executeUpdate(); } catch (Exception e) { logger.error("error:", e); return 0; } finally { if (session != null && session.isOpen()) { session.flush(); session.clear(); session.close(); } } }
private static void updateAttemptMetrics(RMContainerImpl container) { // If this is a preempted container, update preemption metrics Resource resource = container.getContainer().getResource(); RMAppAttempt rmAttempt = container.rmContext.getRMApps() .get(container.getApplicationAttemptId().getApplicationId()) .getCurrentAppAttempt(); if (rmAttempt != null) { if (ContainerExitStatus.PREEMPTED == container.finishedStatus .getExitStatus()) { rmAttempt.getRMAppAttemptMetrics().updatePreemptionInfo(resource, container); } long usedMillis = container.finishTime - container.creationTime; long memorySeconds = resource.getMemory() * usedMillis / DateUtils.MILLIS_PER_SECOND; long vcoreSeconds = resource.getVirtualCores() * usedMillis / DateUtils.MILLIS_PER_SECOND; rmAttempt.getRMAppAttemptMetrics() .updateAggregateAppResourceUsage(memorySeconds,vcoreSeconds); } }
synchronized AggregateAppResourceUsage getRunningAggregateAppResourceUsage() { long currentTimeMillis = System.currentTimeMillis(); // Don't walk the whole container list if the resources were computed // recently. if ((currentTimeMillis - lastMemoryAggregateAllocationUpdateTime) > MEM_AGGREGATE_ALLOCATION_CACHE_MSECS) { long memorySeconds = 0; long vcoreSeconds = 0; for (RMContainer rmContainer : this.liveContainers.values()) { long usedMillis = currentTimeMillis - rmContainer.getCreationTime(); Resource resource = rmContainer.getContainer().getResource(); memorySeconds += resource.getMemory() * usedMillis / DateUtils.MILLIS_PER_SECOND; vcoreSeconds += resource.getVirtualCores() * usedMillis / DateUtils.MILLIS_PER_SECOND; } lastMemoryAggregateAllocationUpdateTime = currentTimeMillis; lastMemorySeconds = memorySeconds; lastVcoreSeconds = vcoreSeconds; } return new AggregateAppResourceUsage(lastMemorySeconds, lastVcoreSeconds); }
/** * Reads the payment DTO from the form */ @Override protected DoPaymentDTO resolvePaymentDTO(final ActionContext context) { final DoPaymentDTO dto = super.resolvePaymentDTO(context); dto.setContext(TransactionContext.PAYMENT); final PaymentForm form = context.getForm(); if (form.isToSystem()) { dto.setTo(SystemAccountOwner.instance()); } // When there is a single payment scheduled for today, remove it, making the payment to be processed now final List<ScheduledPaymentDTO> payments = dto.getPayments(); if (payments != null && payments.size() == 1) { final ScheduledPaymentDTO payment = payments.get(0); if (DateUtils.isSameDay(Calendar.getInstance(), payment.getDate())) { // A single payment scheduled for today is handled as not scheduled dto.setPayments(null); } } return dto; }
@Override public Map<String, Object> getParams() { Map<String, Object> params = new HashMap<>(); for (MacroArgs macroArgs : paramNames) { TimeZone timeZone = macroArgs.timeZone == null ? TimeZone.getDefault() : macroArgs.timeZone; Date date1 = (Date) namedParameters.get(macroArgs.firstParamName); if (date1 == null) { throw new RuntimeException(String.format("Parameter %s not found for macro", macroArgs.firstParamName)); } Calendar calendar1 = Calendar.getInstance(timeZone); calendar1.setTime(date1); calendar1 = DateUtils.truncate(calendar1, Calendar.DAY_OF_MONTH); Calendar calendar2 = Calendar.getInstance(timeZone); calendar2.setTime(calendar1.getTime()); calendar2.add(Calendar.DAY_OF_MONTH, 1); params.put(macroArgs.firstParamName, calendar1.getTime()); params.put(macroArgs.secondParamName, calendar2.getTime()); } return params; }
@Test public void getSecuritySummariesByAccount() throws Exception { Transaction buy = createSecurityTransaction(BigDecimal.TEN, "-123.45"); buy.addDetails(new TransactionDetail(null, BigDecimal.ONE.negate(), null, null)); Transaction dividend = createSecurityTransaction(null, "150.00"); List<SecuritySummary> securities = securityDao.getSecuritySummariesByAccount(); assertThat(securities).hasSize(1); assertThat(securities.get(0).getAccount()).isEqualTo(buy.getAccount()); assertThat(securities.get(0).getSecurity()).isEqualTo(buy.getSecurity()); assertThat(securities.get(0).getShares()).isEqualByComparingTo(buy.getAssetQuantity()); assertThat(securities.get(0).getCostBasis()).isEqualByComparingTo(buy.getDetails().get(0).getAmount().negate()); assertThat(securities.get(0).getDividends()).isEqualTo(dividend.getAmount()); assertThat(securities.get(0).getFirstAcquired().getTime()).isEqualTo(DateUtils.truncate(buy.getDate(), Calendar.DAY_OF_MONTH).getTime()); assertThat(securities.get(0).getTransactionCount()).isEqualTo(2); }
@Override public void init(Map<String, Object> params) { if (companion != null) { companion.initTable(weeklyReportsTable); } setWeekRange(DateTimeUtils.getFirstDayOfWeek(DateUtils.addWeeks(timeSource.currentTimestamp(), -1))); User currentOrSubstitutedUser = userSession.getCurrentOrSubstitutedUser(); managedProjects = projectsService.getActiveManagedProjectsForUser(currentOrSubstitutedUser, View.LOCAL); managedUsers = projectsService.getManagedUsers(currentOrSubstitutedUser, View.LOCAL); initUsersTable(); initUserReportsTable(); initDateField(); initStatusOption(); initTypeOptions(); updateWeek(); project.addValueChangeListener(e -> task.setValue(null)); status.setOptionsList(Arrays.asList(TimeEntryStatus.values())); refresh.setAction(new RefreshAction(usersTable)); user.setOptionsList(projectsService.getManagedUsers(userSession.getCurrentOrSubstitutedUser(), View.MINIMAL)); }
@Test public void getPurchasePriceAdjustsForSplits() throws Exception { Security security = new Security("stock", SecurityType.STOCK); security.setSplits(Lists.newArrayList(new StockSplit(security, splitDate, new SplitRatio(BigDecimal.ONE, BigDecimal.valueOf(2L))))); TransactionDetail purchase = new TransactionDetailBuilder().amount(BigDecimal.TEN.negate()) .shares(BigDecimal.ONE).get(); new TransactionBuilder().date(DateUtils.addDays(splitDate, -1)) .account(new Account(new Currency())) .security(security) .details(purchase).get(); TransactionDetail sale = new TransactionDetailBuilder().amount(BigDecimal.TEN) .shares(BigDecimal.ONE) .onTransaction(DateUtils.addDays(splitDate, 1)).get(); SecurityLot lot = new SecurityLot(purchase, sale, BigDecimal.ONE); assertThat(lot.getPurchasePrice()).isEqualTo(BigDecimal.valueOf(5L)); }
/** * Section generated today? * * @return {@code true} if section generated, returns {@code false} otherwise */ public synchronized boolean hasSectionToday() { try { final Query query = new Query().addSort(Keys.OBJECT_ID, SortDirection.DESCENDING). setCurrentPageNum(1).setPageSize(1); query.setFilter(new PropertyFilter(Article.ARTICLE_TYPE, FilterOperator.EQUAL, Article.ARTICLE_TYPE_C_JOURNAL_SECTION)); final JSONObject result = articleRepository.get(query); final List<JSONObject> journals = CollectionUtils.<JSONObject>jsonArrayToList(result.optJSONArray(Keys.RESULTS)); if (journals.isEmpty()) { return false; } final JSONObject maybeToday = journals.get(0); final long created = maybeToday.optLong(Article.ARTICLE_CREATE_TIME); return DateUtils.isSameDay(new Date(created), new Date()); } catch (final RepositoryException e) { LOGGER.log(Level.ERROR, "Check section generated failed", e); return false; } }
private void pushMessage(Connection connection, String queueName, String messageId, String payload, long offsetTimeInSecond) { String PUSH_MESSAGE = "INSERT INTO queue_message (created_on, deliver_on, queue_name, message_id, offset_time_seconds, payload) VALUES (:createdOn, :deliverOn, :queueName, :messageId, :offsetSeconds, :payload)"; String UPDATE_MESSAGE = "UPDATE queue_message SET payload = :payload WHERE queue_name = :queueName AND message_id = :messageId"; createQueueIfNotExists(connection, queueName); Date now = DateUtils.truncate(new Date(), Calendar.SECOND); Date deliverTime = new Date(now.getTime() + (offsetTimeInSecond*1000)); boolean exists = existsMessage(connection, queueName, messageId); if (!exists) { connection.createQuery(PUSH_MESSAGE) .addParameter("createdOn", now) .addParameter("deliverOn", deliverTime) .addParameter("queueName", queueName) .addParameter("messageId", messageId) .addParameter("offsetSeconds", offsetTimeInSecond) .addParameter("payload", payload).executeUpdate(); } else { connection.createQuery(UPDATE_MESSAGE) .addParameter("queueName", queueName) .addParameter("messageId", messageId) .addParameter("payload", payload).executeUpdate(); } }
@Override public int sendAppDailyEmail() { Date endDate = new Date(); Date startDate = DateUtils.addDays(endDate, -1); int successCount = 0; List<AppDesc> appDescList = appService.getAllAppDesc(); for (AppDesc appDesc : appDescList) { try { boolean result = sendAppDailyEmail(appDesc.getAppId(), startDate, endDate); if (result) { successCount++; } } catch (Exception e) { logger.error(e.getMessage(), e); } } return successCount; }
@Override public Agents instancesCreatedAfterTimeout(PluginSettings settings, Agents agents) { ArrayList<Agent> oldAgents = new ArrayList<>(); for (Agent agent : agents.agents()) { OpenStackInstance instance = instances.get(agent.elasticAgentId()); if (instance == null) { continue; } if (DateUtils.addMinutes(instance.createAt().toDate(), settings.getAutoRegisterPeriod().getMinutes()).before(new Date())) { oldAgents.add(agent); } } return new Agents(oldAgents); }
/** * 检查锁定 */ @RequestMapping(value = "/check_lock", method = RequestMethod.POST) public @ResponseBody Message checkLock(Long id) { Order order = orderService.find(id); if (order == null) { return Message.warn("admin.common.invalid"); } Admin admin = adminService.getCurrent(); if (order.isLocked(admin)) { if (order.getOperator() != null) { return Message.warn("admin.order.adminLocked", order.getOperator().getUsername()); } else { return Message.warn("admin.order.memberLocked"); } } else { order.setLockExpire(DateUtils.addSeconds(new Date(), 20)); order.setOperator(admin); orderService.update(order); return SUCCESS_MESSAGE; } }
/** * 找回密码提交 */ @RequestMapping(value = "/find", method = RequestMethod.POST) public @ResponseBody Message find(String captchaId, String captcha, String username, String email) { if (!captchaService.isValid(CaptchaType.findPassword, captchaId, captcha)) { return Message.error("shop.captcha.invalid"); } if (StringUtils.isEmpty(username) || StringUtils.isEmpty(email)) { return Message.error("shop.common.invalid"); } Member member = memberService.findByUsername(username); if (member == null) { return Message.error("shop.password.memberNotExist"); } if (!member.getEmail().equalsIgnoreCase(email)) { return Message.error("shop.password.invalidEmail"); } Setting setting = SettingUtils.get(); SafeKey safeKey = new SafeKey(); safeKey.setValue(UUID.randomUUID().toString() + DigestUtils.md5Hex(RandomStringUtils.randomAlphabetic(30))); safeKey.setExpire(setting.getSafeKeyExpiryTime() != 0 ? DateUtils.addMinutes(new Date(), setting.getSafeKeyExpiryTime()) : null); member.setSafeKey(safeKey); memberService.update(member); mailService.sendFindPasswordMail(member.getEmail(), member.getUsername(), safeKey); return Message.success("shop.password.mailSuccess"); }
private Order loadChangeAndSave(Saver saver) { Order order = persistence.callInTransaction(em -> em.find(Order.class, this.order.getId())); Order orderCopy = metadata.getTools().copy(order); Customer customerCopy = metadata.getTools().copy(this.customer); Date date = DateUtils.addDays(orderCopy.getDate(), 1); orderCopy.setDate(date); orderCopy.setAmount(null); orderCopy.setCustomer(customerCopy); assertNull(orderCopy.getUser()); assertTrue(PersistenceHelper.isNew(orderCopy)); saver.save(orderCopy); order = persistence.callInTransaction(em -> em.find(Order.class, this.order.getId(), orderView)); assertEquals(date, order.getDate()); return order; }
private Date getDate() { Date date = parseDate(requestMap.get("inpDate")); if (date != null) { log.debug("Return date ordered from request." + date.toString()); return date; } date = parseDate((String) httpSession.getAttribute(windowId + "|" + "DATEORDERED")); if (date != null) { log.debug("Return date ordered from window's session: " + date.toString()); return date; } date = parseDate((String) httpSession.getAttribute(windowId + "|" + "DATEINVOICED")); if (date != null) { log.debug("Return date invoiced from window's session: " + date.toString()); return date; } return DateUtils.truncate(new Date(), Calendar.DATE); }
private OpenStackInstances unregisteredAfterTimeout(PluginSettings settings, Agents knownAgents) throws Exception { String agentID; Map<String, String> op_instance_prefix = new HashMap<String, String>(); op_instance_prefix.put("name",settings.getOpenstackVmPrefix()); Period period = settings.getAutoRegisterPeriod(); OpenStackInstances unregisteredInstances = new OpenStackInstances(); OpenstackClientWrapper client = new OpenstackClientWrapper(settings); List<Server> allInstances = (List<Server>) client.getClient().compute().servers().list(op_instance_prefix); for (Server server : allInstances) { if (knownAgents.containsAgentWithId(server.getId())) { continue; } if (DateUtils.addMinutes(server.getCreated(), period.getMinutes()).before(new Date())) { unregisteredInstances.register(new OpenStackInstance(server.getId(), server.getCreated(), server.getMetadata().get(Constants.GOSERVER_PROPERTIES_PREFIX + Constants.ENVIRONMENT_KEY), client.getClient())); } } return unregisteredInstances; }
private void manualCostAdjustment(String materialTransactionId, BigDecimal amount, boolean incremental, boolean unitCost, int day) { try { OBDal.getInstance().commitAndClose(); HashMap<String, Object> parameters = new HashMap<String, Object>(); String content = "{\r 'M_Transaction_ID':'" + materialTransactionId + "', \r '_params':{\r 'Cost':" + amount.toString() + ", \r 'DateAcct':'" + formatDate(DateUtils.addDays(new Date(), day)) + "', \r 'IsIncremental':" + incremental + ", \r 'IsUnitCost':" + unitCost + "\r }\r}"; Object object = new ManualCostAdjustmentProcessHandler(); Class<? extends Object> clazz = object.getClass(); Method method = clazz.getDeclaredMethod("execute", Map.class, String.class); method.setAccessible(true); String response = ((JSONObject) method.invoke(object, parameters, content)).toString(); assertTrue(response.contains("success")); assertFalse(response.contains("error")); OBDal.getInstance().commitAndClose(); } catch (Exception e) { throw new OBException(e); } }
/** * Gets hot articles with the specified fetch size. * * @param fetchSize the specified fetch size * @return recent articles, returns an empty list if not found * @throws ServiceException service exception */ public List<JSONObject> getHotArticles(final int fetchSize) throws ServiceException { final String id = String.valueOf(DateUtils.addDays(new Date(), -7).getTime()); try { final Query query = new Query().addSort(Article.ARTICLE_COMMENT_CNT, SortDirection.DESCENDING). addSort(Keys.OBJECT_ID, SortDirection.ASCENDING).setCurrentPageNum(1).setPageSize(fetchSize); final List<Filter> filters = new ArrayList<Filter>(); filters.add(new PropertyFilter(Keys.OBJECT_ID, FilterOperator.GREATER_THAN_OR_EQUAL, id)); filters.add(new PropertyFilter(Article.ARTICLE_TYPE, FilterOperator.NOT_EQUAL, Article.ARTICLE_TYPE_C_DISCUSSION)); query.setFilter(new CompositeFilter(CompositeFilterOperator.AND, filters)); final JSONObject result = articleRepository.get(query); final List<JSONObject> ret = CollectionUtils.<JSONObject>jsonArrayToList(result.optJSONArray(Keys.RESULTS)); organizeArticles(ret); return ret; } catch (final RepositoryException e) { LOGGER.log(Level.ERROR, "Gets hot articles failed", e); throw new ServiceException(e); } }