示例#1
0
 public final void writeNew(
     Transaction trans, Pointer4 pointer, ClassMetadata classMetadata, ByteArrayBuffer buffer) {
   writeEncrypt(buffer, pointer.address(), 0);
   if (classMetadata == null) {
     return;
   }
   classMetadata.addToIndex(trans, pointer.id());
 }
示例#2
0
  public QueryResult classOnlyQuery(QQueryBase query, ClassMetadata clazz) {
    if (!clazz.hasClassIndex()) {
      return new IdListQueryResult(query.transaction());
    }

    final AbstractQueryResult queryResult = newQueryResult(query.transaction());
    queryResult.loadFromClassIndex(clazz);
    return queryResult;
  }
示例#3
0
  public final boolean delete4(
      Transaction transaction, ObjectReference ref, Object obj, int cascade, boolean userCall) {
    int id = ref.getID();
    StatefulBuffer reader = readStatefulBufferById(transaction, id);
    if (reader != null) {
      if (obj != null) {
        if ((!showInternalClasses()) && Const4.CLASS_INTERNAL.isAssignableFrom(obj.getClass())) {
          return false;
        }
      }
      reader.setCascadeDeletes(cascade);
      transaction.idSystem().notifySlotDeleted(id, SlotChangeFactory.USER_OBJECTS);
      ClassMetadata classMetadata = ref.classMetadata();
      classMetadata.delete(reader, obj);

      return true;
    }
    return false;
  }
示例#4
0
 public long[] getIDsForClass(Transaction trans, ClassMetadata clazz) {
   final IntArrayList ids = new IntArrayList();
   clazz
       .index()
       .traverseIds(
           trans,
           new Visitor4() {
             public void visit(Object obj) {
               ids.add(((Integer) obj).intValue());
             }
           });
   return ids.asLong();
 }
示例#5
0
 public int instanceCount(ClassMetadata clazz, Transaction trans) {
   synchronized (lock()) {
     return clazz.indexEntryCount(trans);
   }
 }