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

Examples of com.orientechnologies.orient.core.metadata.schema.OProperty.createIndex()


        OProperty p = database.getMetadata().getSchema().getClass("Account").getProperty("id");
        if (p == null)
          p = database.getMetadata().getSchema().getClass("Account").createProperty("id", OType.INTEGER);

        if (!p.isIndexed())
          p.createIndex(INDEX_TYPE.NOTUNIQUE);
      }
    }

    public void cycle() {
      record.reset();
View Full Code Here


        OProperty p = database.getMetadata().getSchema().getClass("Account").getProperty("id");
        if (p == null)
          p = database.getMetadata().getSchema().getClass("Account").createProperty("id", OType.INTEGER);

        if (!p.isIndexed())
          p.createIndex(INDEX_TYPE.NOTUNIQUE);
      }
    }

    public void cycle() {
      record.reset();
View Full Code Here

    OProperty prop = cls.getProperty(field);
    if (prop == null)
      throw new IllegalArgumentException("Property '" + field + "' was not found in class '" + cls + "'");

    prop.createIndex(indexType.toUpperCase(), progressListener);

    return prop.getIndex().getUnderlying().size();
  }
}
View Full Code Here

        if (fields.get("min") != null)
          prop.setMin(fields.get("min"));
        if (fields.get("max") != null)
          prop.setMax(fields.get("max"));
        if (fields.get("indexed") != null)
          prop.createIndex(fields.get("indexed").equals("Unique") ? OProperty.INDEX_TYPE.UNIQUE : OProperty.INDEX_TYPE.NOTUNIQUE);

        db.getMetadata().getSchema().save();

        sendTextContent(iRequest, OHttpUtils.STATUS_OK_CODE, "OK", null, OHttpUtils.CONTENT_TEXT_PLAIN,
            "Property " + fields.get("name") + " created successfully with id=" + prop.getId());
View Full Code Here

        OProperty p = database.getMetadata().getSchema().getClass("Account").getProperty("id");
        if (p == null)
          p = database.getMetadata().getSchema().getClass("Account").createProperty("id", OType.INTEGER);

        if (!p.isIndexed())
          p.createIndex(INDEX_TYPE.NOTUNIQUE);
      }
    }

    public void cycle() {
      record.reset();
View Full Code Here

      OProperty p = userClass.getProperty("name");
      if (p == null)
        p = userClass.createProperty("name", OType.STRING).setMandatory(true).setNotNull(true);

      if (userClass.getInvolvedIndexes("name") == null)
        p.createIndex(INDEX_TYPE.UNIQUE);

      // ROLE
      final OClass roleClass = getDatabase().getMetadata().getSchema().getClass("ORole");

      if (!roleClass.existsProperty("inheritedRole")) {
View Full Code Here

      p = roleClass.getProperty("name");
      if (p == null)
        p = roleClass.createProperty("name", OType.STRING).setMandatory(true).setNotNull(true);

      if (roleClass.getInvolvedIndexes("name") == null)
        p.createIndex(INDEX_TYPE.UNIQUE);
    }

  }

  public void createClassTrigger() {
View Full Code Here

 
  private void createNewIndexClass(ODatabaseRecordTx db){
    Logger.info("...creating INDEX CLASS...");
    OClass indexClass = db.getMetadata().getSchema().createClass(IndexDao.MODEL_NAME);
    OProperty keyProp = indexClass.createProperty("key", OType.STRING);
    keyProp.createIndex(INDEX_TYPE.UNIQUE);
    keyProp.setNotNull(true).setMandatory(true);
  }
 
  private void updateIndices(ODatabaseRecordTx db){
    List<String> indicesName = Arrays.asList(new String [] {
View Full Code Here

  public void testCreateUniqueIndex() {
    final OSchema schema = database.getMetadata().getSchema();
    final OClass oClass = schema.getClass("PropertyIndexTestClass");
    final OProperty propOne = oClass.getProperty("prop1");

    propOne.createIndex(OClass.INDEX_TYPE.UNIQUE);

    final Collection<OIndex<?>> indexes = propOne.getIndexes();
    OIndexDefinition indexDefinition = null;

    for (final OIndex<?> index : indexes) {
View Full Code Here

      OProperty p = database.getMetadata().getSchema().getClass("Account").getProperty("id");
      if (p == null)
        p = database.getMetadata().getSchema().getClass("Account").createProperty("id", OType.INTEGER);

      if (!p.isIndexed())
        p.createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
    }

    System.out.println("\nTotal objects in Animal cluster before the test: " + foundObjects);
  }
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.