本文整理汇总了Java中org.osgl.storage.ISObject.getKey方法的典型用法代码示例。如果您正苦于以下问题:Java ISObject.getKey方法的具体用法?Java ISObject.getKey怎么用?Java ISObject.getKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgl.storage.ISObject
的用法示例。
在下文中一共展示了ISObject.getKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMessage
import org.osgl.storage.ISObject; //导入方法依赖的package包/类
private MimeMessage createMessage() throws Exception {
MailerConfig config = mailerConfig();
if (null == config) {
throw E.unexpected("Cannot find mailer config for %s", confId);
}
Session session = mailerConfig().session();
if (Act.isDev()) {
session.setDebug(true);
}
MimeMessage msg = new MimeMessage(session);
msg.setFrom(from());
msg.setSubject(subject());
msg.setSentDate(new Date());
msg.setRecipients(Message.RecipientType.TO, list2Array(to()));
msg.setRecipients(Message.RecipientType.CC, list2Array(cc()));
msg.setRecipients(Message.RecipientType.BCC, list2Array(bcc()));
String content = this.content;
if (null == content) {
ViewManager vm = Act.viewManager();
Template t = vm.load(this);
E.illegalStateIf(null == t, "Mail template not defined");
content = t.render(this);
}
if (attachments.isEmpty()) {
msg.setText(content, config().encoding(), accept().name());
} else {
Multipart mp = new MimeMultipart();
MimeBodyPart bp = new MimeBodyPart();
mp.addBodyPart(bp);
bp.setText(content, config().encoding(), accept().name());
for (ISObject sobj : attachments) {
String fileName = sobj.getAttribute(ISObject.ATTR_FILE_NAME);
if (S.blank(fileName)) {
fileName = sobj.getKey();
}
String contentType = sobj.getAttribute(ISObject.ATTR_CONTENT_TYPE);
if (S.blank(contentType)) {
contentType = "application/octet-stream";
}
MimeBodyPart attachment = new MimeBodyPart();
attachment.attachFile(sobj.asFile(), contentType, null);
attachment.setFileName(fileName);
mp.addBodyPart(attachment);
}
msg.setContent(mp);
}
msg.saveChanges();
return msg;
}
示例2: Put
import org.osgl.storage.ISObject; //导入方法依赖的package包/类
public Put(ISObject content, Sftp sftp) {
this(content.getKey(), content, sftp);
}