Package jodd.datetime

Examples of jodd.datetime.JDateTime


  Question prevQuestion;

  @Action
  @Transaction
  public void view() {
    JDateTime questionDate = date != null ? DateUtil.toJDateTime(date.intValue()) : new JDateTime();
    question = questionService.findQuestionForDate(questionDate);
    nextQuestion = questionService.findNextQuestion(question);
    prevQuestion = questionService.findPreviousQuestion(question);
    answerService.loadAnswers(question);
    statsService.calcAnswerDistribution(question);
View Full Code Here


  @Transaction
  public void view() {
    log.debug("index view");

    // prepare question date
    now = new JDateTime();
    questionDate = date != null ? DateUtil.toJDateTime(date.intValue()) : now;
    if (questionDate.isAfterDate(now)) {
      questionDate = now;      // don't peek in the future
    }
View Full Code Here

   * JSON action, with no extension.
   */
  @Action(extension = Action.NONE)
  @Transaction
  public String view() {
    Question question = questionService.findQuestionForDate(new JDateTime());
    answerService.loadAnswers(question);

    StringBuilder json = new StringBuilder();
    json.append('{');
    json.append("\"question\": \"").append(Format.textPlain(question.getText())).append("\",");
View Full Code Here

   * <li>it holds custom data that will be used for rendering.
   */
  @Action("/uphea.xml")
  @Transaction
  public RssData view() {
    Question latestQuestion = questionService.findQuestionForDate(new JDateTime());
    List<Question> questions = questionService.findPreviousQuestions(latestQuestion, 24);
    questions.add(0, latestQuestion);

    Feed feed = new Feed();
    feed.setTitle("uphea.com");
View Full Code Here

  /**
   * Stores user and password.
   */
  public User registerNewUser(User user, String password) {
    user.setHashpw(passwordEncoder.encodePassword(password));
    JDateTime now = new JDateTime();
    user.setSince(now);
    user.setLastLogin(now);
    return appDao.store(user);
  }
View Full Code Here

   */
  public Vote voteForAnswer(Answer answer, String ipAddress, User user) {
    updateAnswerVoteCount(answer, true);
    Vote vote = new Vote();
    vote.setAnswer(answer);
    vote.setTime(new JDateTime());
    vote.setIpAddress(ipAddress);
    if (user != null) {
      vote.setUserId(user.getId());
    }
    return appDao.store(vote);
View Full Code Here

  /**
   * Logins user.
   */
  @ReadWriteTransaction
  public void login(User user) {
    appDao.updateProperty(user, "lastLogin", new JDateTime());
  }
View Full Code Here

   * Creates welcome message.
   */
  public void createWelcomeMessage(User user) {

    EmailMessage emailMessage = new EmailMessage();
    emailMessage.setCreated(new JDateTime());
    emailMessage.setDestination(user.getEmail());
    emailMessage.setSource(defaultFromAddress);
    emailMessage.setTemplate(DEFAULT_EMAIL_TEMPLATE);

    Map<String, Object> ctx = new HashMap<String, Object>(1);
View Full Code Here

  /**
   * Creates lost password message.
   */
  public void createLostPasswordMessage(User user, UserUid userUid) {
    EmailMessage emailMessage = new EmailMessage();
    emailMessage.setCreated(new JDateTime());
    emailMessage.setDestination(user.getEmail());
    emailMessage.setSource(defaultFromAddress);
    emailMessage.setTemplate(DEFAULT_EMAIL_TEMPLATE);

    Map<String, Object> ctx = new HashMap<String, Object>(2);
View Full Code Here

    }
    int year = Convert.toIntValue(value, 0);
    if (year < 1900) {
      return false;
    }
    return year <= new JDateTime().getYear();
  }
View Full Code Here

TOP

Related Classes of jodd.datetime.JDateTime

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.