Validates the given property metadata to ensure it is valid for an automatic timestamp field.

@param propertyMetadata
the metadata to validate
16799
private void validateAutoTimestampField(PropertyMetadata propertyMetadata) {
    Class<?> dataClass = propertyMetadata.getDeclaredType();
    if (Collections.binarySearch(VALID_TIMESTAMP_TYPES, dataClass.getName()) < 0) {
      String messageFormat = "Field %s in class %s must be one of the following types - %s";
      throw new EntityManagerException(String.format(messageFormat,
          propertyMetadata.getField().getName(), entityClass, VALID_TIMESTAMP_TYPES));
    }
  }
1120271
public void validateFor(final int type) throws ValueFormatException
   {
      if (constraints == null || constraints.length <= 0)
      {
         return;
      }

      if (type == PropertyType.DATE)
      {
         for (String constrString : constraints)
         {
            try
            {
               MinMaxConstraint constraint = parseAsMinMax(constrString);
               if (constraint.getMin().getThreshold().length() > 0)
               {
                  JCRDateFormat.parse(constraint.getMin().getThreshold());
               }

               if (constraint.getMax().getThreshold().length() > 0)
               {
                  JCRDateFormat.parse(constraint.getMax().getThreshold());
               }
            }
            catch (ValueFormatException e)
            {
               throw new ValueFormatException("Wrong DATE constraint format " + constrString, e);
            }
            catch (ConstraintViolationException e)
            {
               throw new ValueFormatException("Wrong DATE constraint format " + constrString, e);
            }
         }
      }
      else if (type == PropertyType.DOUBLE)
      {
         for (String constrString : constraints)
         {
            try
            {
               MinMaxConstraint constraint = parseAsMinMax(constrString);
               if (constraint.getMin().getThreshold().length() > 0)
               {
                  Double.parseDouble(constraint.getMin().getThreshold());
               }
               if (constraint.getMax().getThreshold().length() > 0)
               {
                  Double.parseDouble(constraint.getMax().getThreshold());
               }
            }
            catch (NumberFormatException e)
            {
               throw new ValueFormatException("Wrong DOUBLE constraint format " + constrString, e);
            }
            catch (ConstraintViolationException e)
            {
               throw new ValueFormatException("Wrong DOUBLE constraint format " + constrString, e);
            }
         }
      }
      else if (type == PropertyType.LONG || type == PropertyType.BINARY)
      {
         for (String constrString : constraints)
         {
            try
            {
               MinMaxConstraint constraint = parseAsMinMax(constrString);
               if (constraint.getMin().getThreshold().length() > 0)
               {
                  Long.parseLong(constraint.getMin().getThreshold());
               }
               if (constraint.getMax().getThreshold().length() > 0)
               {
                  Long.parseLong(constraint.getMax().getThreshold());
               }
            }
            catch (NumberFormatException e)
            {
               throw new ValueFormatException("Wrong LONG (or BINARY size) constraint format " + constrString, e);
            }
            catch (ConstraintViolationException e)
            {
               throw new ValueFormatException("Wrong LONG (or BINARY size) constraint format " + constrString, e);
            }
         }
      }
      else if (type == PropertyType.BOOLEAN)
      {
         for (String constrString : constraints)
         {
            if (!constrString.equalsIgnoreCase("true") && !constrString.equalsIgnoreCase("false"))
            {
               throw new ValueFormatException("Wrong BOOLEAN constraint format: " + constrString);
            }
         }
      }
   }
474481
private void checkMetadata() {
    if (!localMember.properties().equals(localProperties)) {
      localProperties = new Properties();
      localProperties.putAll(localMember.properties());
      post(new GroupMembershipEvent(GroupMembershipEvent.Type.METADATA_CHANGED, localMember));
    }
  }
1365767
private function validateSchemata(EntityMetadata $metadata)
    {
        $persistence = $metadata->persistence;
        foreach ($persistence->schemata as $k => $schema) {
            if (!isset($schema['keys']) || empty($schema['keys'])) {
                throw MetadataException::invalidMetadata($metadata->type, 'At least one key must be specified to define an index.');
            }
            $persistence->schemata[$k]['options']['name'] = sprintf('modlr_%s', md5(json_encode($schema)));
        }
    }
1029736
public void setTimestamp(Timestamp timestamp) {
        if (timestamp == null) {
            _properties.remove(AMQP_PROP_TIMESTAMP);
            return;
        }
        
        _properties.put(AMQP_PROP_TIMESTAMP, timestamp);
    }
730904
private static void verifyId(final EntityMetadata entityMetadata) {
        if (!entityMetadata.hasIdProperty()) {
            throw new RepositoryMappingException("No field annotated with @Id present.");
        }

        if (entityMetadata.idProperty().type() != String.class) {
            throw new RepositoryMappingException("The @Id Field needs to be of type String.");
        }
    }
385935
private function collectAttributeTypeMetadata(
        PropertyMetadataBuilder $metadata,
        Attribute $attribute
    ) : void {
        $type = $attribute->type;

        // handle the case if the property type is mixed
        if ('mixed' === $type) {
            return;
        }

        if ($attribute->required) {
            $metadata->withBeingRequired();
        }

        // Evaluate type

        // Checks if the property has array<type>
        if (false !== $pos = strpos($type, '<')) {
            $arrayType = substr($type, $pos + 1, -1);

            $metadata->withType(new ArrayType(new MixedType(), $this->createTypeFromName($arrayType)));

            return;
        }

        // Checks if the property has type[]
         if (false !== $pos = strrpos($type, '[')) {
            $arrayType = substr($type, 0, $pos);

            $metadata->withType(new ArrayType(new MixedType(), $this->createTypeFromName($arrayType)));

            return;
        }

        $metadata->withType($this->createTypeFromName($attribute->type));
    }
630833
private function normalizeValue(ClassMetadata $metadata, $property, $value)
    {
        if (self::PARAMETER_ID_KEY === $property) {
            return $this->getFilterValueFromUrl($value);
        }

        if (self::PARAMETER_NULL_VALUE === $value) {
            return null;
        }

        switch ($metadata->getTypeOfField($property)) {
            case 'boolean':
                return (bool) $value;

            case 'integer':
                return (int) $value;

            case 'float':
                return (float) $value;

            case 'datetime':
                // the input has the format `2015-04-28T02:23:50 00:00`, transform it to match the database format
                // `2015-04-28 02:23:50`
                return preg_replace('/(\d{4}(-\d{2}){2})T(\d{2}(:\d{2}){2}) \d{2}:\d{2}/', '$1 $3', $value);
        }

        return $value;
    }
252751
@Override
    public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName) {
        // dynamic beans force code by exception
        try {
            return metaBean.metaProperty(propertyName);
        } catch (NoSuchElementException ex) {
            return null;
        }
    }
1369941
function onMetadata (metadata) {
  metadata = icy.parse(metadata);
  console.error('METADATA EVENT:');
  console.error(metadata);
}
942902
@Override
    public void metaPropertyDefine(String propertyName, Class<?> propertyType) {
        bean.propertyDefine(propertyName, propertyType);
    }
238216
public void setVersionMetadata(PropertyMetadata versionMetadata) {
    if (this.versionMetadata != null) {
      throwDuplicateAnnotationException(entityClass, Version.class, this.versionMetadata,
          versionMetadata);
    }
    this.versionMetadata = versionMetadata;
  }
1019110
private void processVersionField(PropertyMetadata propertyMetadata) {
    Class<?> dataClass = propertyMetadata.getDeclaredType();
    if (!long.class.equals(dataClass)) {
      String messageFormat = "Field %s in class %s must be of type %s";
      throw new EntityManagerException(String.format(messageFormat,
          propertyMetadata.getField().getName(), entityClass, long.class));
    }
    entityMetadata.setVersionMetadata(propertyMetadata);
  }
826780
public static void initializeMetadata()
    {
        // TODO: merge inside meta API.
        DbConn cnx = null;
        try
        {
            cnx = Helpers.getNewDbSession();
            Helpers.updateConfiguration(cnx);
            cnx.commit();
        }
        catch (Exception e)
        {
            throw new JqmRuntimeException("Could not set metadata", e);
        }
        finally
        {
            Helpers.closeQuietly(cnx);
        }
    }
256363
public function validateTimestamps(EntityDefinition $entityMetadata)
    {
        $columnNames = [];

        // get column names
        foreach ($entityMetadata['table']['columns'] as $column) {
            $columnNames[] = $column['name'];
        }

        // get version column names
        if (! empty($entityMetadata['versionTable'])) {
            foreach ($entityMetadata['versionTable']['columns'] as $column) {
                $columnNames[] = $column['name'];
            }
        }

        if (! in_array('created_at', $columnNames) || ! in_array('updated_at', $columnNames)) {
            throw new DomainException('@Timestamps annotation defined in class ' . $entityMetadata['class'] . ' requires a $createdAt and an $updatedAt column property.');
        }
    }
865458
private <X extends Class, T extends Object> void populateMetadata(EntityMetadata metadata, Class<X> clazz,
            Map puProperties)
    {
        // process for metamodelImpl

        if (metadata.getPersistenceUnit() != null)
        {
            MetaModelBuilder<X, T> metaModelBuilder = kunderaMetadata.getApplicationMetadata().getMetaModelBuilder(
                    metadata.getPersistenceUnit());

            onBuildMetaModelSuperClass(clazz.getSuperclass(), metaModelBuilder);

            metaModelBuilder.process(clazz);

            for (Field f : clazz.getDeclaredFields())
            {
                if (f != null && !Modifier.isStatic(f.getModifiers()) && !Modifier.isTransient(f.getModifiers())
                        && !f.isAnnotationPresent(Transient.class))
                {
                    // construct metamodel.
                    metaModelBuilder.construct(clazz, f);

                    // on id attribute.
                    onIdAttribute(metaModelBuilder, metadata, clazz, f);

                    // determine if it is a column family or super column
                    // family.
                    onFamilyType(metadata, clazz, f);
                }
            }

            EntityType entityType = (EntityType) metaModelBuilder.getManagedTypes().get(metadata.getEntityClazz());

            validateAndSetId(metadata, clazz, metaModelBuilder);
            validateandSetEntityType(metadata, clazz, metaModelBuilder);
            MetadataUtils.onJPAColumnMapping(entityType, metadata);

            /* Scan for Relationship field */
            populateRelationMetaData(entityType, clazz, metadata);
        }
    }
1170969
public void validate() throws InvalidPropertyException {

        final String methodName = "validate";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName);
        }

        final List<String> failedPropsMessages = new ArrayList<String>();
        final List<PropertyDescriptor> invalidProperties = new ArrayList<PropertyDescriptor>();

        try {

            if (isSet(_destinationName))
            {
                // BusName must be set
                if (!isSet(_busName)) {

                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                        SibTr.debug(this, TRACE, "Invalid BusName - BusName was "
                                                 + _busName);
                    }
                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_BUSNAME_CWSIV0504"),
                                                                    null, null));
                    invalidProperties.add(new PropertyDescriptor("BusName",
                                    SibRaActivationSpec.class));

                }

                // DestinationType must be valid
                if (!DESTINATION_TYPES.keySet().contains(_destinationType)) {

                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                        SibTr.debug(this, TRACE,
                                    "Invalid Destination Type - We expected a destination type of "
                                                    + DESTINATION_TYPE_QUEUE + " or " + DESTINATION_TYPE_TOPIC_SPACE + " or "
                                                    + DESTINATION_TYPE_PORT + " or " + DESTINATION_TYPE_SERVICE
                                                    + " but we got "
                                                    + _destinationType);
                    }

                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_DESTINATION_TYPE_CWSIV0505"),
                                                                    new Object[] { DESTINATION_TYPE_QUEUE,
                                                                                  DESTINATION_TYPE_TOPIC_SPACE,
                                                                                  DESTINATION_TYPE_PORT,
                                                                                  DESTINATION_TYPE_SERVICE,
                                                                                  _destinationType }, null));
                    invalidProperties.add(new PropertyDescriptor(
                                    "DestinationType", SibRaActivationSpec.class));

                }

                // Make sure we are not using a topic space if wildcarded destinations are used.
                if ((Boolean.TRUE.equals(_useDestinationWildcard))
                    && (DESTINATION_TYPE_TOPIC_SPACE.equals(_destinationType)))
                {
                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_USEDESTWILDCARD_CWSIV0515"),
                                                                    null, null));
                    invalidProperties.add(new PropertyDescriptor(
                                    "UseDestinationWildcard",
                                    SibRaActivationSpec.class));
                }

                // For durable subscriptions...
                if ((DESTINATION_TYPE_TOPIC_SPACE.equals(_destinationType))
                    && (isSet(_subscriptionName))) {

                    // ShareDurableSubscriptions must be valid
                    if (!SUBSCRIPTION_SHAREABILITY.keySet().contains(
                                                                     _shareDurableSubscriptions)) {

                        if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                            SibTr.debug(this, TRACE,
                                        "Invalid shareDurableSubscriptions - We expect a value of "
                                                        + SibRaDurableSubscriptionSharing.ALWAYS + ", "
                                                        + SibRaDurableSubscriptionSharing.NEVER + " or "
                                                        + SibRaDurableSubscriptionSharing.CLUSTER_ONLY + " but we got "
                                                        + _shareDurableSubscriptions);
                        }
                        failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_SHARE_DURSUB_CWSIV0506"),
                                                                        new Object[] { SibRaDurableSubscriptionSharing.ALWAYS,
                                                                                      SibRaDurableSubscriptionSharing.NEVER,
                                                                                      SibRaDurableSubscriptionSharing.CLUSTER_ONLY,
                                                                                      _shareDurableSubscriptions },
                                                                        null));

                        invalidProperties.add(new PropertyDescriptor(
                                        "ShareDurableSubscriptions",
                                        SibRaActivationSpec.class));

                    }

                    // DurableSubscriptionHome must be set
                    if (!isSet(_durableSubscriptionHome)) {

                        failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_DURSUBHOME_CWSIV0507"),
                                                                        null, null));
                        invalidProperties.add(new PropertyDescriptor(
                                        "DurableSubscriptionHome",
                                        SibRaActivationSpec.class));

                    }

                }

            } else {

                // DestinationType must be valid and not a topic space
                if (!DESTINATION_TYPES.keySet().contains(_destinationType)
                    || DESTINATION_TYPE_TOPIC_SPACE
                                    .equals(_destinationType)) {

                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                        SibTr.debug(this, TRACE,
                                    "Invalid Destination Type - No destination was specified so we expected a destination type of "
                                                    + DESTINATION_TYPE_QUEUE + " or " + DESTINATION_TYPE_PORT + " or "
                                                    + DESTINATION_TYPE_SERVICE + " but we got "
                                                    + _destinationType);
                    }

                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_DESTINATION_TYPE_CWSIV0508"),
                                                                    new Object[] { DESTINATION_TYPE_QUEUE,
                                                                                  DESTINATION_TYPE_PORT,
                                                                                  DESTINATION_TYPE_SERVICE,
                                                                                  _destinationType }, null));
                    invalidProperties.add(new PropertyDescriptor(
                                    "DestinationType", SibRaActivationSpec.class));

                }

            }

            // MaxBatchSize must be an Integer greater than zero
            if ((_maxBatchSize == null) || (_maxBatchSize.intValue() < 1)) {

                failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_MAXBATCH_CWSIV0509"),
                                                                null, null));
                invalidProperties.add(new PropertyDescriptor("MaxBatchSize",
                                SibRaActivationSpec.class));

            }

            // MessageDeletionMode must be valid
            if (!MESSAGE_DELETION_MODES.keySet().contains(_messageDeletionMode)) {

                if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                    SibTr.debug(this, TRACE,
                                "Invalid Message Deletion Mode we expected a mode of "
                                                + SibRaMessageDeletionMode.SINGLE + " or "
                                                + SibRaMessageDeletionMode.BATCH + " or "
                                                + SibRaMessageDeletionMode.APPLICATION + " but we got "
                                                + _messageDeletionMode);
                }

                failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_DELETION_MODE_CWSIV0510"),
                                                                new Object[] { SibRaMessageDeletionMode.SINGLE,
                                                                              SibRaMessageDeletionMode.BATCH,
                                                                              SibRaMessageDeletionMode.APPLICATION,
                                                                              _messageDeletionMode }, null));
                invalidProperties.add(new PropertyDescriptor(
                                "MessageDeletionMode", SibRaActivationSpec.class));

            }

            // MaxConcurrency must be an Integer greater than zero
            if ((_maxConcurrency == null) || (_maxConcurrency.intValue() < 1)) {

                failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_MAXCONC_CWSIV0511"),
                                                                null, null));
                invalidProperties.add(new PropertyDescriptor("MaxConcurrency",
                                SibRaActivationSpec.class));

            }

            /**
             * For the target set of properties, use the defaults if none specified
             */

            if ("".equals(_targetType)) {

                _targetType = JmsraConstants.DEFAULT_TARGET_TRANSPORT;

            }

            if ("".equals(_target)) {

                _target = JmsraConstants.DEFAULT_TARGET;

            }

            // Target type must be one of the predefined values
            if ((null == _targetType) || ("".equals(_targetType))) {

                _targetType = JmsraConstants.DEFAULT_TARGET_TYPE;

            } else {

                if (!((ApiJmsConstants.TARGET_TYPE_BUSMEMBER.equals(_targetType)) ||
                      (ApiJmsConstants.TARGET_TYPE_ME.equals(_targetType)) || (ApiJmsConstants.TARGET_TYPE_CUSTOM.equals(_targetType)))) {

                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_TARGET_TYPE_CWSIV0512"),
                                                                    new Object[] { ApiJmsConstants.TARGET_TYPE_BUSMEMBER,
                                                                                  ApiJmsConstants.TARGET_TYPE_ME,
                                                                                  ApiJmsConstants.TARGET_TYPE_CUSTOM,
                                                                                  _targetType },
                                                                    null));

                    invalidProperties.add(new PropertyDescriptor(
                                    "targetType",
                                    SibRaActivationSpec.class));

                }

            }

            // Target significance must be one of the predefined values
            if ((null == _targetSignificance) || ("".equals(_targetSignificance))) {

                _targetSignificance = JmsraConstants.DEFAULT_TARGET_SIGNIFICANCE;

            } else {

                if (!((ApiJmsConstants.TARGET_SIGNIFICANCE_PREFERRED.equals(_targetSignificance)) || (ApiJmsConstants.TARGET_SIGNIFICANCE_REQUIRED.equals(_targetSignificance)))) {

                    failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_TARGET_SIGNIFICANCE_CWSIV0513"),
                                                                    new Object[] { ApiJmsConstants.TARGET_SIGNIFICANCE_PREFERRED,
                                                                                  ApiJmsConstants.TARGET_SIGNIFICANCE_REQUIRED,
                                                                                  _targetSignificance },
                                                                    null));
                    invalidProperties.add(new PropertyDescriptor(
                                    "targetSignificance",
                                    SibRaActivationSpec.class));

                }

            }

            if ((_useServerSubject.booleanValue()) && (isSet(_providerEndpoints)))
            {
                failedPropsMessages.add(NLS.getFormattedMessage(("INVALID_PROPERTY_PROVIDER_ENDPOINTS_CWSIV0514"),
                                                                new Object[] { _providerEndpoints },
                                                                null));
                invalidProperties.add(new PropertyDescriptor(
                                "providerEndpoints",
                                SibRaActivationSpec.class));
            }

        } catch (final IntrospectionException exception) {

            FFDCFilter.processException(exception, CLASS_NAME + "."
                                                   + methodName, FFDC_PROBE_1, this);
            // Should never happen

        }

        // If we have any invalid properties, throw an
        // InvalidPropertyException
        if (!invalidProperties.isEmpty()) {

            final PropertyDescriptor[] invalidPropertyArray = (PropertyDescriptor[]) invalidProperties
                            .toArray(new PropertyDescriptor[invalidProperties
                                            .size()]);

            if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
                SibTr.debug(this, TRACE, "Invalid properties found:",
                            failedPropsMessages);
            }

            final InvalidPropertyException exc = new InvalidPropertyException(
                            NLS.getFormattedMessage(
                                                    ("INVALID_PROPERTIES_CWSIV0501"),
                                                    new Object[] { this, failedPropsMessages }, null));
            exc.setInvalidPropertyDescriptors(invalidPropertyArray);
            throw exc;
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }

    }