Prepare node data to send to the remote controller

        :param properties: If properties is None use actual property otherwise use the parameter
540301
def _node_data(self, properties=None):
        
        if properties:
            data = copy.copy(properties)
        else:
            data = copy.copy(self._properties)
            # We replace the startup script name by the content of the file
            mapping = {
                "base_script_file": "startup_script",
                "startup_config": "startup_config_content",
                "private_config": "private_config_content",
            }
            for k, v in mapping.items():
                if k in list(self._properties.keys()):
                    data[v] = self._base_config_file_content(self._properties[k])
                    del data[k]
                    del self._properties[k]  # We send the file only one time
        data["name"] = self._name
        if self._console:
            # console is optional for builtin nodes
            data["console"] = self._console
        if self._console_type:
            data["console_type"] = self._console_type

        # None properties are not be send. Because it can mean the emulator doesn't support it
        for key in list(data.keys()):
            if data[key] is None or data[key] is {} or key in self.CONTROLLER_ONLY_PROPERTIES:
                del data[key]
        return data
1290102
def make_remote_view(data, settings, more_excluded_names=None):
    
    data = get_remote_data(data, settings, mode='editable',
                           more_excluded_names=more_excluded_names)
    remote = {}
    for key, value in list(data.items()):
        view = value_to_display(value, minmax=settings['minmax'])
        remote[key] = {'type':  get_human_readable_type(value),
                       'size':  get_size(value),
                       'color': get_color_name(value),
                       'view':  view}
    return remote
1177036
@Override
	public Object convert(Object source) {

		NodeInterface relatedNode = getRelatedNode(true);
		if (relatedNode != null) {

			try {
				
				relatedNode.setProperty(targetKey, source);
				
			} catch (FrameworkException fex) {

				logger.warn("Unable to set remote node property {}", targetKey);
			}
		}
		
		return null;
	}
508326
def update_property_node(node_to_insert, field_uri):
  
  root = T.SetItemField(
            T.FieldURI(FieldURI=field_uri),
            T.CalendarItem(node_to_insert)
        )
  return root
687370
private static void processProperty(final ClassNode cNode, PropertyNode node) {
        String name = node.getName();
        FieldNode field = node.getField();
        int propNodeModifiers = node.getModifiers();

        String getterName = "get" + Verifier.capitalize(name);
        String setterName = "set" + Verifier.capitalize(name);

        // GROOVY-3726: clear volatile, transient modifiers so that they don't get applied to methods
        if ((propNodeModifiers & Modifier.VOLATILE) != 0) {
            propNodeModifiers = propNodeModifiers - Modifier.VOLATILE;
        }
        if ((propNodeModifiers & Modifier.TRANSIENT) != 0) {
            propNodeModifiers = propNodeModifiers - Modifier.TRANSIENT;
        }

        Statement getterBlock = node.getGetterBlock();
        if (getterBlock == null) {
            MethodNode getter = cNode.getGetterMethod(getterName);
            if (getter == null && ClassHelper.boolean_TYPE == node.getType()) {
                String secondGetterName = "is" + Verifier.capitalize(name);
                getter = cNode.getGetterMethod(secondGetterName);
            }
            if (!node.isPrivate() && methodNeedsReplacement(cNode, getter)) {
                getterBlock = new ExpressionStatement(new FieldExpression(field));
            }
        }
        Statement setterBlock = node.getSetterBlock();
        if (setterBlock == null) {
            // 2nd arg false below: though not usual, allow setter with non-void return type
            MethodNode setter = cNode.getSetterMethod(setterName, false);
            if (!node.isPrivate() &&
                    (propNodeModifiers & ACC_FINAL) == 0 &&
                    methodNeedsReplacement(cNode, setter)) {
                setterBlock = new ExpressionStatement(
                        new BinaryExpression(
                                new FieldExpression(field),
                                Token.newSymbol(Types.EQUAL, 0, 0),
                                new VariableExpression("value")
                        )
                );
            }
        }

        if (getterBlock != null) {
            MethodNode getter =
                    new MethodNode(getterName, propNodeModifiers, node.getType(), Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, getterBlock);
            getter.setSynthetic(true);
            cNode.addMethod(getter);

            if (ClassHelper.boolean_TYPE == node.getType() || ClassHelper.Boolean_TYPE == node.getType()) {
                String secondGetterName = "is" + Verifier.capitalize(name);
                MethodNode secondGetter =
                        new MethodNode(secondGetterName, propNodeModifiers, node.getType(), Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, getterBlock);
                secondGetter.setSynthetic(true);
                cNode.addMethod(secondGetter);
            }
        }
        if (setterBlock != null) {
            Parameter[] setterParameterTypes = {new Parameter(node.getType(), "value")};
            VariableExpression var = (VariableExpression) ((BinaryExpression) ((ExpressionStatement) setterBlock).getExpression()).getRightExpression();
            var.setAccessedVariable(setterParameterTypes[0]);
            MethodNode setter =
                    new MethodNode(setterName, propNodeModifiers, ClassHelper.VOID_TYPE, setterParameterTypes, ClassNode.EMPTY_ARRAY, setterBlock);
            setter.setSynthetic(true);
            cNode.addMethod(setter);
        }
    }
