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

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


    return contentsId;
  }

  @Override
  public Message getMessage(String id) throws ApsSystemException {
    Message message = null;
    try {
      MessageRecordVO messageRecord = (MessageRecordVO) this.getMessageDAO().loadEntityRecord(id);
      if (messageRecord != null) {
        message = (Message) createEntityFromXml(messageRecord.getTypeCode(), messageRecord.getXml());
        message.setUsername(messageRecord.getUsername());
        message.setCreationDate(messageRecord.getCreationDate());
      }
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getMessage");
      throw new ApsSystemException("Error loading messageRecord", t);
    }
View Full Code Here


*/
public class UserNewMessageAction extends AbstractApsEntityAction implements INewMessageAction {
 
  @Override
  public void validate() {
    Message message = this.getMessage();
    if (message == null) {
      return;
    }
    super.validate();
    if (this.getRecaptchaEnabled()) {
View Full Code Here

 
  @Override
  public String createNew() {
    try {
      String typeCode = this.getTypeCode();
      Message message = null;
      if (typeCode != null && typeCode.length() > 0) {
        message = this.getMessageManager().createMessageType(typeCode);
      }
      if (message == null) {
        return "voidTypeCode";
View Full Code Here

  }

  protected boolean sendAnswerNotification(Answer answer) throws ApsSystemException {
    boolean sent = false;
    try {
      Message message = this.getMessage(answer.getMessageId());
      MessageTypeNotifierConfig config = this.getNotifierConfig(message.getTypeCode());
      if (config != null) {
        String email = this.extractUserMail(message, config);
        if (null!=email) {
          String renderingLangCode = message.getLangCode();
          if (renderingLangCode==null || this.getLangManager().getLang(renderingLangCode)==null) {
            renderingLangCode = this.getLangManager().getDefaultLang().getCode();
          }
          MessageModel messageModel = config.getMessageModel();
          String subject = this.getEntityRenderer().render(message, messageModel.getSubjectModel(), renderingLangCode, false);
          subject = "RE: " + subject;
          String text = answer.getText();
          String senderCode = config.getSenderCode();
          String[] recipientsTo = new String[] { email };
          Properties attachmentFiles = answer.getAttachments();
          this.getMailManager().sendMail(text, subject, IMailManager.CONTENTTYPE_TEXT_PLAIN,
              attachmentFiles, recipientsTo, null, null, senderCode);
          sent = true;
        } else {
          ApsSystemUtils.getLogger().warn("ATTENTION: email Attribute \"" +
              config.getMailAttrName() + "\" for Message \"" + message.getId() +
              "\" isn't valued!!\nCheck \"jpwebdynamicform_messageTypes\" Configuration or " +
              "\"" + JpwebdynamicformSystemConstants.MESSAGE_NOTIFIER_CONFIG_ITEM + "\" Configuration");
        }
      } else {
        ApsSystemUtils.getLogger().warn("Answer not sent! Message lacking in notifier configuration.");
View Full Code Here

  }

  @Override
  public String entryMessage() {
    try {
      Message message = this.getMessage();
      if (message == null) {
        return "expiredMessage";
      }
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "entryMessage");
View Full Code Here

  }
 
  @Override
  public String save() {
    try {
      Message message = this.getMessage();
      if (message == null) {
        return "expiredMessage";
      }
      if (this.getRecaptchaAfterEnabled()) {
        return "captchaPage";
      }
      String honeypotFieldName = null;
      String honeypotValue = null;
      if (this.getHoneypotEnabled()) {
        honeypotFieldName = this.getHoneypotParamName();
        honeypotValue = this.getRequest().getParameter(honeypotFieldName);
      }
      if (!this.getHoneypotEnabled() || (null == honeypotValue || honeypotValue.length() == 0)) {
        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"));
          return INPUT;
        }
      }
      if (this.getHoneypotEnabled()) {
        String honeypotSessionParamName = SESSION_PARAM_NAME_HONEYPOT + message.getTypeCode();
        this.getRequest().getSession().removeAttribute(honeypotSessionParamName);
      }
      this.setMessageOnSession(null);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "save");
View Full Code Here

*/
public class ListAttributeAction extends com.agiletec.apsadmin.system.entity.attribute.action.list.ListAttributeAction {

  @Override
  protected IApsEntity getCurrentApsEntity() {
    Message message = this.updateMessageOnSession();
    return message;
  }
View Full Code Here

  /**
   * Update the Message entity with the field parameters and instert it into the session.
   * @return The updated message.
   */
  protected Message updateMessageOnSession() {
    Message message = (Message) this.getRequest().getSession().getAttribute(INewMessageAction.SESSION_PARAM_NAME_CURRENT_MESSAGE + this.getTypeCode());
    if (null != message) {
      this.getEntityActionHelper().updateEntity(message, this.getRequest());
    }
    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.