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

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


    String field;
    String fieldName = null;
    String fieldValue;
    OType type = null;
    OClass linkedClass;
    OType linkedType;
    OProperty prop;

    // UNMARSHALL ALL THE FIELDS
    for (int i = 0; i < fields.size(); ++i) {
View Full Code Here


      db = getProfiledDatabaseInstance(iRequest);

      if (db.getMetadata().getSchema().getClass(urlParts[2]) != null)
        throw new IllegalArgumentException("Class '" + urlParts[2] + "' already exists");

      final OClass cls = db.getMetadata().getSchema().createClass(urlParts[2]);
      db.getMetadata().getSchema().save();

      sendTextContent(iRequest, OHttpUtils.STATUS_CREATED_CODE, OHttpUtils.STATUS_CREATED_DESCRIPTION, null,
          OHttpUtils.CONTENT_TEXT_PLAIN, cls.getId());

    } finally {
      if (db != null)
        OSharedDocumentDatabase.release(db);
    }
View Full Code Here

    if (iFetchPlan != null) {
      // GET THE FETCH PLAN FOR THE GENERIC FIELD IF SPECIFIED
      depthLevel = iFetchPlan.get(iFieldName);

      if (depthLevel == null) {
        OClass cls = record.getSchemaClass();
        while (cls != null && depthLevel == null) {
          depthLevel = iFetchPlan.get(cls.getName() + "." + iFieldName);

          if (depthLevel == null)
            cls = cls.getSuperClass();
        }
      }
    } else
      // INFINITE
      depthLevel = -1;
View Full Code Here

      throw new OCommandExecutionException("Can't execute the command because it hasn't been parsed yet");

    if (database.getMetadata().getSchema().existsClass(className))
      throw new OCommandExecutionException("Class " + className + " already exists");

    final OClass sourceClass = ((OSchemaProxy) database.getMetadata().getSchema()).createClassInternal(className, superClass,
        clusterIds);
    return sourceClass.getId();
  }
View Full Code Here

    return false;
  }

  protected void checkIndexedProperties(final ODocument iRecord) {
    final OClass cls = iRecord.getSchemaClass();
    if (cls == null)
      return;

    OPropertyIndex index;
    for (OProperty prop : cls.getIndexedProperties()) {
      index = prop.getIndex();
      if (index != null)
        index.checkEntry(iRecord);
    }
  }
View Full Code Here

    }
  }

  protected Map<OProperty, Object> getIndexedProperties(final ODocument iRecord) {
    final ORecordSchemaAware<?> record = iRecord;
    final OClass cls = record.getSchemaClass();
    if (cls == null)
      return null;

    OPropertyIndex index;
    Object fieldValue;

    Map<OProperty, Object> indexedProperties = null;

    for (OProperty prop : cls.getIndexedProperties()) {
      index = prop.getIndex();
      if (index != null) {
        if (prop.getType() == OType.LINK)
          // GET THE RID TO AVOID LOADING
          fieldValue = record.field(prop.getName(), OType.LINK);
View Full Code Here

      db = getProfiledDatabaseInstance(iRequest);

      if (db.getMetadata().getSchema().getClass(urlParts[2]) == null)
        throw new IllegalArgumentException("Invalid class '" + urlParts[2] + "'");

      final OClass cls = db.getMetadata().getSchema().getClass(urlParts[2]);

      cls.removeProperty(urlParts[3]);

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

      sendTextContent(iRequest, OHttpUtils.STATUS_OK_CODE, "OK", null, OHttpUtils.CONTENT_TEXT_PLAIN, null);
View Full Code Here

   */
  public Object execute(final Map<Object, Object> iArgs) {
    if (field == null)
      throw new OCommandExecutionException("Can't execute the command because it hasn't been parsed yet");

    OClass cls = database.getMetadata().getSchema().getClass(sourceClassName);
    if (cls == null)
      throw new OCommandExecutionException("Class '" + sourceClassName + "' not found");

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

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

View Full Code Here

        // FOUND
        if (id instanceof ORecordId) {
          return (ORecordId) id;
        } else if (id instanceof Number) {
          // TREATS AS CLUSTER POSITION
          final OClass cls = iDb.getMetadata().getSchema().getClass(iPojo.getClass());
          if (cls == null)
            throw new OConfigurationException("Class " + iPojo.getClass() + " is not managed by current database");

          return new ORecordId(cls.getDefaultClusterId(), ((Number) id).longValue());
        } else if (id instanceof String)
          return new ORecordId((String) id);
      }
    }
    return null;
View Full Code Here

  /**
   * Returns the number of the records of the class iClassName.
   */
  public long countClass(final String iClassName) {
    final OClass cls = getMetadata().getSchema().getClass(iClassName);

    if (cls == null)
      throw new IllegalArgumentException("Class '" + iClassName + "' not found in database");

    return cls.count();
  }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.metadata.schema.OClass

Copyright © 2018 www.massapicom. 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.