0

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);
}

}

ephti2000
  • 17
  • 1
  • 9
  • [What have you tried](http://mattgemmell.com/what-have-you-tried/)? – RealSkeptic Mar 26 '15 at 19:29
  • possible duplicate of [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java) – RealSkeptic Mar 26 '15 at 20:42
  • 1
    In your code: `if (xSSN == "Multiple" || xSSN == "multiple" ...` – RealSkeptic Mar 26 '15 at 20:49
  • What specific issue are you running into? Don't compare Strings using ==. Use the .equals method instead. See this blog post for how to clone a content item in WebCenter Content: https://jonathanhult.com/blog/2013/04/clone-content-webcenter-content-11g/ – Jonathan Hult Mar 27 '15 at 13:50

0 Answers0