Package com.agiletec.plugins.jpwebdynamicform.aps.system.services.message.model

Examples of com.agiletec.plugins.jpwebdynamicform.aps.system.services.message.model.Answer


        this.addActionError(this.getText("Message.message.notFound"));
        return "messageNotFound";
      } else if (!this.checkEmailAddress()) {
        return "messageNotFound";
      }
      Answer answer = this.prepareAnswer();
      boolean sent = this.getMessageManager().sendAnswer(answer);
      if (!sent) {
        this.addActionError(this.getText("Errors.answer.sendingError"));
        return INPUT;
      }
View Full Code Here


  /**
   * Prepare an answer with the form parameters, ready to be saved.
   * @return The answer ready to be saved.
   */
  protected Answer prepareAnswer() {
    Answer answer = new Answer();
    answer.setMessageId(this.getId());
    answer.setOperator(this.getCurrentUser().getUsername());
    answer.setSendDate(new Date());
    answer.setText(this.getText());
    String fileName = this.getAttachmentFileName();
    File file = this.getAttachment();
    if (null!=fileName && null!=file && fileName.length()>0) {
      Properties attachments = new Properties();
      attachments.setProperty(fileName, file.getAbsolutePath());
      answer.setAttachments(attachments);
    }
    return answer;
  }
View Full Code Here

      conn = this.getConnection();
      stat = conn.prepareStatement(GET_MESSAGE_ANSWERS);
      stat.setString(1, messageId);
      res = stat.executeQuery();
      while (res.next()) {
        Answer answer = new Answer();
        answer.setAnswerId(res.getString(1));
        answer.setMessageId(res.getString(2));
        answer.setOperator(res.getString(3));
        answer.setSendDate(res.getTimestamp(4));
        answer.setText(res.getString(5));
        answers.add(answer);
      }
    } catch (Throwable t) {
      processDaoException(t, "Error reading answers to message " + messageId, "loadAnswers");
    } finally {
View Full Code Here

        if (null == mainAnswers || mainAnswers.isEmpty()) {
            return;
        }
    this._answers = new ArrayList<JAXBAnswer>();
    for (int i = 0; i < mainAnswers.size(); i++) {
      Answer answer = mainAnswers.get(i);
      JAXBAnswer jaxbAnswer = new JAXBAnswer(answer);
      this._answers.add(jaxbAnswer);
    }
    }
View Full Code Here

    Message message = this._helper.createMessage(null, null, "it", new Date(), "company", "address", JpwebdynamicformTestHelper.EMAIL, "note");
    this._helper.addMessage(message);
    String messageId = message.getId();
    assertNotNull(this._messageManager.getMessage(messageId));
   
    Answer answer1 = this._helper.createAnswer(null, messageId, "admin", new Date(), "text1");
    this._helper.addAnswer(answer1);
    Answer answer2 = this._helper.createAnswer(null, messageId, "admin", new Date(), "text2");
    this._helper.addAnswer(answer2);
    List<Answer> answers = this._messageManager.getAnswers(messageId);
    assertEquals(2, answers.size());
   
    this._messageManager.deleteMessage(messageId);
View Full Code Here

    Message message = this._helper.createMessage(null, "admin", "it", new Date(), "company", "address", "indirizzoemail@dominioinesistente.it", "note");
    this._helper.addMessage(message);
    String messageId = message.getId();
    assertNotNull(this._messageManager.getMessage(messageId));
   
    Answer answer1 = this._helper.createAnswer("1", messageId, "mainEditor", new Date(), "text1");
    this._messageManager.sendAnswer(answer1);
    Answer answer2 = this._helper.createAnswer("2", messageId, "mainEditor", new Date(), "text2");
    this._messageManager.sendAnswer(answer2);
   
    List<Answer> answers = this._messageManager.getAnswers(messageId);
    assertEquals(2, answers.size());
   
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpwebdynamicform.aps.system.services.message.model.Answer

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.