List of usage examples for java.time LocalDateTime now
public static LocalDateTime now()
From source file:org.nuxeo.ecm.core.redis.contribs.RedisClusterInvalidator.java
protected String getCurrentDateTime() { return LocalDateTime.now().toString(); }
From source file:onl.area51.httpd.action.Request.java
default Request expiresIn(Duration d) { return expires(LocalDateTime.now().plus(d)); }
From source file:net.sf.gazpachoquest.dbpopulator.DBPopulator.java
public void populateForFullDemo(Set<UserDTO> respondents) { // No Randomization enabled QuestionnaireDefinitionDTO questionnaireDefinition = sampleQuizCreator.create(); asignDefaultMailTemplate(questionnaireDefinition); questionnaireDefinitionEditorFacade.confirm(questionnaireDefinition); ResearchDTO research = ResearchDTO.with().type(ResearchAccessType.BY_INVITATION) .name("New Quiz" + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); research = researchFacade.save(research); Integer researchId = research.getId(); for (UserDTO respondent : respondents) { researchFacade.addRespondent(researchId, respondent); }/* w w w . jav a2 s. c o m*/ researchFacade.changeStatus(researchId, EntityStatus.CONFIRMED); research = ResearchDTO.with().type(ResearchAccessType.OPEN_ACCESS) .name("Anonymous New Quiz" + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); research = researchFacade.save(research); questionnaireDefinition = sampleQuizCreator.create(); questionnaireDefinition.setRenderingMode(RenderingMode.ALL_IN_ONE); questionnaireDefinition = questionnaireDefinitionEditorFacade.save(questionnaireDefinition); asignDefaultMailTemplate(questionnaireDefinition); questionnaireDefinitionEditorFacade.confirm(questionnaireDefinition); research = ResearchDTO.with().type(ResearchAccessType.OPEN_ACCESS) .name("Anonymous New Quiz" + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); research = researchFacade.save(research); // Question Randomization Enabled questionnaireDefinition = sampleQuizCreator.create(); questionnaireDefinition.setQuestionsPerPage(1); questionnaireDefinition.setRandomizationStrategy(RandomizationStrategy.QUESTIONS_RANDOMIZATION); questionnaireDefinition = questionnaireDefinitionEditorFacade.save(questionnaireDefinition); asignDefaultMailTemplate(questionnaireDefinition); questionnaireDefinitionEditorFacade.confirm(questionnaireDefinition); research = ResearchDTO.with().type(ResearchAccessType.BY_INVITATION) .name("New Quiz" + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); research = researchFacade.save(research); researchId = research.getId(); for (UserDTO respondent : respondents) { researchFacade.addRespondent(researchId, respondent); } researchFacade.changeStatus(researchId, EntityStatus.CONFIRMED); research = ResearchDTO.with().type(ResearchAccessType.OPEN_ACCESS) .name("Anonymous New Quiz" + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); research = researchFacade.save(research); // Groups Randomization Enabled questionnaireDefinition = sampleQuizCreator.create(); questionnaireDefinition.setRandomizationStrategy(RandomizationStrategy.SECTIONS_RANDOMIZATION); questionnaireDefinition = questionnaireDefinitionEditorFacade.save(questionnaireDefinition); asignDefaultMailTemplate(questionnaireDefinition); questionnaireDefinitionEditorFacade.confirm(questionnaireDefinition); research = ResearchDTO.with().type(ResearchAccessType.BY_INVITATION) .name("New Quiz" + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); research = researchFacade.save(research); researchId = research.getId(); for (UserDTO respondent : respondents) { researchFacade.addRespondent(researchId, respondent); } researchFacade.changeStatus(researchId, EntityStatus.CONFIRMED); research = ResearchDTO.with().type(ResearchAccessType.OPEN_ACCESS) .name("Anonymous New Quiz" + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); researchFacade.save(research); // First Group Randomization Enabled questionnaireDefinition = sampleQuizCreator.create(); SectionDTO firstSection = questionnaireDefinition.getSections().get(0); firstSection.setRandomizationEnabled(true); questionnaireDefinitionEditorFacade.save(firstSection); asignDefaultMailTemplate(questionnaireDefinition); questionnaireDefinitionEditorFacade.confirm(questionnaireDefinition); research = ResearchDTO.with().type(ResearchAccessType.BY_INVITATION) .name("New Quiz" + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); research = researchFacade.save(research); researchId = research.getId(); for (UserDTO respondent : respondents) { researchFacade.addRespondent(researchId, respondent); } researchFacade.changeStatus(researchId, EntityStatus.CONFIRMED); research = ResearchDTO.with().type(ResearchAccessType.OPEN_ACCESS) .name("Anonymous New Quiz" + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); researchFacade.save(research); questionnaireDefinition = fastFoodSurveyCreator.create(); asignDefaultMailTemplate(questionnaireDefinition); questionnaireDefinitionEditorFacade.confirm(questionnaireDefinition); research = ResearchDTO.with().type(ResearchAccessType.OPEN_ACCESS) .name("New customer satisfation survey " + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); researchFacade.save(research); questionnaireDefinition = javaPerformanceSurveyCreator.create(); asignDefaultMailTemplate(questionnaireDefinition); questionnaireDefinitionEditorFacade.confirm(questionnaireDefinition); research = ResearchDTO.with().type(ResearchAccessType.OPEN_ACCESS) .name("Java Performance Survey " + questionnaireDefinition.getLanguageSettings().getTitle() + " started") .startDate(LocalDateTime.now()).expirationDate(LocalDateTime.of(2015, 12, 31, 12, 0, 0)).build(); research.setQuestionnaireDefinition(questionnaireDefinition); researchFacade.save(research); }
From source file:nc.noumea.mairie.appock.services.impl.DemandeServiceImpl.java
@Override public void annuleDemande(Demande demande) throws UnsupportedEncodingException, MessagingException { demande = demandeRepository.findOne(demande.getId()); demande.setEtatDemande(EtatDemande.ANNULE); demande.setDateTraitement(LocalDateTime.now()); demande.setTraitementUser(authHelper.getCurrentUser().getNomComplet()); demandeRepository.save(demande);/*www.j a v a 2s . c om*/ mailService.sendMailSuiteAnnulationDemande(demande); }
From source file:nc.noumea.mairie.appock.viewmodel.EditStockReferentServiceViewModel.java
@Command @NotifyChange("*") public void valideInventaire() { Messagebox.show(//w w w . ja v a2 s . c om "Confirmez-vous que vous avez ralis un inventaire et mis jour vos sorties de stocks ?", "Confirmation", new Messagebox.Button[] { Messagebox.Button.YES, Messagebox.Button.NO }, Messagebox.QUESTION, evt -> { if (evt.getName().equals("onYes")) { AppUser appUser = authHelper.getCurrentUser(); entity.setInventaireDemande(false); entity.setDateDernierInventaire(LocalDateTime.now()); entity.setInventaireUser(appUser.getNomComplet()); stockService.save(entity); refreshListeArticleStock(); mailService.sendMailValidationInventaire(appUser.getService()); BindUtils.postNotifyChange(null, null, this, "*"); showNotificationStandard("Validation de l'inventaire prise en compte"); } }); }
From source file:org.codelibs.fess.helper.SystemHelper.java
public LocalDateTime getCurrentTimeAsLocalDateTime() { return LocalDateTime.now(); }
From source file:com.google.refine.model.medadata.ProjectMetadata.java
@Override public void write(JSONWriter writer, Properties options) throws JSONException { writer.object();/* w w w . j a v a 2s . c om*/ writer.key("name"); writer.value(_name); writer.key("tags"); writer.array(); for (String tag : _tags) { writer.value(tag); } writer.endArray(); writer.key("created"); writer.value(ParsingUtilities.localDateToString(_created)); writer.key("modified"); writer.value(ParsingUtilities.localDateToString(_modified)); writer.key("creator"); writer.value(_creator); writer.key("contributors"); writer.value(_contributors); writer.key("subject"); writer.value(_subject); writer.key("description"); writer.value(_description); writer.key("rowCount"); writer.value(_rowCount); writer.key("title"); writer.value(title); writer.key("homepage"); writer.value(homepage); writer.key("image"); writer.value(image); writer.key("license"); writer.value(license); writer.key("version"); writer.value(version); writer.key("customMetadata"); writer.object(); for (String key : _customMetadata.keySet()) { Serializable value = _customMetadata.get(key); writer.key(key); writer.value(value); } writer.endObject(); // write JSONArray directly if (_importOptionMetadata.length() > 0) { writer.key("importOptionMetadata"); writer.value(_importOptionMetadata); } // write user metadata in {name, value, display} form: if (_userMetadata.length() > 0) { writer.key(PreferenceStore.USER_METADATA_KEY); writer.value(_userMetadata); } if (isSaveMode(options)) { writer.key("password"); writer.value(_password); writer.key("encoding"); writer.value(_encoding); writer.key("encodingConfidence"); writer.value(_encodingConfidence); writer.key("preferences"); _preferenceStore.write(writer, options); } writer.endObject(); if (isSaveMode(options)) { written = LocalDateTime.now(); } }
From source file:com.ccserver.digital.service.CreditCardApplicationExtractionServiceTest.java
@Test public void ExportLeadsTest() throws IOException { ExportLeadsDTO exportLeadDto = new ExportLeadsDTO(); exportLeadDto.setLosApplicationId("123GTP"); exportLeadDto.setSaleAgentId("45678"); exportLeadDto.setMobile("98599999999"); List<CreditCardApplication> applicationList = new ArrayList<>(); CreditCardApplication creditCardApplication = new CreditCardApplication(); creditCardApplication.setFirstName("First Name"); creditCardApplication.setLastName("Last Name"); creditCardApplication.setPassportNumber("121213"); creditCardApplication.setEmail("you@you"); creditCardApplication.setBusinessStartDate(LocalDateTime.now()); creditCardApplication.setDateOfIssue(null); Phone mobile = new Phone(); mobile.setCountryCode("+84"); mobile.setPhoneNumber("98599999999"); creditCardApplication.setMobile(mobile); //creditCardApplication.setLosApplicationId("123GTP"); creditCardApplication.setSaleAgentId("45678"); applicationList.add(creditCardApplication); Mockito.when(repository.findAllSaleAgents()).thenReturn(applicationList); byte[] result = ccAppExtractionService.ExportLeads(); Assert.assertNotNull(result);/*from w w w . j a v a 2 s. c o m*/ }
From source file:com.doctor.other.concurrent_hash_map_based_table.ConcurrentHashMapBasedTable.java
private void pruneCache() { String expireTime = LocalDateTime.now().minusHours(ttl).format(Util.timeFormatter); log.info("{expireTime:{}}", expireTime); for (String rowKey : table.keySet()) { ConcurrentHashMap<String, ConcurrentSkipListMap<String, ConcurrentSet<T>>> rowMap = table.get(rowKey); for (String columnKey : rowMap.keySet()) { ConcurrentSkipListMap<String, ConcurrentSet<T>> columnMap = rowMap.get(columnKey); Iterator<String> iterator = columnMap.keySet().iterator(); while (iterator.hasNext()) { String timesplices = iterator.next(); if (timesplices.compareTo(expireTime) < 0) { columnMap.get(timesplices).clear(); iterator.remove();/* w w w.j av a 2s .c om*/ } else { break; } } } } }
From source file:lu.list.itis.dkd.aig.util.FusekiHttpHelper.java
/** * Create a random dataset name with an optionnal prefix * /*from w ww.j a v a 2s .c om*/ * @param prefix * @return a random dataset name */ public static String createRandomDataSetName(@Nullable String prefix) { String random = Long.toString(Math.round(Math.random() * 1000)); String date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH'h'mm'm'ss's'S")); String dataSet = Strings.nullToEmpty(prefix) + date + '_' + random; return dataSet; }