Database SQL Operation: TaskAssignment.searchUnreservedByRelatedIDTypeAndLongestAssignedDateTime
Description: | Returns the unreserved task identifier based on related ID and nearest assigned date. There may be more than one record matching the search criteria as system generated tasks could have the same assigned date time.
@deprecated Since Curam 6.0 SP2. This method has been replaced by two distinct functions that cater for tasks assigned to organization objects and those assigned to users.
{@link curam.core.sl.entity.intf.TaskAssignment#searchUnreservedByRelatedIDAndLongestAssignedDateTime(TaskIDRelatedIDAndTypeKey)}.
{@link curam.core.sl.entity.intf.TaskAssignment#searchUnreservedByRelatedNameAndAndLongestAssignedDateTime(TaskIDRelatedIDAndTypeKey)}.
See release note CR00290609. |
Sterotype: | nsmulti |
SELECT
Task.taskID,
Task.versionNo
INTO
:taskID,
:versionNo
FROM
TaskAssignment,
Task
WHERE
(
:relatedName IS NULL
OR TaskAssignment.relatedName = :relatedName
)
AND
(
:searchByRelatedIDInd = '0'
OR TaskAssignment.relatedID = :relatedID
)
AND TaskAssignment.assigneeType = :assigneeType
AND TaskAssignment.taskID = Task.taskID
AND Task.reservedBy IS NULL
AND Task.assignedDateTime =
(
SELECT
MIN(assignedDateTime)
FROM
TaskAssignment,
Task
WHERE
(
:relatedName IS NULL
OR TaskAssignment.relatedName = :relatedName
)
AND
(
:searchByRelatedIDInd = '0'
OR TaskAssignment.relatedID = :relatedID
)
AND TaskAssignment.assigneeType = :assigneeType
AND TaskAssignment.taskID = Task.taskID
AND Task.assignedDateTime <= :assignedDateTime
AND Task.reservedBy IS NULL
)
|