Package com.mobixess.jodb.core.io.ObjectDataContainer

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


        if(fieldsIterator==null){
            return null;
        }
        ByteBuffer byteBuffer = _threadLocalBuffer.get();
        byteBuffer.clear();
        FieldRecord record = persistentDataContainer.getRecordCache();
        for (int i = 0; fieldsIterator.hasNext(); ++i) {
            fieldsIterator.next(record, session.getBase(), false);
            byteBuffer.put(record._primitiveRawDataBuffer.get(0));
        }
        byteBuffer.flip();
View Full Code Here


            return false;
        }
        if(fieldsIterator.getRemainingInCurrentCategory() != value1.length){
            return false;
        }
        FieldRecord record = value2.getRecordCache();
        for (int i = 0; i < value1.length && fieldsIterator.hasNext(); i++) {
            fieldsIterator.next(record, context.getBase(), false);
            if(record._primitiveRawDataBuffer.get(0)!=value1[i]){
                return false;
            }
View Full Code Here

        }
        JODBOperationContext context = new JODBOperationContext(_session,ticket,sortDataCache,null,null,excludedObjects,true);
        IndexDataIterator indexIterator = null;
        boolean skipConventionalSorting = false;

        FieldRecord indexDataIteratorFieldRecord = null;//used for iteraion through indexed data
        QueryNode indexedNode = null;
        TypeConstraint typeConstraint = null;
        try{
           
            Vector<ConstraintBase> vectorOfConstraints = _constraints._constraints;
            for (int i = 0; i < vectorOfConstraints.size(); i++) {
                ConstraintBase nextCandidate = vectorOfConstraints.elementAt(i);
                if(nextCandidate instanceof TypeConstraint){
                    if(typeConstraint == null){
                        typeConstraint = (TypeConstraint) nextCandidate;
                    }else{
                        typeConstraint = null;//multiple type constraints
                        break;
                    }
                }
            }
           
            if(typeConstraint != null){
                //boolean useIndexDataFromIterator = false;
                JODBIndexingRootAgent indexingRootAgent = _session.getIndexingRootAgent();
                ClassDescriptor classDescriptor = _session.getDescriptorForClass((Class)typeConstraint.getObject());
                JODBIndexingAgent indexingAgent = null;
                if(sortDataCache!=null){
                    //lookup indexing data to optimize query
                    SortNodeRecord[] sortRecords = sortDataCache.getSortNodes();
                    int fieldId = classDescriptor.getFieldIDForName(sortRecords[0]._fullPath);
                    if(fieldId!=-1){
                        indexingAgent = indexingRootAgent.getIndexingAgent(fieldId, base);
                        if(indexingAgent!=null){
                            indexIterator = indexingAgent.getIndexIterator(sortRecords[0]._orderAscending);
                            indexedNode = _descendants.get(sortRecords[0]._fullPath);
                            skipConventionalSorting = sortRecords.length == 1;
                        }
                    }
                }
                if(indexIterator == null){
                    //search first index
                    Iterator<String> descendants = _descendants.keySet().iterator();
                    while (descendants.hasNext() && indexIterator == null) {
                        String next = descendants.next();
                        Field field = classDescriptor.getFieldForName(next);
                        if(field==null){
                            continue;
                        }
                        indexingAgent = indexingRootAgent.getIndexingAgent(field, base);
                        if(indexingAgent!=null){
                            indexIterator = indexingAgent.getIndexIterator(true);
                            indexedNode = _descendants.get(next);
                        }
                    }
                }
                if(indexingAgent!=null && indexedNode != null){
                    Field field = classDescriptor.getFieldForID(indexingAgent.getFieldId(), null);
                    Class fieldType = field.getType();                       
                    if(fieldType.isPrimitive()){
                        indexDataIteratorFieldRecord = new FieldRecord();
                        indexDataIteratorFieldRecord._fieldID = indexingAgent.getFieldId();
                        indexDataIteratorFieldRecord._category = FIELD_CATEGORIES.PRIMITIVE;
                        indexDataIteratorFieldRecord._fieldTypeID = base.getClassTypeSubstitutionID(fieldType.getName());
                    }
                }
View Full Code Here

            String name = fields[i]._field.getName();
            if( _descendants.containsKey(name)){
                unProcessedDescendantFields.put(name,fields[i]._field);
            }
        }
        FieldRecord record = dataContainer.getRecordCache();
        while (unProcessedDescendantFields.size() > 0 && fieldsIterator.hasNext()) {
            fieldsIterator.next(record,context.getBase(),false);
            Field field = classDescriptor.getFieldForID(record._fieldID, null);
            String name = field.getName();
            QueryNode descendant = _descendants.get(name);
View Full Code Here

        } else {
            FieldsIterator fieldsIterator = dataContainer.getActiveFieldsIterator();
            if(fieldsIterator == null){
                return;//TODO add warning?
            }
            FieldRecord iterratorFieldRecord = dataContainer.getRecordCache();
            IOBase base = context.getBase();
            while(fieldsIterator.hasNext()){
                fieldsIterator.next(iterratorFieldRecord, context.getBase(),false);
                QueryNode descendant = _descendants.get(base.getSimpleFieldNameForID(iterratorFieldRecord._fieldID));
                if(descendant!=null && descendant.hasSortInstructions()){
View Full Code Here

        FieldsIterator fieldsIterator = persistentDataContainer.getActiveFieldsIterator();
        if(fieldsIterator==null){
            return null;
        }
        byte[] result = new byte[fieldsIterator.getRemainingInCurrentCategory()];
        FieldRecord record = persistentDataContainer.getRecordCache();
        for (int i = 0; i < result.length && fieldsIterator.hasNext(); i++) {
            fieldsIterator.next(record, session.getBase(), false);
            result[i] = record._primitiveRawDataBuffer.get(0);
        }
        return Enum.valueOf(type, new String(result,"UTF8"));
View Full Code Here

            return false;
        }
        if(fieldsIterator.getRemainingInCurrentCategory() != value1.length){
            return false;
        }
        FieldRecord record = value2.getRecordCache();
        for (int i = 0; i < value1.length && fieldsIterator.hasNext(); i++) {
            fieldsIterator.next(record, context.getBase(), false);
            if(record._primitiveRawDataBuffer.get(0)!=value1[i]){
                return false;
            }
View Full Code Here

            return false;
        }
        if(fieldsIterator.getRemainingInCurrentCategory() != value1.length){
            return false;
        }
        FieldRecord record = value2.getRecordCache();
        for (int i = 0; i < value1.length && fieldsIterator.hasNext(); i++) {
            fieldsIterator.next(record, context.getBase(), false);
            if(record._primitiveRawDataBuffer.get(0)!=value1[i]){
                return false;
            }
View Full Code Here

        FieldsIterator fieldsIterator = persistentDataContainer.getActiveFieldsIterator();
        if(fieldsIterator==null){
            return null;
        }
        byte[] result = new byte[fieldsIterator.getRemainingInCurrentCategory()];
        FieldRecord record = persistentDataContainer.getRecordCache();
        for (int i = 0; i < result.length && fieldsIterator.hasNext(); i++) {
            fieldsIterator.next(record, session.getBase(), false);
            result[i] = record._primitiveRawDataBuffer.get(0);
        }
        return new String(result,"UTF8");
View Full Code Here

                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;
View Full Code Here

TOP

Related Classes of com.mobixess.jodb.core.io.ObjectDataContainer.FieldRecord

Copyright © 2018 www.massapicom. 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.