Recalculate dynamic property values
@param {any} entity Entity instance
@param {any} properties Entity's properties' configuration
@memberof EnTTExt
863
function recalculateAllDynamicProperties(entity, properties) {
  // Find all dynamic properties
  _lodash2.default.forEach(properties, function (propertyConfiguration, propertyName) {
    if (isDynamicProperty(propertyConfiguration)) {
      // Recalculate dynamic property value
      var dynamicValue = propertyConfiguration.dynamic(entity);
      // Set updated dynamic value (wrap into EnTTBypassEverythingValue to bypass read-only restriction)
      entity[propertyName] = new _properties.EnTTBypassEverythingValue(dynamicValue);
    }
  });
}
572939
function addCustomFeatureProperties(entity) {
  for (var i = 0; i < customProperties.length; i++) {
    if (entity.propertyNames.indexOf(customProperties[i]) === -1) {
      entity.addProperty(customProperties[i]);
    }
  }
}
629303
function(property, value, fields) {
            fields = fields || [];

            var setters = this.__getSetters(property, true);

            for (var i = 0, ii = setters.length; i < ii; ++i) {

                var result = setters[i].call(this, value, fields);

                if (!_.isUndefined(result)) {
                    value = result;
                }
            }

            return value;
        }
1336418
function getEntityExtensions(entity) {
      // Check if entity passed as instance or class
      if (entity instanceof _entt2.default) {
        // Return property configuration from instance
        return _cache.ConfigurationCache.get(entity).extensions;
      } else if (_lodash2.default.isFunction(entity) && entity.prototype instanceof _entt2.default) {
        // Return property configuration from class
        return _cache.ConfigurationCache.get(new entity()).extensions;
      }
    }
909994
function(properties){

        /**
         * Create a new instance for the model
         * @class Model
         * @augments BaseModel
         * @param {object} instance_values Key/value object containing values of the row  *
         * @classdesc Generic model. Use it statically to find documents on Cassandra. Any instance represent a row retrieved or which can be saved on DB
         */
        var Model = function(instance_values){
           BaseModel.apply(this,Array.prototype.slice.call(arguments));
        };

        util.inherits(Model,BaseModel);

        for(var i in BaseModel){
            if(BaseModel.hasOwnProperty(i)){
               Model[i] = BaseModel[i];
            }
        }

        Model._set_properties(properties);

        return Model;
    }
875030
private void changeEntityValue(String value, int valueIndex) {

        if (getEntityType().isChoice()) {
            CmsEntity choice = m_entity.getAttribute(CmsType.CHOICE_ATTRIBUTE_NAME).getComplexValues().get(valueIndex);
            String attributeName = getChoiceName(valueIndex);
            if (attributeName != null) {
                choice.setAttributeValue(attributeName, value, 0);
            }
        } else {
            m_entity.setAttributeValue(m_attributeName, value, valueIndex);
        }
    }
1160114
private void processGeneratedProperties(
			Serializable id,
			Object entity,
			Object[] state,
			SharedSessionContractImplementor session,
			GenerationTiming matchTiming) {

		Tuple tuple = getFreshTuple( EntityKeyBuilder.fromPersister( this, id, session ), session );
		saveSharedTuple( entity, tuple, session );

		if ( tuple == null || tuple.getSnapshot().isEmpty() ) {
			throw log.couldNotRetrieveEntityForRetrievalOfGeneratedProperties( getEntityName(), id );
		}

		int propertyIndex = -1;
		for ( NonIdentifierAttribute attribute : getEntityMetamodel().getProperties() ) {
			propertyIndex++;
			final ValueGeneration valueGeneration = attribute.getValueGenerationStrategy();
			if ( isReadRequired( valueGeneration, matchTiming ) ) {
				Object hydratedState = gridPropertyTypes[propertyIndex].hydrate( tuple, getPropertyAliases( "", propertyIndex ), session, entity );
				state[propertyIndex] = gridPropertyTypes[propertyIndex].resolve( hydratedState, session, entity );
				setPropertyValue( entity, propertyIndex, state[propertyIndex] );
			}
		}
	}
