I’m working on UCM project and the workflow is to read on a metadata filed (xComments , which will have SSN #’s separated by commas) and submit a separate document for each SSN found in the xComments and replace the SSN’s with the custom metadata filed Name xSSN.
Just to be brief: If document “A” has xComments filed value 1,2,3 and xSSN value “ multiple” then I want my script/java code to create “Document A”, “Document B”, “Document c”, having a xSSN filed 1,2 and 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);
}
}