List of usage examples for org.joda.time DateTime parse
@FromString public static DateTime parse(String str)
From source file:org.obiba.agate.web.rest.user.UsersPublicResource.java
License:Open Source License
@POST @Path("/_reset_password") public Response resetPassword(@FormParam("key") String key, @FormParam("password") String password) throws IOException { ObjectMapper mapper = new ObjectMapper(); Map<String, String> data = mapper.readValue(configurationService.decrypt(key), new TypeReference<HashMap<String, String>>() { });//w ww . j a v a 2 s . co m if (DateTime.now().isAfter(DateTime.parse(data.get("expire")))) { throw new BadRequestException("Invalid key"); } User user = userService.findUser(data.get("username")); if (user == null) throw new BadRequestException("User not found"); UserCredentials userCredentials = userService.findUserCredentials(user.getName()); if (userCredentials == null) throw new BadRequestException("user has no credentials defined"); userCredentials.setPassword(userService.hashPassword(password)); userService.save(userCredentials); return Response.noContent().build(); }
From source file:org.obiba.mica.web.model.ActionLogDtos.java
License:Open Source License
ActionLog fromDto(ActionLogDto dto) { return ActionLog.newBuilder() // .author(dto.getAuthor()) // .changedOn(DateTime.parse(dto.getChangedOn())) // .action(dto.getAction()) // .build(); // }
From source file:org.obiba.mica.web.model.StatusChangeDtos.java
License:Open Source License
StatusChange fromDto(StatusChangeDto dto) { return StatusChange.newBuilder() // .previous(DataAccessEntityStatus.valueOf(dto.getFrom())) // .current(DataAccessEntityStatus.valueOf(dto.getTo())) // .author(dto.getAuthor()) // .changedOn(DateTime.parse(dto.getChangedOn())) // .build(); // }
From source file:org.obiba.mica.web.model.TimestampsDtos.java
License:Open Source License
static void fromDto(Mica.TimestampsDtoOrBuilder dto, Timestamped timestamped) { if (dto.hasCreated()) timestamped.setCreatedDate(DateTime.parse(dto.getCreated())); if (dto.hasLastUpdate()) timestamped.setLastModifiedDate(DateTime.parse(dto.getLastUpdate())); }
From source file:org.obm.imap.archive.DatabaseOperations.java
License:Open Source License
public static Insert insertArchiveTreatment(ArchiveTreatmentRunId runId, ObmDomainUuid domainId) { return Operations.insertInto(MailArchiveRun.NAME) .columns(MailArchiveRun.Fields.UUID, MailArchiveRun.Fields.DOMAIN_UUID, MailArchiveRun.Fields.STATUS, MailArchiveRun.Fields.SCHEDULE, MailArchiveRun.Fields.START, MailArchiveRun.Fields.END, MailArchiveRun.Fields.HIGHER_BOUNDARY, MailArchiveRun.Fields.RECURRENT) .values(runId.serialize(), domainId.get(), ArchiveStatus.SUCCESS, DateTime.parse("2014-06-01T00:00:00.000Z").toDate(), DateTime.parse("2014-06-01T00:01:00.000Z").toDate(), DateTime.parse("2014-06-01T00:02:00.000Z").toDate(), DateTime.parse("2014-06-01T00:03:00.000Z").toDate(), true) .build();/*from w ww. j a v a 2 s . co m*/ }
From source file:org.obm.imap.archive.treatment.TreatmentStepdefs.java
License:Open Source License
@Given("this user has (\\d+) mails? at \"(.*?)\" in this folder with subject \"(.*?)\"") public void appendMails(int numberOfMails, String internalDate, String subject) throws Exception { for (int i = 0; i < numberOfMails; i++) { imapFolder.store(GreenMailUtil.buildSimpleMessage("from@" + domain.getName(), subject, "message", imapServer.getSmtp().getServerSetup()), DateTime.parse(internalDate).toDate()); }/*ww w .java 2s .c om*/ }
From source file:org.obm.imap.archive.treatment.TreatmentStepdefs.java
License:Open Source License
@Given("this shared mailbox has (\\d+) mails? at \"(.*?)\" in this folder with subject \"(.*?)\"") public void appendMailsInSharedMailboxFolder(int numberOfMails, String internalDate, String subject) throws Exception { for (int i = 0; i < numberOfMails; i++) { imapFolder.store(GreenMailUtil.buildSimpleMessage("from@" + domain.getName(), subject, "message", imapServer.getSmtp().getServerSetup()), DateTime.parse(internalDate).toDate()); }/*from ww w. j av a 2 s. c o m*/ }
From source file:org.obm.imap.archive.treatment.TreatmentStepdefs.java
License:Open Source License
@Given("this shared mailbox has (\\d+) mails? at \"(.*?)\" with subject \"(.*?)\"") public void appendMailsToSharedMailbox(int numberOfMails, String internalDate, String subject) throws Exception { for (int i = 0; i < numberOfMails; i++) { sharedMailbox.store(GreenMailUtil.buildSimpleMessage("from@" + domain.getName(), subject, "message", imapServer.getSmtp().getServerSetup()), DateTime.parse(internalDate).toDate()); }//from w ww . j a va 2 s . c om }
From source file:org.ojai.types.OTimestamp.java
License:Apache License
/** * Parses and return an instance of {@code OTimestamp} from the specified string. * @param dateTimeStr the string to parse * @exception ParseException if the beginning of the specified string * cannot be parsed.//from www . ja v a 2 s .co m */ public static OTimestamp parse(String dateTimeStr) { try { return new OTimestamp(DateTime.parse(dateTimeStr)); } catch (IllegalArgumentException e) { throw new ParseException(e); } }
From source file:org.opentestsystem.authoring.testauth.config.JodaDateTimeXmlAdapter.java
License:Open Source License
@Override public DateTime unmarshal(final String datetime) throws Exception { return DateTime.parse(datetime); }