1192496
protected function setEntityData($entity, $property)
    {
        if (is_array($entity) && count($entity) == 2) {
            TypeChecker::isString($entity[0]);
            TypeChecker::isNumeric($entity[1]);

            $type = $entity[0];
            $id = $entity[1];
        } elseif ($entity[0] instanceof Model) {
            $type = $entity[0]->getMorphClass();
            $id = $entity[0]->getKey();
        } else {
            TypeChecker::isNumeric($entity[0]);

            $type = notifynder_config()->getNotifiedModel();
            $id = $entity[0];
        }

        $this->setNotificationData("{$property}_type", $type);
        $this->setNotificationData("{$property}_id", $id);
    }
893674
public static void fill(Object entity) {
        final Class<?> entityClass = entity.getClass();

        if (N.isEntity(entityClass) == false) {
            throw new IllegalArgumentException(entityClass.getCanonicalName() + " is not a valid entity class with property getter/setter method");
        }

        Type<Object> type = null;
        Class<?> parameterClass = null;
        Object propValue = null;

        for (Method method : ClassUtil.getPropSetMethodList(entityClass).values()) {
            parameterClass = method.getParameterTypes()[0];
            type = N.typeOf(parameterClass);

            if (String.class.equals(parameterClass)) {
                propValue = N.uuid().substring(0, 16);
            } else if (boolean.class.equals(parameterClass) || Boolean.class.equals(parameterClass)) {
                propValue = RAND.nextInt() % 2 == 0 ? false : true;
            } else if (char.class.equals(parameterClass) || Character.class.equals(parameterClass)) {
                propValue = (char) ('a' + RAND.nextInt() % 26);
            } else if (int.class.equals(parameterClass) || Integer.class.equals(parameterClass)) {
                propValue = RAND.nextInt();
            } else if (long.class.equals(parameterClass) || Long.class.equals(parameterClass)) {
                propValue = RAND.nextLong();
            } else if (float.class.equals(parameterClass) || Float.class.equals(parameterClass)) {
                propValue = RAND.nextFloat();
            } else if (double.class.equals(parameterClass) || Double.class.equals(parameterClass)) {
                propValue = RAND.nextDouble();
            } else if (byte.class.equals(parameterClass) || Byte.class.equals(parameterClass)) {
                propValue = Integer.valueOf(RAND.nextInt()).byteValue();
            } else if (short.class.equals(parameterClass) || Short.class.equals(parameterClass)) {
                propValue = Integer.valueOf(RAND.nextInt()).shortValue();
            } else if (Number.class.isAssignableFrom(parameterClass)) {
                propValue = type.valueOf(String.valueOf(RAND.nextInt()));
            } else if (java.util.Date.class.isAssignableFrom(parameterClass) || Calendar.class.isAssignableFrom(parameterClass)) {
                propValue = type.valueOf(String.valueOf(System.currentTimeMillis()));
            } else if (N.isEntity(parameterClass)) {
                propValue = fill(parameterClass);
            } else {
                propValue = type.defaultValue();
            }

            ClassUtil.setPropValue(entity, method, propValue);
        }
    }
454369
private void processKeyValue(Map<ConfigurationKey, Object> properties, ConfigurationKey key, Object value) {
        if (value instanceof String) {
            value = key.convertValue((String) value);
        }
        if (key.isValidValue(value)) {
            Object previous = properties.put(key, value);
            if (previous != null && !previous.equals(value)) {
                throw ConfigurationLogger.LOG.configurationKeyHasDifferentValues(key.get(), previous, value);
            }
        } else {
            throw ConfigurationLogger.LOG.invalidConfigurationPropertyValue(value, key.get());
        }
    }
