Creates a list of {@link HBaseConsumerState} instances based on the given HBase result.
979304
public static List<HBaseConsumerState> create(Result result) {
    return create(result.getFamilyMap(QueueEntryRow.COLUMN_FAMILY));
  }
576219
static <T> ListFactory<T> arrayListFactoryWithFirstElement(final T first) {
    return new ListFactory<T>() {
      @Override List<T> newList() {
        ArrayList<T> list = Lists.arrayList();
        list.add(first);
        return list;
      }
    };
  }
1033232
private List<CmsResultItemBean> buildSearchResultList(
        List<CmsGallerySearchResult> searchResult,
        CmsGallerySearchResult presetResult) {

        ArrayList<CmsResultItemBean> list = new ArrayList<CmsResultItemBean>();
        if ((searchResult == null) || (searchResult.size() == 0)) {
            return list;
        }
        CmsObject cms = getCmsObject();
        for (CmsGallerySearchResult sResult : searchResult) {
            try {
                CmsResultItemBean bean = buildSingleSearchResultItem(cms, sResult, presetResult);
                list.add(bean);
            } catch (Exception e) {
                logError(e);
            }
        }
        return list;
    }
793874
public static List<InstanceModel> instances(BundleContext context) {
        List<InstanceModel> instances = new ArrayList<>();
        try {
            for (ServiceReference ref : context.getServiceReferences(Architecture.class, null)) {
                instances.add(new InstanceModel((Architecture) context.getService(ref)));
            }
        } catch (InvalidSyntaxException e) { //NOSONAR
            // Ignore it.
        }
        return instances;
    }
255368
@Override
    public List<HBaseData> LoadData(HTableInterface hTable, String columnFamily, Object rowKey, Filter filter,
            String... columns) throws IOException
    {
        List<HBaseData> results = new ArrayList<HBaseData>();
        if (scanner == null)
        {

            // only in case of find by id
            Scan scan = null;
            if (rowKey != null)
            {
                byte[] rowKeyBytes = HBaseUtils.getBytes(rowKey);
                Get g = new Get(rowKeyBytes);

                // TODO: After more than one column family for 1 table. this
                // should work. currently failing for embeddable entities.
                if (columnFamily != null)
                {
                    g.addFamily(Bytes.toBytes(columnFamily));
                }

                if (filter != null)
                {
                    g.setFilter(filter);
                }
                Result result = hTable.get(g);

                if (result != null && result.list() != null)
                {
                    HBaseData data = null;
                    for (KeyValue value : result.list())
                    {
                        data = new HBaseData(columnFamily != null ? columnFamily : new String(value.getFamily()),
                                value.getRow());
                        break;
                    }

                    if (data != null)
                    {
                        data.setColumns(result.list());
                        results.add(data);
                    }

                }
                return results;

                // scan = new Scan(g);
            }
            else
            {
                scan = new Scan();
            }
            setScanCriteria(filter, columnFamily, null, scan, columns);
            scanner = hTable.getScanner(scan);
            resultsIter = scanner.iterator();
        }
        return scanResults(columnFamily, results);
    }
1339184
private List returnEntityObjectList(EntityMetadata m, List<HBaseDataWrapper> results, List outputResults)
    {
        Map<Object, Object> entityListMap = new HashMap<Object, Object>();
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());
        EntityType entityType = metaModel.entity(m.getEntityClazz());
        List<AbstractManagedType> subManagedTypes = ((AbstractManagedType) entityType).getSubManagedType();
        Map<String, Class> discrValueToEntityClazz = new HashMap<String, Class>();
        String discrColumn = null;
        if (subManagedTypes != null && !subManagedTypes.isEmpty())
        {
            for (AbstractManagedType subEntity : subManagedTypes)
            {
                discrColumn = ((AbstractManagedType) subEntity).getDiscriminatorColumn();
                discrValueToEntityClazz.put(subEntity.getDiscriminatorValue(), subEntity.getJavaType());
            }
        }
        for (HBaseDataWrapper data : results)
        {
            Class clazz = null;
            if (discrValueToEntityClazz != null && !discrValueToEntityClazz.isEmpty())
            {
                String discrColumnKey = HBaseUtils.getColumnDataKey(m.getTableName(), discrColumn);
                String discrValue = Bytes.toString(data.getColumnValue(discrColumnKey));
                clazz = discrValueToEntityClazz.get(discrValue);
                m = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, clazz);
            }
            else
            {
                clazz = m.getEntityClazz();
            }

            Object entity = KunderaCoreUtils.createNewInstance(clazz); // Entity
            Object rowKeyValue = HBaseUtils.fromBytes(m, metaModel, data.getRowKey());
            if (!metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
            {
                PropertyAccessorHelper.setId(entity, m, rowKeyValue);
            }
            if (entityListMap.get(rowKeyValue) != null)
            {
                entity = entityListMap.get(rowKeyValue);
            }
            entity = populateEntityFromHBaseData(entity, data, m, null);
            if (entity != null)
            {
                entityListMap.put(rowKeyValue, entity);
            }
        }
        for (Object obj : entityListMap.values())
        {
            outputResults.add(obj);
        }
        return outputResults;
    }
