本文整理汇总了Java中com.orientechnologies.orient.core.metadata.schema.OType.STRING属性的典型用法代码示例。如果您正苦于以下问题:Java OType.STRING属性的具体用法?Java OType.STRING怎么用?Java OType.STRING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.orientechnologies.orient.core.metadata.schema.OType
的用法示例。
在下文中一共展示了OType.STRING属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertType
/**
* Convert the vendor agnostic type to an orientdb specific type.
*
* @param fieldType
* @return
*/
private OType convertType(FieldType fieldType) {
switch (fieldType) {
case STRING:
return OType.STRING;
case INTEGER:
return OType.INTEGER;
case BOOLEAN:
return OType.BOOLEAN;
case STRING_SET:
return OType.EMBEDDEDSET;
case STRING_LIST:
return OType.EMBEDDEDLIST;
default:
throw new RuntimeException("Unsupported type {" + fieldType + "}");
}
}
示例2: addCustomEdgeIndex
@Override
public void addCustomEdgeIndex(String label, String indexPostfix, String... fields) {
OrientGraphNoTx noTx = factory.getNoTx();
try {
OrientEdgeType e = noTx.getEdgeType(label);
if (e == null) {
throw new RuntimeException("Could not find edge type {" + label + "}. Create edge type before creating indices.");
}
for (String key : fields) {
if (e.getProperty(key) == null) {
OType type = OType.STRING;
if (key.equals("out") || key.equals("in")) {
type = OType.LINK;
}
e.createProperty(key, type);
}
}
String name = "e." + label + "_" + indexPostfix;
name = name.toLowerCase();
if (fields.length != 0 && e.getClassIndex(name) == null) {
e.createIndex(name, OClass.INDEX_TYPE.NOTUNIQUE_HASH_INDEX, fields);
}
} finally {
noTx.shutdown();
}
}
示例3: convertToSubType
/**
* Convert the vendor agnostic type to an orientdb specific sub type (eg. string for string lists)
*
* @param fieldType
* @return
*/
private OType convertToSubType(FieldType fieldType) {
switch (fieldType) {
case STRING_SET:
return OType.STRING;
case STRING_LIST:
return OType.STRING;
default:
return null;
}
}
示例4: createIndex
/**
* Creates the SBTree index paired to this field within this logical index.
*/
protected void createIndex(final Class<?> keyClass) {
final OIndexManager indexManager = getIndexManager();
// Indexes have to be created outside transactions
final String idxName = getSBTreeIndexName(keyClass);
final boolean txWasOpen = graph.getGraph().getTransaction().isActive();
if (txWasOpen) {
graph.getConsole().println("Warning: prematurely committing a transaction so we can create index " + idxName);
graph.saveDirty();
graph.getGraph().commit();
}
// Index key type
OType keyType = OType.STRING;
if (keyClass == Byte.class || keyClass == Short.class || keyClass == Integer.class || keyClass == Long.class) {
keyType = OType.INTEGER;
} else if (keyClass == Float.class || keyClass == Double.class) {
keyType = OType.DOUBLE;
}
// Create SBTree NOTUNIQUE index
final OIndexFactory factory = OIndexes.getFactory(OClass.INDEX_TYPE.NOTUNIQUE.toString(), null);
final OSimpleKeyIndexDefinition indexDef = new OSimpleKeyIndexDefinition(factory.getLastVersion(), OType.STRING, keyType);
indexManager.createIndex(idxName, OClass.INDEX_TYPE.NOTUNIQUE.toString(), indexDef, null, null, null, null);
}
示例5: getSBTreeIndexName
protected String getSBTreeIndexName(final Class<?> keyClass) {
OType keyType = OType.STRING;
if (keyClass == Byte.class || keyClass == Short.class || keyClass == Integer.class || keyClass == Long.class) {
keyType = OType.INTEGER;
} else if (keyClass == Float.class || keyClass == Double.class) {
keyType = OType.DOUBLE;
}
return escapedName + SEPARATOR_SBTREE + keyType.name();
}