code: public List<ResourceInstanceDTO> activeInstances(ServiceManagerResourceRestService service, String templateName)
  	{
  		WebQuery wq = new WebQuery();
  		wq.eq("template.id", templateName);
  		wq.eq("state",
  		      ResourceInstanceState.TO_PROVISION,
  		      ResourceInstanceState.PROVISIONING,
  		      ResourceInstanceState.NOT_IN_SERVICE,
  		      ResourceInstanceState.IN_SERVICE);
  
  		List<ResourceInstanceDTO> instances = service.searchInstances(wq);
  
  		return instances;
  	}
docs: Returns the number of active instances of the given template name
  
  @param service
  @param templateName
  
  @return