private ORID checkId(ORID id) { if (!id.isValid()) throw new IllegalArgumentException("Invalid id " + id); return id; }
private OType getTypeFromValueEmbedded(final Object fieldValue) { OType type = OType.getTypeByValue(fieldValue); if (type == OType.LINK && fieldValue instanceof ODocument && !((ODocument) fieldValue).getIdentity().isValid()) type = OType.EMBEDDED; return type; }
public Object fetchLinkedCollectionValue(ODocument iRoot, Object iUserObject, String iFieldName, ODocument iLinked, OFetchContext iContext) throws OFetchException { if (iLinked.getIdentity().isValid()) { sendRecord(iLinked); return true; } return null; }
protected OType getTypeFromValueEmbedded(final Object fieldValue) { OType type = OType.getTypeByValue(fieldValue); if (type == OType.LINK && fieldValue instanceof ODocument && !((ODocument) fieldValue).getIdentity().isValid()) type = OType.EMBEDDED; return type; }
@Override public void deleteRecord(ORecord record, ODatabase.OPERATION_MODE mode) { if (!record.getIdentity().isValid()) return; addRecordOperation(record, ORecordOperation.DELETED, null); }
private OType getTypeFromValueEmbedded(final Object fieldValue) { OType type = fieldValue instanceof OResult ? OType.EMBEDDED : OType.getTypeByValue(fieldValue); if (type == OType.LINK && fieldValue instanceof ODocument && !((ODocument) fieldValue).getIdentity().isValid()) type = OType.EMBEDDED; return type; }
private OType getTypeFromValueEmbedded(final Object fieldValue) { OType type = OType.getTypeByValue(fieldValue); if (type == OType.LINK && fieldValue instanceof ODocument && !((ODocument) fieldValue).getIdentity().isValid()) type = OType.EMBEDDED; return type; }
public Object fetchLinkedMapEntry(ODocument iRoot, Object iUserObject, String iFieldName, String iKey, ODocument iLinked, OFetchContext iContext) throws OFetchException { if (iLinked.getIdentity().isValid()) { sendRecord(iLinked); return true; } return null; }
public void deleteRecord(final ORecord iRecord, final OPERATION_MODE iMode) { if (!iRecord.getIdentity().isValid()) return; addRecord(iRecord, ORecordOperation.DELETED, null); }
private void addOwnerToEmbeddedDoc(T e) { if (embeddedCollection && e instanceof ODocument && !((ODocument) e).getIdentity().isValid()) ODocumentInternal.addOwner((ODocument) e, this); if (e instanceof ODocument) ORecordInternal.track(sourceRecord, (ODocument) e); }
private void addOwnerToEmbeddedDoc(T e) { if (embeddedCollection && e instanceof ODocument && !((ODocument) e).getIdentity().isValid()) { ODocumentInternal.addOwner((ODocument) e, this); ORecordInternal.track(sourceRecord, (ODocument) e); } }
@Override public ORID getIdentity() { if (rawElement == null) return ORecordId.EMPTY_RECORD_ID; final ORID rid = rawElement.getIdentity(); if (!rid.isValid()) { // SAVE THE RECORD TO OBTAIN A VALID RID graph.autoStartTransaction(); save(); } return rid; }
private void addOwnerToEmbeddedDoc(T e) { if (embeddedCollection && e instanceof ODocument && !((ODocument) e).getIdentity().isValid()) { ODocumentInternal.addOwner((ODocument) e, this); } if (e instanceof ODocument) ORecordInternal.track(sourceRecord, (ODocument) e); }
public void writeLinkedAttribute(final OIdentifiable iRecord, final String iFieldName) throws IOException { final Object link = iRecord.getIdentity().isValid() ? OJSONWriter.encode(iRecord.getIdentity()) : null; jsonWriter.writeAttribute(settings.indentLevel, true, iFieldName, link); }
public void put(final String key, final Object value, final T element) { final String keyTemp = key + SEPARATOR + value; final ODocument doc = element.getRecord(); if (!doc.getIdentity().isValid()) doc.save(); graph.autoStartTransaction(); underlying.put(keyTemp, doc); }
@Override protected void onConfigure() { OrienteerUser user = getModelObject(); setVisible(!user.getDocument().getIdentity().isValid()); super.onConfigure(); } };
public OIndexRemote<T> put(final Object iKey, final OIdentifiable iValue) { if (iValue instanceof ORecord && !iValue.getIdentity().isValid()) // SAVE IT BEFORE TO PUT ((ORecord) iValue).save(); if (iValue.getIdentity().isNew()) throw new OIndexException( "Cannot insert values in manual indexes against remote protocol during a transaction. Temporary RID cannot be managed at server side"); getDatabase().command(String.format(QUERY_PUT, name), iKey, iValue.getIdentity()).close(); return this; }
public ORecord load() { if (!getIdentity().isValid()) throw new ORecordNotFoundException(getIdentity(), "The record has no id, probably it's new or transient yet "); final ORecord result = getDatabase().load(this); if (result == null) throw new ORecordNotFoundException(getIdentity()); return result; }
public void put(final String key, final Object value, final T element) { final String keyTemp = key + SEPARATOR + value; final ODocument doc = element.getRecord(); if (!doc.getIdentity().isValid()) doc.save(); graph.setCurrentGraphInThreadLocal(); graph.autoStartTransaction(); underlying.put(keyTemp, doc); recordKeyValueIndex.put(new OCompositeKey(doc.getIdentity(), keyTemp), doc.getIdentity()); }
@Override protected void onConfigure() { super.onConfigure(); ODocument doc = getModelObject(); if(doc==null) throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND); //Support of case when metadata was changed in parallel else if(Strings.isEmpty(doc.getClassName()) && doc.getIdentity().isValid()) { getDatabase().reload(); if(Strings.isEmpty(doc.getClassName())) throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND); } }