public void setColumnSorting(final String column, final boolean ascending) { columnSorting = new OPair<String, Boolean>(column, ascending); }
public void setSubValue(final SV iSubValue) { final OPair<V, SV> oldValue = value; value.setValue(iSubValue); }
private boolean isRidOnlySort() { if (parsedTarget.getTargetClasses() != null && this.orderedFields.size() == 1 && this.orderedFields.get(0).getKey() .toLowerCase(Locale.ENGLISH).equals("@rid")) { if (this.target != null && target instanceof ORecordIteratorClass) { return true; } } return false; }
protected int handleStatus(final byte iResult, final int iClientTxId) throws IOException { if (iResult == OChannelBinaryProtocol.RESPONSE_STATUS_OK || iResult == OChannelBinaryProtocol.PUSH_DATA) { return iClientTxId; } else if (iResult == OChannelBinaryProtocol.RESPONSE_STATUS_ERROR) { final List<OPair<String, String>> exceptions = new ArrayList<OPair<String, String>>(); // EXCEPTION while (readByte() == 1) { final String excClassName = readString(); final String excMessage = readString(); exceptions.add(new OPair<String, String>(excClassName, excMessage)); } byte[] serializedException = null; if (srvProtocolVersion >= 19) serializedException = readBytes(); Exception previous = null; if (serializedException != null && serializedException.length > 0) throwSerializedException(serializedException); for (int i = exceptions.size() - 1; i > -1; --i) { previous = createException(exceptions.get(i).getKey(), exceptions.get(i).getValue(), previous); } if (previous != null) { throw new RuntimeException(previous); } else throw new ONetworkProtocolException("Network response error"); } else { // PROTOCOL ERROR // close(); throw new ONetworkProtocolException("Error on reading response from the server"); } }
/** * Execute the command and return the ODocument object created. */ public Object execute(final Map<Object, Object> iArgs) { if (clazz == null) throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); // CREATE VERTEX DOES NOT HAVE TO BE IN TX final OVertex vertex = getDatabase().newVertex(clazz); if (fields != null) // EVALUATE FIELDS for (final OPair<String, Object> f : fields) { if (f.getValue() instanceof OSQLFunctionRuntime) f.setValue(((OSQLFunctionRuntime) f.getValue()).getValue(vertex.getRecord(), null, context)); } OSQLHelper.bindParameters(vertex.getRecord(), fields, new OCommandParameters(iArgs), context); if (content != null) ((ODocument)vertex.getRecord()).merge(content, true, false); if (clusterName != null) vertex.save(clusterName); else vertex.save(); return vertex.getRecord(); }
public String getItemName(int fieldIndex) { if (fieldIndex == 0) { return name; } else { return operationsChain.get(fieldIndex - 1).getValue()[0].toString(); } }
if (f.getValue() instanceof OSQLFunctionRuntime) { f.setValue(((OSQLFunctionRuntime) f.getValue()).getValue(to, null, context)); } else if (f.getValue() instanceof OSQLFilterItem) { f.setValue(((OSQLFilterItem) f.getValue()).getValue(to, null, context)); if (fields != null) fields.addAll(OPair.convertFromMap(content.toMap())); else fields = OPair.convertFromMap(content.toMap());
parseSetFields(clazz, fields); newRecords.add(OPair.convertToMap(fields));
/** * Check whether or not this filter item is chain of fields (e.g. "field1.field2.field3"). Return true if filter item contains * only field projections operators, if field item contains any other projection operator the method returns false. When filter * item does not contains any chain operator, it is also field chain consist of one field. * * @return whether or not this filter item can be represented as chain of fields. */ public boolean isFieldChain() { if (operationsChain == null) { return true; } for (OPair<OSQLMethodRuntime, Object[]> pair : operationsChain) { if (!pair.getKey().getMethod().getName().equals(OSQLMethodField.NAME)) { return false; } } return true; }
private Object extractValue(ODocument record, OPair<String, Object> entry) { Object value = entry.getValue(); if (value instanceof OSQLFilterItem) value = ((OSQLFilterItem) value).getValue(record, null, context); else if (value instanceof OCommandRequest) value = ((OCommandRequest) value).execute(record, null, context); if (value instanceof OIdentifiable && ((OIdentifiable) value).getIdentity().isPersistent()) // USE ONLY THE RID TO AVOID CONCURRENCY PROBLEM WITH OLD VERSIONS value = ((OIdentifiable) value).getIdentity(); return value; }
public void init(final K iKey, final V iValue, final SV iSubValue) { key = iKey; value = new OPair(iValue, iSubValue); }
public boolean filter(final OEdge iObject) { if (targetVertex != null && !targetVertex.equals(iObject.getVertex(connection.getKey().opposite()))) return false; return iObject.isLabeled(labels); }
orderByOptimizer.canBeUsedByOrderBy(index, orderedFields) && !(index.getInternal() instanceof OChainedIndexProxy); try { boolean ascSortOrder = !indexIsUsedInOrderBy || orderedFields.get(0).getValue().equals(KEYWORD_ASC);