Package com.orientechnologies.orient.core.exception

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


  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


    return this;
  }

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

    parameters = iArgs;

    Map<Object, Object> queryArgs = new HashMap<Object, Object>();
    for (int i = parameterCounter; parameters != null && i < parameters.size(); i++) {
View Full Code Here

        if (record.getSchemaClass() != null) {
          final OProperty property = record.getSchemaClass().getProperty(entry.getKey());
          if (property != null
              && (property.getType() != null && (!property.getType().equals(OType.EMBEDDEDMAP) && !property.getType().equals(
                  OType.LINKMAP)))) {
            throw new OCommandExecutionException("field " + entry.getKey() + " is not defined as a map");
          }
        }
        fieldValue = new HashMap();
        record.field(entry.getKey(), fieldValue);
      }
View Full Code Here

  /**
   * Execute the CREATE PROPERTY.
   */
  public Object execute(final Map<Object, Object> iArgs) {
    if (fieldName == 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");

    // REMOVE THE PROPERTY
    sourceClass.dropPropertyInternal(fieldName);
    sourceClass.saveInternal();

View Full Code Here

    return this;
  }

  public Object execute(final Map<Object, Object> iArgs) {
    if (query == null && indexName == null)
      throw new OCommandExecutionException("Can't execute the command because it hasn't been parsed yet");

    if (query != null) {
      // AGAINST CLUSTERS AND CLASSES
      query.execute(iArgs);
      return recordCount;
    } else {
      // AGAINST INDEXES
      final OIndex index = database.getMetadata().getIndexManager().getIndex(indexName);
      if (index == null)
        throw new OCommandExecutionException("Target index '" + indexName + "' not found");

      Object key = null;
      Object value = VALUE_NOT_FOUND;

      if (compiledFilter.getRootCondition() == null) {
        final long total = index.getSize();
        index.clear();
        return total;
      } else {
        if (KEYWORD_KEY.equalsIgnoreCase(compiledFilter.getRootCondition().getLeft().toString()))
          // FOUND KEY ONLY
          key = compiledFilter.getRootCondition().getRight();
        else if (compiledFilter.getRootCondition().getLeft() instanceof OSQLFilterCondition) {
          // KEY AND VALUE
          final OSQLFilterCondition leftCondition = (OSQLFilterCondition) compiledFilter.getRootCondition().getLeft();
          if (KEYWORD_KEY.equalsIgnoreCase(leftCondition.getLeft().toString()))
            key = leftCondition.getRight();

          final OSQLFilterCondition rightCondition = (OSQLFilterCondition) compiledFilter.getRootCondition().getRight();
          if (KEYWORD_RID.equalsIgnoreCase(rightCondition.getLeft().toString()))
            value = rightCondition.getRight();

        }

        if (key == null)
          throw new OCommandExecutionException("'Key' field is required for queries against indexes");

        final boolean result;
        if (value != VALUE_NOT_FOUND)
          result = index.remove(key, (OIdentifiable) value);
        else
View Full Code Here

  /**
   * Execute the CREATE 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");

    final OIndex idx;
    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

    super(iQueryToParse, iName);
  }

  public Object getValue(final ORecordInternal<?> iRecord) {
    if (iRecord == null)
      throw new OCommandExecutionException("expression item '" + name + "' can't be resolved");

    return transformValue(iRecord.getDatabase(), getRecordAttribute(iRecord.getDatabase(), iRecord, name));
  }
View Full Code Here

  /**
   * 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

  /**
   * Execute the ALTER CLASS.
   */
  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 OCluster cls = getCluster();

    if (cls == null)
      throw new OCommandExecutionException("Cluster '" + clusterName + "' not found");

    if (clusterId > -1 && clusterName.equals(String.valueOf(clusterId))) {
      clusterName = cls.getName();
    } else {
      clusterId = cls.getId();
    }

    try {
      cls.set(attribute, value);
    } catch (IOException ioe) {
      throw new OCommandExecutionException("Error altering cluster '" + clusterName + "'", ioe);
    }

    return null;
  }
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");

    int clusterId = database.getMetadata().getSchema().getClass(className).getDefaultClusterId();

    ((OSchemaProxy) database.getMetadata().getSchema()).dropClassInternal(className);
    ((OSchemaProxy) database.getMetadata().getSchema()).saveInternal();
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.