Add properties to select.

TODO: Skip some properties in listings.
179564
protected function queryAddPropertiesSelect(\Smalldb\Flupdo\FlupdoBuilder $query)
	{
		$table = $this->table_alias ? $this->table_alias : $this->table;
		$table_q = $query->quoteIdent($this->table_alias ? $this->table_alias : $this->table);

		// Add properties (some may be calculated)
		foreach ($this->properties as $pi => $p) {
			if ($pi == 'state') {
				// State is not accepted as property and 'state' is reserved name.
				continue;
			}
			$this->queryAddPropertySelect($query, $table, $pi, $p);
		}

		// Import foreign properties using references
		if (!empty($this->references)) {
			foreach ($this->references as $r => $ref) {
				$ref_machine = $this->smalldb->getMachine($ref['machine_type']);
				if (!$ref_machine) {
					throw new \InvalidArgumentException(sprintf('Unknown machine type "%s" for reference "%s".', $ref['machine_type'], $r));
				}

				// Generate reference join
				$ref_alias = 'ref_'.$r;
				$ref_alias_q = $query->quoteIdent($ref_alias);
				$ref_table = $ref_machine->table;
				$ref_table_q = $query->quoteIdent($ref_table);

				$ref_that_id = $ref_machine->describeId();
				$ref_this_id = $ref['machine_id'];

				$id_len = count($ref_that_id);
				if ($id_len != count($ref_this_id)) {
					throw new \InvalidArgumentException('Reference ID has incorrect length ('.$r.').');
				}

				if (isset($ref['query'])) {
					// TODO: Refactor query building syntax to be used everywhere; see $filters in FlupdoGenericListing
					foreach ($ref['query'] as $f) {
						$args = array($f['sql']);
						if (isset($f['params'])) {
							foreach ($f['params'] as $p) {
								$args[] = $query_filters[$p];
							}
						}
						call_user_func_array(array($this->query, $f['stmt']), $args);
					}
				} else {
					// Join refered table
					$on = array();
					for ($i = 0; $i < $id_len; $i++) {
						$on[] = "$table_q.${ref_this_id[$i]} = $ref_alias_q.${ref_that_id[$i]}";
					}
					$query->leftJoin("$ref_table_q AS $ref_alias_q ON ".join(' AND ', $on));
				}

				// Import referred properties
				foreach ($ref_machine->properties as $p => $ref_p) {
					if (!empty($ref_p['is_referred'])) {
						$this->queryAddPropertySelect($query, $ref_alias, $p, $ref_p, $r.'_');
					}
				}

				// Import explicitly referred properties
				if (!empty($ref['properties'])) {
					foreach ($ref['properties'] as $p => $ref_p) {
						$this->queryAddPropertySelect($query, $ref_alias, $p, $ref_p, $r.'_');
					}
				}
			}
		}

		// Add access policy columns
		if (!empty($this->access_policies)) {
			//debug_dump($this->access_policies);
			foreach ($this->access_policies as $policy_name => $policy) {
				switch ($policy['type']) {
					case 'condition':
						$this->queryAddSimpleAccessPolicyCondition($policy_name, $policy, $query, 'select');
						break;
					case 'user_relation':
						$this->queryAddUserRelationAccessPolicyCondition($policy_name, $policy, $query, 'select');
						break;
				}
			}
		}

		//debug_dump("\n".$query->getSqlQuery(), 'Query', true);
	}
911053
public boolean addProperty(String propertyName, String property) {
        boolean ret = this.properties.containsKey(propertyName);
        this.properties.put(propertyName, property);
        return ret;
    }
517508
def _AddPropertiesForFields(descriptor, cls):
  """"""
  for field in descriptor.fields:
    _AddPropertiesForField(field, cls)

  if descriptor.is_extendable:
    # _ExtensionDict is just an adaptor with no state so we allocate a new one
    # every time it is accessed.
    cls.Extensions = property(lambda self: _ExtensionDict(self))
159611
public function addSelfSelectColumns()
    {
        call_user_func(array($this->modelPeerName, 'addSelectColumns'), $this, $this->useAliasInSQL ? $this->modelAlias : null);

        return $this;
    }
822229
function add(changeList, property, index, values) {
        changeList.push({
            type:'add',
            path: property,
            index: index,
            vals: values
        })
    }
357092
private void addProperties(BaseProfileDescriptor pomDescriptor, Properties properties, Store store) {
        Set<Entry<Object, Object>> entrySet = properties.entrySet();
        for (Entry<Object, Object> entry : entrySet) {
            PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
            propertyDescriptor.setName(entry.getKey().toString());
            propertyDescriptor.setValue(entry.getValue().toString());
            pomDescriptor.getProperties().add(propertyDescriptor);
        }

    }
