Examples of FieldsIterator


Examples of com.mobixess.jodb.core.io.ObjectDataContainer.FieldsIterator

        }
        if(tHandle.isNewObject()){
            return false;
        }
       
        FieldsIterator fieldsIterator = persistentCopyObjectDataContainer.readObject(context, tHandle.getHandle().getObjectEntryOffset(), true, indexes);
        tHandle.setCyclicalVersionCounter(persistentCopyObjectDataContainer.getCyclicVersionCounter());
        if (fieldsIterator == null) {
            return false;
        }
        return processor.equals(obj, persistentCopyObjectDataContainer, context, null);
View Full Code Here

Examples of com.mobixess.jodb.core.io.ObjectDataContainer.FieldsIterator

            transactionContainer.disableAgentMode();
        }
    }
   
    private void processIndexForObjectId(long objectOffset, int classId, int fieldId, Class fieldType, ObjectDataContainer dataContainer, JODBIndexingAgent agent, JODBOperationContext context) throws IOException{
        FieldsIterator fieldsIterator = dataContainer.readObject(context, objectOffset, true);
        if(fieldsIterator!=null){
            if(dataContainer.getOriginalClassType()!=classId){
                return;
            }
            if(dataContainer.getOriginalClassType() != dataContainer.getTranslatedClassType()){
                throw new IllegalArgumentException("No indexing for translated classes");
            }
            FieldRecord fieldRecord = dataContainer.getRecordCache();
            IOBase base = context.getBase();
            while (fieldsIterator.hasNext()) {
                fieldsIterator.next(fieldRecord, base,false);
                if(fieldRecord._category != FIELD_CATEGORIES.PRIMITIVE){//TODO optimize to skip none primitive fields
                    continue;
                }
                if(fieldRecord._fieldID == fieldId){
                    agent.insertIndex(objectOffset, fieldRecord._primitiveRawDataBuffer, context);
View Full Code Here

Examples of com.mobixess.jodb.core.io.ObjectDataContainer.FieldsIterator

    private static void fillObject(JODBSession session, boolean delayedActivation, ObjectDataContainer objectDataContainer,  Object instance, int remainingDepth) throws IOException{
        ClassDescriptor classDescriptor = session.getDescriptorForClass(instance.getClass());

        IOBase base = session.getBase();
        FieldsIterator fieldsIterator = objectDataContainer.getActiveFieldsIterator();
        if(fieldsIterator == null){
            return;
        }
        BitSet processedFieldMask = new BitSet();
        FieldRecord record = objectDataContainer.getRecordCache();
        for (int i = 0; fieldsIterator.hasNext(); i++) {
            fieldsIterator.next(record, base);
            Field field = classDescriptor.getFieldForID(record._fieldID, processedFieldMask);
            if (field == null) {
                continue;
            }
            if (field.getType().isPrimitive() && !delayedActivation) {
View Full Code Here

Examples of com.mobixess.jodb.core.io.ObjectDataContainer.FieldsIterator

    private static void fillArray(JODBSession session,
            boolean activation, ObjectDataContainer objectDataContainer,
            Object instance, int remainingDepth) throws IOException
    {
        IOBase base = session.getBase();
        FieldsIterator fieldsIterator = objectDataContainer.getActiveFieldsIterator();
        if(fieldsIterator == null){
            return;
        }
        FieldRecord record = objectDataContainer.getRecordCache();
        ClassDescriptor arrayTypeDescriptor;

        arrayTypeDescriptor = session.getDescriptorForClass(instance.getClass().getComponentType());

        if (arrayTypeDescriptor.isPrimitive()) {
            for (int i = 0; fieldsIterator.hasNext(); i++) {
                fieldsIterator.next(record, base);
                Array.set(instance, i, record._value);
            }
        } else {
            for (int i = 0; fieldsIterator.hasNext(); i++) {
                fieldsIterator.next(record, base);
                Object child = TransactionUtils.launchObject(session,  record._objectOffset, null, remainingDepth - 1);
                Array.set(instance, i, child);
            }
        }
    }
View Full Code Here

Examples of com.mobixess.jodb.core.io.ObjectDataContainer.FieldsIterator

        //Field[] fields = desc.getFields();
        JODBSession session = context.getSession();
        //int[] fieldsIDs = desc.getFieldsSubstitutionIDs();
        //boolean[] processedFields = new boolean[fieldsIDs.length];
        FieldRecord fieldRecord = persistentCopyObjectDataContainer.getRecordCache();
        FieldsIterator fieldsIterator = persistentCopyObjectDataContainer.getActiveFieldsIterator();
        if(fieldsIterator == null){
            return false;
        }
        while (fieldsIterator.hasNext()) {
            fieldsIterator.next(fieldRecord, context.getBase(),false);
//            int index = ArrayUtils.indexOf(fieldsIDs, fieldRecord._fieldID);
//            if(index == -1){
//                continue;//TODO the field is not exist anymore, should it indicate as "not equal" ?
//            }
            Field field = desc.getFieldForID(fieldRecord._fieldID, null);
View Full Code Here

Examples of com.mobixess.jodb.core.io.ObjectDataContainer.FieldsIterator

    }

    private static boolean checkActiveArrayObjectUnchanged(JODBOperationContext context, Object array, ObjectDataContainer objectDataContainer, ClassDescriptor classDescriptor) throws IOException, IllegalClassTypeException{
        //TODO make size estimation here?
        int arraySize = Array.getLength(array);
        FieldsIterator fieldsIterator = objectDataContainer.getActiveFieldsIterator();
        if(fieldsIterator  == null){
            return false;//TODO add warning?
        }
        if(arraySize!=fieldsIterator.getRemainingInCurrentCategory()){
            return true;
        }
        IOBase base = context.getBase();
        JODBSession session = context.getSession();
        FieldRecord fieldRecord = objectDataContainer.getRecordCache();
        if( !classDescriptor.getArrayType().isPrimitive()  ){
            for (int i = 0; i < arraySize; i++) {
                fieldsIterator.next(fieldRecord, base);
                Object value = Array.get(array, i);
                if(value == null){
                    if(fieldRecord._objectOffset!=0){
                        return false;
                    }
                    continue;
                }
                PersistentObjectHandle handle = session.getHandleForActiveObject(value);
                if(handle == null || handle.getObjectEntryOffset() != fieldRecord._objectOffset){
                    return false;
                }
            }
        }else{
            PRIMITIVES_ENUMERATION enumeratedPrimitiveType = PrimitiveJavaTypesUtil.getEnumeratedType(classDescriptor.getArrayType().getName());
            for (int i = 0; i < arraySize; i++) {
                fieldsIterator.next(fieldRecord, base, false);
                Object value = Array.get(array, i);
                if( PrimitiveJavaTypesUtil.comparePrimitives(value, enumeratedPrimitiveType, fieldRecord._primitiveRawDataBuffer) != 0 ){
                    return false;
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.