⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statusemail.java

📁 本系统有十分强大的功能
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                if(job.getPriority() == JobVO.Priority.HIGH)
                    textMessage.append(resourceBundle.getString("entity.crm.job.priority.high")).append(newline);
                else if(job.getPriority() == JobVO.Priority.MEDIUM)
                    textMessage.append(resourceBundle.getString("entity.crm.job.priority.medium")).append(newline);
                else if(job.getPriority() == JobVO.Priority.LOW)
                    textMessage.append(resourceBundle.getString("entity.crm.job.priority.low")).append(newline);
               
                if(job.getInfo() != null)
                {
                    textMessage.append(resourceBundle.getString("entity.crm.job.info")).append(": ");
                    textMessage.append(job.getInfo()).append(newline);
                }
                textMessage.append(newline);
            }
        }
        
        textMessage.append(newline);
        
        if(events.size() > 0)
        {
            textMessage.append(resourceBundle.getString("mail.status.headline.event")).append(newline);
            for(EventVO event : events)
            {
                textMessage.append(resourceBundle.getString("entity.calendar.event.title")).append(": ");
                textMessage.append(event.getTitle()).append(newline);
                
                SimpleDateFormat sdf = null;
                if(event.isAllDay())
                    sdf = new SimpleDateFormat("dd.MM.yyyy");
                else
                    sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm");
                textMessage.append(resourceBundle.getString("entity.calendar.event.startDate")).append(": ");
                textMessage.append(sdf.format(event.getStartDate())).append(newline);
                textMessage.append(resourceBundle.getString("entity.calendar.event.endDate")).append(": ");
                textMessage.append(sdf.format(event.getEndDate())).append(newline);
                
                if(event.getLocation() != null)
                {
                    textMessage.append(resourceBundle.getString("entity.calendar.event.location")).append(": ");
                    textMessage.append(event.getLocation()).append(newline);
                }
                
                if(event.getDescription() != null)
                {
                    textMessage.append(resourceBundle.getString("entity.calendar.event.description")).append(": ");
                    textMessage.append(event.getDescription()).append(newline);
                }
                textMessage.append(newline);
            }
        }
        textMessage.append(newline);
        textMessage.append(resourceBundle.getString("mail.status.footer"));
        return textMessage.toString();
    }

    /**
     * This method overrides getHtmlMessageBody from Email.
     * Reads the content from the resource bundle, and generates the email.
     * @return The Html Message Body from the status mail.
     */
    @Override
    public String getHtmlMessageBody()
    {
        String newline = "</br>";
        ResourceBundle resourceBundle = ResourceBundle.getBundle("WebResources", recipient.getLocale());
        StringBuilder textMessage = new StringBuilder();
        textMessage.append("<html><body>");
        textMessage.append(resourceBundle.getString("mail.status.salutation"));
        textMessage.append(" ").append(recipient.getPerson().getFirstName());
        textMessage.append(" ").append(recipient.getPerson().getLastName()).append(",");
        textMessage.append(newline).append(newline);
        textMessage.append(resourceBundle.getString("mail.status.header")).append(newline).append(newline);
        
        if(jobs.size() > 0)
        {
            textMessage.append(resourceBundle.getString("mail.status.headline.job")).append(newline);
            for(JobVO job : jobs)
            {
                textMessage.append(resourceBundle.getString("entity.crm.job.subject")).append(": ");
                textMessage.append(job.getSubject()).append(newline);
                
                if(job.getReferencedCompany() != null || job.getReferencedCompany() != null)
                {
                    textMessage.append(resourceBundle.getString("entity.crm.job.reference")).append(": ");
                    if(job.getReferencedPerson() != null)
                        textMessage.append(job.getReferencedPerson().getFirstName()).append(" ").append(job.getReferencedPerson().getLastName());
                    if(job.getReferencedCompany() != null)
                        textMessage.append(" ").append(job.getReferencedCompany());
                    textMessage.append(newline);
                }
                
                textMessage.append(resourceBundle.getString("entity.crm.job.status")).append(": ");
                if(job.getStatus() == JobVO.Status.COMPLETED)
                    textMessage.append(resourceBundle.getString("entity.crm.job.status.completed")).append(newline);
                else if(job.getStatus() == JobVO.Status.IN_PROGRESS)
                    textMessage.append(resourceBundle.getString("entity.crm.job.status.inProgress")).append(newline);
                else if(job.getStatus() == JobVO.Status.PLANNED)
                    textMessage.append(resourceBundle.getString("entity.crm.job.status.planned")).append(newline);
                
                textMessage.append(resourceBundle.getString("entity.crm.job.priority")).append(": ");
                if(job.getPriority() == JobVO.Priority.HIGH)
                    textMessage.append(resourceBundle.getString("entity.crm.job.priority.high")).append(newline);
                else if(job.getPriority() == JobVO.Priority.MEDIUM)
                    textMessage.append(resourceBundle.getString("entity.crm.job.priority.medium")).append(newline);
                else if(job.getPriority() == JobVO.Priority.LOW)
                    textMessage.append(resourceBundle.getString("entity.crm.job.priority.low")).append(newline);
               
                if(job.getInfo() != null)
                {
                    textMessage.append(resourceBundle.getString("entity.crm.job.info")).append(": ");
                    textMessage.append(job.getInfo()).append(newline);
                }
                textMessage.append(newline);
            }
        }
        
        textMessage.append(newline);
        
        if(events.size() > 0)
        {
            textMessage.append(resourceBundle.getString("mail.status.headline.event")).append(newline);
            for(EventVO event : events)
            {
                textMessage.append(resourceBundle.getString("entity.calendar.event.title")).append(": ");
                textMessage.append(event.getTitle()).append(newline);
                
                SimpleDateFormat sdf = null;
                if(event.isAllDay())
                    sdf = new SimpleDateFormat("dd.MM.yyyy");
                else
                    sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm");
                textMessage.append(resourceBundle.getString("entity.calendar.event.startDate")).append(": ");
                textMessage.append(sdf.format(event.getStartDate())).append(newline);
                textMessage.append(resourceBundle.getString("entity.calendar.event.endDate")).append(": ");
                textMessage.append(sdf.format(event.getEndDate())).append(newline);
                
                if(event.getLocation() != null)
                {
                    textMessage.append(resourceBundle.getString("entity.calendar.event.location")).append(": ");
                    textMessage.append(event.getLocation()).append(newline);
                }
                
                if(event.getDescription() != null)
                {
                    textMessage.append(resourceBundle.getString("entity.calendar.event.description")).append(": ");
                    textMessage.append(event.getDescription()).append(newline);
                }
                textMessage.append(newline);
            }
        }
        textMessage.append(newline);
        textMessage.append(resourceBundle.getString("mail.status.footer"));
        textMessage.append("</body></html>");
        return textMessage.toString();
    }
    
    /**
     * Reads the subject from the resourcebundle
     * @return the subject of the reminder email.
     */
    @Override
    public String getSubject()
    {
        ResourceBundle resourceBundle = null;
        if(recipient != null)
            resourceBundle = ResourceBundle.getBundle("WebResources", recipient.getLocale());
        else
            resourceBundle = ResourceBundle.getBundle("WebResources");
        SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
        return resourceBundle.getString("mail.status.subject") + " ["+sdf.format(new Date())+"]";
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -