数値かどうかを処理します。

@param entityDesc エンティティ記述
@param propertyDesc エンティティプロパティ記述
@param columnMeta カラムメタデータ
@since 1.11.0
324278
protected void descriminateType(
      EntityDesc entityDesc, EntityPropertyDesc propertyDesc, ColumnMeta columnMeta) {
    String defaultClassName = dialect.getMappedPropertyClassName(columnMeta);
    if (Byte.class.getName().equals(defaultClassName)
        || Short.class.getName().equals(defaultClassName)
        || Integer.class.getName().equals(defaultClassName)
        || Long.class.getName().equals(defaultClassName)
        || Float.class.getName().equals(defaultClassName)
        || Double.class.getName().equals(defaultClassName)
        || BigInteger.class.getName().equals(defaultClassName)
        || BigDecimal.class.getName().equals(defaultClassName)
        || byte.class.getName().equals(defaultClassName)
        || short.class.getName().equals(defaultClassName)
        || int.class.getName().equals(defaultClassName)
        || long.class.getName().equals(defaultClassName)
        || float.class.getName().equals(defaultClassName)
        || double.class.getName().equals(defaultClassName)) {
      propertyDesc.setNumber(true);
    } else if (Time.class.getName().equals(defaultClassName)
        || LocalTime.class.getName().equals(defaultClassName)) {
      propertyDesc.setTime(true);
    } else if (Date.class.getName().equals(defaultClassName)
        || LocalDate.class.getName().equals(defaultClassName)) {
      propertyDesc.setDate(true);
    } else if (Timestamp.class.getName().equals(defaultClassName)
        || java.util.Date.class.getName().equals(defaultClassName)
        || LocalDateTime.class.getName().equals(defaultClassName)) {
      propertyDesc.setTimestamp(true);
    }
  }
49212
protected void createIndexesOnColumns(EntityMetadata m, String tableName, List<Column> columns, Class columnType) {
        Object pooledConnection = null;
        try {
            Cassandra.Client api = null;
            pooledConnection = getConnection();
            api = (org.apache.cassandra.thrift.Cassandra.Client) getConnection(pooledConnection);
            KsDef ksDef = api.describe_keyspace(m.getSchema());
            List<CfDef> cfDefs = ksDef.getCf_defs();

            // Column family definition on which secondary index creation is
            // required
            CfDef columnFamilyDefToUpdate = null;
            boolean isUpdatable = false;
            for (CfDef cfDef : cfDefs) {
                if (cfDef.getName().equals(tableName)) {
                    columnFamilyDefToUpdate = cfDef;
                    break;
                }
            }

            if (columnFamilyDefToUpdate == null) {
                log.error("Join table {} not available.", tableName);
                throw new PersistenceException("table" + tableName + " not found!");
            }
            // create a column family, in case it is not already available.

            // Get list of indexes already created
            List<ColumnDef> columnMetadataList = columnFamilyDefToUpdate.getColumn_metadata();
            List<String> indexList = new ArrayList<String>();

            if (columnMetadataList != null) {
                for (ColumnDef columnDef : columnMetadataList) {
                    indexList.add(new StringAccessor().fromBytes(String.class, columnDef.getName()));
                }
                // need to set them to null else it is giving problem on update
                // column family and trying to add again existing indexes.
                // columnFamilyDefToUpdate.column_metadata = null;
            }

            // Iterate over all columns for creating secondary index on them
            for (Column column : columns) {

                ColumnDef columnDef = new ColumnDef();

                columnDef.setName(column.getName());
                columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass(columnType, false));
                columnDef.setIndex_type(IndexType.KEYS);

                // Add secondary index only if it's not already created
                // (if already created, it would be there in column family
                // definition)
                if (!indexList.contains(new StringAccessor().fromBytes(String.class, column.getName()))) {
                    isUpdatable = true;
                    columnFamilyDefToUpdate.addToColumn_metadata(columnDef);
                }
            }

            // Finally, update column family with modified column family
            // definition
            if (isUpdatable) {
                columnFamilyDefToUpdate.setKey_validation_class(CassandraValidationClassMapper
                    .getValidationClass(m.getIdAttribute().getJavaType(), isCql3Enabled(m)));
                api.system_update_column_family(columnFamilyDefToUpdate);
            }

        } catch (Exception e) {
            log.warn("Could not create secondary index on column family {}, Caused by: . ", tableName, e);

        } finally {
            releaseConnection(pooledConnection);
        }
    }