944905
def setup_controller_params(controller, env, vars)
      if Fastr::HTTP.method?(env, :get)
        controller.get_params = Fastr::HTTP.parse_query_string(env['QUERY_STRING'])
        controller.params = controller.get_params.merge(vars)
      elsif Fastr::HTTP.method?(env, :post)
        controller.post_params = {}
        controller.post_params = Fastr::HTTP.parse_query_string(env['rack.input'].read) if env['rack.input']
        controller.params = controller.post_params.merge(vars)
      else
        controller.params = vars
      end
    end
652656
def _set_properties(self, api_response):
        
        self._properties.clear()
        cleaned = api_response.copy()
        self.dns_name = cleaned.pop("dnsName", None)
        if "creationTime" in cleaned:
            cleaned["creationTime"] = _rfc3339_to_datetime(cleaned["creationTime"])
        self._properties.update(cleaned)
411674
final private function prepareData($properties) {
	
		// trigger before preparing data
		$this->beforePrepareData();
		
		// properly cast a property of this object and return it
		$cast = function($prop) {
			
			$field = static::getMappedField($prop);

			switch ($this->getPropertyType($prop)) {
				
				// integer or bool will cast to integer
				case 'int':
				case 'bool':
					if (is_null($this->$prop) and static::isNullable($field)) {
						$ret = NULL;
					} else {
						$ret = (int)$this->$prop;
					}
					break;
				
				// should be DateTime, maybe null
				case 'DateTime':
					if (is_a($this->$prop, 'DateTime')) {
						$dt = clone($this->$prop);
						$dt->setTimezone(new \DateTimeZone(BASE_TIMEZONE));
						$ret = $dt->format('Y-m-d H:i:s');
					} else if (static::isNullable($field)) {
						$ret = NULL;
					} else {
						$field = static::getColumnType($field);
						$ret = 'date' == $field->type ? '0000-00-00' :'0000-00-00 00:00:00';
					}
					break;
						
				// join array strings in CSV format 
				case 'csv':
					$ret = implode(',', array_filter((array)$this->$prop));
					break;
					
				case 'float':
					if (is_null($this->$prop) and static::isNullable($field)) {
						$ret = NULL;
					} else {
						$curr = setlocale(LC_NUMERIC, 0);
						setlocale(LC_NUMERIC, 'en_US');
						$ret = (string)$this->$prop;
						setlocale(LC_NUMERIC, $curr);
					}
					break;

				// assign with no convertion
				default:
					if ((is_null($this->$prop) or (''==$this->$prop and !static::isEmptiable($field)))
							and static::isNullable($field)) {
						$ret = NULL;
					} else {
						$ret = $this->$prop;
					}
					break;
					
			}
			
			return $ret;
			
		};
		
		// force to array
		$properties	= (array)$properties;

		$class = get_called_class();
		$binds = $class::getBinds();
		
		// create the return object
		$dbObj = new \stdClass();
		
		foreach ($properties as $prop) {
			if (array_key_exists($prop, $binds)) {
				$dbObj->{$binds[$prop]} = $cast($prop);
			}
		}
		
		// trigger after prepared data
		$this->afterPrepareData($dbObj);
			
		return $dbObj;
	
	}
110469
def _set_properties(self, api_response):
        
        job_id_present = (
            "jobReference" in api_response
            and "jobId" in api_response["jobReference"]
            and "projectId" in api_response["jobReference"]
        )
        if not job_id_present:
            raise ValueError("QueryResult requires a job reference")

        self._properties.clear()
        self._properties.update(copy.deepcopy(api_response))
842576
private void setupRequestProperties(HttpURLConnection connection, Map<String, Object> properties) {
		Set<Entry<String, Object>> entries = properties.entrySet();
		for (Entry<String, Object> e : entries) {
			String name = e.getKey();
			Object value = e.getValue();

			if (name != null && value != null) {
				connection.setRequestProperty(name, value.toString());
			}
		}
	}
695521
function serverProperties(item, model, props) {
    var result = {};
    var toRefresh = [];

    _.forEach(props || item, function(val, key) {
        if (val == null) return;
        if (val._isModelItem) {
            result[key] = val.id;
            toRefresh.push(val);
        } else if (_.isArray(val)) {
            result[key] = _.map(val, function(item) {
                if (item._isModelItem) {
                    toRefresh.push(item);
                    return item.id;
                }
                return item;
            });
        } else if (_.has(model.itemDef, key)) {
            if (_.has(model.itemDef[key], '__connection')) result[key] = val;
        } else result[key] = val;
    });

    return {
        properties: result,
        refresh: toRefresh
    };
}
223050
def record_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)
577249
def render_properties!(xml)
    self.class.properties.each do |property, options|
      next unless instance_variable_get("@_set_#{property}")
      property_value = self.send(property)
      render_property!(property, property_value, xml, options)
    end
  end
