private boolean handleIndexAsTarget(ODeleteExecutionPlan result, OIndexIdentifier indexIdentifier, OWhereClause whereClause, OCommandContext ctx) { if (indexIdentifier == null) { return false; } throw new OCommandExecutionException("DELETE VERTEX FROM INDEX is not supported"); }
public SimpleNode splitForAggregation(AggregateProjectionSplit aggregateProj) { if (isAggregate()) { throw new OCommandExecutionException("Cannot use aggregate functions in array concatenation"); } else { return this; } }
private void checkNotIndexed(OClass oClass) { Set<OIndex<?>> indexes = oClass.getIndexes(); if (indexes != null && indexes.size() > 0) { throw new OCommandExecutionException("Cannot rename class '" + oClass.getName() + "' because it has indexes defined on it. Drop indexes before or use UNSAFE (at your won risk)"); } }
public static OMathExpression deserializeFromResult(OResult fromResult) { String className = fromResult.getProperty("__class"); try { OMathExpression result = (OMathExpression) Class.forName(className).getConstructor(Integer.class).newInstance(-1); result.deserialize(fromResult); return result; } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } }
@Override public void applyRemove(OResultInternal result, OCommandContext ctx) { if (expression != null) { expression.applyRemove(result, ctx); } else { throw new OCommandExecutionException("Cannot apply REMOVE " + toString()); } }
private boolean removeSingleValueFromBag(ORidBag bag, Object value, ODocument record) { if (!(value instanceof OIdentifiable)) throw new OCommandExecutionException("Only links or records can be removed from LINKBAG"); bag.remove((OIdentifiable) value); return record.isDirty(); }
private void checkSuperclasses(OSchema schema, OCommandContext ctx) { if (superclasses != null) { for (OIdentifier superclass : superclasses) { if (!schema.existsClass(superclass.getStringValue())) { throw new OCommandExecutionException("Superclass " + superclass + " not found"); } } } }
public Integer evaluate(OCommandContext ctx) { if (this.num != null) { return num.getValue().intValue(); } else if (inputParam != null) { Object obj = inputParam.getValue(ctx.getInputParameters()); if (obj == null || !(obj instanceof Number)) { throw new OCommandExecutionException("" + obj + " is not a number (BATCH)"); } return ((Number) obj).intValue(); } return -1; }
public void applyRemove(OResultInternal result, OCommandContext ctx) { if (mathExpression != null) { mathExpression.applyRemove(result, ctx); } else { throw new OCommandExecutionException("Cannot apply REMOVE " + toString()); } }
@Override public void deserialize(OResult fromResult) { try { super.deserialize(fromResult); this.asc = fromResult.getProperty("asc"); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } }
@Override public void deserialize(OResult fromResult) { try { OExecutionStepInternal.basicDeserialize(fromResult, this); className = fromResult.getProperty("className"); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } }
/** * Execute the ALTER DATABASE. */ public Object execute(final Map<Object, Object> iArgs) { if (attribute == null) throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); final ODatabaseDocumentInternal database = getDatabase(); database.checkSecurity(ORule.ResourceGeneric.DATABASE, ORole.PERMISSION_UPDATE); database.setInternal(attribute, value); return null; }
public void deserialize(OResult fromResult) { left = new OExpression(-1); left.deserialize(fromResult.getProperty("left")); try { operator = (OBinaryCompareOperator) Class.forName(String.valueOf(fromResult.getProperty("operator"))).newInstance(); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } right = new OExpression(-1); right.deserialize(fromResult.getProperty("right")); }
@Override public void deserialize(OResult fromResult) { try { OExecutionStepInternal.basicDeserialize(fromResult, this); identifier = OIdentifier.deserialize(fromResult.getProperty("identifier")); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } }
@Override public Object execute(Map<Object, Object> iArgs) { if (this.sequenceName == null) { throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); } final ODatabaseDocument database = getDatabase(); database.getMetadata().getSequenceLibrary().dropSequence(this.sequenceName); return true; }
public AggregationContext getAggregationContext(OCommandContext ctx) { if (isAggregate()) { OLevelZeroIdentifier result = new OLevelZeroIdentifier(-1); if (functionCall != null) { return functionCall.getAggregationContext(ctx); } } throw new OCommandExecutionException("cannot aggregate on " + toString()); }
@Override public void deserialize(OResult fromResult) { try { OExecutionStepInternal.basicDeserialize(fromResult, this); this.className = fromResult.getProperty("className"); this.orderByRidAsc = fromResult.getProperty("orderByRidAsc"); this.orderByRidDesc = fromResult.getProperty("orderByRidDesc"); } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException(""), e); } }
private void handleTargetCluster(ODeleteExecutionPlan result, OCommandContext ctx, OIdentifier targetClusterName, boolean profilingEnabled) { if (targetClusterName != null) { String name = targetClusterName.getStringValue(); int clusterId = ctx.getDatabase().getClusterIdByName(name); if (clusterId < 0) { throw new OCommandExecutionException("Cluster not found: " + name); } result.chain(new FetchFromClusterExecutionStep(clusterId, ctx, profilingEnabled)); } }
@Override public Object execute(Map<Object, Object> iArgs) { if (this.sequenceName == null) { throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); } final ODatabaseDocument database = getDatabase(); database.getMetadata().getSequenceLibrary().createSequence(this.sequenceName, this.sequenceType, this.params); return database.getMetadata().getSequenceLibrary().getSequenceCount(); }
@Override public Object execute(Map<Object, Object> iArgs) { if (this.sequenceName == null) { throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); } final ODatabaseDocument database = getDatabase(); OSequence sequence = database.getMetadata().getSequenceLibrary().getSequence(this.sequenceName); final boolean result = sequence.updateParams(this.params); sequence.reset(); sequence.save(getDatabase()); return result; }