880343
public EntityListenerDesc createEntityListenerDesc(EntityDesc entityDesc) {
    EntityListenerDesc entityListenerDesc = new EntityListenerDesc();
    entityListenerDesc.setEntityDesc(entityDesc);
    entityListenerDesc.setPackageName(entityDesc.getPackageName());
    String entityPrefix = StringUtil.defaultString(entityDesc.getEntityPrefix(), "");
    String entitySuffix = StringUtil.defaultString(entityDesc.getEntitySuffix(), "");
    String entityName = entityPrefix + entityDesc.getSimpleName() + entitySuffix;
    entityListenerDesc.setSimpleName(entityName + Constants.ENTITY_LISTENER_SUFFIX);
    entityListenerDesc.setEntityClassSimpleName(entityDesc.getSimpleName());
    if (superclassName != null) {
      entityListenerDesc.setSuperclassSimpleName(ClassUtil.getSimpleName(superclassName));
    }
    entityListenerDesc.setTemplateName(Constants.ENTITY_LISTENER_TEMPLATE);
    handleImportName(entityListenerDesc, entityDesc);
    return entityListenerDesc;
  }
509330
protected final void populateIdAccessorMethods(EntityMetadata metadata, Class<?> clazz, Field f)
    {
        try
        {
            BeanInfo info = Introspector.getBeanInfo(clazz);

            for (PropertyDescriptor descriptor : info.getPropertyDescriptors())
            {
                if (descriptor.getName().equals(f.getName()))
                {
                    metadata.setReadIdentifierMethod(descriptor.getReadMethod());
                    metadata.setWriteIdentifierMethod(descriptor.getWriteMethod());
                    return;
                }
            }
        }
        catch (IntrospectionException e)
        {
            throw new RuntimeException(e);
        }
    }
496949
private void onInheritedProperty(TableInfo tableInfo, EntityType entityType)
    {
        String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();

        if (discrColumn != null)
        {
            ColumnInfo columnInfo = new ColumnInfo();
            columnInfo.setColumnName(discrColumn);
            columnInfo.setType(String.class);
            columnInfo.setIndexable(true);

            IndexInfo idxInfo = new IndexInfo(discrColumn);
            tableInfo.addColumnInfo(columnInfo);
            tableInfo.addToIndexedColumnList(idxInfo);
        }
    }
157003
private ColumnDef addColumnFor(FieldDescriptorDef fieldDef, TableDef tableDef)
    {
        String    name      = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN);
        ColumnDef columnDef = tableDef.getColumn(name);

        if (columnDef == null)
        {
            columnDef = new ColumnDef(name);
            tableDef.addColumn(columnDef);
        }
        if (!fieldDef.isNested())
        {    
            columnDef.setProperty(PropertyHelper.TORQUE_PROPERTY_JAVANAME, fieldDef.getName());
        }
        columnDef.setProperty(PropertyHelper.TORQUE_PROPERTY_TYPE, fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE));
        columnDef.setProperty(PropertyHelper.TORQUE_PROPERTY_ID, fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ID));
        if (fieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_PRIMARYKEY, false))
        {
            columnDef.setProperty(PropertyHelper.TORQUE_PROPERTY_PRIMARYKEY, "true");
            columnDef.setProperty(PropertyHelper.TORQUE_PROPERTY_REQUIRED, "true");
        }
        else if (!fieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_NULLABLE, true))
        {
            columnDef.setProperty(PropertyHelper.TORQUE_PROPERTY_REQUIRED, "true");
        }
        if ("database".equals(fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_AUTOINCREMENT)))
        {
            columnDef.setProperty(PropertyHelper.TORQUE_PROPERTY_AUTOINCREMENT, "true");
        }
        columnDef.setProperty(PropertyHelper.TORQUE_PROPERTY_SIZE, fieldDef.getSizeConstraint());
        if (fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_DOCUMENTATION))
        {
            columnDef.setProperty(PropertyHelper.OJB_PROPERTY_DOCUMENTATION,
                                  fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_DOCUMENTATION));
        }
        if (fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_COLUMN_DOCUMENTATION))
        {
            columnDef.setProperty(PropertyHelper.OJB_PROPERTY_COLUMN_DOCUMENTATION,
                                  fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN_DOCUMENTATION));
        }
        return columnDef;
    }
