Eliminating duplicate items in bulk insert work queue queries
In constructing the query for your custom work
queue class, Guidewire recommends that you include the following method,
which excludes duplicate StandardWorkItem
work items from the query:
excludeDuplicatesOnStandardWorkItem(java.lang.Object opaqueBuilder, boolean allowFailedDuplicates) The excludeDuplicatesOnStandardWorkItem method takes the following parameters:
|
|
The query builder to use. |
|
|
(Boolean) Whether to recreate a failed work item. |
The excludeDuplicatesOnStandardWorkItem
helper method excludes StandardWorkItem
work items only. If you query on another work item type, use custom code
similar to the following to exclude the duplicate work items:
builder.mapColumn(XXWorkItem#Target.PropertyInfo as IEntityPropertyInfo,
XX#Id.PropertyInfo as IEntityPropertyInfo)
var subQuery = Queries.createQuery(XXWorkItem)
if allowFailedDuplicates subQuery.compare(XXWorkItem#Status.PropertyInfo.Name, Relop.NotEquals,
WorkItemStatusType.TC_FAILED)
builder.SourceQuery.subselect(XX#Id.PropertyInfo.Name, CompareNotIn, subQuery,
XXWorkItem#Target.PropertyInfo.Name)
