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

      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

  public void saveInternal() {
    getDatabase();

    if (document.getDatabase().getTransaction().isActive())
      throw new OSchemaException("Can't change the schema while a transaction is active. Schema changes is not transactional");

    lock.acquireExclusiveLock();
    try {

      document.setDirty();
View Full Code Here

    return addProperty(iPropertyName, iType, null, null);
  }

  public OProperty createProperty(final String iPropertyName, final OType iType, final OClass iLinkedClass) {
    if (iLinkedClass == null)
      throw new OSchemaException("Missed linked class");

    return addProperty(iPropertyName, iType, null, iLinkedClass);
  }
View Full Code Here

    document.getDatabase().checkSecurity(ODatabaseSecurityResources.SCHEMA, ORole.PERMISSION_DELETE);

    final String lowerName = iPropertyName.toLowerCase();

    if (!properties.containsKey(lowerName))
      throw new OSchemaException("Property '" + iPropertyName + "' not found in class " + name + "'");

    final StringBuilder cmd = new StringBuilder("drop property ");
    // CLASS.PROPERTY NAME
    cmd.append(name);
    cmd.append('.');
View Full Code Here

    document.getDatabase().checkSecurity(ODatabaseSecurityResources.SCHEMA, ORole.PERMISSION_DELETE);

    final OProperty prop = properties.remove(iPropertyName.toLowerCase());

    if (prop == null)
      throw new OSchemaException("Property '" + iPropertyName + "' not found in class " + name + "'");

    prop.dropIndex();

    fixedSize -= prop.getType().size;
    owner.saveInternal();
View Full Code Here

    document.getDatabase().checkSecurity(ODatabaseSecurityResources.SCHEMA, ORole.PERMISSION_UPDATE);

    final String lowerName = iPropertyName.toLowerCase();

    if (properties.containsKey(lowerName))
      throw new OSchemaException("Class " + name + " already has the property '" + iPropertyName + "'");

    final StringBuilder cmd = new StringBuilder("create property ");
    // CLASS.PROPERTY NAME
    cmd.append(name);
    cmd.append('.');
View Full Code Here

    }
  }

  private OPropertyImpl addNewProperty(final String iName, final OType iType, final OType iLinkedType, final OClass iLinkedClass) {
    if (iName == null || iName.length() == 0)
      throw new OSchemaException("Found property name null");

    final Character wrongCharacter = OSchemaShared.checkNameIfValid(iName);
    if (wrongCharacter != null)
      throw new OSchemaException("Found invalid property name. Character '" + wrongCharacter + "' can't be used in property name.");

    final String lowerName = iName.toLowerCase();

    if (properties.containsKey(lowerName))
      throw new OSchemaException("Class " + name + " already has the property '" + iName + "'");

    final OPropertyImpl prop = new OPropertyImpl(this, iName, iType);

    properties.put(lowerName, prop);
    fixedSize += iType.size;
View Full Code Here

    return addProperty(iPropertyName, iType, null, null);
  }

  public OProperty createProperty(final String iPropertyName, final OType iType, final OClass iLinkedClass) {
    if (iLinkedClass == null)
      throw new OSchemaException("Missed linked class");

    return addProperty(iPropertyName, iType, null, iLinkedClass);
  }
View Full Code Here

    document.getDatabase().checkSecurity(ODatabaseSecurityResources.SCHEMA, ORole.PERMISSION_DELETE);

    final String lowerName = iPropertyName.toLowerCase();

    if (!properties.containsKey(lowerName))
      throw new OSchemaException("Property '" + iPropertyName + "' not found in class " + name + "'");

    final StringBuilder cmd = new StringBuilder("drop property ");
    // CLASS.PROPERTY NAME
    cmd.append(name);
    cmd.append('.');
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.