463800
public void addPropertyColumn(String propertyName, Class propertyType, int minWidth, int maxWidth)
    {
        addPropertyColumn(propertyName).withMinWidth(minWidth).withMaxWidth(maxWidth);
    }
54880
private String getColumnName(EntityMetadata metadata, EntityType entityType, String property)
    {
        String columnName = null;

        if (property.indexOf(".") > 0)
        {
            property = property.substring((kunderaQuery.getEntityAlias() + ".").length());
        }
        try
        {
            columnName = ((AbstractAttribute) entityType.getAttribute(property)).getJPAColumnName();
        }
        catch (IllegalArgumentException iaex)
        {
            log.warn("No column found by this name : " + property + " checking for embeddedfield");
        }
        // where condition may be for search within embedded object
        if (columnName == null && property.indexOf(".") > 0)
        {
            String enclosingEmbeddedField = MetadataUtils.getEnclosingEmbeddedFieldName(metadata, property, true,
                    kunderaMetadata);
            if (enclosingEmbeddedField != null)
            {
                columnName = property;
            }
        }

        if (columnName == null)
        {
            log.error("No column found by this name : " + property);
            throw new JPQLParseException("No column found by this name : " + property + ". Check your query.");
        }
        return columnName;
    }
467188
public List<SqlDesc> createSqlDescs(EntityDesc entityDesc) {
    List<SqlDesc> results = new ArrayList<SqlDesc>();
    if (entityDesc.getIdEntityPropertyDescs().size() > 0) {
      results.add(
          createSqlDesc(entityDesc, selectByIdFileName, Constants.SELECT_BY_ID_SQL_TEMPLATE));
      if (entityDesc.getVersionEntityPropertyDesc() != null) {
        results.add(
            createSqlDesc(
                entityDesc,
                selectByIdAndVersionFileName,
                Constants.SELECT_BY_ID_AND_VERSION_SQL_TEMPLATE));
      }
    }
    for (String templateName : findTemplateNames()) {
      String fileName = removeTemplateExtension(templateName);
      results.add(createSqlDesc(entityDesc, fileName, templateName));
    }
    return results;
  }
232210
private void setSpecificFieldsInResult(List<Map<String, Object>> columnsToOutput, EntityMetadata m, List results,
            JsonArray array)
    {
        Map<String, Class> colNameToJavaType = new HashMap<String, Class>();
        for (Map<String, Object> map : columnsToOutput)
        {
            colNameToJavaType.put((String) map.get(Constants.COL_NAME), (Class) map.get(Constants.FIELD_CLAZZ));
        }
        Map<String, List<Object>> outputResults = new HashMap<String, List<Object>>();
        for (JsonElement element : array)
        {
            String column = element.getAsJsonObject().get("key").getAsString();
            String value = element.getAsJsonObject().get("value").getAsString();
            String id = element.getAsJsonObject().get("id").getAsString();
            Object obj = PropertyAccessorHelper.fromSourceToTargetClass(colNameToJavaType.get(column), String.class,
                    value);
            if (colNameToJavaType.size() > 1)
            {
                if (!outputResults.containsKey(id))
                {
                    outputResults.put(id, new ArrayList<Object>());
                }
                outputResults.get(id).add(obj);
            }
            else
            {
                results.add(obj);
            }
        }
        if (colNameToJavaType.size() > 1)
        {
            results.addAll(outputResults.values());
        }
    }
857487
public static void setColumnsMap(Record record, Map<String, Object> columns) {
		record.setColumnsMap(columns);
	}
219909
@TimerJ
    public TableMetadataBuilder withColumns(List<ColumnMetadata> columnsMetadata) {
        for (ColumnMetadata colMetadata : columnsMetadata) {
            columns.put(colMetadata.getName(), colMetadata);
        }
        return this;
    }
