Checks whether an entity with given metadata contains a collection field

@param m
@return
336825
public static boolean containsBasicElementCollectionField(final EntityMetadata m,
            final KunderaMetadata kunderaMetadata)
    {
        Metamodel metaModel = kunderaMetadata.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());
        EntityType entityType = metaModel.entity(m.getEntityClazz());
        Iterator<Attribute> iter = entityType.getAttributes().iterator();
        while (iter.hasNext())
        {
            Attribute attr = iter.next();

            if (attr.isCollection() && !attr.isAssociation()
                    && isBasicElementCollectionField((Field) attr.getJavaMember()))
            {
                return true;
            }
        }
        return false;
    }
1117382
@Override
    protected List<Object> populateEntities(EntityMetadata m, Client client)
    {

        ClientMetadata clientMetadata = ((ClientBase) client).getClientMetadata();

        if (!MetadataUtils.useSecondryIndex(clientMetadata) && (clientMetadata.getIndexImplementor() != null))
        {
            return populateUsingLucene(m, client, null, kunderaQuery.getResult());
        }
        else
        {
            List results = onQuery(m, client);
            return results;
        }
    }
362712
public boolean contains(final MediaType type) {
        boolean contains = false;
        for (final MediaType mine : this.list) {
            if (mine.matches(type)) {
                contains = true;
                break;
            }
        }
        return contains;
    }
352755
public boolean hasMembersToDocument() {
        if (classDoc instanceof AnnotationTypeDoc) {
            return ((AnnotationTypeDoc) classDoc).elements().length > 0;
        }
        for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
            VisibleMemberMap members = visibleMemberMaps[i];
            if (!members.noVisibleMembers()) {
                return true;
            }
        }
        return false;
    }
1119720
@Override
    protected List findUsingLucene(EntityMetadata m, Client client)
    {
        try
        {
            BasicDBObject orderByClause = getOrderByClause(m);
            // find on id, so no need to add skip() [firstResult hardcoded 0]
            return ((MongoDBClient) client).loadData(m, createMongoQuery(m, getKunderaQuery().getFilterClauseQueue()),
                    null, orderByClause, isSingleResult ? 1 : maxResult, 0, isCountQuery(),
                    getKeys(m, getKunderaQuery().getResult()), getKunderaQuery().getResult());
        }
        catch (Exception e)
        {
            log.error("Error during executing query, Caused by:", e);
            throw new QueryHandlerException(e);
        }

    }
881638
private boolean isEntity(Object o){
        Class<? extends Object> varClass = o.getClass();
        return managedClasses.contains( varClass.getCanonicalName() );
    }
283875
public static Map<String, String> toMap(List<EntityMetadata> metadata) {
		
		Map<String, String> map = new LinkedHashMap<String, String>();
		
		if(CollectionUtils.isNotEmpty(metadata)) {
			
			for(EntityMetadata m : metadata) {
				
				map.put(m.getName(), m.getValue());
				
			}
		
		}
		
		return map;
		
	}
374809
@Override
  public <T> boolean isCollectionReadonly(Class<T> entityClass) {
    return isCollectionReadonly(Util.determineCollectionName(entityClass));
  }
532547
public function validateMetadataInheritance(EntityMetadata $metadata, MetadataFactory $mf)
    {
        if (true === $metadata->isPolymorphic()) {
            foreach ($metadata->ownedTypes as $child) {

                if (false === $this->isEntityTypeValid($child)) {
                    throw MetadataException::invalidMetadata($metadata->type, sprintf('The owned entity type "%s" is invalid based on the configured name format "%s"', $child, $this->config->getEntityFormat()));
                }

                if (false === $mf->metadataExists($child)) {
                    throw MetadataException::invalidMetadata($metadata->type, sprintf('The entity owns a type "%s" that does not exist.', $child));
                }
            }
        }

        if (false === $metadata->isPolymorphic() && true === $metadata->isAbstract()) {
            throw MetadataException::invalidMetadata($metadata->type, 'An entity must be polymorphic to be abstract.');
        }

        if (false === $metadata->isChildEntity()) {
            return true;
        }
        if (true === $metadata->isPolymorphic()) {
            throw MetadataException::invalidMetadata($metadata->type, 'An entity cannot both be polymorphic and be a child.');
        }
        if ($metadata->extends === $metadata->type) {
            throw MetadataException::invalidMetadata($metadata->type, 'An entity cannot extend itself.');
        }

        if (false === $mf->metadataExists($metadata->extends)) {
            throw MetadataException::invalidMetadata($metadata->type, sprintf('The parent entity type "%s" does not exist.', $metadata->extends));
        }

        $parent = $mf->getMetadataForType($metadata->extends);
        if (false === $parent->isPolymorphic()) {
            throw MetadataException::invalidMetadata($metadata->type, sprintf('Parent classes must be polymorphic. Parent entity "%s" is not polymorphic.', $metadata->extends));
        }
        return true;
    }
