Package com.mobixess.jodb.core.JODBConstants

Examples of com.mobixess.jodb.core.JODBConstants.COMPARE_RESULT


        @Override
        void evaluateActiveObject(Object activeObject, Field field, JODBOperationContext context) throws IOException
        {
            Class originClass = getObject().getClass();
            if(field!= null && field.getType().isPrimitive()){
                COMPARE_RESULT compareResult;
                if(!PrimitiveJavaTypesUtil.isPrimitiveWrapper(originClass)){
                    compareResult = COMPARE_RESULT.UNKNOWN;
                }else{
                    compareResult = PrimitiveJavaTypesUtil.compare(_constraintOrigin, field, activeObject);
                }
                processCompareResult(compareResult);
                return;
            }
            if(field!=null && activeObject!=null){
                try {
                    activeObject = field.get(activeObject);
                } catch (Exception e) {
                    e.printStackTrace();
                    throw new JodbIOException(e);
                }
            }
            if(activeObject!=null){
                if(originClass != activeObject.getClass()){
                    processCompareResult(COMPARE_RESULT.UNKNOWN);
                    return;
                }
                IClassProcessor processor = JODBPluginRegistry.getInstance().getClassProcessor(originClass);
                COMPARE_RESULT compareResult = processor.compare(getObject(),activeObject, context, null);
                processCompareResult(compareResult);
                return;
            }
        }
View Full Code Here


        @Override
        void evaluatePersistentCopy(ClassDescriptor classDescriptor, ObjectDataContainer dataContainer, FieldRecord record, JODBOperationContext context) throws IOException
        {
            Class originClass = getObject().getClass();
            if(record!=null && record._category == FIELD_CATEGORIES.PRIMITIVE){
                COMPARE_RESULT compareResult;
                if(!PrimitiveJavaTypesUtil.isPrimitiveWrapper(originClass)){
                    compareResult = COMPARE_RESULT.UNKNOWN;
                }else{
                    PRIMITIVES_ENUMERATION fieldTypeEnum = PrimitiveJavaTypesUtil.getEnumeratedType(record._fieldTypeID, context.getBase());
                    compareResult = PrimitiveJavaTypesUtil.compare(_constraintOrigin, record, fieldTypeEnum);
                }
                processCompareResult(compareResult);
                return;
            }
            if(dataContainer!=null){
                Class persistentObjectClass;
                try {
                    persistentObjectClass = context.getSession().resolveClassForID(dataContainer.getOriginalClassType());
                } catch (ClassNotFoundException e) {
                    //TODO debug output???
                    throw new JodbIOException(e);
                }
                if(originClass!=persistentObjectClass){
                    processCompareResult(COMPARE_RESULT.UNKNOWN);
                    return;
                }
                IClassProcessor processor = JODBPluginRegistry.getInstance().getClassProcessor(originClass);
                if(_type == CONSTRAINT_TYPE.EQUAL || _type == CONSTRAINT_TYPE.NOT){//equals methods can be better optimized
                    boolean equal = processor.equals(getTranslatedOrigin(), dataContainer, context, null);
                    processCompareResult(equal? COMPARE_RESULT.EQUAL : COMPARE_RESULT.SMALLER);
                    return;
                }else{
                    COMPARE_RESULT compareResult = processor.compare(getTranslatedOrigin(), dataContainer, context, null, originClass);
                    processCompareResult(compareResult);
                    return;
                }
               
            }
View Full Code Here

TOP

Related Classes of com.mobixess.jodb.core.JODBConstants.COMPARE_RESULT

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.