/** * Returns a Page of DocumentPackages, that last updated in time range, which represents a * paginated query response. Important once you have many DocumentPackages. * * @param status Returned DocumentPackages must have their status set to this value to be included * in the result set * @param request Identifying which page of results to return * @param from Date range starting from this date included * @param to Date range ending of this date included * @return List of DocumentPackages that populate the specified page */ public Page<DocumentPackage> getUpdatedPackagesWithinDateRange( PackageStatus status, PageRequest request, Date from, Date to) { String fromDate = DateHelper.dateToIsoUtcFormat(from); String toDate = DateHelper.dateToIsoUtcFormat(to); String path = template .urlFor(UrlTemplate.PACKAGE_LIST_STATUS_DATE_RANGE_PATH) .replace("{status}", new PackageStatusConverter(status).toAPIPackageStatus()) .replace("{from}", Integer.toString(request.getFrom())) .replace("{to}", Integer.toString(request.to())) .replace("{lastUpdatedStartDate}", fromDate) .replace("{lastUpdatedEndDate}", toDate) .build(); try { String response = client.get(path); Result<Package> results = JacksonUtil.deserialize(response, new TypeReference<Result<Package>>() {}); return convertToPage(results, request); } catch (RequestException e) { throw new EslServerException("Could not get package list.", e); } catch (Exception e) { e.printStackTrace(); throw new EslException("Could not get package list. Exception: " + e.getMessage()); } }
public static void save(Properties properties, File file) throws IOException { Assert.notNull(properties, "存储的属性为空!"); OutputStream outputStream = new FileOutputStream(file); properties.store(outputStream, "saved on " + DateHelper.getStringDate()); outputStream.flush(); outputStream.close(); }