Examples of OType


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

          iType = OType.LINKMAP;
      }
    }

    Object result = iMultiValue;
    final OType linkedType;

    // CREATE THE RETURN MULTI VALUE OBJECT BASED ON DISCOVERED TYPE
    if (iType.equals(OType.EMBEDDEDSET) || iType.equals(OType.LINKSET)) {
      result = new HashSet<Object>();
    } else if (iType.equals(OType.EMBEDDEDLIST) || iType.equals(OType.LINKLIST)) {
View Full Code Here

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

   * @return field value if defined, otherwise null
   */
  public <RET> RET field(final String iFieldName) {
    RET value = this.<RET> rawField(iFieldName);

    final OType t = fieldType(iFieldName);

    if (_lazyLoad && value instanceof ORID && t != OType.LINK && _database != null) {
      // CREATE THE DOCUMENT OBJECT IN LAZY WAY
      value = (RET) _database.load((ORID) value);
      _fieldValues.put(iFieldName, value);
View Full Code Here

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

      if (!fieldValue.toString().matches(p.getRegexp()))
        throw new OValidationException("The field '" + p.getName() + "' doesn't match the regular expression '" + p.getRegexp()
            + "'. Field value is: " + fieldValue);
    }

    final OType type = p.getType();

    if (p.getMin() != null) {
      String min = p.getMin();

      if (p.getType().equals(OType.STRING) && (fieldValue != null && ((String) fieldValue).length() < Integer.parseInt(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName()
            + "' contains less characters than " + min + " requested");
      else if (p.getType().equals(OType.BINARY) && (fieldValue != null && ((byte[]) fieldValue).length < Integer.parseInt(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' contains less bytes than "
            + min + " requested");
      else if (p.getType().equals(OType.INTEGER) && (fieldValue != null && type.asInt(fieldValue) < Integer.parseInt(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is minor than " + min);
      else if (p.getType().equals(OType.LONG) && (fieldValue != null && type.asLong(fieldValue) < Long.parseLong(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is minor than " + min);
      else if (p.getType().equals(OType.FLOAT) && (fieldValue != null && type.asFloat(fieldValue) < Float.parseFloat(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is minor than " + min);
      else if (p.getType().equals(OType.DOUBLE) && (fieldValue != null && type.asDouble(fieldValue) < Double.parseDouble(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is minor than " + min);
      else if (p.getType().equals(OType.DATE)) {
        try {
          if (fieldValue != null
              && ((Date) fieldValue).before(iRecord.getDatabase().getStorage().getConfiguration().getDateFormatInstance()
                  .parse(min)))
            throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' contains the date "
                + fieldValue + "that is before the date accepted (" + min + ")");
        } catch (ParseException e) {
        }
      } else if (p.getType().equals(OType.DATETIME)) {
        try {
          if (fieldValue != null
              && ((Date) fieldValue).before(iRecord.getDatabase().getStorage().getConfiguration().getDateTimeFormatInstance()
                  .parse(min)))
            throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' contains the datetime "
                + fieldValue + "that is before the datetime accepted (" + min + ")");
        } catch (ParseException e) {
        }
      } else if (p.getType().equals(OType.EMBEDDEDLIST) || p.getType().equals(OType.EMBEDDEDSET)
          || p.getType().equals(OType.LINKLIST) || p.getType().equals(OType.LINKSET)
          && (fieldValue != null && ((Collection<?>) fieldValue).size() < Integer.parseInt(min)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' contains less items then "
            + min + " requested");
    }

    if (p.getMax() != null) {
      String max = p.getMax();

      if (p.getType().equals(OType.STRING) && (fieldValue != null && ((String) fieldValue).length() > Integer.parseInt(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName()
            + "' contains more characters than " + max + " requested");
      else if (p.getType().equals(OType.BINARY) && (fieldValue != null && ((byte[]) fieldValue).length > Integer.parseInt(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' contains more bytes than "
            + max + " requested");
      else if (p.getType().equals(OType.INTEGER) && (fieldValue != null && type.asInt(fieldValue) > Integer.parseInt(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is major than " + max);
      else if (p.getType().equals(OType.LONG) && (fieldValue != null && type.asLong(fieldValue) > Long.parseLong(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is major than " + max);
      else if (p.getType().equals(OType.FLOAT) && (fieldValue != null && type.asFloat(fieldValue) > Float.parseFloat(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is major than " + max);
      else if (p.getType().equals(OType.DOUBLE) && (fieldValue != null && type.asDouble(fieldValue) > Double.parseDouble(max)))
        throw new OValidationException("The field '" + iRecord.getClassName() + "." + p.getName() + "' is major than " + max);
      else if (p.getType().equals(OType.DATE)) {
        try {
          if (fieldValue != null
              && ((Date) fieldValue).before(iRecord.getDatabase().getStorage().getConfiguration().getDateFormatInstance()
View Full Code Here

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

      iOutput.append(record.getSchemaClass().getStreamableName());
      iOutput.append(OStringSerializerHelper.CLASS_SEPARATOR);
    }

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

    final String[] fieldNames = iOnlyDelta && record.isTrackingChanges() ? record.getDirtyFields() : record.fieldNames();
View Full Code Here

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

    final List<String> fields = OStringSerializerHelper.smartSplit(iContent, OStringSerializerHelper.RECORD_SEPARATOR);

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

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

    return fieldValue;
  }

  public static Object parseStringNumber(final String iValue) {
    final OType t = ORecordSerializerCSVAbstract.getType(iValue);

    if (t == OType.INTEGER)
      return Integer.parseInt(iValue);
    else if (t == OType.LONG)
      return Long.parseLong(iValue);
View Full Code Here

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

      // @COMPATIBILITY 1.0rc4 IGNORE THE ID
      next = jsonReader.readString(OJSONReader.COMMA_SEPARATOR);

    next = jsonReader.checkContent("\"type\"").readString(OJSONReader.NEXT_IN_OBJECT);

    final OType type = OType.valueOf(next);

    String attrib;
    String value;

    String min = null;
    String max = null;
    String linkedClass = null;
    OType linkedType = null;
    String indexName = null;
    String indexType = null;
    boolean mandatory = false;
    boolean notNull = false;
View Full Code Here

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

      throw new OCommandExecutionException("Property '" + className + "." + fieldName
          + "' already exists. Remove it before to retry.");

    // CREATE THE PROPERTY
    OClass linkedClass = null;
    OType linkedType = null;
    if (linked != null) {
      // FIRST SEARCH BETWEEN CLASSES
      linkedClass = database.getMetadata().getSchema().getClass(linked);

      if (linkedClass == null)
View Full Code Here

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

    if ("add".equals(operation)) {
      iRequest.data.commandInfo = "Studio add property";

      try {
        OType type = OType.valueOf(fields.get("type"));

        OPropertyImpl prop;
        if (type == OType.LINK || type == OType.LINKLIST || type == OType.LINKSET || type == OType.LINKMAP)
          prop = (OPropertyImpl) cls.createProperty(fields.get("name"), type,
              db.getMetadata().getSchema().getClass(fields.get("linkedClass")));
View Full Code Here

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

    return fieldValue;
  }

  public static Object parseStringNumber(final String iValue) {
    final OType t = ORecordSerializerCSVAbstract.getType(iValue);

    if (t == OType.INTEGER)
      return Integer.parseInt(iValue);
    else if (t == OType.LONG)
      return Long.parseLong(iValue);
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.