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

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


      if (o == null)
        continue;

      ODocument document = null;
      final OClass linkedClass;
      if (!(o instanceof ORecord<?>)) {
        final String fieldBound = OObjectSerializerHelper.getDocumentBoundField(o.getClass());
        if (fieldBound != null) {
          OObjectSerializerHelper.invokeCallback(o, null, OBeforeSerialization.class);
          document = (ODocument) OObjectSerializerHelper.getFieldValue(o, fieldBound);
View Full Code Here


        if (iLinkedRecord.getDatabase() == null && iParentRecord != null)
          // OVERWRITE THE DATABASE TO THE SAME OF THE PARENT ONE
          iLinkedRecord.setDatabase(iParentRecord.getDatabase());

        if (iLinkedRecord instanceof ODocument) {
          final OClass schemaClass = ((ODocument) iLinkedRecord).getSchemaClass();
          iLinkedRecord.getDatabase().save(iLinkedRecord,
              schemaClass != null ? iLinkedRecord.getDatabase().getClusterNameById(schemaClass.getDefaultClusterId()) : null);
        } else
          // STORE THE TRAVERSED OBJECT TO KNOW THE RECORD ID. CALL THIS VERSION TO AVOID CLEAR OF STACK IN THREAD-LOCAL
          iLinkedRecord.getDatabase().save(iLinkedRecord);

        iLinkedRecord.getDatabase().registerPojo(iLinkedRecord.getDatabase().getUserObjectByRecord(iLinkedRecord, null),
View Full Code Here

    else {
      // CLASS
      if (subjectName.startsWith(OCommandExecutorSQLAbstract.CLASS_PREFIX))
        subjectName = subjectName.substring(OCommandExecutorSQLAbstract.CLASS_PREFIX.length());

      final OClass cls = database.getMetadata().getSchema().getClass(subjectName);
      if (cls == null)
        throw new OCommandSQLParsingException("Class " + subjectName + " not found in database", text, pos);

      className = cls.getName();
    }

    final int beginFields = OStringParser.jumpWhiteSpaces(text, pos);
    if (beginFields == -1 || text.charAt(beginFields) != '(')
      throw new OCommandSQLParsingException("Set of fields is missed. Example: (name, surname)", text, pos);
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

   */
  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");

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

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

    if (prop.getIndex() == null)
      throw new IllegalArgumentException("Property '" + cls + "." + field + "' has not index");
View Full Code Here

      rid = (ORecordId) primaryKey;
    else if (primaryKey instanceof String)
      rid = new ORecordId((String) primaryKey);
    else if (primaryKey instanceof Number) {
      // COMPOSE THE RID
      OClass cls = database.getMetadata().getSchema().getClass(entityClass);
      if (cls == null)
        throw new IllegalArgumentException("Class '" + entityClass + "' is not configured in the database");
      rid = new ORecordId(cls.getDefaultClusterId(), ((Number) primaryKey).longValue());
    } else
      throw new IllegalArgumentException("PrimaryKey '" + primaryKey + "' type (" + primaryKey.getClass() + ") is not supported");

    return (T) database.load(rid);
  }
View Full Code Here

      throw new IllegalArgumentException("The document received is not a vertex. Found class '" + iVertex.getSchemaClass() + "'");
  }

  public void checkVertexClass(final String iVertexTypeName) {
    if (iVertexTypeName != null) {
      final OClass cls = getMetadata().getSchema().getClass(iVertexTypeName);
      if (cls == null)
        throw new IllegalArgumentException("The class '" + iVertexTypeName + "' was not found");

      if (!cls.isSubClassOf(vertexBaseClass))
        throw new IllegalArgumentException("The class '" + iVertexTypeName + "' doesn't extend the vertex type");
    }
  }
View Full Code Here

      throw new OCommandExecutionException("Native queries can run only in embedded-local version. Not in the remote one.");

    queryRecord.setSourceQuery(this);

    // CHECK IF A CLASS WAS CREATED
    OClass cls = database.getMetadata().getSchema().getClass(cluster);
    if (cls == null)
      throw new OCommandExecutionException("Cluster " + cluster + " was not found");

    ((OStorageEmbedded) database.getStorage()).browse(cls.getPolymorphicClusterIds(), null, null, this, record, false);
    return null;
  }
View Full Code Here

      iOutput.append(OStringSerializerHelper.CLASS_SEPARATOR);
    }

    OProperty prop;
    OType type;
    OClass linkedClass;
    OType linkedType;
    String fieldClassName;
    int i = 0;

    final Set<String> fieldNamesIterator = iOnlyDelta && record.isTrackingChanges() ? record.getDirtyFields() : record.fieldNames();
View Full Code Here

    return iValue != null ? iValue.getClass().getSimpleName() : null;
  }

  private OClass getLinkInfo(final ODatabaseComplex<?> iDatabase, final String iFieldClassName) {
    OClass linkedClass = iDatabase.getMetadata().getSchema().getClass(iFieldClassName);

    if (iDatabase.getDatabaseOwner() instanceof ODatabaseObject) {
      ODatabaseObject dbo = (ODatabaseObject) iDatabase.getDatabaseOwner();
      if (linkedClass == null) {
        Class<?> entityClass = dbo.getEntityManager().getEntityClass(iFieldClassName);
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.