1157048
function checkEntityTypes(em, entityTypes) {
    assertParam(entityTypes, "entityTypes").isString().isOptional().or().isNonEmptyArray().isString()
        .or().isInstanceOf(EntityType).or().isNonEmptyArray().isInstanceOf(EntityType).check();
    if (typeof entityTypes === "string") {
      entityTypes = em.metadataStore._getEntityType(entityTypes, false);
    } else if (Array.isArray(entityTypes) && typeof entityTypes[0] === "string") {
      entityTypes = entityTypes.map(function (etName) {
        return em.metadataStore._getEntityType(etName, false);
      });
    }
    return entityTypes;
  }
1132788
public static boolean isCollection(EntityDataModel entityDataModel, String typeName) {
        EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(typeName);
        if (entitySet != null) {
            return true;
        }
        try {
            if (Collection.class.isAssignableFrom(Class.forName(typeName))
                    || COLLECTION_PATTERN.matcher(typeName).matches()) {
                return true;
            }
        } catch (ClassNotFoundException e) {
            LOG.debug("Not possible to find class for type name: {}", typeName);
        }

        return false;
    }
785772
public boolean isCollection(Object obj, Field field) {
        try {
            Object val = field.get(obj);
            boolean isCollResource = false;
            if (val != null) {
                isCollResource = CollectionResource.class.equals(val.getClass());
            }
            return (!isCollResource && !field.getType().equals(CollectionResource.class))
                    && (Collection.class.equals(field.getType()) || ArrayUtils.contains(field.getType().getInterfaces(),
                    Collection.class));
        } catch (Exception e) {
            throw new Siren4JRuntimeException(e);
        }
    }
335281
private void onQuery(EntityMetadata m, Client client)
    {

        try
        {
            // Called only in case of standalone entity.
            FilterList filter = null;
            if (translator.getFilter() != null)
            {
                filter = new FilterList(translator.getFilter());
            }
            String[] columnAsArr = getColumnsAsArray();

            if (isFindKeyOnly(m, columnAsArr))
            {
                this.handler.setFilter(new KeyOnlyFilter());
            }

            if (filter == null && columns != null)
            {
                handler.readDataByRange(m.getSchema(), m.getEntityClazz(), m, translator.getStartRow(),
                        translator.getEndRow(), columnAsArr, null);
            }
            if (MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata()))
            {
                if (filter == null)
                {
                    // means complete scan without where clause, scan all
                    // records.
                    // findAll.
                    if (translator.isRangeScan())
                    {
                        handler.readDataByRange(m.getSchema(), m.getEntityClazz(), m, translator.getStartRow(),
                                translator.getEndRow(), columnAsArr, null);
                    }
                    else
                    {
                        handler.readDataByRange(m.getSchema(), m.getEntityClazz(), m, null, null, columnAsArr, null);
                    }
                }
                else
                {
                    // means WHERE clause is present.
                    if (translator.isRangeScan())
                    {
                        handler.readDataByRange(m.getSchema(), m.getEntityClazz(), m, translator.getStartRow(),
                                translator.getEndRow(), columnAsArr, filter);
                    }
                    else
                    {
                        // if range query. means query over id column. create
                        // range
                        // scan method.

                        handler.readData(m.getSchema(), entityMetadata.getEntityClazz(), entityMetadata, null,
                                m.getRelationNames(), filter, columnAsArr);
                    }
                }
            }
        }
        catch (IOException ioex)
        {
            log.error("Error while executing query{} , Caused by:", ioex);
            throw new QueryHandlerException("Error while executing , Caused by:", ioex);
        }
    }
34478
protected boolean isCappedCollection(TableInfo tableInfo)
    {
        return MongoDBPropertyReader.msmd != null ? MongoDBPropertyReader.msmd.isCappedCollection(databaseName,
                tableInfo.getTableName()) : false;
    }
968386
@Override
    public EnhanceEntity findById(Object primaryKey, EntityMetadata m, Client client)
    {
        return super.findById(primaryKey, m, client);
    }
146913
@Override
    public boolean hasMembersToDocument() {
        if (utils.isAnnotationType(typeElement)) {
            return !utils.getAnnotationMethods(typeElement).isEmpty();
        }
        for (VisibleMemberMap.Kind kind : VisibleMemberMap.Kind.values()) {
            VisibleMemberMap members = getVisibleMemberMap(kind);
            if (!members.noVisibleMembers()) {
                return true;
            }
        }
        return false;
    }
103720
def has_field(mc, field_name):
    
    try:
        mc._meta.get_field(field_name)
    except FieldDoesNotExist:
        return False
    return True