346230
private function updateEntity($property, EntityInterface $entity, Repository $repository, ParametersCollection $configuration)
    {
        if ($configuration->offsetExists('on') && $onEvent = $configuration->offsetGet('on')) {
            
            $onEvent = !static::isIterable($onEvent) ? [$onEvent] : $onEvent;
            
            foreach ($onEvent as $onEventName) {
                if (($onEventName === Timestampable::ON_CREATE && $repository->isNewEntity($entity)) || $onEventName === Timestampable::ON_UPDATE) {
                    $entity->setByProperty($property, new DateTime());
                }
            }
            
            return null;
        }
        
        throw new ExtensionException('Wrong configuration passed to Timestampable extension');
    }
324383
@Override
    public T apply(T entity) {

        double value = entity.get(this.element).doubleValue();
        double nv;

        if (this.up == null) {
            double high = Math.ceil(value / this.stepwidth) * this.stepwidth;
            double low = Math.floor(value / this.stepwidth) * this.stepwidth;
            nv = ((value - low < high - value) ? low : high);
        } else if (this.up.booleanValue()) {
            nv = Math.ceil(value / this.stepwidth) * this.stepwidth;
        } else {
            nv = Math.floor(value / this.stepwidth) * this.stepwidth;
        }

        Number num;

        if (this.longBased) {
            num = Long.valueOf((long) nv);
        } else {
            num = Integer.valueOf((int) nv);
        }

        return entity.with(lenient(this.element, num));

    }
809182
function unitProperty (property, value) {
  if (value !== +value) {
    return value
  }

  if (unitCache[property]) {
    return value + unitCache[property]
  }

  supportElement.style[property] = 0

  let propValue = supportElement.style[property]
  let match = propValue.match && propValue.match(UNIT_REG)

  if (match) {
    return value + (unitCache[property] = match[1])
  }

  return value
}
57225
function getter(value, properties) {
        // Most calculations happen within the typecast and the value passed is typically the value we want to use.
        // Typically, the getter just returns the value.
        // Modifications to the value within the getter are not written to the object.

        // Getter can transform value after typecast.
        if (properties.getter) {
            value = properties.getter.call(this[_privateKey]._root, value);
        }

        return value;
    }
302796
function(property, sorted) {
            var setters = this.__collectAllPropertyValues.apply(this, ['__setters', 1].concat(property || []));

            if (!property) {
                return setters;
            }

            setters = setters[property];

            if (!sorted) {
                return setters[property];
            }

            var sortedSetters = [];

            for (var name in setters) {
                sortedSetters.push(setters[name]);
            }

            sortedSetters = sortedSetters.sort(function(s1, s2) { return s2[0] - s1[0]; });

            for (var i = 0, ii = sortedSetters.length; i < ii; ++i) {
                sortedSetters[i] = sortedSetters[i][1];
            }

            return sortedSetters;
        }
