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

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


            throws IOException
    {
        if(!persistentDataContainer.isArray()){
            throw new IOException();
        }
        FieldsIterator fieldsIterator = persistentDataContainer.getActiveFieldsIterator();
        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();
        PRIMITIVES_ENUMERATION enumeratedType = PrimitiveJavaTypesUtil.getEnumeratedType(type.getName());
        return (Comparable) PrimitiveJavaTypesUtil.getAsWrappedPrimitive(enumeratedType, byteBuffer);
View Full Code Here


            Field[] fieldsToIgnore) throws IOException
    {
        if(!value2.isArray()){
            return false;
        }
        FieldsIterator fieldsIterator = value2.getActiveFieldsIterator();
        if(fieldsIterator==null){
            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;
            }
        }
        return true;
View Full Code Here

            ticket.close();
        }
    }
   
    private CONSTRAINT_EVALUATION_STATUS analize(ClassDescriptor classDescriptor, ObjectDataContainer dataContainer, JODBOperationContext context) throws IOException{
        FieldsIterator fieldsIterator = dataContainer.getActiveFieldsIterator();
        if(fieldsIterator==null){
            return getCumulativeStatus();
        }
        //int[] hierarchy = dataContainer.getClassHierarchy();
        int typeID = dataContainer.getOriginalClassType();
        try {
            classDescriptor = _session.getDescriptorForClass(typeID);
        } catch (Exception e) {
            e.printStackTrace();
            throw new JodbIOException(e);
        }
        _constraints.evaluatePersistentCopy(classDescriptor, dataContainer, null, context);
        HashMap<String, Field> unProcessedDescendantFields = _threadLocalAuxData.get()._processedFieldsBuffer;
        unProcessedDescendantFields.clear();
        FieldAndIDRecord[] fields = classDescriptor.getAllFields();
        for (int i = 0; i < fields.length; i++) {
            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);
            if(descendant == null){
                continue;
View Full Code Here

            }
            long nextObjectID = fieldRecord._objectOffset;
            readSortData(nextObjectID, sortDataCache, context);
            return;
        } 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()){
                    descendant.readSortData(null, iterratorFieldRecord, sortDataCache, context);
                }
                if(sortDataCache.isValuesAccumulationComplete()){
View Full Code Here

            throws IOException
    {
        if(!persistentDataContainer.isArray()){
            throw new IOException();
        }
        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

            Field[] fieldsToIgnore) throws IOException
    {
        if(!value2.isArray()){
            return false;
        }
        FieldsIterator fieldsIterator = value2.getActiveFieldsIterator();
        if(fieldsIterator==null){
            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;
            }
        }
        return true;
View Full Code Here

    public boolean equals(byte[] value1, ObjectDataContainer value2, JODBOperationContext context, Field[] fieldsToIgnore) throws IOException {
        if(!value2.isArray()){
            return false;
        }
        FieldsIterator fieldsIterator = value2.getActiveFieldsIterator();
        if(fieldsIterator==null){
            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;
            }
        }
        return true;
View Full Code Here

    public String composeInstance(Class type, ObjectDataContainer persistentDataContainer, JODBSession session) throws IOException {
        if(!persistentDataContainer.isArray()){
            throw new IOException();
        }
        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

        {
            int totalConstraints = _constraints.size();
            for (int i = 0; i < totalConstraints; i++) {
                _constraints.elementAt(i).evaluatePersistentCopy(classDescriptor, dataContainer, primitiveRecord, context);
                if(dataContainer!=null && i < totalConstraints){
                    FieldsIterator fieldsIterator = dataContainer.getActiveFieldsIterator();
                    if(fieldsIterator != null){
                        fieldsIterator.reset();
                    }
                }
            }
            if(JODBConfig.useCacheOnSortOperations()){
                processSortValuesCache(dataContainer, primitiveRecord, context);
View Full Code Here

        IOTicket ioTicket = contextTicketCache.getTicketForRead(base);//base.getIOTicket(true, false);
        try{
            ioTicket.lock(false);
            DataContainersCache dataContainersCache = getObjectDataContainerCache();
            ObjectDataContainer objectDataContainer = dataContainersCache.pullObjectDataContainer();
            FieldsIterator fieldsIterator = objectDataContainer.readObject(ioTicket.getRandomAccessBuffer(),base, session, offset, true);
            ClassDescriptor classDescriptor = objectDataContainer.getClassDescriptorForPersistedObject();
            if (classDescriptor == null || fieldsIterator == null) {
                // basically same as >>objectDataContainer.isDeleted()<< or no class available for persistent copy
                return null;
            }
View Full Code Here

TOP

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

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.