当前位置: 首页>>代码示例>>Java>>正文


Java OType类代码示例

本文整理汇总了Java中com.orientechnologies.orient.core.metadata.schema.OType的典型用法代码示例。如果您正苦于以下问题:Java OType类的具体用法?Java OType怎么用?Java OType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OType类属于com.orientechnologies.orient.core.metadata.schema包,在下文中一共展示了OType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupTypesAndIndices

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
/**
 * Setup some indices. This is highly orientdb specific and may not be easy so setup using blueprint API.
 */
private void setupTypesAndIndices() {
	try (Tx tx = graph.tx()) {
		OrientGraph g = ((OrientGraph) ((DelegatingFramedOrientGraph) tx.getGraph()).getBaseGraph());
		ODatabaseDocument rawDb = g.getRawDatabase();
		OClass e = rawDb.createEdgeClass("HAS_MEMBER");
		e.createProperty("in", OType.LINK);
		e.createProperty("out", OType.LINK);
		e.createIndex("e.has_member", OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, "out", "in");

		OClass v = rawDb.createVertexClass(Group.class.getSimpleName());
		v.createProperty("name", OType.STRING);

		v = rawDb.createVertexClass(Person.class.getSimpleName());
		v.createProperty("name", OType.STRING);
		v.createIndex(Person.class.getSimpleName() + ".name", OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, "name");
		tx.success();
	}

}
 
开发者ID:Syncleus,项目名称:Ferma-OrientDB,代码行数:23,代码来源:IndexTest.java

示例2: Auditor

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
public Auditor(Transaction t, String user) {
    this.transaction = t;
    this.auditUser = user;
    
    // verificar que la clase de auditorías exista
    if (this.transaction.getDBClass(this.ODBAUDITLOGVERTEXCLASS) == null) {
        OrientVertexType olog = this.transaction.getGraphdb().createVertexType(this.ODBAUDITLOGVERTEXCLASS);
        olog.createProperty("rid", OType.STRING);
        olog.createProperty("timestamp", OType.DATETIME);
        olog.createProperty("user", OType.STRING);
        olog.createProperty("action", OType.STRING);
        olog.createProperty("label", OType.STRING);
        olog.createProperty("log", OType.STRING);
        this.transaction.commit();
    }
    
}
 
开发者ID:mdre,项目名称:odbogm,代码行数:18,代码来源:Auditor.java

示例3: createSchemaDB

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
private void createSchemaDB(ODatabaseDocumentTx db)
{
    OSchema schema = db.getMetadata().getSchema();

    // item
    OClass item = schema.createClass("Item");

    item.createProperty("stringKey", OType.STRING).createIndex(OClass.INDEX_TYPE.UNIQUE);
    item.createProperty("intKey", OType.INTEGER).createIndex(OClass.INDEX_TYPE.UNIQUE);
    item.createProperty("date", OType.DATE).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("time", OType.DATETIME).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("text", OType.STRING);
    item.createProperty("length", OType.LONG).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("published", OType.BOOLEAN).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("title", OType.STRING).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("author", OType.STRING).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    item.createProperty("tags", OType.EMBEDDEDLIST);

}
 
开发者ID:geekflow,项目名称:light,代码行数:20,代码来源:OrientJdbcTest.java

