ClassLoaderResolver clr = ec.getClassLoaderResolver(); RelationType relationType = pkMmd.getRelationType(clr); if (relationType != RelationType.NONE && MetaDataUtils.getInstance().isMemberEmbedded(ec.getMetaDataManager(), clr, pkMmd, relationType, null))
if (MetaDataUtils.isJdbcTypeNumeric(enumJdbcType))
/** * Accessor for the (LDAP) object classes for the specified class. Uses the extension "objectClass" if specified, * else the "schema" if specified. name. * @param cmd Metadata for the class * @return The object classes */ public static Set<String> getObjectClassesForClass(AbstractClassMetaData cmd) { Set<String> ocs = new LinkedHashSet<String>(); if (cmd.hasExtension("objectClass")) { ocs.addAll(Arrays.asList(cmd.getValuesForExtension("objectClass"))); } else if (cmd.getSchema() != null) { ocs.addAll(Arrays.asList(MetaDataUtils.getInstance().getValuesForCommaSeparatedAttribute(cmd.getSchema()))); } return ocs; }
/** * Convenience method to return if the array is stored in the owning table as a column. * Overrides the superclass since arrays can be stored in a single column also when the no join is * specified and the array is of a primitive/wrapper type. * @return Whether it is stored in a single column in the main table. */ protected boolean containerIsStoredInSingleColumn() { if (super.containerIsStoredInSingleColumn()) { return true; } if (mmd != null && mmd.hasArray() && mmd.getJoinMetaData() == null && MetaDataUtils.getInstance().arrayStorableAsByteArrayInSingleColumn(mmd)) { return true; } return false; }
try implTypes = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, fieldRole, clr, storeMgr.getMetaDataManager());
if (MetaDataUtils.isJdbcTypeString(jdbcType)) else if (MetaDataUtils.isJdbcTypeNumeric(jdbcType))
if (MetaDataUtils.persistColumnAsNumeric(colmd))
Class candidateClass, boolean subclasses, boolean ignoreCache, FetchPlan fetchPlan, Filter filter, StoreManager storeMgr) List<AbstractClassMetaData> cmds = MetaDataUtils.getMetaDataForCandidates(candidateClass, subclasses, ec); if (NucleusLogger.DATASTORE_NATIVE.isDebugEnabled())
String[] implNames = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, FieldRole.ROLE_COLLECTION_ELEMENT, clr, ec.getMetaDataManager()); if (implNames != null && implNames.length > 0) String[] implNames = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, FieldRole.ROLE_ARRAY_ELEMENT, clr, ec.getMetaDataManager()); if (implNames != null && implNames.length == 1)
if (MetaDataUtils.getInstance().arrayStorableAsByteArrayInSingleColumn(mmd))
private Object asEnumValue(MongoFieldExpression fieldExpr, Enum<?> value) { // Use the right type of Enum value for the property being compared against AbstractMemberMetaData mmd = fieldExpr.getMemberMetaData(); ColumnMetaData colmd = null; if (mmd != null && mmd.getColumnMetaData() != null && mmd.getColumnMetaData().length > 0) { colmd = mmd.getColumnMetaData()[0]; } if (MetaDataUtils.persistColumnAsNumeric(colmd)) { return value.ordinal(); } return value.toString(); }
public static List<Long> performMongoCount(DB db, BasicDBObject filterObject, Class candidateClass, boolean subclasses, ExecutionContext ec) throws MongoException { StoreManager storeMgr = ec.getStoreManager(); long count = 0; for (AbstractClassMetaData cmd : MetaDataUtils.getMetaDataForCandidates(candidateClass, subclasses, ec)) { Table table = storeMgr.getStoreDataForClass(cmd.getFullClassName()).getTable(); String collectionName = table.getName(); count += db.getCollection(collectionName).count(filterObject); } List<Long> results = new LinkedList<>(); results.add(count); if (ec.getStatistics() != null) { // Add to statistics ec.getStatistics().incrementNumReads(); } return results; }
if (relationType != RelationType.NONE && MetaDataUtils.getInstance().isMemberEmbedded(ec.getMetaDataManager(), clr, mmd, relationType, null))
String[] implNames = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, FieldRole.ROLE_COLLECTION_ELEMENT, clr, ec.getMetaDataManager()); if (implNames != null && implNames.length == 1) String[] implNames = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, FieldRole.ROLE_ARRAY_ELEMENT, clr, ec.getMetaDataManager()); if (implNames != null && implNames.length == 1)
String[] components = MetaDataUtils.getInstance().getValuesForCommaSeparatedAttribute(cellStr); if (Collection.class.isAssignableFrom(mmd.getType()))
/** * Initialize this JavaTypeMapping for the given member MetaData and Table owning it. * @param mmd MetaData for the member to be mapped (if any) * @param table The table storing this mapping (if any) * @param clr the ClassLoaderResolver */ public void initialize(AbstractMemberMetaData mmd, Table table, ClassLoaderResolver clr) { if (mmd != null && mmd.isSerialized()) { datastoreJavaType = ClassNameConstants.JAVA_IO_SERIALIZABLE; } else if (mmd != null) { if (MetaDataUtils.isJdbcTypeNumeric(TypeConversionHelper.getJdbcTypeForEnum(mmd, roleForMember, clr))) { datastoreJavaType = ClassNameConstants.JAVA_LANG_INTEGER; } } super.initialize(mmd, table, clr); if (storeMgr.getDatastoreAdapter().supportsOption(DatastoreAdapter.NATIVE_ENUM_TYPE)) { // TODO When this enum is using native handling then get the enum "type" from the enum, and set it on the column as the sqlType. } }
public Class getType() { if (type.isEnum()) { ColumnMetaData colmd = null; if (mmd.getColumnMetaData() != null && mmd.getColumnMetaData().length > 0) { colmd = mmd.getColumnMetaData()[0]; } if (MetaDataUtils.persistColumnAsNumeric(colmd)) { return int.class; } return String.class; } return type; }
StoreManager storeMgr = ec.getStoreManager(); ClassLoaderResolver clr = ec.getClassLoaderResolver(); List<AbstractClassMetaData> cmds = MetaDataUtils.getMetaDataForCandidates(q.getCandidateClass(), q.isSubclasses(), ec);
if (relationType != RelationType.NONE && MetaDataUtils.getInstance().isMemberEmbedded(ec.getMetaDataManager(), clr, mmd, relationType, null))
String[] implNames = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, FieldRole.ROLE_FIELD, clr, ec.getMetaDataManager()); if (implNames != null && implNames.length == 1) String[] implNames = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, FieldRole.ROLE_COLLECTION_ELEMENT, clr, ec.getMetaDataManager()); if (implNames != null && implNames.length > 0) String[] implNames = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, FieldRole.ROLE_MAP_KEY, clr, ec.getMetaDataManager()); if (implNames != null && implNames.length == 1) String[] implNames = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, FieldRole.ROLE_MAP_VALUE, clr, ec.getMetaDataManager()); if (implNames != null && implNames.length == 1) String[] implNames = MetaDataUtils.getInstance().getImplementationNamesForReferenceField(mmd, FieldRole.ROLE_ARRAY_ELEMENT, clr, ec.getMetaDataManager()); if (implNames != null && implNames.length == 1)