Examples of OSchema


Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

  }

  private void createSchema(ODatabaseDocumentTx dbDocumentTx) {
    ODatabaseRecordThreadLocal.INSTANCE.set(dbDocumentTx);

    OSchema schema = dbDocumentTx.getMetadata().getSchema();
    if (!schema.existsClass("TestClass")) {
      OClass testClass = schema.createClass("TestClass");
      testClass.createProperty("id", OType.LONG);
      testClass.createProperty("timestamp", OType.LONG);
      testClass.createProperty("stringValue", OType.STRING);

      testClass.createIndex("idIndex", OClass.INDEX_TYPE.UNIQUE, "id");

      schema.save();
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

  }

  private void createSchema(ODatabaseDocumentTx dbDocumentTx) {
    ODatabaseRecordThreadLocal.INSTANCE.set(dbDocumentTx);

    OSchema schema = dbDocumentTx.getMetadata().getSchema();
    if (!schema.existsClass("TestClass")) {
      OClass testClass = schema.createClass("TestClass");
      testClass.createProperty("id", OType.LONG);
      testClass.createProperty("timestamp", OType.LONG);
      testClass.createProperty("stringValue", OType.STRING);
      testClass.createProperty("binaryValue", OType.BINARY);

      testClass.createIndex("idIndex", OClass.INDEX_TYPE.UNIQUE, "id");

      schema.save();
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

    this(iClassName);
    _recordId = (ORecordId) iRID;

    final ODatabaseRecordInternal database = getDatabaseInternal();
    if (_recordId.clusterId > -1 && database.getStorageVersions().classesAreDetectedByClusterId()) {
      final OSchema schema = database.getMetadata().getSchema();
      final OClass cls = schema.getClassByClusterId(_recordId.clusterId);
      if (cls != null && !cls.getName().equals(iClassName))
        throw new IllegalArgumentException("Cluster id does not correspond class name should be " + iClassName + " but found "
            + cls.getName());
    }
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

          && database.getStorageVersions().classesAreDetectedByClusterId()) {
        if (_recordId.clusterId < 0) {
          checkForLoading();
          checkForFields("@class");
        } else {
          final OSchema schema = database.getMetadata().getSchema();
          if (schema != null)
            _clazz = schema.getClassByClusterId(_recordId.clusterId);
        }
      } else {
        // CLASS NOT FOUND: CHECK IF NEED LOADING AND UNMARSHALLING
        checkForLoading();
        checkForFields("@class");
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

  }

  private void createSchema(ODatabaseDocumentTx dbDocumentTx) {
    ODatabaseRecordThreadLocal.INSTANCE.set(dbDocumentTx);

    OSchema schema = dbDocumentTx.getMetadata().getSchema();
    if (!schema.existsClass("TestClass")) {
      OClass testClass = schema.createClass("TestClass");
      testClass.createProperty("id", OType.INTEGER);
      testClass.createProperty("timestamp", OType.LONG);
      testClass.createProperty("stringValue", OType.STRING);

      testClass.createIndex("idIndex", OClass.INDEX_TYPE.UNIQUE, "id");

      schema.save();
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

  }

  private void createSchema(ODatabaseDocumentTx dbDocumentTx) {
    ODatabaseRecordThreadLocal.INSTANCE.set(dbDocumentTx);

    OSchema schema = dbDocumentTx.getMetadata().getSchema();
    if (!schema.existsClass("TestClass")) {
      OClass testClass = schema.createClass("TestClass");
      testClass.createProperty("id", OType.LONG);
      testClass.createProperty("timestamp", OType.LONG);
      testClass.createProperty("stringValue", OType.STRING);

      testClass.createIndex("idIndex", OClass.INDEX_TYPE.UNIQUE, "id");

      schema.save();
    }
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

        // OVERWRITE CLUSTER SELECTION STRATEGY
        final String nodeName = getLocalNodeName();
        final ODistributedConfiguration dbCfg = getDatabaseConfiguration(iDatabase.getName());

        final OSchema schema = ((ODatabaseComplexInternal<?>) iDatabase).getDatabaseOwner().getMetadata().getSchema();

        final Set<String> cfgClusterNames = new HashSet<String>();
        for (String c : cfg.getClusterNames())
          cfgClusterNames.add(c);

        boolean distribCfgDirty = false;
        for (OClass c : schema.getClasses()) {
          ((OClassImpl) c).setClusterSelectionInternal(new OLocalClusterStrategy(this, iDatabase.getName(), c));

          if (!c.isAbstract()) {
            final int[] clusterIds = c.getClusterIds();
            final List<String> clusterNames = new ArrayList<String>(clusterIds.length);
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

  public CompositeIndexWithNullTest(@Optional String url) {
    super(url);
  }

  public void testPointQuery() {
    final OSchema schema = database.getMetadata().getSchema();
    OClass clazz = schema.createClass("compositeIndexNullPointQueryClass");
    clazz.createProperty("prop1", OType.INTEGER);
    clazz.createProperty("prop2", OType.INTEGER);
    clazz.createProperty("prop3", OType.INTEGER);

    final ODocument metadata = new ODocument();
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

    explain = database.command(new OCommandSQL("explain " + query)).execute();
    Assert.assertTrue(explain.<Set<String>> field("involvedIndexes").contains("compositeIndexNullPointQueryIndex"));
  }

  public void testPointQueryInTx() {
    final OSchema schema = database.getMetadata().getSchema();
    OClass clazz = schema.createClass("compositeIndexNullPointQueryInTxClass");
    clazz.createProperty("prop1", OType.INTEGER);
    clazz.createProperty("prop2", OType.INTEGER);
    clazz.createProperty("prop3", OType.INTEGER);

    final ODocument metadata = new ODocument();
View Full Code Here

Examples of com.orientechnologies.orient.core.metadata.schema.OSchema

  public void testPointQueryInMiddleTx() {
    if (database.getURL().startsWith("remote:"))
      return;

    final OSchema schema = database.getMetadata().getSchema();
    OClass clazz = schema.createClass("compositeIndexNullPointQueryInMiddleTxClass");
    clazz.createProperty("prop1", OType.INTEGER);
    clazz.createProperty("prop2", OType.INTEGER);
    clazz.createProperty("prop3", OType.INTEGER);

    final ODocument metadata = new ODocument();
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.