Package com.orientechnologies.orient.core.exception

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


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

    }
  }

  public OPropertyImpl addPropertyInternal(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

  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

  }

  protected void checkClusterBoundedToClass(int iClusterId) {
    for (OClass clazz : getMetadata().getSchema().getClasses()) {
      if (clazz.getDefaultClusterId() == iClusterId)
        throw new OSchemaException("Can't drop the cluster '" + getClusterNameById(iClusterId) + "' because the classes ['"
            + clazz.getName() + "'] are bound to it. Drop these classes before to drop the cluster");
      else if (clazz.getClusterIds().length > 1) {
        for (int i : clazz.getClusterIds()) {
          if (i == iClusterId)
            throw new OSchemaException("Can't drop the cluster '" + getClusterNameById(iClusterId) + "' because the classes ['"
                + clazz.getName() + "'] are bound to it. Drop these classes before to drop the cluster");
        }
      }
    }
  }
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

    final String key = iClassName.toLowerCase();

    lock.acquireExclusiveLock();
    try {
      if (classes.containsKey(key))
        throw new OSchemaException("Class " + iClassName + " already exists in current database");

      final StringBuilder cmd = new StringBuilder("create class ");
      cmd.append(iClassName);

      if (iSuperClass != null) {
View Full Code Here

    }
  }

  public OClass createClassInternal(final String iClassName, final OClass iSuperClass, int[] iClusterIds) {
    if (iClassName == null || iClassName.length() == 0)
      throw new OSchemaException("Found class name null");

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

    if (iClusterIds == null || iClusterIds.length == 0)
      // CREATE A NEW CLUSTER
      iClusterIds = new int[] { getDatabase().addCluster(iClassName, CLUSTER_TYPE.PHYSICAL) };

    getDatabase().checkSecurity(ODatabaseSecurityResources.SCHEMA, ORole.PERMISSION_CREATE);

    final String key = iClassName.toLowerCase();

    lock.acquireExclusiveLock();
    try {
      if (classes.containsKey(key))
        throw new OSchemaException("Class " + iClassName + " already exists in current database");

      final OClassImpl cls = new OClassImpl(this, classes.size(), iClassName, iClusterIds);
      classes.put(key, cls);

      if (cls.getShortName() != null)
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");

      final StringBuilder cmd = new StringBuilder("drop class ");
      cmd.append(iClassName);
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.