/* (non-Javadoc)
@see org.jbpm.process.audit.AuditLogService#findNodeInstances(long, java.lang.String)
174340
@Override
    public List<NodeInstanceLog> findNodeInstances(long processInstanceId, String nodeId) {
        EntityManager em = getEntityManager();
        Query query = em
            .createQuery("FROM NodeInstanceLog n WHERE n.processInstanceId = :processInstanceId AND n.nodeId = :nodeId ORDER BY date,id")
                .setParameter("processInstanceId", processInstanceId)
                .setParameter("nodeId", nodeId);
        return executeQuery(query, em, NodeInstanceLog.class);
    }
761739
public static <T extends Node> List<T> findNodes(List<Node> nodes, Class<T> cls) {
        List<T> results = new ArrayList<>();
        findNodes(nodes, cls, results);
        return results;
    }
890119
public List<Instance> listInstances() {
    // [START instance_admin_client_list_instances]
    List<Instance> instances =
        Lists.newArrayList(instanceAdminClient.listInstances(Options.pageSize(1)).iterateAll());
    // [END instance_admin_client_list_instances]
    return instances;
  }
529680
public List<String> listInstanceIDs(final Set<String> instanceIDs) {
        Set<String> allInstanceIDs = allMockEc2Instances.keySet();
        if (null == instanceIDs || instanceIDs.size() == 0) {
            return new ArrayList<String>(allInstanceIDs);
        } else {
            List<String> filteredInstanceIDs = new ArrayList<String>();
            for (String id : allInstanceIDs) {
                if (null != id && instanceIDs.contains(id)) {
                    filteredInstanceIDs.add(id);
                }
            }
            return filteredInstanceIDs;
        }
    }
919033
@Override
    public Set<Object> getInstances() {
        Set<Object> set = new HashSet<>();
        ClassLoader cl = Thread.currentThread().getContextClassLoader();

        Consumer<JsonArray> reader = array -> {
            if (array != null && array.size() > 0) {
                for (int i = 0; i < array.size(); i++) {
                    try {
                        Class<?> clazz = cl.loadClass(array.getString(i));
                        set.add(clazz.newInstance());
                    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        };

        JsonArray binders = config.getJsonArray(CONFIG_BINDERS, null);
        JsonArray instances = config.getJsonArray(CONFIG_INSTANCES, null);

        reader.accept(binders);
        reader.accept(instances);

        return set;
    }
458461
public ClosableIterator<NodeWithEmbeddedNodes> findEntities(HttpNeo4jClient executionEngine, EntityKey[] keys, Long txId) {
		if ( singlePropertyKey ) {
			return singlePropertyIdFindEntities( executionEngine, keys, txId );
		}
		else {
			return multiPropertiesIdFindEntities( executionEngine, keys, txId );
		}
	}
1109794
public java.util.List<com.google.appengine.v1.Instance> getInstancesList() {
    return instances_;
  }
889195
@Override
    public Collection<org.jbpm.services.api.model.NodeInstanceDesc> getActiveNodesForCase(String caseId, QueryContext queryContext) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("caseId", caseId + "%");
        applyQueryContext(params, queryContext);
        applyDeploymentFilter(params);
        List<org.jbpm.services.api.model.NodeInstanceDesc> nodeInstances =  commandService.execute(new QueryNameCommand<List<org.jbpm.services.api.model.NodeInstanceDesc>>("getActiveNodesForCase", params));
        return nodeInstances;
    }
319234
@Override
    public List<Pair<Long, String>> getLastNRegisteredInstances() {
        List<Pair<Long, String>> list = new ArrayList<Pair<Long, String>>();

        synchronized (recentRegisteredQueue) {
            for (Pair<Long, String> aRecentRegisteredQueue : recentRegisteredQueue) {
                list.add(aRecentRegisteredQueue);
            }
        }
        Collections.reverse(list);
        return list;
    }
507848
public List<Node> getNodes(Collection<Long> nodeIds)
	{
		if(nodeIds.isEmpty()) return Collections.emptyList();
		return getSomeElements(NODE + "s?" + NODE + "s=" + toCommaList(nodeIds), Node.class);
	}
444235
private VariableNode[] children(VariableNode node) {
        if (node.children != null) {
            return node.children;
        }

        VariableNode[] children;

        Object value = getValue(node);
        Object[] ids = debugger.getObjectIds(value);
        if (ids == null || ids.length == 0) {
            children = CHILDLESS;
        } else {
            Arrays.sort(ids, new Comparator<Object>() {
                @Override
                    public int compare(Object l, Object r)
                    {
                        if (l instanceof String) {
                            if (r instanceof Integer) {
                                return -1;
                            }
                            return ((String)l).compareToIgnoreCase((String)r);
                        }
                        if (r instanceof String) {
                            return 1;
                        }
                        int lint = ((Integer)l).intValue();
                        int rint = ((Integer)r).intValue();
                        return lint - rint;
                    }
            });
            children = new VariableNode[ids.length];
            for (int i = 0; i != ids.length; ++i) {
                children[i] = new VariableNode(value, ids[i]);
            }
        }
        node.children = children;
        return children;
    }
912879
public long getNodesCount() throws RepositoryException
   {
      try
      {
         ResultSet countNodes = findNodesCount();
         try
         {
            if (countNodes.next())
            {
               return countNodes.getLong(1);
            }
            else
            {
               throw new SQLException("ResultSet has't records.");
            }
         }
         finally
         {
            JDBCUtils.freeResources(countNodes, null, null);
         }
      }
      catch (SQLException e)
      {
         throw new RepositoryException("Can not calculate nodes count", e);
      }
   }
571460
List<Long> findWayNodesByWayID(long id) {
        try {
            this.pStmtWayNodesR.setLong(1, id);

            ResultSet rs = this.pStmtWayNodesR.executeQuery();
            Map<Integer, Long> nodeList = new TreeMap<>();
            while (rs.next()) {
                // way, node, position
                Long nodeID = rs.getLong(1);
                Integer pos = rs.getInt(2);
                nodeList.put(pos, nodeID);
            }
            rs.close();
            return new ArrayList<>(nodeList.values());
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
1260945
public List<Node> findSiblings(Node node) {
      Preconditions.checkNotNull(node);
    
      Node parent = node.parent();
      if (null == parent) return null;

      return parent.childNodes();               
  }
684352
public java.util.List<String> getInstanceGroupIds() {
        if (instanceGroupIds == null) {
            instanceGroupIds = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return instanceGroupIds;
    }
73878
public java.util.List<NodeSnapshot> getNodeSnapshots() {
        if (nodeSnapshots == null) {
            nodeSnapshots = new com.amazonaws.internal.SdkInternalList<NodeSnapshot>();
        }
        return nodeSnapshots;
    }
1183399
@Override
    public Map<String, List<CloudInstance>> getCloudInstances(CloudInstanceRepository repository) {
        DescribeInstancesResult instanceResult;
        if (null == settings.getFilters() || settings.getFilters().isEmpty() ) {
            instanceResult = ec2Client.describeInstances();
        } else {
            instanceResult = ec2Client.describeInstances(buildFilterRequest(settings.getFilters()));
        }
        DescribeAutoScalingInstancesResult autoScaleResult = autoScalingClient.describeAutoScalingInstances();
        List<AutoScalingInstanceDetails> autoScalingInstanceDetails = autoScaleResult.getAutoScalingInstances();
        Map<String, String> autoScaleMap = new HashMap<>();
        for (AutoScalingInstanceDetails ai : autoScalingInstanceDetails) {
            autoScaleMap.put(ai.getInstanceId(), ai.getAutoScalingGroupName());
        }

        Map<String, List<Instance>> ownerInstanceMap = new HashMap<>();

        List<Instance> instanceList = new ArrayList<>();
        List<Reservation> reservations = instanceResult.getReservations();
        for (Reservation currRes : reservations) {
            List<Instance> currInstanceList = currRes.getInstances();
            if (CollectionUtils.isEmpty(ownerInstanceMap.get(currRes.getOwnerId()))) {
                ownerInstanceMap.put(currRes.getOwnerId(), currRes.getInstances());
            } else {
                ownerInstanceMap.get(currRes.getOwnerId()).addAll(currRes.getInstances());
            }
            instanceList.addAll(currInstanceList);
        }

        Map<String, List<CloudInstance>> returnList = new HashMap<>();
        int i = 0;
        for (String acct : ownerInstanceMap.keySet()) {
            ArrayList<CloudInstance> rawDataList = new ArrayList<>();
            for (Instance currInstance : ownerInstanceMap.get(acct)) {
                i = i + 1;
                LOGGER.info("Collecting instance details for " + i + " of "
                        + instanceList.size() + ". Instance ID=" + currInstance.getInstanceId());
                CloudInstance object = getCloudInstanceDetails(acct,
                        currInstance, autoScaleMap, repository);
                rawDataList.add(object);
            }
            if (CollectionUtils.isEmpty(returnList.get(acct))) {
                returnList.put(acct, rawDataList);
            } else {
                returnList.get(acct).addAll(rawDataList);
            }
        }
        return returnList;
    }