Package com.orientechnologies.orient.core.exception

Examples of com.orientechnologies.orient.core.exception.OSchemaException


    lock.acquireExclusiveLock();
    try {

      final OClass cls = classes.get(key);
      if (cls == null)
        throw new OSchemaException("Class " + iClassName + " was not found in current database");

      if (cls.getBaseClasses() != null)
        throw new OSchemaException("Class " + iClassName
            + " can't be dropped since has sub classes. Remove the dependencies before to drop it again");

      final StringBuilder cmd = new StringBuilder("drop class ");
      cmd.append(iClassName);
View Full Code Here


    lock.acquireExclusiveLock();
    try {

      final OClass cls = classes.get(key);
      if (cls == null)
        throw new OSchemaException("Class " + iClassName + " was not found in current database");

      if (cls.getBaseClasses() != null)
        throw new OSchemaException("Class " + iClassName
            + " can't be dropped since has sub classes. Remove the dependencies before to drop it again");

      if (cls.getSuperClass() != null) {
        // REMOVE DEPENDENCY FROM SUPERCLASS
        ((OClassImpl) cls.getSuperClass()).baseClasses.remove(cls);
View Full Code Here

    } finally {
      lock.releaseSharedLock();
    }

    throw new OSchemaException("Class #" + iClassId + " was not found in current database");
  }
View Full Code Here

  private void checkForDateFormat(final String iDateAsString) {
    if (type == OType.DATE) {
      try {
        owner.owner.getDocument().getDatabase().getStorage().getConfiguration().getDateFormatInstance().parse(iDateAsString);
      } catch (ParseException e) {
        throw new OSchemaException("Invalid date format setted", e);
      }
    } else if (type == OType.DATETIME) {
      try {
        owner.owner.getDocument().getDatabase().getStorage().getConfiguration().getDateTimeFormatInstance().parse(iDateAsString);
      } catch (ParseException e) {
        throw new OSchemaException("Invalid datetime format setted", e);
      }
    }
  }
View Full Code Here

    if (iClusterId == -1)
      return;

    for (OClass clazz : getMetadata().getSchema().getClasses()) {
      if (clazz.getDefaultClusterId() == iClusterId)
        throw new OSchemaException("Cannot drop the cluster '" + getClusterNameById(iClusterId) + "' because the classes ['"
            + clazz.getName() + "'] are bound to it. Drop these classes before dropping the cluster");
      else if (clazz.getClusterIds().length > 1) {
        for (int i : clazz.getClusterIds()) {
          if (i == iClusterId)
            throw new OSchemaException("Cannot drop the cluster '" + getClusterNameById(iClusterId) + "' because the classes ['"
                + clazz.getName() + "'] are bound to it. Drop these classes before dropping the cluster");
        }
      }
    }
  }
View Full Code Here

    this._source = null;
  }

  protected void setClass(final OClass iClass) {
    if (iClass != null && iClass.isAbstract())
      throw new OSchemaException("Cannot create a document of the abstract class '" + iClass + "'");

    _clazz = iClass;
  }
View Full Code Here

            final ODocument recordSchemaAware = (ODocument) iRecord;
            final OClass recordClass = recordSchemaAware.getSchemaClass();
            final OClass clusterIdClass = database.getMetadata().getSchema().getClassByClusterId(rid.clusterId);
            if (recordClass == null && clusterIdClass != null || clusterIdClass == null && recordClass != null
                || (recordClass != null && !recordClass.equals(clusterIdClass)))
              throw new OSchemaException("Record saved into cluster " + iClusterName + " should be saved with class "
                  + clusterIdClass + " but saved with class " + recordClass);
          }

          rid.clusterPosition = OClusterPositionFactory.INSTANCE.valueOf(newObjectCounter--);
View Full Code Here

      final ODocument recordSchemaAware = (ODocument) record;
      final OClass recordClass = recordSchemaAware.getSchemaClass();
      final OClass clusterIdClass = metadata.getSchema().getClassByClusterId(rid.clusterId);
      if (recordClass == null && clusterIdClass != null || clusterIdClass == null && recordClass != null
          || (recordClass != null && !recordClass.equals(clusterIdClass)))
        throw new OSchemaException("Record saved into cluster '" + iClusterName + "' should be saved with class '" + clusterIdClass
            + "' but has been created with class '" + recordClass + "'");
    }
  }
View Full Code Here

      OType type = globalRef.getType();
      if (type == OType.LINK || type == OType.LINKSET || type == OType.LINKLIST || type == OType.LINKMAP || type == OType.EMBEDDED
          || type == OType.EMBEDDEDSET || type == OType.EMBEDDEDLIST || type == OType.EMBEDDEDMAP)
        this.linkedClass = iLinkedClass;
      else
        throw new OSchemaException("Linked class is not supported for type: " + type);

    } finally {
      releaseSchemaWriteLock();
    }
View Full Code Here

      checkEmbedded();
      OType type = globalRef.getType();
      if (type == OType.EMBEDDEDSET || type == OType.EMBEDDEDLIST || type == OType.EMBEDDEDMAP)
        this.linkedType = iLinkedType;
      else
        throw new OSchemaException("Linked type is not supported for type: " + type);

    } finally {
      releaseSchemaWriteLock();
    }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.exception.OSchemaException

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.