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

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


    assertTrue(messageIds.contains(message1.getId()));
  }
 
  public void testAddGetMessage() throws Throwable {
    Date currentDate = new Date();
    Message message1 = this._helper.createMessage(null, "admin", "it", currentDate, "MyName", "MySurname", "MyAddress", JpwebdynamicformTestHelper.EMAIL, "MyNotes");
    this._messageManager.addMessage(message1);
    Message addedMessage = this._messageManager.getMessage(message1.getId());
    this.compareMessages(message1, addedMessage);
   
    // store = false
    Message message2 = this._helper.createMessage("id", "admin", "it", currentDate, "MyCompany", "MyAddress", JpwebdynamicformTestHelper.EMAIL, "MyNotes");
    this._messageManager.addMessage(message2);
    assertNull(this._messageManager.getMessage(message2.getId()));
    assertEquals(1, this._messageManager.loadMessagesId(null).size());
  }
View Full Code Here


    assertNull(this._messageManager.getMessage(message2.getId()));
    assertEquals(1, this._messageManager.loadMessagesId(null).size());
  }
 
  public void testDeleteMessage() throws Throwable {
    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");
View Full Code Here

    answers = this._messageManager.getAnswers(messageId);
    assertEquals(0, answers.size());
  }
 
  public void testAddGetAnswer() throws Throwable {
    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");
View Full Code Here

   
    public List<String> getMessages(Properties properties) throws Throwable {
        List<String> usernames = null;
        try {
            String userMessageType = properties.getProperty("typeCode");
            Message prototype = (Message) this.getMessageManager().getEntityPrototype(userMessageType);
            if (null == prototype) {
                throw new ApiException(IApiErrorCodes.API_PARAMETER_VALIDATION_ERROR,
            "Message Type '" + userMessageType + "' does not exist", Response.Status.CONFLICT);
            }
            String langCode = properties.getProperty(SystemConstants.API_LANG_CODE_PARAMETER);
View Full Code Here

   
    public JAXBMessage getMessage(Properties properties) throws ApiException, Throwable {
        JAXBMessage jaxbMessage = null;
        try {
            String id = properties.getProperty("id");
            Message userMessage = this.getMessageManager().getMessage(id);
            if (null == userMessage) {
                throw new ApiException(IApiErrorCodes.API_PARAMETER_VALIDATION_ERROR,
            "Message '" + id + "' does not exist", Response.Status.CONFLICT);
            }
            jaxbMessage = new JAXBMessage(userMessage, null);
View Full Code Here

            IApsEntity profilePrototype = this.getMessageManager().getEntityPrototype(jaxbMessage.getTypeCode());
            if (null == profilePrototype) {
                throw new ApiException(IApiErrorCodes.API_VALIDATION_ERROR,
            "User Message type with code '" + jaxbMessage.getTypeCode() + "' does not exist", Response.Status.CONFLICT);
            }
            Message message = (Message) jaxbMessage.buildEntity(profilePrototype, null);
            List<ApiError> errors = this.validate(message);
            if (errors.size() > 0) {
                response.addErrors(errors);
                response.setResult(IResponseBuilder.FAILURE, null);
                return response;
View Full Code Here

   
    public void deleteMessage(Properties properties) throws ApiException, Throwable {
        StringApiResponse response = new StringApiResponse();
        try {
            String id = properties.getProperty("id");
            Message message = this.getMessageManager().getMessage(id);
            if (null == message) {
                throw new ApiException(IApiErrorCodes.API_PARAMETER_VALIDATION_ERROR,
            "Message '" + id + "' does not exist", Response.Status.CONFLICT);
            }
      this.getMessageManager().deleteMessage(id);
View Full Code Here

    }
  }
 
  public String captchaConfirm() {
    try {
      Message message = this.getMessage();
      if (message == null) {
        return "expiredMessage";
      }
      String username = this.getCurrentUser().getUsername();
      message.setUsername(username);
      message.setCreationDate(new Date());
      message.setLangCode(this.getCurrentLang().getCode());
      try {
        this.getMessageManager().sendMessage(message);
      } catch (Throwable t) {
        ApsSystemUtils.logThrowable(t, this, "save");
        this.addActionError(this.getText("Errors.webdynamicform.sendingError"));
View Full Code Here

   * Executes the operation of visualization of a message.
   * @return The action result code.
   */
  public String view() {
    try {
      Message message = this.getMessage();
      if (message == null || !this.isUserAllowed(message)) {
        this.addActionError(this.getText("Message.message.notFound"));
        return "messageNotFound";
      }
    } catch(Throwable t) {
View Full Code Here

    return senderCodes;
  }

  @Override
  public Message createMessageType(String typeCode) {
    Message message = (Message) super.getEntityPrototype(typeCode);
    return message;
  }
View Full Code Here

TOP

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

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.