Package com.orientechnologies.orient.core.exception

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


  /**
   * Execute the command.
   */
  public Object execute(final Map<Object, Object> iArgs) {
    if (schemaClass == null)
      throw new OCommandExecutionException("Can't execute the command because it hasn't been parsed yet");

    final long recs = schemaClass.count();

    try {
      schemaClass.truncate();
    } catch (IOException e) {
      throw new OCommandExecutionException("Error on executing command", e);
    }

    return recs;
  }
View Full Code Here


  private void searchInClusters() {
    final int[] clusterIds;
    String firstCluster = compiledFilter.getTargetClusters().keySet().iterator().next();

    if (firstCluster == null || firstCluster.length() == 0)
      throw new OCommandExecutionException("No cluster or schema class selected in query");

    if (Character.isDigit(firstCluster.charAt(0)))
      // GET THE CLUSTER NUMBER
      clusterIds = OStringSerializerHelper.splitIntArray(firstCluster);
    else
View Full Code Here

  }

  private void searchInIndex() {
    final OIndex index = database.getMetadata().getIndexManager().getIndex(compiledFilter.getTargetIndex());
    if (index == null)
      throw new OCommandExecutionException("Target index '" + compiledFilter.getTargetIndex() + "' not found");

    if (compiledFilter.getRootCondition() != null) {
      if (!"KEY".equalsIgnoreCase(compiledFilter.getRootCondition().getLeft().toString()))
        throw new OCommandExecutionException("'Key' field is required for queries against indexes");

      final Object right = compiledFilter.getRootCondition().getRight();

      Collection<OIdentifiable> result = null;
      if (compiledFilter.getRootCondition().getOperator() instanceof OQueryOperatorBetween) {
View Full Code Here

          if (targetClasses == null)
            targetClasses = new HashMap<OClass, String>();

          OClass cls = database.getMetadata().getSchema().getClass(subjectName);
          if (cls == null)
            throw new OCommandExecutionException("Class '" + subjectName + "' was not found in current database");

          targetClasses.put(cls, alias);
        }
      }
    }
View Full Code Here

  public void bindParameters(final Map<Object, Object> iArgs) {
    if (parameterItems == null || iArgs == null || iArgs.size() == 0)
      return;

    if (iArgs.size() < parameterItems.size())
      throw new OCommandExecutionException("Can't execute because " + (parameterItems.size() - iArgs.size())
          + " parameter(s) are unbounded");

    String paramName;
    for (Entry<Object, Object> entry : iArgs.entrySet()) {
      if (entry.getKey() instanceof Integer)
View Full Code Here

  /**
   * Execute the REMOVE INDEX.
   */
  public Object execute(final Map<Object, Object> iArgs) {
    if (name == null)
      throw new OCommandExecutionException("Can't execute the command because it hasn't been parsed yet");

    if (name.indexOf('.') > -1) {
      // PROPERTY INDEX
      final String[] parts = name.split("\\.");
      final String className = parts[0];
      if (className == null)
        throw new OCommandExecutionException("Class " + className + " not found");
      String fieldName = parts[1];

      final OClass cls = database.getMetadata().getSchema().getClass(className);
      if (cls == null)
        throw new OCommandExecutionException("Class '" + className + "' not found");

      final OPropertyImpl prop = (OPropertyImpl) cls.getProperty(fieldName);
      if (prop == null)
        throw new IllegalArgumentException("Property '" + fieldName + "' was not found in class '" + cls + "'");

View Full Code Here

  /**
   * Execute the GRANT.
   */
  public Object execute(final Map<Object, Object> iArgs) {
    if (role == null)
      throw new OCommandExecutionException("Can't execute the command because it hasn't been parsed yet");

    role.grant(resource, privilege);
    role.save();

    return role;
View Full Code Here

  /**
   * Execute the DROP CLASS.
   */
  public Object execute(final Map<Object, Object> iArgs) {
    if (className == null)
      throw new OCommandExecutionException("Can't execute the command because it hasn't been parsed yet");

    ((OSchemaProxy) database.getMetadata().getSchema()).dropClassInternal(className);

    return null;
  }
View Full Code Here

  /**
   * Execute the CREATE CLASS.
   */
  public Object execute(final Map<Object, Object> iArgs) {
    if (className == null)
      throw new OCommandExecutionException("Can't execute the command because it hasn't been parsed yet");

    if (database.getMetadata().getSchema().existsClass(className))
      throw new OCommandExecutionException("Class " + className + " already exists");

    final OClass sourceClass = ((OSchemaProxy) database.getMetadata().getSchema()).createClassInternal(className, superClass,
        clusterIds);
    return sourceClass.getId();
  }
View Full Code Here

  /**
   * Execute the ALTER PROPERTY.
   */
  public Object execute(final Map<Object, Object> iArgs) {
    if (attribute == null)
      throw new OCommandExecutionException("Can't execute the command because it hasn't been parsed yet");

    final OClassImpl sourceClass = (OClassImpl) database.getMetadata().getSchema().getClass(className);
    if (sourceClass == null)
      throw new OCommandExecutionException("Source class '" + className + "' not found");

    final OPropertyImpl prop = (OPropertyImpl) sourceClass.getProperty(fieldName);
    if (prop == null)
      throw new OCommandExecutionException("Property '" + className + "." + fieldName + "' not exists");

    prop.setInternal(attribute, value);
    return null;
  }
View Full Code Here

TOP

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

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.