Package com.orientechnologies.orient.core.metadata.schema

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema.createClass()


    checkNotNull(db);

    OSchema schema = db.getMetadata().getSchema();
    OClass type = schema.getClass(DB_CLASS);
    if (type == null) {
      type = schema.createClass(DB_CLASS);

      type.createProperty(P_PATH, OType.STRING).setNotNull(true);
      type.createIndex(P_PATH + "idx", INDEX_TYPE.UNIQUE, P_PATH);
      type.createProperty(P_BLOBID, OType.STRING).setNotNull(true);
      type.createProperty(P_CONTENTTYPE, OType.STRING);
View Full Code Here


    checkNotNull(db);

    OSchema schema = db.getMetadata().getSchema();
    OClass type = schema.getClass(DB_CLASS);
    if (type == null) {
      type = schema.createClass(DB_CLASS);
      type.createProperty(P_VERSION, OType.INTEGER);
      type.createProperty(P_TYPE, OType.STRING);
      type.createProperty(P_ENABLED, OType.BOOLEAN);
      type.createProperty(P_NOTES, OType.STRING);
      type.createProperty(P_PROPERTIES, OType.EMBEDDEDMAP);
View Full Code Here

    try (ODatabaseDocumentTx db = databaseManager.connect(DB_NAME, true)) {

      // entities
      final OSchema schema = db.getMetadata().getSchema();
      if (!schema.existsClass(DB_CLASS)) {
        final OClass type = schema.createClass(DB_CLASS);
        type.createProperty(P_TIMESTAMP, OType.LONG);
        type.createProperty(P_TYPE, OType.STRING);
        type.createProperty(P_SUBTYPE, OType.STRING);
        type.createProperty(P_DATA, OType.EMBEDDEDMAP, OType.STRING);
        type.createIndex(I_TYPE, INDEX_TYPE.NOTUNIQUE_HASH_INDEX, P_TYPE);
View Full Code Here

  @BeforeTest
  public void before() {
    db = new ODatabaseDocumentTx("memory:" + OCompositeIndexSQLInserTest.class.getSimpleName());
    db.create();
    OSchema schema = db.getMetadata().getSchema();
    OClass book = schema.createClass("Book");
    book.createProperty("author", OType.STRING);
    book.createProperty("title", OType.STRING);
    book.createProperty("publicationYears", OType.EMBEDDEDLIST, OType.INTEGER);
    book.createIndex("books", "unique", "author", "title", "publicationYears");
  }
View Full Code Here

  }

  @Test
  public void testShortName() {
    OSchema schema = db.getMetadata().getSchema();
    OClass oClass = schema.createClass(SHORTNAME_CLASS_NAME);
    Assert.assertNull(oClass.getShortName());
    Assert.assertNull(queryShortName());

    final OStorage storage = db.getStorage();
View Full Code Here

  }

  @Test
  public void testRename() {
    OSchema schema = db.getMetadata().getSchema();
    OClass oClass = schema.createClass("ClassName");

    final OStorage storage = db.getStorage();
    final OAbstractPaginatedStorage paginatedStorage = (OAbstractPaginatedStorage) storage;
    final ODiskCache diskCache = paginatedStorage.getDiskCache();
View Full Code Here

  }

  @Test
  public void testRenameClusterAlreadyExists() {
    OSchema schema = db.getMetadata().getSchema();
    OClass classOne = schema.createClass("ClassOne");
    OClass classTwo = schema.createClass("ClassTwo");

    final int clusterId = db.addCluster("classthree");
    classTwo.addClusterId(clusterId);
View Full Code Here

  @Test
  public void testRenameClusterAlreadyExists() {
    OSchema schema = db.getMetadata().getSchema();
    OClass classOne = schema.createClass("ClassOne");
    OClass classTwo = schema.createClass("ClassTwo");

    final int clusterId = db.addCluster("classthree");
    classTwo.addClusterId(clusterId);

    ODocument document = new ODocument("ClassTwo");
View Full Code Here

        graph
            .executeOutsideTx(new OCallable<OClass, OrientBaseGraph>() {

              @Override
              public OClass call(final OrientBaseGraph g) {
                return schema.createClass(className, schema.getClass(getBaseClassName()));

              }
            }, "Committing the active transaction to create the new type '", className, "' as subclass of '", getBaseClassName(),
                "'. The transaction will be reopen right after that. To avoid this behavior create the classes outside the transaction");
View Full Code Here

  @BeforeMethod
  public void beforeMethod() throws Exception {
    super.beforeMethod();

    final OSchema schema = database.getMetadata().getSchema();
    final OClass oClass = schema.createClass("DropPropertyIndexTestClass");
    oClass.createProperty("prop1", EXPECTED_PROP1_TYPE);
    oClass.createProperty("prop2", EXPECTED_PROP2_TYPE);
  }

  @AfterMethod
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.