List of usage examples for java.time LocalDate now
public static LocalDate now()
From source file:GUI.Framedashboard.java
private void btnupdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnupdateActionPerformed User u = new User(); UserDao udao = new UserDao(); int i = jTable1.getSelectedRow(); int s = (int) jTable1.getModel().getValueAt(i, 0); u.setId(s);/*w ww. java 2 s .c o m*/ u.setUsername(tfusername.getText()); u.setUsernameCanonical(tfusername.getText()); u.setEmail(tfemail.getText()); u.setEmailCanonical(tfemail.getText()); // u.setPassword(tfmdp.getText()); if (chbenabled.isSelected()) u.setEnabled(1); else { u.setEnabled(0); } if (cboxgender.getSelectedIndex() == 0) { u.setGender("m"); } else { u.setGender("f"); } u.setPhone(tfphone.getText()); u.setLastname(tflastname.getText()); u.setFirstname(tffirstname.getText()); if (cbrole.getSelectedIndex() == 0) { u.setRoles("ROLE_ADMIN"); } if (cbrole.getSelectedIndex() == 1) { u.setRoles("ROLE_USER"); } else { u.setRoles("ROLE_FOURNISSEUR"); } try { u.setBonus(Integer.parseInt(tfbonus.getText())); } catch (NumberFormatException ex) { System.out.println("erreur" + ex); } java.sql.Date d = java.sql.Date.valueOf(LocalDate.now()); u.setUpdated_at(d); u.setAdress(taadress.getText()); udao.update(u); jTable1.setModel(new UserModel()); // TODO add your handling code here: }
From source file:dpfmanager.shell.interfaces.gui.component.report.ReportsView.java
@FXML protected void clearReports(ActionEvent event) throws Exception { LocalDate date = LocalDate.now(); date = date.plusYears(10L);/*from w ww. ja v a 2 s . co m*/ RadioButton radio = (RadioButton) toggleClear.getSelectedToggle(); if (radio.getId().equals("radOlder")) { if (datePicker.getValue() != null) { date = datePicker.getValue(); } else { getContext().send(BasicConfig.MODULE_MESSAGE, new AlertMessage(AlertMessage.Type.ALERT, bundle.getString("alertSelectDate"))); return; } } // All ok, delete if (getController().clearReports(date)) { getModel().clearData(); getModel().readReports(); recalculateSize(); hideClearOptions(); addData(); getContext().send(BasicConfig.MODULE_MESSAGE, new AlertMessage(AlertMessage.Type.INFO, bundle.getString("successDeleteReports"))); } else { getContext().send(BasicConfig.MODULE_MESSAGE, new AlertMessage(AlertMessage.Type.ERROR, bundle.getString("errorDeleteReports"))); } }
From source file:ro.cs.products.Executor.java
private static int execute(CommandLine commandLine) throws Exception { int retCode = ReturnCode.OK; CommandLineParser parser = new DefaultParser(); String logFile = props.getProperty("master.log.file"); String folder;// w w w . ja va2 s . c om boolean debugMode = commandLine.hasOption(Constants.PARAM_VERBOSE); Logger.CustomLogger logger; SensorType sensorType = commandLine.hasOption(Constants.SENSOR) ? Enum.valueOf(SensorType.class, commandLine.getOptionValue(Constants.SENSOR)) : SensorType.S2; if (commandLine.hasOption(Constants.PARAM_INPUT_FOLDER)) { folder = commandLine.getOptionValue(Constants.PARAM_INPUT_FOLDER); Utilities.ensureExists(Paths.get(folder)); Logger.initialize(Paths.get(folder, logFile).toAbsolutePath().toString(), debugMode); logger = Logger.getRootLogger(); if (commandLine.hasOption(Constants.PARAM_VERBOSE)) { printCommandLine(commandLine); } if (sensorType == SensorType.L8) { logger.warn("Argument --input will be ignored for Landsat8"); } else { String rootFolder = commandLine.getOptionValue(Constants.PARAM_INPUT_FOLDER); FillAnglesMethod fillAnglesMethod = Enum.valueOf(FillAnglesMethod.class, commandLine.hasOption(Constants.PARAM_FILL_ANGLES) ? commandLine.getOptionValue(Constants.PARAM_FILL_ANGLES).toUpperCase() : FillAnglesMethod.NONE.name()); if (!FillAnglesMethod.NONE.equals(fillAnglesMethod)) { try { Set<String> products = null; if (commandLine.hasOption(Constants.PARAM_PRODUCT_LIST)) { products = new HashSet<>(); for (String product : commandLine.getOptionValues(Constants.PARAM_PRODUCT_LIST)) { if (!product.endsWith(".SAFE")) { products.add(product + ".SAFE"); } else { products.add(product); } } } ProductInspector inspector = new ProductInspector(rootFolder, fillAnglesMethod, products); inspector.traverse(); } catch (IOException e) { logger.error(e.getMessage()); retCode = ReturnCode.DOWNLOAD_ERROR; } } } } else { folder = commandLine.getOptionValue(Constants.PARAM_OUT_FOLDER); Utilities.ensureExists(Paths.get(folder)); Logger.initialize(Paths.get(folder, logFile).toAbsolutePath().toString(), debugMode); logger = Logger.getRootLogger(); printCommandLine(commandLine); String proxyType = commandLine.hasOption(Constants.PARAM_PROXY_TYPE) ? commandLine.getOptionValue(Constants.PARAM_PROXY_TYPE) : nullIfEmpty(props.getProperty("proxy.type", null)); String proxyHost = commandLine.hasOption(Constants.PARAM_PROXY_HOST) ? commandLine.getOptionValue(Constants.PARAM_PROXY_HOST) : nullIfEmpty(props.getProperty("proxy.host", null)); String proxyPort = commandLine.hasOption(Constants.PARAM_PROXY_PORT) ? commandLine.getOptionValue(Constants.PARAM_PROXY_PORT) : nullIfEmpty(props.getProperty("proxy.port", null)); String proxyUser = commandLine.hasOption(Constants.PARAM_PROXY_USER) ? commandLine.getOptionValue(Constants.PARAM_PROXY_USER) : nullIfEmpty(props.getProperty("proxy.user", null)); String proxyPwd = commandLine.hasOption(Constants.PARAM_PROXY_PASSWORD) ? commandLine.getOptionValue(Constants.PARAM_PROXY_PASSWORD) : nullIfEmpty(props.getProperty("proxy.pwd", null)); NetUtils.setProxy(proxyType, proxyHost, proxyPort == null ? 0 : Integer.parseInt(proxyPort), proxyUser, proxyPwd); List<ProductDescriptor> products = new ArrayList<>(); Set<String> tiles = new HashSet<>(); Polygon2D areaOfInterest = new Polygon2D(); ProductStore source = Enum.valueOf(ProductStore.class, commandLine.getOptionValue(Constants.PARAM_DOWNLOAD_STORE, ProductStore.SCIHUB.toString())); if (sensorType == SensorType.S2 && !commandLine.hasOption(Constants.PARAM_FLAG_SEARCH_AWS) && !commandLine.hasOption(Constants.PARAM_USER)) { throw new MissingOptionException("Missing SciHub credentials"); } String user = commandLine.getOptionValue(Constants.PARAM_USER); String pwd = commandLine.getOptionValue(Constants.PARAM_PASSWORD); if (user != null && pwd != null && !user.isEmpty() && !pwd.isEmpty()) { String authToken = "Basic " + new String(Base64.getEncoder().encode((user + ":" + pwd).getBytes())); NetUtils.setAuthToken(authToken); } ProductDownloader downloader = sensorType.equals(SensorType.S2) ? new SentinelProductDownloader(source, commandLine.getOptionValue(Constants.PARAM_OUT_FOLDER), props) : new LandsatProductDownloader(commandLine.getOptionValue(Constants.PARAM_OUT_FOLDER), props); TileMap tileMap = sensorType == SensorType.S2 ? SentinelTilesMap.getInstance() : LandsatTilesMap.getInstance(); if (commandLine.hasOption(Constants.PARAM_AREA)) { String[] points = commandLine.getOptionValues(Constants.PARAM_AREA); for (String point : points) { areaOfInterest.append(Double.parseDouble(point.substring(0, point.indexOf(","))), Double.parseDouble(point.substring(point.indexOf(",") + 1))); } } else if (commandLine.hasOption(Constants.PARAM_AREA_FILE)) { areaOfInterest = Polygon2D.fromWKT(new String( Files.readAllBytes(Paths.get(commandLine.getOptionValue(Constants.PARAM_AREA_FILE))), StandardCharsets.UTF_8)); } else if (commandLine.hasOption(Constants.PARAM_TILE_SHAPE_FILE)) { String tileShapeFile = commandLine.getOptionValue(Constants.PARAM_TILE_SHAPE_FILE); if (Files.exists(Paths.get(tileShapeFile))) { logger.info(String.format("Reading %s tiles extents", sensorType)); tileMap.fromKmlFile(tileShapeFile); logger.info(String.valueOf(tileMap.getCount() + " tiles found")); } } else { if (tileMap.getCount() == 0) { logger.info(String.format("Loading %s tiles extents", sensorType)); tileMap.read(Executor.class.getResourceAsStream(sensorType + "tilemap.dat")); logger.info(String.valueOf(tileMap.getCount() + " tile extents loaded")); } } if (commandLine.hasOption(Constants.PARAM_TILE_LIST)) { Collections.addAll(tiles, commandLine.getOptionValues(Constants.PARAM_TILE_LIST)); } else if (commandLine.hasOption(Constants.PARAM_TILE_LIST_FILE)) { tiles.addAll( Files.readAllLines(Paths.get(commandLine.getOptionValue(Constants.PARAM_TILE_LIST_FILE)))); } if (commandLine.hasOption(Constants.PARAM_PRODUCT_LIST)) { String[] uuids = commandLine.getOptionValues(Constants.PARAM_PRODUCT_UUID_LIST); String[] productNames = commandLine.getOptionValues(Constants.PARAM_PRODUCT_LIST); if (sensorType == SensorType.S2 && (!commandLine.hasOption(Constants.PARAM_DOWNLOAD_STORE) || ProductStore.SCIHUB.toString() .equals(commandLine.getOptionValue(Constants.PARAM_DOWNLOAD_STORE))) && (uuids == null || uuids.length != productNames.length)) { logger.error("For the list of product names a corresponding list of UUIDs has to be given!"); return -1; } for (int i = 0; i < productNames.length; i++) { ProductDescriptor productDescriptor = sensorType == SensorType.S2 ? new SentinelProductDescriptor(productNames[i]) : new LandsatProductDescriptor(productNames[i]); if (uuids != null) { productDescriptor.setId(uuids[i]); } products.add(productDescriptor); } } else if (commandLine.hasOption(Constants.PARAM_PRODUCT_LIST_FILE)) { for (String line : Files .readAllLines(Paths.get(commandLine.getOptionValue(Constants.PARAM_PRODUCT_LIST_FILE)))) { products.add(sensorType == SensorType.S2 ? new SentinelProductDescriptor(line) : new LandsatProductDescriptor(line)); } } double clouds; if (commandLine.hasOption(Constants.PARAM_CLOUD_PERCENTAGE)) { clouds = Double.parseDouble(commandLine.getOptionValue(Constants.PARAM_CLOUD_PERCENTAGE)); } else { clouds = Constants.DEFAULT_CLOUD_PERCENTAGE; } String sensingStart; if (commandLine.hasOption(Constants.PARAM_START_DATE)) { String dateString = commandLine.getOptionValue(Constants.PARAM_START_DATE); LocalDate startDate = LocalDate.parse(dateString, DateTimeFormatter.ISO_DATE); long days = ChronoUnit.DAYS.between(startDate, LocalDate.now()); sensingStart = String.format(Constants.PATTERN_START_DATE, days); } else { sensingStart = Constants.DEFAULT_START_DATE; } String sensingEnd; if (commandLine.hasOption(Constants.PARAM_END_DATE)) { String dateString = commandLine.getOptionValue(Constants.PARAM_END_DATE); LocalDate endDate = LocalDate.parse(dateString, DateTimeFormatter.ISO_DATE); long days = ChronoUnit.DAYS.between(endDate, LocalDate.now()); sensingEnd = String.format(Constants.PATTERN_START_DATE, days); } else { sensingEnd = Constants.DEFAULT_END_DATE; } int limit; if (commandLine.hasOption(Constants.PARAM_RESULTS_LIMIT)) { limit = Integer.parseInt(commandLine.getOptionValue(Constants.PARAM_RESULTS_LIMIT)); } else { limit = Constants.DEFAULT_RESULTS_LIMIT; } if (commandLine.hasOption(Constants.PARAM_DOWNLOAD_STORE)) { String value = commandLine.getOptionValue(Constants.PARAM_DOWNLOAD_STORE); if (downloader instanceof SentinelProductDownloader) { ((SentinelProductDownloader) downloader) .setDownloadStore(Enum.valueOf(ProductStore.class, value)); logger.info("Products will be downloaded from %s", value); } else { logger.warn("Argument --store will be ignored for Landsat8"); } } downloader.shouldCompress(commandLine.hasOption(Constants.PARAM_FLAG_COMPRESS)); downloader.shouldDeleteAfterCompression(commandLine.hasOption(Constants.PARAM_FLAG_DELETE)); if (commandLine.hasOption(Constants.PARAM_FILL_ANGLES)) { if (downloader instanceof SentinelProductDownloader) { ((SentinelProductDownloader) downloader) .setFillMissingAnglesMethod(Enum.valueOf(FillAnglesMethod.class, commandLine.hasOption(Constants.PARAM_FILL_ANGLES) ? commandLine.getOptionValue(Constants.PARAM_FILL_ANGLES).toUpperCase() : FillAnglesMethod.NONE.name())); } else { logger.warn("Argument --ma will be ignored for Landsat8"); } } int numPoints = areaOfInterest.getNumPoints(); tiles = tiles.stream().map(t -> t.startsWith("T") ? t.substring(1) : t).collect(Collectors.toSet()); if (products.size() == 0 && numPoints == 0 && tileMap.getCount() > 0) { Rectangle2D rectangle2D = tileMap.boundingBox(tiles); areaOfInterest.append(rectangle2D.getX(), rectangle2D.getY()); areaOfInterest.append(rectangle2D.getMaxX(), rectangle2D.getY()); areaOfInterest.append(rectangle2D.getMaxX(), rectangle2D.getMaxY()); areaOfInterest.append(rectangle2D.getX(), rectangle2D.getMaxY()); areaOfInterest.append(rectangle2D.getX(), rectangle2D.getY()); } numPoints = areaOfInterest.getNumPoints(); if (products.size() == 0 && numPoints > 0) { String searchUrl; AbstractSearch searchProvider; logger.debug("No product provided, searching on the AOI"); if (sensorType == SensorType.L8) { logger.debug("Search will be done for Landsat"); searchUrl = props.getProperty(Constants.PROPERTY_NAME_LANDSAT_SEARCH_URL, Constants.PROPERTY_NAME_DEFAULT_LANDSAT_SEARCH_URL); if (!NetUtils.isAvailable(searchUrl)) { logger.warn(searchUrl + " is not available!"); } searchProvider = new LandsatSearch(searchUrl); if (commandLine.hasOption(Constants.PARAM_START_DATE)) { searchProvider.setSensingStart(commandLine.getOptionValue(Constants.PARAM_START_DATE)); } if (commandLine.hasOption(Constants.PARAM_END_DATE)) { searchProvider.setSensingEnd(commandLine.getOptionValue(Constants.PARAM_END_DATE)); } if (commandLine.hasOption(Constants.PARAM_TILE_LIST)) { searchProvider.setTiles(tiles); } ((LandsatSearch) searchProvider).limit(limit); } else if (!commandLine.hasOption(Constants.PARAM_FLAG_SEARCH_AWS)) { logger.debug("Search will be done on SciHub"); searchUrl = props.getProperty(Constants.PROPERTY_NAME_SEARCH_URL, Constants.PROPERTY_DEFAULT_SEARCH_URL); if (!NetUtils.isAvailable(searchUrl)) { logger.warn(searchUrl + " is not available!"); searchUrl = props.getProperty(Constants.PROPERTY_NAME_SEARCH_URL_SECONDARY, Constants.PROPERTY_DEFAULT_SEARCH_URL_SECONDARY); } searchProvider = new SciHubSearch(searchUrl); SciHubSearch search = (SciHubSearch) searchProvider; if (user != null && !user.isEmpty() && pwd != null && !pwd.isEmpty()) { search = search.auth(user, pwd); } String interval = "[" + sensingStart + " TO " + sensingEnd + "]"; search.filter(Constants.SEARCH_PARAM_INTERVAL, interval).limit(limit); if (commandLine.hasOption(Constants.PARAM_RELATIVE_ORBIT)) { search.filter(Constants.SEARCH_PARAM_RELATIVE_ORBIT_NUMBER, commandLine.getOptionValue(Constants.PARAM_RELATIVE_ORBIT)); } } else { logger.debug("Search will be done on AWS"); searchUrl = props.getProperty(Constants.PROPERTY_NAME_AWS_SEARCH_URL, Constants.PROPERTY_DEFAULT_AWS_SEARCH_URL); searchProvider = new AmazonSearch(searchUrl); searchProvider.setTiles(tiles); Calendar calendar = Calendar.getInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); calendar.add(Calendar.DAY_OF_MONTH, Integer.parseInt(sensingStart.replace("NOW", "").replace("DAY", ""))); searchProvider.setSensingStart(dateFormat.format(calendar.getTime())); calendar = Calendar.getInstance(); String endOffset = sensingEnd.replace("NOW", "").replace("DAY", ""); int offset = endOffset.isEmpty() ? 0 : Integer.parseInt(endOffset); calendar.add(Calendar.DAY_OF_MONTH, offset); searchProvider.setSensingEnd(dateFormat.format(calendar.getTime())); if (commandLine.hasOption(Constants.PARAM_RELATIVE_ORBIT)) { searchProvider.setOrbit( Integer.parseInt(commandLine.getOptionValue(Constants.PARAM_RELATIVE_ORBIT))); } } if (searchProvider.getTiles() == null || searchProvider.getTiles().size() == 0) { searchProvider.setAreaOfInterest(areaOfInterest); } searchProvider.setClouds(clouds); products = searchProvider.execute(); } else { logger.debug("Product name(s) present, no additional search will be performed."); } if (downloader instanceof SentinelProductDownloader) { ((SentinelProductDownloader) downloader).setFilteredTiles(tiles, commandLine.hasOption(Constants.PARAM_FLAG_UNPACKED)); } downloader.setProgressListener(batchProgressListener); downloader.setFileProgressListener(fileProgressListener); retCode = downloader.downloadProducts(products); } return retCode; }
From source file:org.tightblog.service.WeblogEntryManager.java
/** * Get Weblog Entries grouped by calendar day. * * @param wesc WeblogEntrySearchCriteria object listing desired search parameters * @return Map of Lists of WeblogEntries keyed by calendar day */// ww w.j a v a2 s .com public Map<LocalDate, List<WeblogEntry>> getDateToWeblogEntryMap(WeblogEntrySearchCriteria wesc) { Map<LocalDate, List<WeblogEntry>> map = new TreeMap<>(Collections.reverseOrder()); List<WeblogEntry> entries = getWeblogEntries(wesc); for (WeblogEntry entry : entries) { entry.setCommentRepository(weblogEntryCommentRepository); LocalDate tmp = entry.getPubTime() == null ? LocalDate.now() : entry.getPubTime().atZone(ZoneId.systemDefault()).toLocalDate(); List<WeblogEntry> dayEntries = map.computeIfAbsent(tmp, k -> new ArrayList<>()); dayEntries.add(entry); } return map; }
From source file:alfio.manager.EventManagerIntegrationTest.java
@Test public void testUpdateBoundedCategory() { List<TicketCategoryModification> categories = Collections.singletonList(new TicketCategoryModification(null, "default", 10, new DateTimeModification(LocalDate.now(), LocalTime.now()), new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "", false, null, null, null, null, null)); Pair<Event, String> pair = initEvent(categories, organizationRepository, userManager, eventManager, eventRepository);/*from w w w .j a v a 2 s . com*/ Event event = pair.getKey(); TicketCategory category = ticketCategoryRepository.findByEventId(event.getId()).get(0); TicketCategoryModification tcm = new TicketCategoryModification(category.getId(), "default", 20, new DateTimeModification(LocalDate.now(), LocalTime.now()), new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "", false, null, null, null, null, null); eventManager.updateCategory(category.getId(), event.getId(), tcm, pair.getValue()); waitingQueueSubscriptionProcessor.distributeAvailableSeats(event); List<Ticket> tickets = ticketRepository.findFreeByEventId(event.getId()); assertNotNull(tickets); assertFalse(tickets.isEmpty()); assertEquals(AVAILABLE_SEATS, tickets.size()); assertEquals(0, tickets.stream().filter(t -> t.getCategoryId() == null).count()); }
From source file:net.resheim.eclipse.timekeeper.ui.views.WorkWeekView.java
@Override public void createPartControl(Composite parent) { FormToolkit ft = new FormToolkit(parent.getDisplay()); ScrolledComposite root = new ScrolledComposite(parent, SWT.V_SCROLL); ft.adapt(root);// ww w . j a va2 s. co m GridLayout layout = new GridLayout(); root.setLayout(layout); root.setExpandHorizontal(true); root.setExpandVertical(true); Composite main = ft.createComposite(root); ft.adapt(main); root.setContent(main); GridLayout layout2 = new GridLayout(3, false); layout2.horizontalSpacing = 0; main.setLayout(layout2); dateTimeLabel = new Text(main, SWT.NONE); GridData gdLabel = new GridData(); gdLabel.verticalIndent = 3; gdLabel.verticalAlignment = SWT.BEGINNING; dateTimeLabel.setLayoutData(gdLabel); dateChooser = new DateTime(main, SWT.DROP_DOWN | SWT.DATE | SWT.LONG); GridData gdChooser = new GridData(); gdChooser.verticalAlignment = SWT.BEGINNING; dateChooser.setLayoutData(gdChooser); ft.adapt(dateChooser); dateChooser.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { // Determine the first date of the week LocalDate date = LocalDate.of(dateChooser.getYear(), dateChooser.getMonth() + 1, dateChooser.getDay()); contentProvider.setFirstDayOfWeek(calculateFirstDayOfWeek(date)); viewer.setInput(this); } }); statusLabel = new Text(main, SWT.NONE); GridData gdStatusLabel = new GridData(); gdStatusLabel.grabExcessHorizontalSpace = true; gdStatusLabel.horizontalAlignment = SWT.FILL; gdStatusLabel.verticalIndent = 3; gdStatusLabel.verticalAlignment = SWT.BEGINNING; statusLabel.setLayoutData(gdStatusLabel); viewer = new TreeViewer(main, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); // Make the tree view provide selections getSite().setSelectionProvider(viewer); contentProvider = new ViewContentProvider(); viewer.setContentProvider(contentProvider); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); layoutData.horizontalSpan = 3; viewer.getControl().setLayoutData(layoutData); createTitleColumn(); for (int i = 0; i < 7; i++) { createTimeColumn(i); } Tree tree = viewer.getTree(); viewer.setComparator(new ViewerComparatorExtension()); tree.setHeaderVisible(true); tree.setLinesVisible(true); // Adjust column width when view is resized root.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { Rectangle area = root.getClientArea(); int width = area.width - 2 * tree.getBorderWidth(); Point vBarSize = tree.getVerticalBar().getSize(); width -= vBarSize.x; TreeColumn[] columns = tree.getColumns(); int cwidth = 0; for (int i = 1; i < columns.length; i++) { columns[i].pack(); if (columns[i].getWidth() < 50) { columns[i].setWidth(50); } cwidth += columns[i].getWidth(); } tree.getColumns()[0].setWidth(width - cwidth); } }); // Determine the first date of the week LocalDate date = LocalDate.now(); WeekFields weekFields = WeekFields.of(Locale.getDefault()); int day = date.get(weekFields.dayOfWeek()); contentProvider.setFirstDayOfWeek(date.minusDays(day - 1)); makeActions(); hookContextMenu(); hookDoubleClickAction(); contributeToActionBars(); taskListener = new TaskListener(); TasksUiPlugin.getTaskActivityManager().addActivationListener(taskListener); TasksUiPlugin.getTaskList().addChangeListener(taskListener); viewer.setInput(getViewSite()); // Force a redraw so content is visible root.pack(); installStatusUpdater(); }
From source file:alfio.manager.EventManagerIntegrationTest.java
@Test public void testUpdateEventHeader() { List<TicketCategoryModification> categories = Collections.singletonList(new TicketCategoryModification(null, "default", 10, new DateTimeModification(LocalDate.now(), LocalTime.now()), new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "", false, null, null, null, null, null)); Pair<Event, String> pair = initEvent(categories, organizationRepository, userManager, eventManager, eventRepository);/*from w w w .j a va 2 s . co m*/ Event event = pair.getLeft(); String username = pair.getRight(); Map<String, String> desc = new HashMap<>(); desc.put("en", "muh description new"); desc.put("it", "muh description new"); desc.put("de", "muh description new"); EventModification em = new EventModification(event.getId(), Event.EventType.INTERNAL, "http://example.com/new", null, "http://example.com/tc", "https://example.com/img.png", null, event.getShortName(), "new display name", event.getOrganizationId(), event.getLocation(), "0.0", "0.0", ZoneId.systemDefault().getId(), desc, DateTimeModification.fromZonedDateTime(event.getBegin()), DateTimeModification.fromZonedDateTime(event.getEnd().plusDays(42)), event.getRegularPrice(), event.getCurrency(), eventRepository.countExistingTickets(event.getId()), event.getVat(), event.isVatIncluded(), event.getAllowedPaymentProxies(), Collections.emptyList(), false, null, 7, null, null); eventManager.updateEventHeader(event, em, username); Event updatedEvent = eventRepository.findById(event.getId()); Assert.assertEquals("http://example.com/new", updatedEvent.getWebsiteUrl()); Assert.assertEquals("http://example.com/tc", updatedEvent.getTermsAndConditionsUrl()); Assert.assertEquals("https://example.com/img.png", updatedEvent.getImageUrl()); Assert.assertEquals("new display name", updatedEvent.getDisplayName()); }
From source file:com.hotelbeds.distribution.hotel_api_sdk.HotelApiClient.java
public RateCommentDetailsRS getRateCommentDetail(Integer contract, Integer incoming, Integer... rates) throws HotelApiSDKException { return getRateCommentDetail(LocalDate.now(), contract, incoming, rates); }
From source file:org.dataconservancy.packaging.tool.cli.AutomatedPackageTool.java
private InputStream createPackageMetadata() { final Properties metadata = new Properties(); if (packageMetadataFile != null) { if (!packageMetadataFile.exists()) { throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION); }/*from ww w . j a v a2s . com*/ try (InputStream fileStream = new FileInputStream(packageMetadataFile)) { metadata.load(fileStream); } catch (FileNotFoundException e) { throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION, e); } catch (IOException e) { log.error(e.getMessage()); throw new PackageToolException(PackagingToolReturnInfo.CMD_LINE_FILE_NOT_FOUND_EXCEPTION); } } if (!metadata.containsKey(packageNameKey)) { final List<String> name = packageParams.getParam(packageNameKey); if (name != null && name.size() > 0) { metadata.setProperty(packageNameKey, name.get(name.size() - 1)); } else { metadata.setProperty(packageNameKey, defaultPackageName); } } else if (packageName == null) { packageName = metadata.getProperty(packageNameKey); } else { metadata.setProperty(packageNameKey, packageName); } if (externalID != null) { metadata.setProperty(GeneralParameterNames.EXTERNAL_PROJECT_ID, externalID); } metadata.setProperty(BagItParameterNames.BAGGING_DATE, LocalDate.now().toString()); final ByteArrayOutputStream metaDataOut = new ByteArrayOutputStream(); InputStream metadataStream = null; try { metadata.store(metaDataOut, null); metaDataOut.close(); metadataStream = new ByteArrayInputStream(metaDataOut.toByteArray()); } catch (IOException e) { e.printStackTrace(); } return metadataStream; }
From source file:com.github.drbookings.ui.controller.MainController.java
void scrollToToday() { // if (logger.isDebugEnabled()) { // logger.debug("Trying to scroll to today"); // }/* w w w. j a v a2 s.co m*/ final int index = getManager().getUIData().indexOf(new DateBean(LocalDate.now(), getManager())); if (index >= 0) { if (logger.isDebugEnabled()) { logger.debug("Scrolling to index " + index); } tableView.scrollTo(index); } else { if (logger.isDebugEnabled()) { logger.debug("no entry for today"); } } }