606775
@SuppressWarnings({ "rawtypes", "unchecked" })
    public static void setPropertiesFromThrift(String prefix, Properties properties, org.apache.thrift.TBase entity) throws Exception {
        Field field = entity.getClass().getDeclaredField("metaDataMap");
        Map<org.apache.thrift.TFieldIdEnum, org.apache.thrift.meta_data.FieldMetaData> fields = (Map<org.apache.thrift.TFieldIdEnum, FieldMetaData>) field.get(entity);
        
        for (Entry<org.apache.thrift.TFieldIdEnum, FieldMetaData> f : fields.entrySet()) { 
            ThriftTypes type = ThriftTypes.values()[f.getValue().valueMetaData.type];
            Object value = entity.getFieldValue(f.getKey());
            if (value == null)
                continue;
            
            switch (type) {
            case VOID   : 
                break;
            case BOOL   :
            case BYTE   :
            case DOUBLE :
            case I16    :
            case I32    :
            case I64    :
            case STRING :
            case ENUM   : 
                if (value instanceof byte[]) {
                    properties.put(prefix + f.getKey().getFieldName(), Base64.encodeBase64String((byte[])value));
                }
                else if (value instanceof ByteBuffer) {
                    properties.put(prefix + f.getKey().getFieldName(), base64Encode((ByteBuffer)value));
                }
                else {
                    properties.put(prefix + f.getKey().getFieldName(), value.toString());
                }
                break;
            case MAP    : {
                String newPrefix = prefix + f.getKey().getFieldName() + ".";
                org.apache.thrift.meta_data.MapMetaData meta = (org.apache.thrift.meta_data.MapMetaData)f.getValue().valueMetaData;
                if (!meta.keyMetaData.isStruct() && !meta.keyMetaData.isContainer()) {
                    Map<Object, Object> map = (Map<Object, Object>)value;
                    for (Entry<Object, Object> entry : map.entrySet()) {
                        properties.put(newPrefix + entry.getKey(), entry.getValue().toString());
                    }
                }
                else {
                    LOG.error(String.format("Unable to serializer field '%s' key type '%s' not supported", f.getKey().getFieldName(), meta.keyMetaData.getTypedefName()));
                }
                break;
            }
            case LIST   : {
                String newPrefix = prefix + f.getKey().getFieldName() + ".";

                List<Object> list = (List<Object>)value;
                org.apache.thrift.meta_data.ListMetaData listMeta = (org.apache.thrift.meta_data.ListMetaData)f.getValue().valueMetaData;
                for (Object entry : list) {
                    String id;
                    if (entry instanceof CfDef) {
                        id = ((CfDef)entry).name;
                    }
                    else if (entry instanceof ColumnDef) {
                        ByteBuffer name = ((ColumnDef)entry).name;
                        id = base64Encode(name);
                    }
                    else {
                        LOG.error("Don't know how to convert to properties " + listMeta.elemMetaData.getTypedefName());
                        continue;
                    }
                    
                    if (listMeta.elemMetaData.isStruct()) {
                        setPropertiesFromThrift(newPrefix + id + ".", properties, (org.apache.thrift.TBase)entry);
                    }
                    else {
                        properties.put(newPrefix + id, entry);
                    }
                }
                
                break;
            }
            case STRUCT : {
                setPropertiesFromThrift(prefix + f.getKey().getFieldName() + ".", properties, (org.apache.thrift.TBase)value);
                break;
            }
            case SET    :
            default:
                LOG.error("Unhandled value : " + f.getKey().getFieldName() + " " + type);
                break;
            }
        }
878267
function interceptPropertySet ({ entity, properties }) {
  // Create a proxy .interceptPropertySet(...) methods, per property
  this.interceptPropertySet = _.reduce(properties, (interceptPropertySet, propertyConfiguration, propertyName) => {

    // Fetch extensions implementing .interceptPropertySet(...) method for this property's interceptor functions
    let setterInterceptors = _.compact(
      _.map(this.extensions, (extension) => {
        // Check if implementing .interceptPropertySet(...) method
        if (extension.implemented.interceptPropertySet) {
          // Return the setter interceptor function (if returned for this property)
          return extension.interceptPropertySet(propertyName, propertyConfiguration);
        }
      })
    );

    // Initialize a per-property setter intercepting function and returns the updated value
    interceptPropertySet[propertyName] = (currentValue, newValue) => {

      // Initialize the EnTTExtValueEvent event
      let changes = [ currentValue, newValue ],
          event = new EnTTExtValueEvent({
        changes,
        currentValue,
        value: newValue,
      });

      // Cycle through all the setter interceptors
      _.forEach(setterInterceptors, (setterInterceptor) => {
        // Execute the extensino intercaptor
        setterInterceptor(entity, properties, event);
        // Update the changes array for the next interceptor
        changes.push(event.value);
      });

      // Return the updated value
      return event.value;

    };

    // Return composed interceptors
    return interceptPropertySet;

  }, {});
}