1104376
@Override
    public <T> Query<T> createSqlQueryMappingColumns(Class<T> entityType,
                                                     String sql,
                                                     Map<String, String> columnMapping) {
        Assert.notNull(entityType, "entityType must not null");
        Assert.hasText(sql, "sql must has text");
        Assert.notEmpty(columnMapping, "columnMapping must not empty");
        RawSqlBuilder rawSqlBuilder = RawSqlBuilder.parse(sql);
        columnMapping.entrySet().forEach(entry -> {
            rawSqlBuilder.columnMapping(entry.getKey(), entry.getValue());
        });
        return ebeanServer.find(entityType).setRawSql(rawSqlBuilder.create());
    }
1372674
private void addColumnToTableInfo(EntityMetadata entityMetadata, Type type, TableInfo tableInfo)
    {
        // Add columns to table info.

        Metamodel metaModel = kunderaMetadata.getApplicationMetadata()
                .getMetamodel(entityMetadata.getPersistenceUnit());
        EntityType entityType = metaModel.entity(entityMetadata.getEntityClazz());
        Map<String, PropertyIndex> columns = entityMetadata.getIndexProperties();

        // populate columnsToBeIndexed with composite indexes
        for (Entry<String, PropertyIndex> c : columns.entrySet())
        {
            PropertyIndex indexedColumn = c.getValue();
            if (indexedColumn.getIndexType() != null
                    && indexedColumn.getIndexType().toLowerCase().equals(Constants.COMPOSITE))
            {
                IndexInfo indexInfo = new IndexInfo(c.getKey(), indexedColumn.getMax(), indexedColumn.getMin(),
                        indexedColumn.getIndexType(), indexedColumn.getName());
                tableInfo.addToIndexedColumnList(indexInfo);
            }
        }

        Set attributes = entityType.getAttributes();

        Iterator<Attribute> iter = attributes.iterator();
        while (iter.hasNext())
        {
            Attribute attr = iter.next();

            if (!attr.isAssociation())
            {
                if (((MetamodelImpl) metaModel).isEmbeddable(attr.getJavaType()))
                {

                    EmbeddableType embeddable = metaModel.embeddable(attr.getJavaType());

                    EmbeddedColumnInfo embeddedColumnInfo = getEmbeddedColumn(tableInfo, embeddable, attr.getName(),
                            attr.getJavaType(), ((Field) ((Field) attr.getJavaMember())));

                    if (!tableInfo.getEmbeddedColumnMetadatas().contains(embeddedColumnInfo))
                    {
                        tableInfo.addEmbeddedColumnInfo(embeddedColumnInfo);
                    }
                }
                else if (!attr.isCollection() && !((SingularAttribute) attr).isId())
                {

                    if (((Field) attr.getJavaMember()).getAnnotation(Lob.class) != null)
                    {
                        tableInfo.addLobColumnInfo(((AbstractAttribute) attr).getJPAColumnName());
                    }

                    ColumnInfo columnInfo = getColumn(tableInfo, attr,
                            columns != null ? columns.get(((AbstractAttribute) attr).getJPAColumnName()) : null, null);
                    if (!tableInfo.getColumnMetadatas().contains(columnInfo))
                    {
                        tableInfo.addColumnInfo(columnInfo);
                    }
                }
                else if (attr.isCollection()
                        && MetadataUtils.isBasicElementCollectionField((Field) attr.getJavaMember()))
                {
                    CollectionColumnInfo cci = new CollectionColumnInfo();
                    cci.setCollectionColumnName(((AbstractAttribute) attr).getJPAColumnName());
                    cci.setType(attr.getJavaType());
                    cci.setGenericClasses(PropertyAccessorHelper.getGenericClasses((Field) attr.getJavaMember()));

                    tableInfo.addCollectionColumnMetadata(cci);
                    // add if collection column is indexed
                    String jpaName = ((AbstractAttribute) attr).getJPAColumnName();
                    PropertyIndex indexedColumn = columns.get(jpaName);
                    if (indexedColumn != null && indexedColumn.getName() != null)
                    {
                        IndexInfo indexInfo = new IndexInfo(jpaName, indexedColumn.getMax(), indexedColumn.getMin(),
                                indexedColumn.getIndexType(), indexedColumn.getName());
                        tableInfo.addToIndexedColumnList(indexInfo);
                        // Add more if required
                    }
                }
                else if (attr.isCollection()
                        && !MetadataUtils.isBasicElementCollectionField((Field) attr.getJavaMember()))
                {
                    CollectionColumnInfo eci = new CollectionColumnInfo();
                    eci.setCollectionColumnName(((AbstractAttribute) attr).getJPAColumnName());
                    eci.setType(attr.getJavaType());
                    eci.setGenericClasses(PropertyAccessorHelper.getGenericClasses((Field) attr.getJavaMember()));

                    tableInfo.addElementCollectionMetadata(eci);
                    // add if collection column is indexed
                    String jpaName = ((AbstractAttribute) attr).getJPAColumnName();
                    PropertyIndex indexedColumn = columns.get(jpaName);
                    if (indexedColumn != null && indexedColumn.getName() != null)
                    {
                        IndexInfo indexInfo = new IndexInfo(jpaName, indexedColumn.getMax(), indexedColumn.getMin(),
                                indexedColumn.getIndexType(), indexedColumn.getName());
                        tableInfo.addToIndexedColumnList(indexInfo);
                        // Add more if required
                    }
                }

            }
        }

        onInheritedProperty(tableInfo, entityType);
    }
