Converts the given array of native entities to a list of model objects of given type,
<code>entityClass</code>.

@param entityClass
the entity class
@param nativeEntities
native entities to convert
@return the list of model objects
347198
static <E> List<E> toEntities(Class<E> entityClass, Entity[] nativeEntities) {
    if (nativeEntities == null || nativeEntities.length == 0) {
      return new ArrayList<>();
    }
    return toEntities(entityClass, Arrays.asList(nativeEntities));
  }
44069
public static CmsEntityWrapper[] arrayFromEntityList(List<CmsEntity> entities) {

        CmsEntityWrapper[] result = new CmsEntityWrapper[entities.size()];
        for (int i = 0; i < entities.size(); i++) {
            result[i] = new CmsEntityWrapper(entities.get(i));
        }
        return result;
    }
465646
public <E> List<E> find(Class<E> entityClass, Object... primaryKeys)
    {
        List<E> entities = new ArrayList<E>();
        if (primaryKeys == null)
        {
            return entities;
        }
        Set<Object> pKeys = new HashSet<Object>(Arrays.asList(primaryKeys));
        for (Object primaryKey : pKeys)
        {
            E e = find(entityClass, primaryKey);
            if (e != null)
            {
                entities.add(e);
            }
        }
        return entities;
    }
862712
@Override
    public <E> List<E> findAll(Class<E> entityClass, String[] columnsToSelect, Object... keys)
    {
        Object connection = getConnection();
        List results = new ArrayList();
        try
        {
            for (Object key : keys)
            {
                Object result = fetch(entityClass, key, connection, null);
                if (result != null)
                {
                    results.add(result);
                }
            }
        }
        catch (InstantiationException e)
        {
            logger.error("Error during find by key:", e);
            throw new PersistenceException(e);
        }
        catch (IllegalAccessException e)
        {
            logger.error("Error during find by key:", e);
            throw new PersistenceException(e);
        }
        return results;
    }
532874
public void delete(List<?> entities) {
    try {
      entityManager.executeEntityListeners(CallbackType.PRE_DELETE, entities);
      Key[] nativeKeys = new Key[entities.size()];
      for (int i = 0; i < entities.size(); i++) {
        nativeKeys[i] = Marshaller.marshalKey(entityManager, entities.get(i));
      }
      nativeWriter.delete(nativeKeys);
      entityManager.executeEntityListeners(CallbackType.POST_DELETE, entities);
    } catch (DatastoreException exp) {
      throw DatastoreUtils.wrap(exp);
    }
  }
963036
protected List<String> createEntity(JSONArray entities) throws AtlasServiceException {
        LOG.debug("Creating entities: {}", entities);
        JSONObject response = callAPIWithBody(API.CREATE_ENTITY, entities.toString());
        List<String> results = extractEntityResult(response).getCreatedEntities();
        LOG.debug("Create entities returned results: {}", results);
        return results;
    }
461592
public <T extends BaseNlpEntity> List<T> getEntities(Class<T> clazz) {
    List<BaseNlpEntity> resultList = new ArrayList<>();
    for (BaseNlpEntity item : getEntities()) {
      if (item.getClass().equals(clazz)) {
        resultList.add(item);
      }
    }
    return (List<T>) resultList;
  }
38724
public List<MappedSuperclass<EntityMappings<T>>> getAllMappedSuperclass()
   {
      List<MappedSuperclass<EntityMappings<T>>> list = new ArrayList<MappedSuperclass<EntityMappings<T>>>();
      List<Node> nodeList = childNode.get("mapped-superclass");
      for(Node node: nodeList)
      {
         MappedSuperclass<EntityMappings<T>>  type = new MappedSuperclassImpl<EntityMappings<T>>(this, "mapped-superclass", childNode, node);
         list.add(type);
      }
      return list;
   }
1157953
@SuppressWarnings("unchecked")
  @Override
  public <T> List<T> getCollection(Class<T> entityClass) {
    String collectionName = Util.determineCollectionName(entityClass);
    Map<Object, T> collection = (Map<Object, T>) collectionsRef.get().get(collectionName);
    if (null == collection) {
      createCollection(collectionName);
      collection = (Map<Object, T>) collectionsRef.get().get(collectionName);
    }

    CollectionMetaData cmd = cmdMap.get(collectionName);
    List<T> newCollection = new ArrayList<T>();
    try {
      for (T document : collection.values()) {
        Object obj = Util.deepCopy(document);
        if(encrypted && cmd.hasSecret() && null != obj) {
          CryptoUtil.decryptFields(obj, cmd, dbConfig.getCipher());
        }
        newCollection.add((T) obj);
      }
    } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
      logger.error("Error when decrypting value for a @Secret annotated field for entity: " + collectionName, e);
      throw new JsonDBException("Error when decrypting value for a @Secret annotated field for entity: " + collectionName, e);
    }
    return newCollection;
  }
19931
@Override
  public <T> boolean collectionExists(Class<T> entityClass) {
    return collectionExists(Util.determineCollectionName(entityClass));
  }
110546
private static Collection<Class> scanEntityClasses(String... persistenceXmlFiles) {
        DDLGenerator.Profile profile = new DDLGenerator.Profile(null);
        profile.addPersistenceFile(persistenceXmlFiles);
        return profile.getEntityClasses();
    }