示例4: createItem

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
private ODocument createItem(int id, ODocument doc)
{
    String itemKey = Integer.valueOf(id).toString();

    doc.setClassName("Item");
    doc.field("stringKey", itemKey);
    doc.field("intKey", id);
    String contents = "OrientDB is a deeply scalable Document-Graph DBMS with the flexibility of the Document databases and the power to manage links of the Graph databases. " + "It can work in schema-less mode, schema-full or a mix of both. Supports advanced features such as ACID Transactions, Fast Indexes, Native and SQL queries." + " It imports and exports documents in JSON." + " Graphs of hundreads of linked documents can be retrieved all in memory in few milliseconds without executing costly JOIN such as the Relational DBMSs do. " + "OrientDB uses a new indexing algorithm called MVRB-Tree, derived from the Red-Black Tree and from the B+Tree with benefits of both: fast insertion and ultra fast lookup. " + "The transactional engine can run in distributed systems supporting up to 9.223.372.036 Billions of records for the maximum capacity of 19.807.040.628.566.084 Terabytes of data distributed on multiple disks in multiple nodes. " + "OrientDB is FREE for any use. Open Source License Apache 2.0. ";
    doc.field("text", contents);
    doc.field("title", "orientDB");
    doc.field("length", contents.length());
    doc.field("published", (id % 2 > 0));
    doc.field("author", "anAuthor" + id);
    // doc.field("tags", asList("java", "orient", "nosql"), OType.EMBEDDEDLIST);
    Calendar instance = Calendar.getInstance(TimeZone.getTimeZone("UTC"));

    instance.add(Calendar.HOUR_OF_DAY, -id);
    Date time = instance.getTime();
    doc.field("date", time, OType.DATE);
    doc.field("time", time, OType.DATETIME);

    return doc;
}
 
开发者ID:geekflow,项目名称:light,代码行数:24,代码来源:OrientJdbcTest.java

示例5: initialize

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
@Override
public void initialize() {
    // method is called under unit of work (with NOTX transaction mode,
    // because orient "DDL" must be executed in this mode).

    final ODatabaseDocumentTx db = context.getConnection();
    final OSchema schema = db.getMetadata().getSchema();

    // creating class only if it isn't already exists
    // this is very naive approach: normally existing class structure must also be
    // verified and updated if necessary
    if (schema.existsClass(CLASS_NAME)) {
        return;
    }

    final OClass sampleClass = schema.createClass(CLASS_NAME);
    sampleClass.createProperty("name", OType.STRING);
    sampleClass.createProperty("amount", OType.INTEGER);
}
 
开发者ID:xvik,项目名称:guice-persist-orient-examples,代码行数:20,代码来源:ManualSchemeInitializer.java

