/** * {@inheritDoc} * * @param indexName * @param indexType */ public String toCreateIndexDDL(final String indexName, final String indexType, final String engine) { return createIndexDDLWithFieldType(indexName, indexType, engine).toString(); }
protected StringBuilder createIndexDDLWithFieldType(String indexName, String indexType, String engine) { final StringBuilder ddl = createIndexDDLWithoutFieldType(indexName, indexType,engine); ddl.append(' ').append(keyType.name()); return ddl; }
@Override public String toString() { return "OPropertyIndexDefinition{" + "className='" + className + '\'' + ", field='" + field + '\'' + ", keyType=" + keyType + ", collate=" + collate + ", null values ignored = " + isNullValuesIgnored() + '}'; }
@Override public OClass call(final OrientGraph g) { String indexType = configuration.getString("type"); OType keyType = (OType) configuration.getProperty("keytype"); String collate = configuration.getString("collate"); ODocument metadata = (ODocument) configuration.getProperty("metadata"); final ODatabaseDocument db = getRawDatabase(); final OSchema schema = db.getMetadata().getSchema(); final OClass cls = schema.getClass(className); final OProperty property = cls.getProperty(key); if (property != null) keyType = property.getType(); OPropertyIndexDefinition indexDefinition = new OPropertyIndexDefinition(className, key, keyType); if (collate != null) indexDefinition.setCollate(collate); db.getMetadata().getIndexManager() .createIndex(className + "." + key, indexType, indexDefinition, cls.getPolymorphicClusterIds(), null, metadata); return null; } };
final OType keyType = OType.valueOf(keyTypeStr.toUpperCase(Locale.ENGLISH)); loadedIndexDefinition = new OPropertyIndexDefinition(className, propertyName, keyType);
protected void serializeFromStream() { super.serializeFromStream(); className = document.field("className"); field = document.field("field"); final String keyTypeStr = document.field("keyType"); keyType = OType.valueOf(keyTypeStr); setCollate((String) document.field("collate")); setNullValuesIgnored(!Boolean.FALSE.equals(document.<Boolean> field("nullValuesIgnored"))); }
@Override protected final void fromStream() { serializeFromStream(); }
public Object getDocumentValueToIndex(final ODocument iDocument) { if (OType.LINK.equals(keyType)) { final OIdentifiable identifiable = iDocument.field(field); if (identifiable != null) return createValue(identifiable.getIdentity()); else return null; } return createValue(iDocument.<Object>field(field)); }
keyType = property.getType(); OPropertyIndexDefinition indexDefinition = new OPropertyIndexDefinition(className, key, keyType); if (collate != null) indexDefinition.setCollate(collate); db.getMetadata().getIndexManager() .createIndex(className + "." + key, indexType, indexDefinition, cls.getPolymorphicClusterIds(), null, metadata);
.getIndexManager() .createIndex(className + "." + key, indexType, new OPropertyIndexDefinition(className, key, keyType), cls.getPolymorphicClusterIds(), null);
indexDefinition = new OPropertyRidBagIndexDefinition(oClass.getName(), fieldName); } else indexDefinition = new OPropertyIndexDefinition(oClass.getName(), fieldName, type);
protected void serializeToStream() { super.serializeToStream(); document.field("className", className); document.field("field", field); document.field("keyType", keyType.toString()); document.field("collate", collate.getName()); document.field("nullValuesIgnored", isNullValuesIgnored()); }