1204185
public AbstractInstanceArrayList createInstanceFor(Collection jenaBeans) throws SemanticModelException
    {
        if (jenaBeans.isEmpty())
        {
            return null;
        }
        Object firstJenaBean = jenaBeans.iterator().next();
        Instance instance = createInstanceFor(firstJenaBean);
        if (null != instance && jenaBeans instanceof List)
        {
            List<Instance> instances = new ArrayList<Instance>();
            for (Object jenaBean : jenaBeans)
            {
                
                instances.add(createInstanceFor(jenaBean));
            }
            return new InstanceArrayList(instances, instance.getConcept());
        }
        if (firstJenaBean.getClass().isPrimitive() || firstJenaBean instanceof String)
        {
            List<InstanceLiteral> instances = new ArrayList<InstanceLiteral>();
            for (Object jenaBean : jenaBeans)
            {
                
                instances.add(new InstanceLiteral(jenaBean.toString()));
            }
            return new InstanceLiteralArrayList(instances);
        }
        return null;
    }
509890
private void assignReferenceToProxy(List results)
    {
        if (results != null)
        {
            for (Object obj : results)
            {
                kunderaMetadata.getCoreMetadata().getLazyInitializerFactory().setProxyOwners(getEntityMetadata(), obj);
            }
        }
    }
839625
public List<Model> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) {
    return commandContext.getModelEntityManager().findModelsByNativeQuery(parameterMap, firstResult, maxResults);
  }
358574
public static List<OrderingResult> getOrderingResults(Result r) {
    if(r instanceof OrderingResult) {
      List<OrderingResult> ors = new ArrayList<>(1);
      ors.add((OrderingResult) r);
      return ors;
    }
    if(r instanceof HierarchicalResult) {
      return filterResults(((HierarchicalResult) r).getHierarchy(), r, OrderingResult.class);
    }
    return Collections.emptyList();
  }
1063161
public static List<CreateTableResult> initAllTables() {
        final List<CreateTableResult> ret = new ArrayList<>();
        final List<RepositoryDefinition> repositoryDefs = getRepositoryDefinitions();
        boolean isSuccess = false;
        for (final RepositoryDefinition repositoryDef : repositoryDefs) {
            try {
                isSuccess = JdbcFactory.getInstance().createTable(repositoryDef);
            } catch (final SQLException e) {
                LOGGER.log(Level.ERROR, "Creates table [" + repositoryDef.getName() + "] error", e);
            }

            ret.add(new CreateTableResult(repositoryDef.getName(), isSuccess));
        }

        return ret;
    }
1014339
public DList newDList()
    {
        if ((getCurrentDatabase() == null))
        {
            throw new DatabaseClosedException("Database is NULL, cannot create a DList with a null database.");
        }
        return (DList) DListFactory.singleton.createCollectionOrMap(getCurrentPBKey());
    }
144164
public List<ProcessInstance> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) {
    return commandContext.getExecutionEntityManager().findProcessInstanceByNativeQuery(parameterMap, firstResult, maxResults);
  }
869474
public List<HistoricVariableInstance> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) {
    return commandContext.getHistoricVariableInstanceEntityManager().findHistoricVariableInstancesByNativeQuery(parameterMap, firstResult, maxResults);
  }
236918
protected ConsumerKey createConsumerKey(
                                            DispatchableConsumerPoint consumerPoint,
                                            SelectionCriteria criteria,
                                            SIBUuid12 connectionUuid,
                                            boolean readAhead,
                                            boolean forwardScanning,
                                            JSConsumerSet consumerSet)
                    throws SISelectorSyntaxException, SIDiscriminatorSyntaxException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc,
                        "createConsumerKey",
                        new Object[] { consumerPoint,
                                      criteria,
                                      connectionUuid,
                                      Boolean.valueOf(readAhead),
                                      Boolean.valueOf(forwardScanning),
                                      consumerSet });

        ConsumerKey key = new LocalQPConsumerKey(
                        consumerPoint,
                        this,
                        criteria,
                        connectionUuid,
                        forwardScanning,
                        consumerSet);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createConsumerKey", key);

        return key;
    }
1132041
public static <T> List<T> buildSQLResult(SQLRestResponse result,Class<T> type){
		if(result == null || result.getRows() == null || result.getRows().size() == 0)
			return null;
		if(result.getRows() != null && result.getRows().size() > 0) {
			List<Object[]> rows = result.getRows();
			List<T> datas = new ArrayList<T>(rows.size());
			ColumnMeta[] metas = result.getColumns();
			if (Map.class.isAssignableFrom(type)) {
				Map<String,Object> data = null;
				for(int i = 0; i < rows.size(); i ++) {
					Object[] row = rows.get(i);
					data = new HashMap<String,Object>(metas.length);
					for (int j = 0; j < metas.length; j++) {
						data.put(metas[j].getName(),row[j]);
					}
					datas.add((T)data);
				}

			} else {
				DateFormat defaultDateFormat = SerialUtil.getDateFormateMeta().toDateFormat();
				T valueObject = null;
				for(int i = 0; i < rows.size(); i ++) {
					Object[] row = rows.get(i);
					valueObject = buildObject(type,  metas,  row,defaultDateFormat);
					datas.add(valueObject);
				}
			}
			return datas;
		}
		else {
			return null;
		}

	}
509898
@NonNull
    public static <T> PutResults<T> newInstance(@NonNull Map<T, PutResult> putResults) {
        return new PutResults<T>(putResults);
    }