Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
I am using the following code to get signatures from a set of workflow tasks:
wt.fc.QueryResult qr = wt.workflow.work.WorkflowHelper.service.getWorkItems(primaryBusinessObject);
java.lang.String current_signature = ";
if (qr != null)
{
while (qr.hasMoreElements())
{
WorkItem workitem = (WorkItem)qr.nextElement();
current_signature = workitem.getCompletedBy();
My problem is that the signature it returns is a string with the user name and not the full name. If I can turn the string into WTUser, I can then use getFullName() to get the full name of the user. Anybody have any ideas? Thanks in advance.
You may want to use the WfVotingEventObject instead to get a record of completed workitems scroll to the bottom of my posting to see that code.
I have posted this code on ptcuser before. This is a safer way to find a wtuser object given the user id string:
Try the following:
try {
wt.util.WTProperties wtPropertiesReference;
wtPropertiesReference = wt.util.WTProperties.getLocalProperties();
String ldapServicesArray = new String[] {
wtPropertiesReference.getProperty("wt.federation.org.defaultAdapter")};
String[] ldapSubtreeScope =
{wt.org.OrganizationServicesHelper.SUBTREE_SCOPE};
wt.org.GenericDirectoryContextProvider directoryContextProvider = new
wt.org.GenericDirectoryContextProvider( ldapServicesArray, ldapSubtreeScope
);
wt.org.WTUser userVariableDefinedInWorkflow =
wt.org.OrganizationServicesHelper.manager.getUser(<usernamestringvariableinw<br/>orkflow>,directoryContextProvider);
} catch (Exception error)
{
error.printStackTrace();
}
Here is the wfvotingeventaudit logic to get full nameof completed by
WTCollection voting = WfEngineHelper.service.getVotingEvents((wt.workflow.engine.WfProcess)self.getObject(), null, null, null);
Object anItem = null;
wt.workflow.engine.WfVotingEventAudit aVote = null;
if (voting != null && !voting.isEmpty())
{
Iterator voteIterator = voting.iterator();
while (voteIterator.hasNext())
{
anItem = voteIterator.next();
if (anItem instanceof wt.workflow.engine.WfVotingEventAudit)
{
aVote = (wt.workflow.engine.WfVotingEventAudit)anItem;
// aVote.getUserComment()
// aVote.getActivityName()
// Role arole = aVote.getRole()
// aVote.isSigned()
// aVote.isRequired()
// aVote.getAssigneeRef() // returns WTPrincipalReference (who was assigned activty/workitem vote attached to)
// aVote.getUserRef() // WTPrincipalReference of voted/completed by
// aVote.getActivityKey() // long for querying for WfActivity object in all likelyhood
// aVote.getCreateTimestamp()
// aVote.getModifyTimestamp()
// aVote.getTimestamp()
// aVote.getTripCount() // numbe rof times activity been completed (not sure if in total or by a particular user)
}
}
}