Examples of OIndexDefinition


Examples of com.orientechnologies.orient.core.index.OIndexDefinition

        for (ODocument indexEntry : indexContent) {
          if (i > 0)
            writer.append(",");

          indexEntry.setLazyLoad(false);
          final OIndexDefinition indexDefinition = index.getDefinition();

          exportEntry.reset();
          exportEntry.setLazyLoad(false);

          if (indexDefinition instanceof ORuntimeKeyIndexDefinition
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OIndexDefinition

    index = database.getMetadata().getSchema().getClass("DropPropertyIndexTestClass")
        .getClassIndex("DropPropertyIndexCompositeIndex");

    Assert.assertNotNull(index);

    final OIndexDefinition indexDefinition = index.getDefinition();

    Assert.assertTrue(indexDefinition instanceof OCompositeIndexDefinition);
    Assert.assertEquals(indexDefinition.getFields(), Arrays.asList("prop1", "prop2"));
    Assert.assertEquals(indexDefinition.getTypes(), new OType[] { EXPECTED_PROP1_TYPE, EXPECTED_PROP2_TYPE });
    Assert.assertEquals(index.getType(), "UNIQUE");
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OIndexDefinition

    final OIndex<?> index = database.getMetadata().getSchema().getClass("DropPropertyIndexTestClass")
        .getClassIndex("DropPropertyIndexCompositeIndex");

    Assert.assertNotNull(index);

    final OIndexDefinition indexDefinition = index.getDefinition();

    Assert.assertTrue(indexDefinition instanceof OCompositeIndexDefinition);
    Assert.assertEquals(indexDefinition.getFields(), Arrays.asList("prop1", "prop2"));
    Assert.assertEquals(indexDefinition.getTypes(), new OType[] { EXPECTED_PROP1_TYPE, EXPECTED_PROP2_TYPE });
    Assert.assertEquals(index.getType(), "UNIQUE");
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OIndexDefinition

       for (final OIndex<?> index : indexes) {
         json.beginObject();
         json.writeAttribute("name", index.getName());
         json.writeAttribute("type", index.getType());

         final OIndexDefinition indexDefinition = index.getDefinition();
         if (indexDefinition != null && !indexDefinition.getFields().isEmpty())
           json.writeAttribute("fields", indexDefinition.getFields());
         json.endObject();
       }
       json.endCollection();
     }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OIndexDefinition

    try {
      final OIndexManager indexManager = getDatabase().getMetadata().getIndexManager();

      final ArrayList<OIndex<?>> relatedIndexes = new ArrayList<OIndex<?>>();
      for (final OIndex<?> index : indexManager.getClassIndexes(owner.getName())) {
        final OIndexDefinition definition = index.getDefinition();

        if (OCollections.indexOf(definition.getFields(), globalRef.getName(), new OCaseInsentiveComparator()) > -1) {
          if (definition instanceof OPropertyIndexDefinition) {
            relatedIndexes.add(index);
          } else {
            throw new IllegalArgumentException("This operation applicable only for property indexes. " + index.getName() + " is "
                + index.getDefinition());
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OIndexDefinition

    acquireSchemaReadLock();
    try {
      final Set<OIndex<?>> indexes = owner.getIndexes();
      final List<OIndex<?>> indexList = new LinkedList<OIndex<?>>();
      for (final OIndex<?> index : indexes) {
        final OIndexDefinition indexDefinition = index.getDefinition();
        if (indexDefinition.getFields().contains(globalRef.getName()))
          indexList.add(index);
      }

      return indexList;
    } finally {
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OIndexDefinition

      if ((this.collate != null && !this.collate.equals(oldCollate)) || (this.collate == null && oldCollate != null)) {
        final Set<OIndex<?>> indexes = owner.getClassIndexes();
        final List<OIndex<?>> indexesToRecreate = new ArrayList<OIndex<?>>();

        for (OIndex<?> index : indexes) {
          OIndexDefinition definition = index.getDefinition();

          final List<String> fields = definition.getFields();
          if (fields.contains(getName()))
            indexesToRecreate.add(index);
        }

        if (!indexesToRecreate.isEmpty()) {
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OIndexDefinition

    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) {
      if (index.getName().equals("PropertyIndexTestClass.prop1")) {
        indexDefinition = index.getDefinition();
        break;
      }
    }

    Assert.assertNotNull(indexDefinition);
    Assert.assertEquals(indexDefinition.getParamCount(), 1);
    Assert.assertEquals(indexDefinition.getFields().size(), 1);
    Assert.assertTrue(indexDefinition.getFields().contains("prop1"));
    Assert.assertEquals(indexDefinition.getTypes().length, 1);
    Assert.assertEquals(indexDefinition.getTypes()[0], OType.STRING);

    schema.save();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OIndexDefinition

        if (!fieldName.equals("@rid") && !existingFieldNames.contains(fieldName.toLowerCase()))
          throw new OIndexException("Index with name : '" + name + "' cannot be created on class : '" + this.name
              + "' because field: '" + fieldName + "' is absent in class definition.");
      }

      final OIndexDefinition indexDefinition = OIndexDefinitionFactory.createIndexDefinition(this, Arrays.asList(fields),
          extractFieldTypes(fields), null);

      return getDatabase().getMetadata().getIndexManager()
          .createIndex(name, type, indexDefinition, polymorphicClusterIds, progressListener, metadata, algorithm);
    } finally {
View Full Code Here

Examples of com.orientechnologies.orient.core.index.OIndexDefinition

    Assert.assertNotNull(propOneIndex.get("a"));
    Assert.assertEquals(propOneIndex.getSize(), 1);

    final OIndex<?> compositeIndex = oClass.getClassIndex("classIndexManagerComposite");

    final OIndexDefinition compositeIndexDefinition = compositeIndex.getDefinition();
    Assert.assertNotNull(compositeIndex.get(compositeIndexDefinition.createValue("a", 1)));
    Assert.assertEquals(compositeIndex.getSize(), 1);

    final OIndex<?> propZeroIndex = oSuperClass.getClassIndex("classIndexManagerTestSuperClass.prop0");
    Assert.assertNotNull(propZeroIndex.get("x"));
    Assert.assertEquals(propZeroIndex.getSize(), 1);
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.