It seems like that the 'NodeSetAssignees' just simply insert(Of course with some validations) two values(node,userid) into the 'Assignees' table...
// Public method
//
// Assign a list of users to a node, overwriting any
// current assignment
//
// Parameters:
//
// node The node.
// context The PrgSession object.
// assigneeList The list of userIDs to assign to the node.
// This MUST be a list of integers or a list
// of assocs with an integer in the field Id.
//
// Return an assoc:
//
// OK TRUE if ok.
// ErrMsg Application error message if not ok.
// ApiError Error returned by API if not ok.
//
function Assoc NodeSetAssignees( \
DAPINODE node, \
Object context, \
List assigneeList = {} )
Dynamic apiError
Dynamic assignee
String errMsg
Assoc retVal
Dynamic status
Object dbConnect = context.fDBConnect
CAPICONNECT connection = dbConnect.fConnection
Integer nodeID = node.pID
Boolean ok = TRUE
status = .CheckAssign( node, context, assigneeList )
if ( !status.ok )
ok = FALSE
errMsg = status.ErrMsg
apiError = status.ApiError
else
if ( !dbConnect.StartTrans() )
ok = FALSE
errMsg = [Task_ErrMsg.ErrorWritingAssigneeData]
else
status = CAPI.exec( connection, 'delete from Assignees where DataID = :A1', nodeID )
if IsError( status )
ok = FALSE
errMsg = [Task_ErrMsg.ErrorWritingAssigneeData]
apiError = status
else
for assignee in assigneeList
status = CAPI.exec( connection, 'insert into Assignees values( :A1, :A2 )', nodeID, assignee )
if IsError( status )
ok = FALSE
errMsg = [Task_ErrMsg.ErrorWritingAssigneeData]
apiError = status
break
end
end
end
dbConnect.EndTrans( ok )
end
end
retVal.OK = ok
retVal.ErrMsg = errMsg
retVal.ApiError = apiError
return retVal
end