1032643
public List<NamedNativeQuery<EntityMappings<T>>> getAllNamedNativeQuery()
   {
      List<NamedNativeQuery<EntityMappings<T>>> list = new ArrayList<NamedNativeQuery<EntityMappings<T>>>();
      List<Node> nodeList = childNode.get("named-native-query");
      for(Node node: nodeList)
      {
         NamedNativeQuery<EntityMappings<T>>  type = new NamedNativeQueryImpl<EntityMappings<T>>(this, "named-native-query", childNode, node);
         list.add(type);
      }
      return list;
   }
905295
public <E> List<E> executeQuery(Class<E> entityClass, OracleNoSQLQueryInterpreter interpreter,
            Set<Object> primaryKeys)
    {

        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClass);
        MetamodelImpl metamodel = (MetamodelImpl) KunderaMetadataManager.getMetamodel(kunderaMetadata,
                entityMetadata.getPersistenceUnit());

        EntityType entityType = metamodel.entity(entityMetadata.getEntityClazz());

        List<E> results = new ArrayList<E>();

        if (interpreter.getClauseQueue().isEmpty()) // Select all query
        {
            // Select Query with where clause (requires search within inverted
            // index)
            return findAll(entityClass, interpreter.getSelectColumns(), null);
        }
        else if (interpreter.isFindById() && interpreter.getClauseQueue().size() == 1)
        {
            Object value = null;
            Object clause = interpreter.getClauseQueue().peek();
            if (clause.getClass().isAssignableFrom(FilterClause.class))
            {
                value = interpreter.getRowKey();
            }
            else
            {
                throw new QueryHandlerException(
                        "Query with multiple AND/OR clause is not supported with oracle nosql db");
            }
            if (value != null)
            {
                Object output = find(entityClass, value, Arrays.asList(interpreter.getSelectColumns()));
                if (output != null)
                {
                    results.add((E) output);
                }
            }
        }
        else if (interpreter.getClauseQueue().size() >= 1) // query over index
        // keys.
        {
            return onIndexSearch(interpreter, entityMetadata, metamodel, results,
                    Arrays.asList(interpreter.getSelectColumns()));
        }
        return results;

        // throw new
        // UnsupportedOperationException("Query with where clause is not yet
        // supported");
    }
1273400
public List<EntityBeanType<EnterpriseBeansType<T>>> getAllEntity()
   {
      List<EntityBeanType<EnterpriseBeansType<T>>> list = new ArrayList<EntityBeanType<EnterpriseBeansType<T>>>();
      List<Node> nodeList = childNode.get("entity");
      for(Node node: nodeList)
      {
         EntityBeanType<EnterpriseBeansType<T>>  type = new EntityBeanTypeImpl<EnterpriseBeansType<T>>(this, "entity", childNode, node);
         list.add(type);
      }
      return list;
   }
416337
public static TableModel[] entity2ReadOnlyModel(Class<?>... entityClasses) {
		List<TableModel> l = new ArrayList<TableModel>();
		for (Class<?> clazz : entityClasses) {
			l.add(entity2ReadOnlyModel(clazz));
		}
		return l.toArray(new TableModel[l.size()]);
	}
709250
@Override
    public <E> List<E> find(Class<E> entityClass, Map<String, String> col)
    {
        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, getPersistenceUnit(),
                entityClass);
        List<E> entities = new ArrayList<E>();
        Map<String, Field> columnFamilyNameToFieldMap = MetadataUtils.createSuperColumnsFieldMap(entityMetadata,
                kunderaMetadata);
        for (String columnFamilyName : col.keySet())
        {
            String entityId = col.get(columnFamilyName);
            if (entityId != null)
            {
                E e = null;
                try
                {
                    List results = new ArrayList();
                    fetchEntity(entityClass, entityId, entityMetadata, entityMetadata.getRelationNames(),
                            entityMetadata.getSchema(), results, null, null);
                    if (results != null)
                    {
                        e = (E) results.get(0);
                    }
                }
                catch (IOException ioex)
                {
                    log.error("Error during find for embedded entities, Caused by: .", ioex);

                    throw new KunderaException(ioex);
                }

                Field columnFamilyField = columnFamilyNameToFieldMap.get(columnFamilyName.substring(0,
                        columnFamilyName.indexOf("|")));
                Object columnFamilyValue = PropertyAccessorHelper.getObject(e, columnFamilyField);
                if (Collection.class.isAssignableFrom(columnFamilyField.getType()))
                {
                    entities.addAll((Collection) columnFamilyValue);
                }
                else
                {
                    entities.add((E) columnFamilyValue);
                }
            }
        }
        return entities;
    }
1328591
public function buildListEntityInterfaces(array $entityClassNames = [])
    {
        $listEntityInterfaces = [];

        $moduleOptionsManager = $this->getModuleOptionsPluginManager();
        $allowedModules = $this->getAllowedModules($entityClassNames);

        foreach ($entityClassNames as $entityClassName) {
            $r = new ReflectionClass($entityClassName);
            $useInterfaces = $r->getInterfaceNames();
            foreach ($useInterfaces as $currentInterface) {
                if ($moduleOptionsManager->hasModuleNameByClassName($currentInterface)) {
                    $moduleNameByInterface = $moduleOptionsManager->getModuleNameByClassName($currentInterface);
                    if (array_key_exists($moduleNameByInterface, $allowedModules)) {
                        $listEntityInterfaces[$currentInterface] = $currentInterface;
                    }
                }
            }
        }

        return $listEntityInterfaces;
    }