Examples of ClassMapping


Examples of cuchaz.enigma.mapping.ClassMapping

  {
    // is this class deobfuscated?
    // we need to tell the decompiler the deobfuscated name so it doesn't get freaked out
    // the decompiler only sees the deobfuscated class, so we need to load it by the deobfuscated name
    String lookupClassName = obfClassName;
    ClassMapping classMapping = m_mappings.getClassByObf( obfClassName );
    if( classMapping != null && classMapping.getDeobfName() != null )
    {
      lookupClassName = classMapping.getDeobfName();
    }
   
    // is this class even in the jar?
    if( !m_jarIndex.containsObfClass( new ClassEntry( obfClassName ) ) )
    {
View Full Code Here

Examples of nexj.core.meta.persistence.ClassMapping

            }

            if (!bNull)
            {
               // TODO: Insert with composition mappings.
               ClassMapping assocMapping = (ClassMapping)attributeMapping;
               boolean bSuccessor = isCreateSuccessor(primaryWork, assocMapping, bOID);

               if (bSuccessor)
               {
                  if (list == null)
                  {
                     inst.getAdapter().addDependency(uow, primaryWork, inst,
                        assocMapping.getKey(true), assocMapping.getKey(false), true);
                  }
                  else
                  {
                     for (int k = 0; k < list.getCount(); ++k)
                     {
                        inst = list.getInstance(k);

                        if (inst != null)
                        {
                           inst.getAdapter().addDependency(uow, primaryWork, inst,
                              assocMapping.getKey(true), assocMapping.getKey(false), true);
                        }
                     }
                  }
               }
               else
               {
                  Work work = addClassWork(uow, instance, primaryWork, assocMapping);

                  if (list != null)
                  {
                     inst = list.getInstance(0);
                  }

                  if (inst.getOID() != null)
                  {
                     work.setKeyValue(assocMapping.getKey(false), assocMapping.getKey(true), inst);

                     if (assocMapping.getKey(false) == mapping.getObjectKey())
                     {
                        instance.setOID(inst.getOID());
                     }
                  }
                  else
                  {
                     inst.getAdapter().addDependency(uow, work, inst,
                        assocMapping.getKey(false), assocMapping.getKey(true), false);
                  }
               }
            }
         }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.ClassMapping

            + "where o.oplock = 0").getResultList();
        em.close();
    }

    public void testOplockFieldMapping() {
        ClassMapping cm = (ClassMapping) JPAFacadeHelper.getMetaData(
            emf, OptimisticLockInstance.class);
        FieldMapping fm = cm.getFieldMapping("oplock");
        assertEquals(1, fm.getColumns().length);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.ClassMapping

    public void setUp() {
        setUp(NonstandardMappingEntity.class);
    }

    public void testPersistentMapMetaData() {
        ClassMapping cm = (ClassMapping) JPAFacadeHelper.getMetaData(emf,
            NonstandardMappingEntity.class);
        assertEquals("NONSTD_MAPPING_MAP",
            cm.getFieldMapping("map").getTable().getName());
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.ClassMapping

    }

    public boolean exists(OpenJPAStateManager sm, Object context) {
        // add where conditions on base class to avoid joins if subclass
        // doesn't use oid as identifier
        ClassMapping mapping = (ClassMapping) sm.getMetaData();
        return exists(mapping, sm.getObjectId(), context);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.ClassMapping

            throw SQLExceptions.getStore(se, _dict);
        }
    }

    public boolean syncVersion(OpenJPAStateManager sm, Object context) {
        ClassMapping mapping = (ClassMapping) sm.getMetaData();
        try {
            return mapping.getVersion().checkVersion(sm, this, true);
        } catch (SQLException se) {
            throw SQLExceptions.getStore(se, _dict);
        }
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.ClassMapping

            throw SQLExceptions.getStore(se, _dict);
        }
    }

    public int compareVersion(OpenJPAStateManager state, Object v1, Object v2) {
        ClassMapping mapping = (ClassMapping) state.getMetaData();
        return mapping.getVersion().compareVersion(v1, v2);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.ClassMapping

     */
    private boolean initializeState(OpenJPAStateManager sm, PCState state,
        JDBCFetchConfiguration fetch, ConnectionInfo info)
        throws ClassNotFoundException, SQLException {
        Object oid = sm.getObjectId();
        ClassMapping mapping = (ClassMapping) sm.getMetaData();
        Result res = null;
        try {
            if (info != null && info.result != null) {
                res = info.result;
                info.sm = sm;
                if (info.mapping == null)
                    info.mapping = mapping;
                mapping = info.mapping;
            } else if (oid instanceof OpenJPAId
                && !((OpenJPAId) oid).hasSubclasses()) {
                Boolean custom = customLoad(sm, mapping, state, fetch);
                if (custom != null)
                    return custom.booleanValue();
                res = getInitializeStateResult(sm, mapping, fetch,
                    Select.SUBS_EXACT);
                if (res == null && !selectPrimaryKey(sm, mapping, fetch))
                    return false;
                if (res != null && !res.next())
                    return false;
            } else {
                ClassMapping[] mappings = mapping.
                    getIndependentAssignableMappings();
                if (mappings.length == 1) {
                    mapping = mappings[0];
                    Boolean custom = customLoad(sm, mapping, state, fetch);
                    if (custom != null)
                        return custom.booleanValue();
                    res = getInitializeStateResult(sm, mapping, fetch,
                        Select.SUBS_ANY_JOINABLE);
                    if (res == null && !selectPrimaryKey(sm, mapping, fetch))
                        return false;
                } else
                    res = getInitializeStateUnionResult(sm, mapping, mappings,
                        fetch);
                if (res != null && !res.next())
                    return false;
            }

            // figure out what type of object this is; the state manager
            // only guarantees to provide a base class
            Class type;
            if (res == null)
                type = mapping.getDescribedType();
            else {
                if (res.getBaseMapping() != null)
                    mapping = res.getBaseMapping();
                res.startDataRequest(mapping.getDiscriminator());
                try {
                    type = mapping.getDiscriminator().getClass(this, mapping,
                        res);
                } finally {
                    res.endDataRequest();
                }
            }

            // initialize the state manager; this may change the mapping
            // and the object id instance if the type as determined
            // from the indicator is a subclass of expected type
            sm.initialize(type, state);

            // load the selected mappings into the given state manager
            if (res != null) {
                // re-get the mapping in case the instance was a subclass
                mapping = (ClassMapping) sm.getMetaData();
                load(mapping, sm, fetch, res);
                mapping.getVersion().afterLoad(sm, this);
            }
            return true;
        } finally {
            if (res != null && (info == null || res != info.result))
                res.close();
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.ClassMapping

    private boolean selectPrimaryKey(OpenJPAStateManager sm,
        ClassMapping mapping, JDBCFetchConfiguration fetch)
        throws SQLException {
        // select pks from base class record to ensure it exists and lock
        // it if needed
        ClassMapping base = mapping;
        while (base.getJoinablePCSuperclassMapping() != null)
            base = base.getJoinablePCSuperclassMapping();

        Select sel = _sql.newSelect();
        sel.select(base.getPrimaryKeyColumns());
        sel.wherePrimaryKey(sm.getObjectId(), base, this);
        Result exists = sel.execute(this, fetch);
        try {
            if (!exists.next())
                return false;
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.ClassMapping

                res = info.result;
            info.sm = null;
        }
        try {
            // if there's an existing result, load all we can from it
            ClassMapping mapping = (ClassMapping) sm.getMetaData();
            if (res != null) {
                load(mapping, sm, jfetch, res);
                removeLoadedFields(sm, fields);
            }

            // if the instance is hollow and there's a customized
            // get by id method, use it
            if (sm.getLoaded().length() == 0
                && mapping.customLoad(sm, this, null, jfetch))
                removeLoadedFields(sm, fields);

            //### select is kind of a big object, and in some cases we don't
            //### use it... would it be worth it to have a small shell select
            //### object that only creates a real select when actually used?

            Select sel = _sql.newSelect();
            if (select(sel, mapping, Select.SUBS_EXACT, sm, fields, jfetch,
                EagerFetchModes.EAGER_JOIN, true, false)) {
                sel.wherePrimaryKey(sm.getObjectId(), mapping, this);
                res = sel.execute(this, jfetch, lockLevel);
                try {
                    if (!res.next())
                        return false;
                    load(mapping, sm, jfetch, res);
                } finally {
                    res.close();
                }
            }

            // now allow the fields to load themselves individually too
            FieldMapping[] fms = mapping.getFieldMappings();
            for (int i = 0; i < fms.length; i++)
                if (fields.get(i) && !sm.getLoaded().get(i))
                    fms[i].load(sm, this, jfetch.traverseJDBC(fms[i]));
            mapping.getVersion().afterLoad(sm, this);
            return true;
        } catch (ClassNotFoundException cnfe) {
            throw new StoreException(cnfe);
        } catch (SQLException se) {
            throw SQLExceptions.getStore(se, _dict);
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.