Examples of FieldMapping

Note that a Filter with the pattern '*' no constraint and only an null value as mapping would create a 1:1 copy of the source. TODO: Is it OK to keep an actual implementation in the Service API package? @author Rupert Westenthaler
  • org.exolab.castor.mapping.xml.FieldMapping
    @version $Revision: 1.1.1.1 $ $Date: 2003/03/03 07:08:35 $
  • org.kitesdk.data.FieldMapping
    Represents how to store a Schema field. @since 0.14.0

  • Examples of org.apache.openjpa.jdbc.meta.FieldMapping

         * Set attribute override into proper mapping.
         */
        private void endAttributeOverride()
            throws SAXException {
            Object elem = currentElement();
            FieldMapping fm;
            if (elem instanceof ClassMapping)
                fm = getAttributeOverride((ClassMapping) elem);
            else
                fm = getAttributeOverride((FieldMapping) elem);
            if (_cols != null) {
                fm.getValueInfo().setColumns(_cols);
                if (_colTable != null)
                    fm.getMappingInfo().setTableName(_colTable);
                setUnique(fm);
            }
            clearColumnInfo();
            _override = null;
        }
    View Full Code Here

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

        /**
         * Return the proper override.
         */
        private FieldMapping getAttributeOverride(ClassMapping cm) {
            FieldMapping sup = (FieldMapping) cm.getDefinedSuperclassField
                (_override);
            if (sup == null)
                sup = (FieldMapping) cm.addDefinedSuperclassField(_override,
                    Object.class, Object.class);
            return sup;
    View Full Code Here

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

            throws SAXException {
            ClassMapping embed = fm.getEmbeddedMapping();
            if (embed == null)
                throw getException(_loc.get("not-embedded", fm));

            FieldMapping efm = embed.getFieldMapping(_override);
            if (efm == null)
                throw getException(_loc.get("embed-override-name",
                    fm, _override));
            return efm;
        }
    View Full Code Here

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

        /**
         * Set the join table information back.
         */
        private void endJoinTable() {
            FieldMapping fm = (FieldMapping) currentElement();
            if (_joinCols != null)
                fm.getMappingInfo().setColumns(_joinCols);
            if (_cols != null)
                fm.getElementMapping().getValueInfo().setColumns(_cols);
            clearColumnInfo();
        }
    View Full Code Here

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

        }

        @Override
        public void populateColumns(Version vers, Table table, Column[] cols) {
            // check for version field and use its name as column name
            FieldMapping fm = vers.getClassMapping().getVersionFieldMapping();
            if (fm != null && cols.length == 1)
                cols[0].setName(fm.getName());
            else
                super.populateColumns(vers, table, cols);
        }
    View Full Code Here

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

            ClassMapping owner;
            ClassMapping from, to;
            Action action;
            Variable var;
            Iterator itr = (_actions == null) ? null : _actions.iterator();
            FieldMapping field;
            while (itr != null && itr.hasNext()) {
                action = (Action) itr.next();

                // treat subqueries like variables for alias generation purposes
                if (action.op == Action.VAR)
    View Full Code Here

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

        }

        public Object toDataStoreValue(Select sel, ExpContext ctx, ExpState state,
            Object val) {
            PathExpState pstate = (PathExpState) state;
            FieldMapping field = (pstate.cmpfield != null) ? pstate.cmpfield
                : pstate.field;
            if (isXPath())
                return val;
            if (field != null) {
                if (_key)
                    return field.toKeyDataStoreValue(val, ctx.store);
                if (field.getElement().getDeclaredTypeCode() != JavaTypes.OBJECT)
                    return field.toDataStoreValue(val, ctx.store);

                val = field.getExternalValue(val, ctx.store.getContext());
                return field.toDataStoreValue(val, ctx.store);
            }
            return _class.toDataStoreValue(val, _class.getPrimaryKeyColumns(),
                ctx.store);
        }
    View Full Code Here

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

                throw new UnsupportedOperationException();

            GetMapValueExpState gstate = (GetMapValueExpState) state;
            PCPath map = (PCPath) _map;
            Object key = ((Const) _key).getValue(ctx, gstate.keyState);
            FieldMapping field = map.getFieldMapping(gstate.mapState);
            if (!(field.getStrategy() instanceof LRSMapFieldStrategy))
                throw new UnsupportedOperationException();

            LRSMapFieldStrategy strat = (LRSMapFieldStrategy) field.getStrategy();
            ClassMapping[] clss = strat.getIndependentValueMappings(true);
            if (clss != null && clss.length > 1)
                throw RelationStrategies.unjoinable(field);

            ClassMapping cls = (clss.length == 0) ? null : clss[0];
            ForeignKey fk = strat.getJoinForeignKey(cls);

            // manually create a subselect for the Map's value
            sql.append("(SELECT ");
            Column[] values = field.getElementMapping().getColumns();
            for (int i = 0; i < values.length; i++) {
                if (i > 0)
                    sql.append(", ");
                sql.append(values[i].getFullName());
            }
    View Full Code Here

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

            boolean augmentUpdates = true;

            for (Iterator i = updateParams.entrySet().iterator(); i.hasNext();) {
                Map.Entry next = (Map.Entry) i.next();
                Path path = (Path) next.getKey();
                FieldMapping fmd = (FieldMapping) path.last();

                if (fmd.isVersion())
                    augmentUpdates = false;

                Val val = (Val) next.getValue();
                if (val == null)
                    val = new Null();
                Column col = fmd.getColumns()[0];
                if (allowAlias) {
                  sql.append(sel.getColumnAlias(col));
                } else {
                  sql.append(toDBName(col.getIdentifier()));
                }           
                sql.append(" = ");

                ExpState state = val.initialize(sel, ctx, 0);
                // JDBC Paths are always PCPaths; PCPath implements Val
                ExpState pathState = ((Val) path).initialize(sel, ctx, 0);
                calculateValue(val, sel, ctx, state, path, pathState);

                // append the value with a null for the Select; i
                // indicates that the
                int length = val.length(sel, ctx, state);
                for (int j = 0; j < length; j++)
                    val.appendTo((allowAlias) ? sel : null, ctx, state, sql, j);

                if (i.hasNext())
                    sql.append(", ");
            }

            if (augmentUpdates) {
                Path path = (Path) updateParams.keySet().iterator().next();
                FieldMapping fm = (FieldMapping) path.last();
               
                ClassMapping meta = fm.getDefiningMapping();
                Map<Column,?> updates = meta.getVersion().getBulkUpdateValues();
                for (Map.Entry e : updates.entrySet()) {
                    Column col = (Column) e.getKey();
                    Object val = e.getValue();
                    sql.append(", ").append(toDBName(col.getIdentifier())).append(" = ");
    View Full Code Here

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

            return rels;
        }

        private void setMappedBy(Object oid, Result res) {
            //  for inverse toOne relation field
            FieldMapping mappedByFieldMapping = field.getMappedByMapping();
           
            if (mappedByFieldMapping != null) {
                ValueMapping val = mappedByFieldMapping.getValueMapping();
                ClassMetaData decMeta = val.getTypeMetaData();
                // this inverse field does not have corresponding classMapping
                // its value may be a collection/map etc.
                if (decMeta == null)
                    return;
    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.