Examples of RdbPrimitiveElementMapping


Examples of org.objectweb.jorm.mapper.rdb.metainfo.RdbPrimitiveElementMapping

        if (logger.isLoggable(BasicLevel.DEBUG)) {
            logger.log(BasicLevel.DEBUG, "The Primitive field " + pe.getName()
                    + " is mappeded over the column (name=" + colName
                    + ", sql type=" + colType + ")");
        }
        RdbPrimitiveElementMapping pem = (RdbPrimitiveElementMapping)
          t.getPrimitiveElementMappingByCol(colName);
        if (pem == null) {
            pem = t.createPrimitiveElementMapping(pe, colName, colType, false);
        }
        if (join != null) {
            pem.bindPrimitiveElement(join, pe);
        }
        return pem;
    }
View Full Code Here

Examples of org.objectweb.jorm.mapper.rdb.metainfo.RdbPrimitiveElementMapping

        RdbTable table = rcm.getRdbTable();
        //Map the name def of the reference over new local columns
        if (nd.isFieldName()) {
            PrimitiveElement pe = (PrimitiveElement) jclass
                    .getTypedElement(nd.getFieldName());
            RdbPrimitiveElementMapping pem = (RdbPrimitiveElementMapping) table
                    .getPrimitiveElementMappingByCol(sf.columns[0].name);
            if (pem == null) {
                // create it
                table.createPrimitiveElementMapping(pe,
                        sf.columns[0].name, sf.columns[0].sqlType,
                        false);
            } else {
                //it already exists
                //remove the old hidden field
                ((Class) pe.getParent()).removeTypedElement(pe
                        .getName());
                //Use the existing one in the name def
                pe = (PrimitiveElement) pem.getLinkedMO();
                nd.setFieldName(pe.getName());
                if (pem.getType() == null) {
                    pem.setType(sf.columns[0].sqlType);
                }
            }
        } else {
            Map tndproj = tnd.getNameRef().getProjection();
            Iterator it = nd.getNameRef().getProjection().entrySet()
                    .iterator();
            while (it.hasNext()) {
                Map.Entry me = (Map.Entry) it.next();
                //find the field in the class used in by this name def
                PrimitiveElement pe = (PrimitiveElement) jclass
                        .getTypedElement((String) me.getValue());
                //find the pk column
                RdbPrimitiveElementMapping tpem = getPEMOfField(tclass,
                        (Mapping) rcm.getParent(),
                        (String) tndproj.get(me.getKey()));
                //find the fk column name
                SpeedoColumn fkCol = sf.getFKColumn(tpem.getName());
                //check if the fk column name is already used
                RdbPrimitiveElementMapping pem = (RdbPrimitiveElementMapping) table
                        .getPrimitiveElementMappingByCol(fkCol.name);
                if (pem == null) {
                    // create it
                    table.createPrimitiveElementMapping(pe, fkCol.name,
                            fkCol.sqlType, false);
                } else {
                    //it already exists
                    //remove the old hidden field
                    ((Class) pe.getParent()).removeTypedElement(pe.getName());
                    //Use the existing one in the name def
                    pe = (PrimitiveElement) pem.getLinkedMO();
                    me.setValue(pe.getName());
                    if (pem.getType() == null) {
                        pem.setType(sf.columns[0].sqlType);
                    }
                }
            }
        }
    }
View Full Code Here

Examples of org.objectweb.jorm.mapper.rdb.metainfo.RdbPrimitiveElementMapping

            SpeedoJoinColumn jc = (SpeedoJoinColumn) fkColIt.next();
            j.addJoinColumnNames(jc.targetColumn, jc.column.name);
        }
        // map the name def over pk field of the referenced class
        if (tnd.isFieldName()) {
            RdbPrimitiveElementMapping pem = (RdbPrimitiveElementMapping) trcm
                    .getPrimitiveElementMapping(tnd.getFieldName(), true);
            PrimitiveElement pe = (PrimitiveElement) jclass
                    .getTypedElement(nd.getFieldName());
            exttable.createPrimitiveElementMapping(pe, pem.getName(),
                    null, false, j);
        } else {
            Map tclassndproj = tnd.getNameRef().getProjection();
            Iterator it = nd.getNameRef().getProjection().entrySet()
                    .iterator();
            while (it.hasNext()) {
                Map.Entry me = (Map.Entry) it.next();
                PrimitiveElement pe = (PrimitiveElement) jclass
                        .getTypedElement((String) me.getValue());
                RdbPrimitiveElementMapping pem = (RdbPrimitiveElementMapping)
                  trcm.getPrimitiveElementMapping(
                          (String) tclassndproj.get(me.getKey()), true);
                exttable.createPrimitiveElementMapping(pe, pem.getName(), null, false, j);
            }
        }
    }
View Full Code Here

Examples of org.objectweb.jorm.mapper.rdb.metainfo.RdbPrimitiveElementMapping

            while (it.hasNext()) {
                Map.Entry me = (Map.Entry) it.next();
                //find the field in the genclass used in by this name def
                PrimitiveElement pe = gcr.getHiddenField((String) me.getValue());
                //find the pk column
                RdbPrimitiveElementMapping tpem = getPEMOfField(tclass,
                        (Mapping) gcm.getParent(),
                        (String) tndproj.get(me.getKey()));
                //find the fk column name
                SpeedoColumn fkCol = sf.getFKColumn(tpem.getName());
                createPEMInGC(pe, fkCol, table, nd, (String) me.getKey());
            }
        }
    }
View Full Code Here

Examples of org.objectweb.jorm.mapper.rdb.metainfo.RdbPrimitiveElementMapping

        if (col.name == null) {
            // default mapping
            col.name = pe.getName();
        }
        //check if the column name is already used
        RdbPrimitiveElementMapping pem = (RdbPrimitiveElementMapping)
            table.getPrimitiveElementMappingByCol(col.name);
        if (pem == null) {
            // create it
            table.createPrimitiveElementMapping(
                    pe, col.name, col.sqlType, !col.allowNull);
        } else {
            //it exists then assign the real primitive element to the
            // the name def
            ((GenClassRef) pe.getParent()).removeTypedElement(pe.getName());
            pe = (PrimitiveElement) pem.getLinkedMO();
            if (nd.isFieldName()) {
                nd.setFieldName(pe.getName());
            } else {
                nd.getNameRef().getProjection().put(
                        compositeFieldName, pe.getName());
            }
            if (pem.getType() == null) {
                pem.setType(col.sqlType);
            }
        }
    }
View Full Code Here

Examples of org.objectweb.jorm.mapper.rdb.metainfo.RdbPrimitiveElementMapping

    private RdbPrimitiveElementMapping getPEMOfField(
            SpeedoClass sc,
            Mapping map,
            String fieldName) throws PException {
        SpeedoClass current = sc;
        RdbPrimitiveElementMapping pem = null;
        while(pem == null) {
          RdbClassMultiMapping trcm = getClassMapping(map, current.jormclass);
          pem = (RdbPrimitiveElementMapping)
            trcm.getPrimitiveElementMapping(fieldName, true);
            current = sc.getSuper();
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.