Creating a Supervised Work List— Service Connector API Example (Java)

This topic provides an example that illustrates creating a supervised work list and viewing work on a particular process instance, using the method calls available in the Java Service Connector API.

	private void creatingAndManagingSupervisedWorkListViewsExample()
	{
		try
		{
			// Step 1: Find the GUIDS which we can view the work list for
			ListActionAuthorisedEntitiesResponse authorisedEntities = serviceConnectorInstance
					.listActionAuthorisedEntities("BRM", "viewWorkList");
			// Step 2: Get the details of the GUIDS - in this example just the first one
			if (authorisedEntities.getGuidArray() != null && authorisedEntities.getGuidArray().length > 0)
			{
				XmlOrgModelNode node = serviceConnectorInstance.browseModelNode(-1, null,
						authorisedEntities.getGuidArray(0), null);
				// Step 3: Build up the entity we want to get the work list for
				XmlModelEntityId entity = XmlModelEntityId.Factory.newInstance();
				entity.setGuid(node.getGuid());
				entity.setEntityType(node.getEntityType());
				entity.setModelVersion(node.getModelVersion());
				// Get the work list for the specified GUID
				serviceConnectorInstance.getWorkListItems(OrderFilterCriteria.Factory.newInstance(), entity, 0, 100);
				// Example 2 for a specific instance ID
				OrderFilterCriteria oc = OrderFilterCriteria.Factory.newInstance();
				oc.setFilter("appInstance='pvm:0a125'");
				serviceConnectorInstance.getAllocatedWorkListItems(oc, entity, 0, 100);
			}
		}
		catch (SecurityFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (InvalidServiceRequestFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (com.tibco.n2.de.services.InternalServiceFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (InvalidOrgModelVersionFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (InvalidEntityReferenceFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (InvalidEntityFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (com.tibco.n2.brm.services.InternalServiceFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (WorkItemOrderFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (WorkItemFilterFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (com.tibco.n2.brm.services.SecurityFault e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}