355460
def add(name, options)
      @properties[name.to_sym] = Property.new(name.to_sym, options[:type], options[:default])
    end
352417
public void putProperties(Map<String, String> properties) {
		for (Map.Entry<String, String> property : properties.entrySet()) {
			put(property.getKey(), property.getValue());
		}
	}
1099030
protected function _addDefaultSelectTypes()
    {
        $typeMap = $this->getTypeMap()->getDefaults();
        $select = $this->clause('select');
        $types = [];

        foreach ($select as $alias => $value) {
            if (isset($typeMap[$alias])) {
                $types[$alias] = $typeMap[$alias];
                continue;
            }
            if (is_string($value) && isset($typeMap[$value])) {
                $types[$alias] = $typeMap[$value];
            }
            if ($value instanceof TypedResultInterface) {
                $types[$alias] = $value->getReturnType();
            }
        }
        $this->getSelectTypeMap()->addDefaults($types);
    }
1082687
private function addAjaxPropertyForEditAll()
    {
        $inputProvider = $this->getEnvironment()->getInputProvider();

        if (('select' !== $inputProvider->getParameter('act'))
            && ('edit' !== $inputProvider->getParameter('select'))
            && ('edit' !== $inputProvider->getParameter('mode'))
        ) {
            return;
        }

        $originalProperty = $this->findOriginalPropertyByModelId($inputProvider->getValue('name'));
        if (null === $originalProperty) {
            return;
        }

        $propertiesDefinition = $this->getEnvironment()->getDataDefinition()->getPropertiesDefinition();

        $propertyClass = \get_class($originalProperty);

        $property = new $propertyClass($inputProvider->getValue('name'));
        $property->setLabel($originalProperty->getLabel());
        $property->setDescription($originalProperty->getDescription());
        $property->setDefaultValue($originalProperty->getDefaultValue());
        $property->setExcluded($originalProperty->isExcluded());
        $property->setSearchable($originalProperty->isSearchable());
        $property->setFilterable($originalProperty->isFilterable());
        $property->setWidgetType($originalProperty->getWidgetType());
        $property->setExplanation($originalProperty->getExplanation());
        $property->setExtra($originalProperty->getExtra());

        $propertiesDefinition->addProperty($property);
    }
908237
public void loadChoices(String propertyName) {
        if (propertyName == null || propertyName.isEmpty()) {
            loadChoices(DEFAULT_CHOICES);
        } else {
            loadChoices(PropertyUtil.getValues(propertyName, null));
        }
    }
594774
def _add_additional_properties(position, properties_dict):
        
        add_prop = etree.SubElement(position, 'AdditionalProperties')
        for key, value in properties_dict.items():
            etree.SubElement(add_prop, 'Property', attrib={'name': key, 'value': value})
775917
private void addLoadPropertyIds(Object[] properties, int count) {
        addNewObjectArray(count);
        for (int i = 0; i != count; ++i) {
            cfw.add(ByteCode.DUP);
            cfw.addPush(i);
            Object id = properties[i];
            if (id instanceof String) {
                cfw.addPush((String)id);
            } else {
                cfw.addPush(((Integer)id).intValue());
                addScriptRuntimeInvoke("wrapInt", "(I)Ljava/lang/Integer;");
            }
            cfw.add(ByteCode.AASTORE);
        }
    }
405242
public EntityBuilder addProperties(Map<String, Object> properties) {
    	if(MapUtils.isEmpty(properties)) {
    		throw new IllegalArgumentException("properties cannot be null or empty.");
    	}
        for (String key : properties.keySet()) {
            addProperty(key, properties.get(key));
        }
        return this;
    }
511354
def add_properties_callbacks(cls):
    """"""
    for name in cls._mutators:                                                 #pylint: disable=protected-access
        if not hasattr(cls, name):
            continue
        setattr(cls, name, properties_mutator(cls, name))
    for name in cls._operators:                                                #pylint: disable=protected-access
        if not hasattr(cls, name):
            continue
        setattr(cls, name, properties_operator(cls, name))
    for name in cls._ioperators:                                               #pylint: disable=protected-access
        if not hasattr(cls, name):
            continue
        setattr(cls, name, properties_mutator(cls, name, True))
    return cls
572939
function addCustomFeatureProperties(entity) {
  for (var i = 0; i < customProperties.length; i++) {
    if (entity.propertyNames.indexOf(customProperties[i]) === -1) {
      entity.addProperty(customProperties[i]);
    }
  }
}
435880
public static void addPropertiesToSpec(ModuleSpec.Builder moduleSpecBuilder, Map<String, String> properties) {
        for (Entry<String, String> entry : properties.entrySet()) {
            moduleSpecBuilder.addProperty(entry.getKey(), entry.getValue());
        }
    }