Examples of OProperty


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

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

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

      final OProperty prop = cls.createProperty(urlParts[3], OType.STRING);

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

    } finally {
View Full Code Here

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

        OClass c = database.getMetadata().getSchema().getClass("Account");
        if (c == null)
          c = database.getMetadata().getSchema().createClass("Account");

        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);
      }
    }
View Full Code Here

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

      synchronized (this) {
        OClass c = database.getMetadata().getSchema().getClass("Account");
        if (c == null)
          c = database.getMetadata().getSchema().createClass("Account");

        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);
      }
    }
View Full Code Here

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

    else
      fieldValue = iCondition.getLeft().toString();

    String className = iTargetClasses.get(0);

    final OProperty prop = iDatabase.getMetadata().getSchema().getClass(className).getProperty(fieldName);
    if (prop == null)
      // NO PROPERTY DEFINED
      return null;

    final OPropertyIndex index = prop.getIndex();
    if (index == null || !(index.getUnderlying() instanceof OIndexFullText))
      // NO FULL TEXT INDEX
      return null;

    return index.getUnderlying().get(fieldValue);
View Full Code Here

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

    if (iItem == null || !(iItem instanceof OSQLFilterItemField))
      return false;

    OSQLFilterItemField item = (OSQLFilterItemField) iItem;

    final OProperty prop = iSchemaClass.getProperty(item.getName());
    if (prop != null && prop.isIndexed()) {
      // TODO: IMPROVE THIS MANAGEMENT
      // ONLY EQUALS IS SUPPORTED NOW!
      OIndex idx = prop.getIndex().getUnderlying();
      idx = idx.getInternal();

      if (((idx instanceof OIndexUnique || idx instanceof OIndexNotUnique) && iCondition.getOperator() instanceof OQueryOperatorEquals)
          || idx instanceof OIndexFullText && iCondition.getOperator() instanceof OQueryOperatorContainsText) {
        Object value = iCondition.getLeft() == iItem ? iCondition.getRight() : iCondition.getLeft();
        if (value != null) {
          if (value instanceof OSQLFilterItemParameter)
            value = ((OSQLFilterItemParameter) value).getValue(null);

          final Collection<?> resultSet = prop.getIndex().getUnderlying().get(value);
          if (resultSet != null && resultSet.size() > 0)
            for (Object o : resultSet) {
              if (o instanceof ORID)
                iResultSet.add(database.load((ORID) o));
              else
View Full Code Here

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

      // MARSHALL THE CLASSNAME
      iOutput.append(record.getClassName());
      iOutput.append(OStringSerializerHelper.CLASS_SEPARATOR);
    }

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

    // MARSHALL ALL THE CONFIGURED FIELDS
    for (Entry<String, Object> f : record) {
      if (i > 0)
        iOutput.append(OStringSerializerHelper.RECORD_SEPARATOR);

      // SEARCH FOR A CONFIGURED PROPERTY
      prop = record.getSchemaClass() != null ? record.getSchemaClass().getProperty(f.getKey()) : null;
      fieldValue = f.getValue();
      fieldClassName = getClassName(fieldValue);

      type = record.fieldType(f.getKey());
      linkedClass = null;
      linkedType = null;

      if (prop != null) {
        // RECOGNIZED PROPERTY
        type = prop.getType();
        linkedClass = prop.getLinkedClass();
        linkedType = prop.getLinkedType();

      } else if (fieldValue != null) {
        // NOT FOUND: TRY TO DETERMINE THE TYPE FROM ITS CONTENT
        if (fieldValue.getClass() == byte[].class) {
          type = OType.BINARY;
View Full Code Here

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

    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) {
      field = fields.get(i).trim();

      try {
        pos = field.indexOf(FIELD_VALUE_SEPARATOR);
        if (pos > -1) {
          // GET THE FIELD NAME
          fieldName = field.substring(0, pos);

          // GET THE FIELD VALUE
          fieldValue = field.length() > pos + 1 ? field.substring(pos + 1) : null;

          // SEARCH FOR A CONFIGURED PROPERTY
          prop = record.getSchemaClass() != null ? record.getSchemaClass().getProperty(fieldName) : null;
          if (prop != null) {
            // RECOGNIZED PROPERTY
            type = prop.getType();
            linkedClass = prop.getLinkedClass();
            linkedType = prop.getLinkedType();

          } else {
            type = iRecord instanceof ODocument ? ((ODocument) iRecord).fieldType(fieldName) : null;
            linkedClass = null;
            linkedType = null;
View Full Code Here

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

    if (iFieldValue.equals("null"))
      return null;

    if (iFieldName != null)
      if (iRecord.getSchemaClass() != null) {
        final OProperty p = iRecord.getSchemaClass().getProperty(iFieldName);
        if (p != null) {
          iType = p.getType();
          iLinkedType = p.getLinkedType();
        }
      }

    if (iFieldValue.startsWith("{") && iFieldValue.endsWith("}")) {
      // OBJECT OR MAP. CHECK THE TYPE ATTRIBUTE TO KNOW IT
View Full Code Here

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

    for (Map.Entry<String, Object> entry : addEntries.entrySet()) {
      coll = null;
      if (!record.containsField(entry.getKey())) {
        // GET THE TYPE IF ANY
        if (record.getSchemaClass() != null) {
          OProperty prop = record.getSchemaClass().getProperty(entry.getKey());
          if (prop != null && prop.getType() == OType.LINKSET)
            // SET TYPE
            coll = new HashSet<Object>();
        }

        if (coll == null)
View Full Code Here

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

    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);

    return prop.getIndex().getUnderlying().size();
  }
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.