733709
private String setProperty(Node node, HierarchicalProperty property)
   {

      String propertyName = WebDavNamespaceContext.createName(property.getName());

      if (READ_ONLY_PROPS.contains(property.getName()))
      {
         return WebDavConst.getStatusDescription(HTTPStatus.CONFLICT);
      }

      try
      {

         Workspace ws = node.getSession().getWorkspace();
         NodeTypeDataManager nodeTypeHolder = ((WorkspaceImpl)ws).getNodeTypesHolder();
         NodeData data = (NodeData)((NodeImpl)node).getData();
         InternalQName propName =
            ((SessionImpl)node.getSession()).getLocationFactory().parseJCRName(propertyName).getInternalName();
         PropertyDefinitionDatas propdefs =
            nodeTypeHolder.getPropertyDefinitions(propName, data.getPrimaryTypeName(), data.getMixinTypeNames());
         if (propdefs == null)
         {
            throw new RepositoryException();
         }

         PropertyDefinitionData propertyDefinitionData = propdefs.getAnyDefinition();
         if (propertyDefinitionData == null)
         {
            throw new RepositoryException();
         }

         boolean isMultiValued = propertyDefinitionData.isMultiple();

         if (node.isNodeType(WebDavConst.NodeTypes.MIX_VERSIONABLE) && !node.isCheckedOut())
         {
            node.checkout();
            node.save();
         }

         if (!isMultiValued)
         {
            node.setProperty(propertyName, property.getValue());
         }
         else
         {
            String[] value = new String[1];
            value[0] = property.getValue();
            node.setProperty(propertyName, value);
         }

         node.save();
         return WebDavConst.getStatusDescription(HTTPStatus.OK);

      }
      catch (AccessDeniedException e)
      {
         return WebDavConst.getStatusDescription(HTTPStatus.FORBIDDEN);
      }
      catch (ItemNotFoundException e)
      {
         return WebDavConst.getStatusDescription(HTTPStatus.NOT_FOUND);
      }
      catch (PathNotFoundException e)
      {
         return WebDavConst.getStatusDescription(HTTPStatus.NOT_FOUND);
      }
      catch (RepositoryException e)
      {
         return WebDavConst.getStatusDescription(HTTPStatus.CONFLICT);

      }

   }
1171600
function Property( field, value, params ) {

  if( !(this instanceof Property) )
    return new Property( value )

  if( params != null )
    Object.assign( this, params )

  this._field = field
  this._data = value

  Object.defineProperty( this, '_field', { enumerable: false })
  Object.defineProperty( this, '_data', { enumerable: false })

}
431819
private void populateNodeProperties(Object entity, EntityMetadata m, Node node)
    {
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());
        EntityType entityType = metaModel.entity(m.getEntityClazz());

        // Iterate over entity attributes
        Set<Attribute> attributes = entityType.getSingularAttributes();
        for (Attribute attribute : attributes)
        {
            Field field = (Field) attribute.getJavaMember();

            // Set Node level properties
            if (!attribute.isCollection() && !attribute.isAssociation() && !((SingularAttribute) attribute).isId())
            {
                String columnName = ((AbstractAttribute) attribute).getJPAColumnName();
                Object value = PropertyAccessorHelper.getObject(entity, field);
                if (value != null)
                {
                    node.setProperty(columnName, toNeo4JProperty(value));
                }
            }
        }
    }
1205371
def connect(self, node, properties=None):
        
        self._check_node(node)

        if not self.definition['model'] and properties:
            raise NotImplementedError(
                "Relationship properties without using a relationship model "
                "is no longer supported."
            )

        params = {}
        rel_model = self.definition['model']
        rp = None  # rel_properties

        if rel_model:
            rp = {}
            # need to generate defaults etc to create fake instance
            tmp = rel_model(**properties) if properties else rel_model()
            # build params and place holders to pass to rel_helper
            for p, v in rel_model.deflate(tmp.__properties__).items():
                rp[p] = '{' + p + '}'
                params[p] = v

            if hasattr(tmp, 'pre_save'):
                tmp.pre_save()

        new_rel = _rel_helper(lhs='us', rhs='them', ident='r', relation_properties=rp, **self.definition)
        q = "MATCH (them), (us) WHERE id(them)={them} and id(us)={self} " \
            "CREATE UNIQUE" + new_rel

        params['them'] = node.id

        if not rel_model:
            self.source.cypher(q, params)
            return True

        rel_ = self.source.cypher(q + " RETURN r", params)[0][0][0]
        rel_instance = self._set_start_end_cls(rel_model.inflate(rel_), node)

        if hasattr(rel_instance, 'post_save'):
            rel_instance.post_save()

        return rel_instance