Java 类ims.admin.vo.UserEmailAccountVo 实例源码

项目:AvoinApotti    文件:CorrespondenceDetailsImpl.java   
public UserEmailAccountVo getEmailAppUser(Integer appUserId) 
{
    if (appUserId == null)
        throw new CodingRuntimeException("Mandatory Argument - Application User Id");

    DomainFactory factory = getDomainFactory();
    String hql = "select u1_1 from UserEmailAccount as u1_1 left join u1_1.appUser as a1_1 where (u1_1.appUser.id = :appUserId)";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    markers.add("appUserId");
    values.add(appUserId);

    List UserEmailAcountList = factory.find(hql, markers, values);

    if (UserEmailAcountList != null && UserEmailAcountList.size() > 0)
    {
        UserEmailAccountVo voUserEmail = UserEmailAccountVoAssembler.createUserEmailAccountVoCollectionFromUserEmailAccount(UserEmailAcountList).get(0);
        return voUserEmail;
    }        
    return null;
}
项目:openMAXIMS    文件:CorrespondenceDetailsImpl.java   
public UserEmailAccountVo getEmailAppUser(Integer appUserId) 
{
    if (appUserId == null)
        throw new CodingRuntimeException("Mandatory Argument - Application User Id");

    DomainFactory factory = getDomainFactory();
    String hql = "select u1_1 from UserEmailAccount as u1_1 left join u1_1.appUser as a1_1 where (u1_1.appUser.id = :appUserId)";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    markers.add("appUserId");
    values.add(appUserId);

    List UserEmailAcountList = factory.find(hql, markers, values);

    if (UserEmailAcountList != null && UserEmailAcountList.size() > 0)
    {
        UserEmailAccountVo voUserEmail = UserEmailAccountVoAssembler.createUserEmailAccountVoCollectionFromUserEmailAccount(UserEmailAcountList).get(0);
        return voUserEmail;
    }        
    return null;
}
项目:openMAXIMS    文件:CorrespondenceDetailsImpl.java   
public UserEmailAccountVo getEmailAppUser(Integer appUserId) 
{
    if (appUserId == null)
        throw new CodingRuntimeException("Mandatory Argument - Application User Id");

    DomainFactory factory = getDomainFactory();
    String hql = "select u1_1 from UserEmailAccount as u1_1 left join u1_1.appUser as a1_1 where (u1_1.appUser.id = :appUserId)";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    markers.add("appUserId");
    values.add(appUserId);

    List UserEmailAcountList = factory.find(hql, markers, values);

    if (UserEmailAcountList != null && UserEmailAcountList.size() > 0)
    {
        UserEmailAccountVo voUserEmail = UserEmailAccountVoAssembler.createUserEmailAccountVoCollectionFromUserEmailAccount(UserEmailAcountList).get(0);
        return voUserEmail;
    }        
    return null;
}
项目:openmaxims-linux    文件:CorrespondenceDetailsImpl.java   
public UserEmailAccountVo getEmailAppUser(Integer appUserId) 
{
    if (appUserId == null)
        throw new CodingRuntimeException("Mandatory Argument - Application User Id");

    DomainFactory factory = getDomainFactory();
    String hql = "select u1_1 from UserEmailAccount as u1_1 left join u1_1.appUser as a1_1 where (u1_1.appUser.id = :appUserId)";
    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    markers.add("appUserId");
    values.add(appUserId);

    List UserEmailAcountList = factory.find(hql, markers, values);

    if (UserEmailAcountList != null && UserEmailAcountList.size() > 0)
    {
        UserEmailAccountVo voUserEmail = UserEmailAccountVoAssembler.createUserEmailAccountVoCollectionFromUserEmailAccount(UserEmailAcountList).get(0);
        return voUserEmail;
    }        
    return null;
}
项目:AvoinApotti    文件:ApplicationUsersImpl.java   
public UserEmailAccountVo getEmailData(AppUserRefVo appUser) 
{
    IMSCriteria imsc=new IMSCriteria (AppUser.class,getDomainFactory());
    imsc.equal("id", appUser.getID_AppUser());
    List users = imsc.find();
    if (users.size()>0)
    {
        AppUser user= (AppUser) users.get(0);
        return UserEmailAccountVoAssembler.create(user.getEmailAccount());
    }
    else
        return null;
}
项目:openMAXIMS    文件:ApplicationUsersImpl.java   
public UserEmailAccountVo getEmailData(AppUserRefVo appUser) 
{
    IMSCriteria imsc=new IMSCriteria (AppUser.class,getDomainFactory());
    imsc.equal("id", appUser.getID_AppUser());
    List users = imsc.find();
    if (users.size()>0)
    {
        AppUser user= (AppUser) users.get(0);
        return UserEmailAccountVoAssembler.create(user.getEmailAccount());
    }
    else
        return null;
}
项目:openMAXIMS    文件:ApplicationUsersImpl.java   
public UserEmailAccountVo getEmailData(AppUserRefVo appUser) 
{
    IMSCriteria imsc=new IMSCriteria (AppUser.class,getDomainFactory());
    imsc.equal("id", appUser.getID_AppUser());
    List users = imsc.find();
    if (users.size()>0)
    {
        AppUser user= (AppUser) users.get(0);
        return UserEmailAccountVoAssembler.create(user.getEmailAccount());
    }
    else
        return null;
}
项目:openmaxims-linux    文件:ApplicationUsersImpl.java   
public UserEmailAccountVo getEmailData(AppUserRefVo appUser) 
{
    IMSCriteria imsc=new IMSCriteria (AppUser.class,getDomainFactory());
    imsc.equal("id", appUser.getID_AppUser());
    List users = imsc.find();
    if (users.size()>0)
    {
        AppUser user= (AppUser) users.get(0);
        return UserEmailAccountVoAssembler.create(user.getEmailAccount());
    }
    else
        return null;
}
项目:AvoinApotti    文件:Logic.java   
private void eMailCorrespondence()
{
    if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes())
    {
        engine.showMessage("Error retrieving document content.");
        return;
    }

    // get email account information for logged in user
    UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId());
    if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0)
    {
        engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account.");
        return;
    }

    StringBuffer sRecipientsNoEmail = new StringBuffer();

    if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull())
    {
        DocumentVo voDoc = new DocumentVo();
        voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document());
        voDoc = domain.getDocument(voDoc);
        if (null == voDoc)
            return;

        AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf");

        StringBuffer emailAddresses = new StringBuffer();

        try
        {
            String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail();
            if (noEmailAddresses != null)
            {
                engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail);
                // TODO give an option to continue?
                return;
            }

            EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor);
            if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0)
            {
                emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients());
                emailCorresp.setAttach(correspondenceDocument);
                emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString());
                emailCorresp.sendEmail();
            }

            engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses);
        }
        catch (MessagingException me)
        {
            engine.showMessage(me.getMessage());
        }
        catch (SecurityException se)
        {
            engine.showMessage(se.getMessage());
        }
    }
}
项目:AvoinApotti    文件:Logic.java   
private void eMailCorrespondence()
{
    if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes())
    {
        engine.showMessage("Error retrieving document content.");
        return;
    }

    // get email account information for logged in user
    UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId());
    if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0)
    {
        engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account.");
        return;
    }

    StringBuffer sRecipientsNoEmail = new StringBuffer();

    if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull())
    {
        DocumentVo voDoc = new DocumentVo();
        voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document());
        voDoc = domain.getDocument(voDoc);
        if (null == voDoc)
            return;

        AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf");

        StringBuffer emailAddresses = new StringBuffer();

        try
        {
            String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail();
            if (noEmailAddresses != null)
            {
                engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail);

                return;
            }

            EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor);
            if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0)
            {
                emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients());
                emailCorresp.setAttach(correspondenceDocument);
                emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString());
                emailCorresp.sendEmail();
            }

            engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses);
        }
        catch (MessagingException me)
        {
            engine.showMessage(me.getMessage());
        }
        catch (SecurityException se)
        {
            engine.showMessage(se.getMessage());
        }
    }
}
项目:AvoinApotti    文件:CorrespondenceDetailImpl.java   
public UserEmailAccountVo getEmailAppUser(Integer appUserId) 
{
    DomainFactory factory = getDomainFactory();
    return UserEmailAccountVoAssembler.create((UserEmailAccount)factory.getDomainObject(UserEmailAccount.class, appUserId));        
}
项目:openMAXIMS    文件:Logic.java   
private void eMailCorrespondence()
{
    if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes())
    {
        engine.showMessage("Error retrieving document content.");
        return;
    }

    // get email account information for logged in user
    UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId());
    if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0)
    {
        engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account.");
        return;
    }

    StringBuffer sRecipientsNoEmail = new StringBuffer();

    if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull())
    {
        DocumentVo voDoc = new DocumentVo();
        voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document());
        voDoc = domain.getDocument(voDoc);
        if (null == voDoc)
            return;

        AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf");

        StringBuffer emailAddresses = new StringBuffer();

        try
        {
            String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail();
            if (noEmailAddresses != null)
            {
                engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail);
                // TODO give an option to continue?
                return;
            }

            EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor);
            if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0)
            {
                emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients());
                emailCorresp.setAttach(correspondenceDocument);
                emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString());
                emailCorresp.sendEmail();
            }

            engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses);
        }
        catch (MessagingException me)
        {
            engine.showMessage(me.getMessage());
        }
        catch (SecurityException se)
        {
            engine.showMessage(se.getMessage());
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private void eMailCorrespondence()
{
    if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes())
    {
        engine.showMessage("Error retrieving document content.");
        return;
    }

    // get email account information for logged in user
    UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId());
    if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0)
    {
        engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account.");
        return;
    }

    StringBuffer sRecipientsNoEmail = new StringBuffer();

    if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull())
    {
        DocumentVo voDoc = new DocumentVo();
        voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document());
        voDoc = domain.getDocument(voDoc);
        if (null == voDoc)
            return;

        AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf");

        StringBuffer emailAddresses = new StringBuffer();

        try
        {
            String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail();
            if (noEmailAddresses != null)
            {
                engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail);

                return;
            }

            EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor);
            if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0)
            {
                emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients());
                emailCorresp.setAttach(correspondenceDocument);
                emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString());
                emailCorresp.sendEmail();
            }

            engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses);
        }
        catch (MessagingException me)
        {
            engine.showMessage(me.getMessage());
        }
        catch (SecurityException se)
        {
            engine.showMessage(se.getMessage());
        }
    }
}
项目:openMAXIMS    文件:CorrespondenceDetailImpl.java   
public UserEmailAccountVo getEmailAppUser(Integer appUserId) 
{
    DomainFactory factory = getDomainFactory();
    return UserEmailAccountVoAssembler.create((UserEmailAccount)factory.getDomainObject(UserEmailAccount.class, appUserId));        
}
项目:openMAXIMS    文件:Logic.java   
private void eMailCorrespondence()
{
    if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes())
    {
        engine.showMessage("Error retrieving document content.");
        return;
    }

    // get email account information for logged in user
    UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId());
    if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0)
    {
        engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account.");
        return;
    }

    StringBuffer sRecipientsNoEmail = new StringBuffer();

    if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull())
    {
        DocumentVo voDoc = new DocumentVo();
        voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document());
        voDoc = domain.getDocument(voDoc);
        if (null == voDoc)
            return;

        AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf");

        StringBuffer emailAddresses = new StringBuffer();

        try
        {
            String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail();
            if (noEmailAddresses != null)
            {
                engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail);
                // TODO give an option to continue?
                return;
            }

            EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor);
            if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0)
            {
                emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients());
                emailCorresp.setAttach(correspondenceDocument);
                emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString());
                emailCorresp.sendEmail();
            }

            engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses);
        }
        catch (MessagingException me)
        {
            engine.showMessage(me.getMessage());
        }
        catch (SecurityException se)
        {
            engine.showMessage(se.getMessage());
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private void eMailCorrespondence()
{
    if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes())
    {
        engine.showMessage("Error retrieving document content.");
        return;
    }

    // get email account information for logged in user
    UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId());
    if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0)
    {
        engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account.");
        return;
    }

    StringBuffer sRecipientsNoEmail = new StringBuffer();

    if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull())
    {
        DocumentVo voDoc = new DocumentVo();
        voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document());
        voDoc = domain.getDocument(voDoc);
        if (null == voDoc)
            return;

        AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf");

        StringBuffer emailAddresses = new StringBuffer();

        try
        {
            String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail();
            if (noEmailAddresses != null)
            {
                engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail);

                return;
            }

            EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor);
            if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0)
            {
                emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients());
                emailCorresp.setAttach(correspondenceDocument);
                emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString());
                emailCorresp.sendEmail();
            }

            engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses);
        }
        catch (MessagingException me)
        {
            engine.showMessage(me.getMessage());
        }
        catch (SecurityException se)
        {
            engine.showMessage(se.getMessage());
        }
    }
}
项目:openMAXIMS    文件:CorrespondenceDetailImpl.java   
public UserEmailAccountVo getEmailAppUser(Integer appUserId) 
{
    DomainFactory factory = getDomainFactory();
    return UserEmailAccountVoAssembler.create((UserEmailAccount)factory.getDomainObject(UserEmailAccount.class, appUserId));        
}
项目:openmaxims-linux    文件:Logic.java   
private void eMailCorrespondence()
{
    if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes())
    {
        engine.showMessage("Error retrieving document content.");
        return;
    }

    // get email account information for logged in user
    UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId());
    if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0)
    {
        engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account.");
        return;
    }

    StringBuffer sRecipientsNoEmail = new StringBuffer();

    if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull())
    {
        DocumentVo voDoc = new DocumentVo();
        voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document());
        voDoc = domain.getDocument(voDoc);
        if (null == voDoc)
            return;

        AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf");

        StringBuffer emailAddresses = new StringBuffer();

        try
        {
            String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail();
            if (noEmailAddresses != null)
            {
                engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail);
                // TODO give an option to continue?
                return;
            }

            EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor);
            if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0)
            {
                emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients());
                emailCorresp.setAttach(correspondenceDocument);
                emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString());
                emailCorresp.sendEmail();
            }

            engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses);
        }
        catch (MessagingException me)
        {
            engine.showMessage(me.getMessage());
        }
        catch (SecurityException se)
        {
            engine.showMessage(se.getMessage());
        }
    }
}
项目:openmaxims-linux    文件:Logic.java   
private void eMailCorrespondence()
{
    if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes())
    {
        engine.showMessage("Error retrieving document content.");
        return;
    }

    // get email account information for logged in user
    UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId());
    if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0)
    {
        engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account.");
        return;
    }

    StringBuffer sRecipientsNoEmail = new StringBuffer();

    if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull())
    {
        DocumentVo voDoc = new DocumentVo();
        voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document());
        voDoc = domain.getDocument(voDoc);
        if (null == voDoc)
            return;

        AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf");

        StringBuffer emailAddresses = new StringBuffer();

        try
        {
            String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail();
            if (noEmailAddresses != null)
            {
                engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail);

                return;
            }

            EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor);
            if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0)
            {
                emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients());
                emailCorresp.setAttach(correspondenceDocument);
                emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString());
                emailCorresp.sendEmail();
            }

            engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses);
        }
        catch (MessagingException me)
        {
            engine.showMessage(me.getMessage());
        }
        catch (SecurityException se)
        {
            engine.showMessage(se.getMessage());
        }
    }
}
项目:openmaxims-linux    文件:CorrespondenceDetailImpl.java   
public UserEmailAccountVo getEmailAppUser(Integer appUserId) 
{
    DomainFactory factory = getDomainFactory();
    return UserEmailAccountVoAssembler.create((UserEmailAccount)factory.getDomainObject(UserEmailAccount.class, appUserId));        
}