Examples of OClass


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

  @SuppressWarnings("unused")
  @Test
  public void populate() {
    database.open("admin", "admin");

    OClass vehicleClass = database.getMetadata().getSchema().getClass("GraphVehicle");
//    if (vehicleClass != null) {
//      database.getMetadata().getSchema().dropClass("GraphCar");
//      database.getMetadata().getSchema().dropClass("GraphMotocycle");
//      database.getMetadata().getSchema().dropClass("GraphVehicle");
//
View Full Code Here

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

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

      if (depthLevel == null) {
        OClass cls = doc.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

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

        // 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

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

    database.addCluster("csv", OStorage.CLUSTER_TYPE.PHYSICAL);
    database.addCluster("flat", OStorage.CLUSTER_TYPE.PHYSICAL);
    database.addCluster("binary", OStorage.CLUSTER_TYPE.PHYSICAL);

    OClass account = database.getMetadata().getSchema()
        .createClass("Account", database.addCluster("account", OStorage.CLUSTER_TYPE.PHYSICAL));
    account.createProperty("id", OType.INTEGER);
    account.createProperty("birthDate", OType.DATE);
    account.createProperty("binary", OType.BINARY);

    database.getMetadata().getSchema().createClass("Company", account);

    OClass profile = database.getMetadata().getSchema()
        .createClass("Profile", database.addCluster("profile", OStorage.CLUSTER_TYPE.PHYSICAL));
    profile.createProperty("nick", OType.STRING).setMin("3").setMax("30").createIndex(INDEX_TYPE.UNIQUE);
    profile.createProperty("name", OType.STRING).setMin("3").setMax("30").createIndex(INDEX_TYPE.NOTUNIQUE);
    profile.createProperty("surname", OType.STRING).setMin("3").setMax("30");
    profile.createProperty("registeredOn", OType.DATETIME).setMin("2010-01-01 00:00:00");
    profile.createProperty("lastAccessOn", OType.DATETIME).setMin("2010-01-01 00:00:00");
    profile.createProperty("photo", OType.TRANSIENT);

    OClass whiz = database.getMetadata().getSchema().createClass("Whiz");
    whiz.createProperty("id", OType.INTEGER);
    whiz.createProperty("account", OType.LINK, profile);
    whiz.createProperty("date", OType.DATE).setMin("2010-01-01");
    whiz.createProperty("text", OType.STRING).setMandatory(true).setMin("1").setMax("140").createIndex(INDEX_TYPE.FULLTEXT);
    whiz.createProperty("replyTo", OType.LINK, profile);

    database.close();
  }
View Full Code Here

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

  @Test
  public void geoSchema() {
    database.open("admin", "admin");

    final OClass mapPointClass = database.getMetadata().getSchema().createClass("MapPoint");
    mapPointClass.createProperty("x", OType.DOUBLE).createIndex(INDEX_TYPE.NOTUNIQUE);
    mapPointClass.createProperty("y", OType.DOUBLE).createIndex(INDEX_TYPE.NOTUNIQUE);

    final OPropertyIndex xIndex = database.getMetadata().getSchema().getClass("MapPoint").getProperty("x").getIndex();
    Assert.assertNotNull(xIndex);

    final OPropertyIndex yIndex = database.getMetadata().getSchema().getClass("MapPoint").getProperty("y").getIndex();
View Full Code Here

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

  @Test
  public void populate() {
    database.open("admin", "admin");

    OClass vehicleClass = database.createVertexType("GraphVehicle");

    database.createVertexType("GraphCar", vehicleClass);
    database.createVertexType("GraphMotocycle", "GraphVehicle");

    ODocument carNode = (ODocument) database.createVertex("GraphCar").field("brand", "Hyundai").field("model", "Coupe")
View Full Code Here

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

        continue;

      OIdentifiable id = null;
      ODocument doc = null;

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

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

        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().registerUserObject(iLinkedRecord.getDatabase().getUserObjectByRecord(iLinkedRecord, null),
View Full Code Here

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

    populateDatabase();
    database.close();
  }

  private void createSchema() {
    OClass worker = database.getMetadata().getSchema().createClass(WORKER);
    OClass workplace = database.getMetadata().getSchema().createClass(WORKPLACE);
    OClass car = database.getMetadata().getSchema().createClass(CAR);

    worker.createProperty("name", OType.STRING);
    worker.createProperty("surname", OType.STRING);
    worker.createProperty("colleagues", OType.LINKLIST, worker);
    worker.createProperty("car", OType.LINK, car);

    workplace.createProperty("name", OType.STRING);
    workplace.createProperty("boss", OType.LINK, workplace);
    workplace.createProperty("workers", OType.LINKLIST, workplace);

    car.createProperty("plate", OType.STRING);
    car.createProperty("owner", OType.LINK, worker);

    database.getMetadata().getSchema().save();
  }
View Full Code Here

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

    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
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.