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());
 }
Exemple #2
0
 private ClassMetadata singleClassConstraint() {
   if (requiresSort()) {
     return null;
   }
   QConClass clazzconstr = classConstraint();
   if (clazzconstr == null) {
     return null;
   }
   ClassMetadata clazz = clazzconstr._classMetadata;
   if (clazz == null) {
     return null;
   }
   if (clazzconstr.hasChildren() || clazz.isArray()) {
     return null;
   }
   return clazz;
 }
  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;
  }
  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;
  }
 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();
 }
Exemple #6
0
 private Constraint addInterfaceConstraint(ReflectClass claxx) {
   Collection4 classes = stream().classCollection().forInterface(claxx);
   if (classes.size() == 0) {
     QConClass qcc = new QConClass(_trans, null, null, claxx);
     addConstraint(qcc);
     return qcc;
   }
   Iterator4 i = classes.iterator();
   Constraint constr = null;
   while (i.moveNext()) {
     ClassMetadata classMetadata = (ClassMetadata) i.current();
     ReflectClass classMetadataClaxx = classMetadata.classReflector();
     if (classMetadataClaxx != null) {
       if (!classMetadataClaxx.isInterface()) {
         if (constr == null) {
           constr = constrain(classMetadataClaxx);
         } else {
           constr = constr.or(constrain(classMetadata.classReflector()));
         }
       }
     }
   }
   return constr;
 }
 public int instanceCount(ClassMetadata clazz, Transaction trans) {
   synchronized (lock()) {
     return clazz.indexEntryCount(trans);
   }
 }