1235791
protected void handleImportName(EntityDesc entityDesc, TableMeta tableMeta) {
    classDescSupport.addImportName(entityDesc, ClassConstants.Entity);
    if (entityDesc.getCatalogName() != null
        || entityDesc.getSchemaName() != null
        || entityDesc.getTableName() != null) {
      classDescSupport.addImportName(entityDesc, ClassConstants.Table);
    }
    if (superclass != null) {
      classDescSupport.addImportName(entityDesc, superclass.getName());
    }
    if (namingType != NamingType.NONE) {
      classDescSupport.addImportName(entityDesc, namingType.getEnumConstant());
    }
    if (originalStatesPropertyName != null) {
      classDescSupport.addImportName(entityDesc, ClassConstants.OriginalStates);
    }
    for (EntityPropertyDesc propertyDesc : entityDesc.getOwnEntityPropertyDescs()) {
      if (propertyDesc.isId()) {
        classDescSupport.addImportName(entityDesc, ClassConstants.Id);
        if (propertyDesc.getGenerationType() != null) {
          classDescSupport.addImportName(entityDesc, ClassConstants.GeneratedValue);
          classDescSupport.addImportName(entityDesc, ClassConstants.GenerationType);
          GenerationType generationType = propertyDesc.getGenerationType();
          if (generationType != null) {
            classDescSupport.addImportName(entityDesc, generationType.getEnumConstant());
            if (generationType == GenerationType.SEQUENCE) {
              classDescSupport.addImportName(entityDesc, ClassConstants.SequenceGenerator);
            } else if (generationType == GenerationType.TABLE) {
              classDescSupport.addImportName(entityDesc, ClassConstants.TableGenerator);
            }
          }
        }
      }
      classDescSupport.addImportName(entityDesc, ClassConstants.Column);
      if (propertyDesc.isVersion()) {
        classDescSupport.addImportName(entityDesc, ClassConstants.Version);
      }
      classDescSupport.addImportName(entityDesc, propertyDesc.getPropertyClassName());
    }
  }
540186
protected void onSuperColumn(EntityMetadata m, boolean isRelation, List<String> relations, List<Object> entities,
        List<SuperColumn> superColumns, ByteBuffer key) {
        Object e = null;
        Object id = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), key.array());

        ThriftRow tr = new ThriftRow(id, m.getTableName(), new ArrayList<Column>(0), superColumns,
            new ArrayList<CounterColumn>(0), new ArrayList<CounterSuperColumn>(0));

        e = getDataHandler().populateEntity(tr, m, KunderaCoreUtils.getEntity(e), relations, isRelation);
        if (log.isInfoEnabled()) {
            log.info("Populating data for super column family of clazz {} and row key {}.", m.getEntityClazz(),
                tr.getId());
        }

        if (e != null) {
            entities.add(e);
        }
    }
372657
public void setColumnMetadata(java.util.Collection<ColumnMetadata> columnMetadata) {
        if (columnMetadata == null) {
            this.columnMetadata = null;
            return;
        }

        this.columnMetadata = new java.util.ArrayList<ColumnMetadata>(columnMetadata);
    }