我正在研究UCM项目,工作流程是读取元数据字段(xComments,将SSN用逗号分隔)并为xComments中的每个SSN提交单独的文档并替换SSN的使用自定义元数据名称xSSN。
简要说明一下: 如果文档“A”的xComments字段值为1,2,3且xSSN值为“multiple”,那么我希望我的脚本/ java代码创建“文档A”,“文档B”,“文档c”,具有xSSN字段1 ,2和3
public class ContentCheckInHandler implements FilterImplementor{
public int doFilter(Workspace ws, DataBinder binder, ExecutionContext cxt)
throws DataException, ServiceException
{
//boolean isCheckin = StringUtils.convertToBool(binder.getLocal("isCheckin"), false);
//boolean isNew = StringUtils.convertToBool(binder.getLocal("isNew"), false);
String dDocType = binder.getLocal("dDocType");
String xRegion = binder.getLocal("xRegion");
String xSSN = binder.getLocal("xSSN");
String xComments = binder.getLocal("xComments");
String [] SSNListSeparate = xComments.split(",");
int[]convertxComments = new int[xComments.length()];
boolean chkxComments = false;
String primaryFile = getFilePath(binder, "primaryFile");
if(xSSN == "Multiple" || xSSN == "multiple" && xComments.length() > 0)
{
for(int i = 0; i < SSNListSeparate.length; i++)
{
convertxComments[i] = Integer.parseInt(SSNListSeparate[i]);
DataBinder b = new DataBinder();
b.putLocal("dID", binder.getLocal("dID"));
b.putLocal("dDocName", binder.getLocal("dDocName"));
b.putLocal("xAccountNumber", binder.getLocal("xAccountNumber"));
b.putLocal("xSSN",SSNListSeparate[i]);
b.putLocal("xRegion", xRegion);
b.putLocal("xFirstName", "");
b.putLocal("xLastName", "");
b.putLocal("xFSADocType", binder.getLocal("xFSADocType"));
b.putLocal("xPLDocType", binder.getLocal("xPLDocType"));
b.putLocal("xDocSource", binder.getLocal("xDocSource"));
ws.execute("CHECKIN_NEW_SUB", b);
}
}
else
{
chkxComments = false;
SystemUtils.trace("TrainingDocument", "SSN value: " + xSSN);//just for testing
}
return CONTINUE;
}
public String getFilePath(DataBinder binder, String fileKey)
throws DataException
{
return ServerFileUtils.getTemporaryFilePath(binder, fileKey);
}
}