1、kettle 维度更新
代理关键字 增加的时候 ,其 FID类型最大只能设置 NUMBER(17),否则报错 ,数据库:ORACLE
2、利用kettle发邮件附件,下面是流程图:
3、利用kettle jar包执行kettle生成的ktr和kjb文件,这里给大家一个我配置好的java工程,大家可以通过TestRunKettle执行kettle生成的文件, 点击下载kettle演示工程
4、支持jasper图形邮件发送的EMAIL插件修改
//start html email 将HMTL文件写入邮件流里面
InputStream is = file.getContent().getInputStream();
if(is!=null && file.getName().getExtension().equals("html")){
// System.out.println(file.getName().getExtension());
//set html to a string
MimeBodyPart htmlContent = new MimeBodyPart();
byte[] bytes = new byte[1024];
String html = "";
int c;
while((c=is.read(bytes))!=-1){
html = html + new String(bytes,0,c);
}
// System.out.println(html);
//replace the image url with new cid url
String IMG_REGEX = "<\\s*img\\s+(?:[^\\s>]\\s*){0,}src\\s*=\\s*[\"']\\s*([^\"'\\s>]*)\\s*[\"'](?:\\s*[^\\s>]){0,}\\s*>";
String PREFIX_IMG = "img_";
Map urlMap = new HashMap();
Pattern p = Pattern.compile(IMG_REGEX);
Matcher m = p.matcher(html);
String url = null;
String cid = null;
int i = 1;
// replace image url
while (m.find()) {
url = m.group(1);
if (StringUtils.hasText(url)) {
if (!urlMap.containsKey(url)) {
cid = PREFIX_IMG+(i++);
urlMap.put(url, cid);
html = html.replaceAll(url, "cid:"+cid);
}
}
}
//add html into email
htmlContent.setContent(html, "text/html; " + "charset=utf-8");
parts.addBodyPart(htmlContent);
//add html's image into email
Iterator urlIterator = urlMap.keySet().iterator();
while (urlIterator.hasNext()) {
url = urlIterator.next();
cid = urlMap.get(url);
MimeBodyPart imageFile = new MimeBodyPart();
byte [] imageBytes = file2byte(url);
DataHandler dh = new DataHandler(new ByteArrayDataSource((byte[])imageBytes,"application/octet-stream"));
imageFile.setDataHandler(dh);
imageFile.setFileName(cid);
// imageFile.setHeader("Content-ID", "IMG" + new Integer(i).toString());
parts.addBodyPart(imageFile);
// System.out.println(html);
// System.out.println(cid);
}
}
//end html email