示例6: convertType

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
/**
 * 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 + "}");
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:23,代码来源:OrientDBDatabase.java

示例7: testUpgradeSchema_TypeDoesNotYetExist

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
@Test
public void testUpgradeSchema_TypeDoesNotYetExist() throws Exception {
  service.upgradeSchema();
  try (ODatabaseDocumentTx db = database.getInstance().connect()) {
    OSchema schema = db.getMetadata().getSchema();
    OClass type = schema.getClass("key_store");
    assertThat(type, is(notNullValue()));
    OProperty prop = type.getProperty("name");
    assertThat(prop, is(notNullValue()));
    assertThat(prop.isMandatory(), is(true));
    assertThat(prop.isNotNull(), is(true));
    assertThat(prop.getType(), is(OType.STRING));
    prop = type.getProperty("bytes");
    assertThat(prop, is(notNullValue()));
    assertThat(prop.isMandatory(), is(true));
    assertThat(prop.isNotNull(), is(true));
    assertThat(prop.getType(), is(OType.BINARY));
    assertThat(type.getInvolvedIndexes("name"), hasSize(1));
    assertThat(type.getInvolvedIndexes("name").iterator().next().getType(), is("UNIQUE"));
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:22,代码来源:LegacyKeyStoreUpgradeServiceTest.java

示例8: defineType

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
@Override
protected void defineType(final OClass type) {
  type.createProperty(P_REPOSITORY_NAME, OType.STRING).setMandatory(true).setNotNull(true);
  type.createProperty(P_ASSET_NAME, OType.STRING).setMandatory(true).setNotNull(true);
  type.createProperty(P_NODE_ID, OType.STRING).setMandatory(true).setNotNull(true);
  type.createProperty(P_COUNT, OType.LONG).setMandatory(true).setNotNull(true);
  type.createProperty(P_DATE_TYPE, OType.STRING).setMandatory(true).setNotNull(true);
  type.createProperty(P_DATE, OType.DATETIME).setMandatory(true).setNotNull(true);

  type.createIndex(I_REPO_NAME_ASSET_NAME_DATE_TYPE_DATE, INDEX_TYPE.NOTUNIQUE, P_REPOSITORY_NAME, P_ASSET_NAME,
      P_DATE_TYPE, P_DATE);
  type.createIndex(I_NODE_ID_REPO_NAME_ASSET_NAME_DATE_TYPE_DATE, INDEX_TYPE.NOTUNIQUE, P_NODE_ID, P_REPOSITORY_NAME,
      P_ASSET_NAME, P_DATE_TYPE, P_DATE);
  type.createIndex(I_NODE_ID_DATE_TYPE_DATE, INDEX_TYPE.NOTUNIQUE, P_NODE_ID, P_DATE_TYPE, P_DATE);
  type.createIndex(I_REPO_NAME_DATE_TYPE_DATE, INDEX_TYPE.NOTUNIQUE, P_REPOSITORY_NAME, P_DATE_TYPE);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:17,代码来源:AssetDownloadCountEntityAdapter.java

示例9: getCount

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
public long getCount(final ODatabaseDocumentTx db, final String repositoryName, final String assetName) {
  checkNotNull(db);
  checkNotNull(repositoryName);
  checkNotNull(assetName);

  Map<String, Object> parameters = buildQueryParameters(repositoryName, assetName, DateType.DAY, null, null);
  Iterable<ODocument> docs = db.command(new OCommandSQL(TOTAL_COUNT_QUERY)).execute(parameters);

  ODocument result = Iterables.getFirst(docs, null);

  if (result != null) {
    return result.field("sum", OType.LONG);
  }

  return 0;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:17,代码来源:AssetDownloadCountEntityAdapter.java

示例10: defineType

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
@Override
protected void defineType(final OClass type) {
  type.createProperty(P_APIKEY, OType.STRING)
      .setMandatory(true)
      .setNotNull(true);
  type.createProperty(P_DOMAIN, OType.STRING)
      .setMandatory(true)
      .setNotNull(true);
  type.createProperty(P_PRIMARY_PRINCIPAL, OType.STRING)
      .setMandatory(true)
      .setNotNull(true);
  type.createProperty(P_PRINCIPALS, OType.BINARY)
      .setMandatory(true)
      .setNotNull(true);
  type.createIndex(I_APIKEY, INDEX_TYPE.UNIQUE, P_DOMAIN, P_APIKEY);
  type.createIndex(I_PRIMARY_PRINCIPAL, INDEX_TYPE.UNIQUE, P_DOMAIN, P_PRIMARY_PRINCIPAL);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:18,代码来源:ApiKeyEntityAdapter.java

示例11: setUp

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
@Before
public void setUp() {
  try (ODatabaseDocumentTx db = componentDatabase.getInstance().connect()) {
    OSchema schema = db.getMetadata().getSchema();

    OClass bucketType = schema.createClass(BUCKET_CLASS);

    OClass componentType = schema.createClass(COMPONENT_CLASS);

    componentType.createProperty(P_GROUP, OType.STRING);
    componentType.createProperty(P_NAME, OType.STRING)
        .setMandatory(true)
        .setNotNull(true);
    componentType.createProperty(P_VERSION, OType.STRING);
    componentType.createProperty(P_BUCKET, OType.LINK, bucketType).setMandatory(true).setNotNull(true);
  }

  underTest = new ComponentDatabaseUpgrade_1_2(componentDatabase.getInstanceProvider());
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:20,代码来源:ComponentDatabaseUpgrade_1_2_Test.java

示例12: defineType

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
@Override
protected void defineType(final OClass type) {
  super.defineType(type);

  type.createProperty(P_NAME, OType.STRING)
      .setMandatory(true)
      .setNotNull(true);
  type.createProperty(P_GROUP, OType.STRING)
      .setMandatory(true)
      .setNotNull(false); // nullable
  type.createProperty(P_JOB_TYPE, OType.STRING)
      .setMandatory(true)
      .setNotNull(true);

  type.createIndex(I_NAME_GROUP, INDEX_TYPE.UNIQUE, P_NAME, P_GROUP);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:17,代码来源:JobDetailEntityAdapter.java

示例13: initDatabase

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
private static void initDatabase() {
    final OServerAdmin admin = service.getServerAdmin();
    try {
        OrientDBUtils.createDatabase(admin, CLASS_NAME);
    } finally {
        admin.close();
    }

    final Optional<ODatabaseDocumentTxSupplier> dbSupplier = service.getODatabaseDocumentTxSupplier(CLASS_NAME);
    assertThat(dbSupplier.isPresent(), is(true));

    try (final ODatabase db = dbSupplier.get().get()) {
        final OClass timestampedClass = db.getMetadata().getSchema().createAbstractClass(Timestamped.class.getSimpleName());
        timestampedClass.createProperty(Timestamped.Field.created_on.name(), OType.DATETIME);
        timestampedClass.createProperty(Timestamped.Field.updated_on.name(), OType.DATETIME);

        final OClass logRecordClass = db.getMetadata().getSchema().createClass(EventLogRecord.class.getSimpleName()).setSuperClasses(ImmutableList.of(timestampedClass));
        logRecordClass.createProperty(EventLogRecord.Field.event.name(), OType.STRING);
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:21,代码来源:EmbeddedOrientDBServiceWithSSLTest.java

示例14: setupDocumentClass

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
protected static void setupDocumentClass(OClass oClass) {
	// Oversize leaves some extra space in the record, to reduce the
	// frequency in which we need to defragment. Orient sets the oversize
	// of class V at 2 by default, so we do the same.
	oClass.setOverSize(2);

	// TODO: should use constants from .graph, or there should be a way for
	// graph to tell the DB certain things so it can optimize for them.
	switch (oClass.getName()) {
	case "V_eclass":
		oClass.setOverSize(4);
		oClass.createProperty(PREFIX_INCOMING + "ofType", OType.LINKBAG);
		oClass.createProperty(PREFIX_INCOMING + "ofKind", OType.LINKBAG);
		break;
	case "V_eobject":
		oClass.createProperty(PREFIX_OUTGOING + "file", OType.LINKBAG);
		oClass.createProperty(PREFIX_OUTGOING + "ofType", OType.LINKLIST);
		oClass.createProperty(PREFIX_OUTGOING + "ofKind", OType.LINKLIST);
		break;
	case "V_file":
		oClass.createProperty(PREFIX_INCOMING + "file", OType.LINKBAG);
		break;
	}

	System.out.println("set up properties for " + oClass.getName() + ": "+ oClass.declaredProperties());
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:27,代码来源:OrientNode.java

示例15: initDatabase

import com.orientechnologies.orient.core.metadata.schema.OType; //导入依赖的package包/类
private static void initDatabase() {
    final OServerAdmin admin = service.getServerAdmin();
    try {
        OrientDBUtils.createDatabase(admin, CLASS_NAME);
    } finally {
        admin.close();
    }
    try (final ODatabase db = service.getODatabaseDocumentTxSupplier(CLASS_NAME).get().get()) {
        final OClass timestampedClass = db.getMetadata().getSchema().createAbstractClass(Timestamped.class.getSimpleName());
        timestampedClass.createProperty(Timestamped.Field.created_on.name(), OType.DATETIME);
        timestampedClass.createProperty(Timestamped.Field.updated_on.name(), OType.DATETIME);

        final OClass logRecordClass = db.getMetadata().getSchema().createClass(EventLogRecord.class.getSimpleName()).setSuperClasses(ImmutableList.of(timestampedClass));
        logRecordClass.createProperty(EventLogRecord.Field.event.name(), OType.STRING);
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:17,代码来源:OrientDBHazelcastPluginTest.java


注:本文中的com.orientechnologies.orient.core.metadata.schema.OType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。