Example #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());
 }
Example #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;
  }
Example #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;
  }
Example #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();
 }
Example #5
0
 public int instanceCount(ClassMetadata clazz, Transaction trans) {
   synchronized (lock()) {
     return clazz.indexEntryCount(trans);
   }
 }