![]() |
Download TeamPage 6.2.46 | ![]() |
com.traction.sdk.edit.NewMailOutEntry NewMailOutEntry, clients can use the com.traction.sdk.SdkFactory method:
public abstract NewMailOutEntry createNewMailOutEntry(Set<? extends TractionId> targets, Project project,
Context context, boolean logMessage,
Set<? extends TractionId> omitEntryIdsFromRelated)
throws AuthenticationException;
com.traction.sdk.edit.PersonalDraftDataModificationException com.traction.sdk.edit.NewEntry 's saveDraft() method, as well as several methods in com.traction.sdk.edit.PersonalDraftManager , now throw the new PersonalDraftDataModificationException. This type of Exception represents a failure to modify personal draft data, usually caused by an underlying I/com.traction.sdk.view.IncludeManager IncludeManager has been extensively modified. The new IncludeManager.DocumentScope interface along with the method createDocumentScope() supports optional nestable scopes for including resources such as images, scripts and CSS, which makes it easy to create the rendering for separate documents such as the HTML body of an email message, and easy access to the resources included inline/IncludeManager.IncludedFiles interface. This allows clients to separate the resources being included within a self-contained generated document from those included in (referenced by) the main response document. The DocumentScope is closed when the self-contained document generation is complete.IncludeManager.ImageParameters interface, which includes a com.
import com.traction.sdk.*;
import com.traction.sdk.view.*;
import com.traction.sdk.sdl.*;
import com.traction.sdk.mail.*;
...
// com.traction.sdk.Context context ...
IncludeManager include = context.getIncludeManager();
SdlEvaluator eval = ctx.getSdlFactory().createSdlEvaluator(context, "com.example.my.template#function");
Scope scope = eval.getScope();
scope.setVariable("myVariable", ...);
SmtpMessage message = context.getSdkFactory().createPersonalSmtpMessage(context);
String htmlContent;
try (IncludeManager.DocumentScope docScope = include.createDocumentScope()) {
include.setDefaultIncludeMode(IncludeManager.ResourceType.CSS, IncludeManager.Mode.INLINE);
include.setDefaultIncludeMode(IncludeManager.ResourceType.JS, IncludeManager.Mode.INLINE);
include.setDefaultIncludeMode(IncludeManager.ResourceType.IMAGE, IncludeManager.Mode.CONTENT_ID);
include.setAutomaticallyIncludeInResponseWhenIncludingInBody(Icon.ImageResourceType.CONTENT, true);
include.setAutomaticallyIncludeInResponseWhenIncludingInBody(Icon.ImageResourceType.FILE_ICON, true);
include.setAutomaticallyIncludeInResponseWhenIncludingInBody(Icon.ImageResourceType.LABEL_ICON, true);
include.setAutomaticallyIncludeInResponseWhenIncludingInBody(Icon.ImageResourceType.ACTION_ICON, true);
include.setAutomaticallyIncludeInResponseWhenIncludingInBody(Icon.ImageResourceType.LOGO, true);
include.setAutomaticallyIncludeInResponseWhenIncludingInBody(Icon.ImageResourceType.PROFILE_PICTURE, true);
htmlContent = eval.eval();
message.addAttachments(docScope.getIncludedFiles());
}
com.traction.sdk.mail.MailFilter Changescom.traction.sdk.mail.IncomingMessage have changed. The subject, content and other attributes of the mail message data are now immutable. MailFilter implementations may inspect that original state, but can only modify the state of the com.traction.sdk.edit.NewReceivedMailEntry accessible from IncomingMessage's getNewEntry() method. These changes were necessary to address some internal consistency issues, and to ensure that the edit SDK implementation can remain coherent in the presence of modifications made both by MailFilters, com.traction.sdk.edit.EntryFilters , and any of the com.traction.sdk.Transformer s that must be applied as part of TeamPage's normal ingestion pipeline. (Server94227)com.traction.sdk.file.FileInfo Embedding URLsgetEmbeddingURL() has been added to the FileInfo interface to allow implementations to supply special URLs for the purpose of embedding a reference to the resource -- usually an image resource -- for the current context. All built-in implementations know how to correctly select the right sort of URL for the context (based upon the current TokenRendererSet and/com.traction.sdk.mail.Message now supports using a com.traction.sdk.file.FileInfo as the message body. The usual use-case for this would be to create a com.traction.sdk.file.TempFile , populate it with the desired HTML body (which may be quite large), and use that as the message body, e.
import com.traction.sdk.*;
import com.traction.file.*;
import com.traction.sdk.mail.*;
import java.io.IOException;
class Foo {
....
void sendMessage(Context context) throws AuthenticationException, MessagingException, IOException {
Message message = context.getSdkFactory().createPersonalSmtpMessage(context);
message.setSubject("Greetings");
try (TempFile bodyFile = createTransientTempFileForBody(context)) {
try (PrintWriter out = bodyFile.getUtf8PrintWriter()) {
// write body to out
}
message.setBodyHtml(bodyFile);
}
message.send();
}
TempFile createTransientTempFileForBody(Context context) throws IOException {
FileData metadata =
FileData.createInstanceForUnnamedResource("message",
MediaType.HTML_UTF_8.toString(),
null);
return context.getSdkFactory().createNewTransientTempFile(context, null, metadata, null);
}
....
}
com.traction.sdk.mail.Message.ReadyToSend com.traction.sdk.Message 's new getReadyToSend() method. If the method succeeds and returns a Message.ReadyToSend object, the client can take this as confirmation that TeamPage was able to open the transport and will be able to send the message, so long as the client creates an otherwise valid message (e.send() method, as usual, or via the send() method on the ReadyToSend instance. Multiple invocations of the getReadyToSend() method will return the same instance, and only one send operation can be performed. ReadyToSend instances are AutoCloseable; closing the instance will cancel the message if it has not already been sent. This provides a nice way to use ReadyToSend with a try-with-resources block, e.
import com.traction.sdk.*;
import com.traction.sdk.mail.*;
...
// com.traction.sdk.Context context ...
SmtpMessage message = context.getSdkFactory().createPersonalSmtpMessage(context);
try (Message.ReadyToSend ready = message.getReadyToSend()) {
message.addRecipient("user@example.com", Message.SupportedRecipientType.TO);
message.setSubject("Greetings");
message.setHtmlBody(...);
}
catch (MessagingException e) {
// won't be able to send
}
Message method abort() will also cancel the message.com.traction.sdk.UserAgent sUserAgent object by its configuration name, or for any user-agent identification string, via the following new methods in com.traction.sdk.config.ServerConfiguration :
public abstract UserAgent getUserAgentFromName(String name);
public abstract UserAgent getUserAgentFromUserAgentString(String uaString);
teampage_logo.jpg