Examples of Embeddable


Examples of org.apache.cayenne.map.Embeddable

        }

        @Override
        Object createObject(ProjectPath path) {
            JpaEmbeddable jpaEmbeddable = (JpaEmbeddable) path.getObject();
            Embeddable embeddable = new Embeddable(jpaEmbeddable.getClassName());
            ((DataMap) targetPath.getObject()).addEmbeddable(embeddable);
            return embeddable;
        }
View Full Code Here

Examples of org.apache.cayenne.map.Embeddable

        @Override
        Object createObject(ProjectPath path) {
            JpaBasic jpaBasic = (JpaBasic) path.getObject();

            Embeddable embeddable = (Embeddable) targetPath.getObject();

            EmbeddableAttribute attribute = new EmbeddableAttribute(jpaBasic.getName());
            attribute.setType(getAttributeType(path, jpaBasic.getName()).getName());
            attribute.setDbAttributeName(jpaBasic.getColumn().getName());

            embeddable.addAttribute(attribute);
            return attribute;
        }
View Full Code Here

Examples of org.apache.cayenne.map.Embeddable

            // format even if no serialVersionUID is defined by the user
            SerialVersionUIDAdder e3 = new SerialVersionUIDAdder(e2);
            return e3;
        }

        Embeddable embeddable = embeddablesByClass.get(key);
        if (embeddable != null) {
            // create enhancer chain
            EmbeddableVisitor e1 = new EmbeddableVisitor(out);

            // this ensures that both enhanced and original classes have compatible
View Full Code Here

Examples of org.apache.cayenne.map.Embeddable

     */
    public static void setEmbeddableAttributeName(EmbeddableAttribute attribute, String newName) {
        String oldName = attribute.getName();

        attribute.setName(newName);
        Embeddable embeddable = attribute.getEmbeddable();
       
        if (embeddable != null) {
            embeddable.removeAttribute(oldName);
            embeddable.addAttribute(attribute);
        }
    }
View Full Code Here

Examples of org.apache.cayenne.map.Embeddable

    public void currentEmbeddableChanged(EmbeddableDisplayEvent e) {
        if (e.getSource() == this) {
            return;
        }

        Embeddable embeddable = (Embeddable) e.getEmbeddable();
        if (embeddable != null) {
            rebuildTable(embeddable);
        }

    }
View Full Code Here

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

        JDBCStore store, Column[] cols, List rvals, int idx) {
        // set rest of columns from fields
        FieldMapping[] fms = vm.getEmbeddedMapping().getFieldMappings();
        Object cval;
        Column[] ecols;
        Embeddable embed;
        for (int i = 0; i < fms.length; i++) {
            if (fms[i].getManagement() != FieldMapping.MANAGE_PERSISTENT)
                continue;
           
            // This recursive code is mainly to deal with situations
            // where an entity contains a collection of embeddableA.
            // The embeddableA element in the collection contains an
            // embeddableB. The parameter vm to toDataStoreValue is
            // embeddableA. If some field in embeddableA is of type
            // embeddableB, recursive call is required to populate the
            // value for embeddableB.
            ValueMapping val = fms[i].getValueMapping();
            if (val.getEmbeddedMapping() != null) {
                cval = (em == null) ? null : em.fetch(i);
                if (cval instanceof PersistenceCapable) {
                    OpenJPAStateManager embedSm = (OpenJPAStateManager)
                        ((PersistenceCapable)cval).pcGetStateManager();
                    idx = toDataStoreValue1(embedSm, val, store, cols, rvals,
                            idx);
                } else if (cval instanceof ObjectIdStateManager) {
                    idx = toDataStoreValue1((ObjectIdStateManager)cval, val,
                            store, cols, rvals, idx);
                } else if (cval == null) {
                    idx = toDataStoreValue1(null, val, store, cols, rvals, idx);
                }
            }
           
            embed = (Embeddable) fms[i].getStrategy();
            ecols = embed.getColumns();
            if (ecols.length == 0)
                continue;

            cval = (em == null) ? null : getValue(embed, em, i);
            cval = embed.toEmbeddedDataStoreValue(cval, store);
            if (cols.length == 1) {
                // rvals is empty
                rvals.add(cval); // save the return value
            } else if (ecols.length == 1) {
                Object rval = rvals.get(0);
View Full Code Here

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

    protected int toObjectValue1(OpenJPAStateManager em, ValueMapping vm,
        Object val, JDBCStore store, JDBCFetchConfiguration fetch,
        Column[] cols, int idx)
        throws SQLException {
        FieldMapping[] fms = vm.getEmbeddedMapping().getFieldMappings();
        Embeddable embed;
        Object cval;
        Column[] ecols;
        for (int i = 0; i < fms.length; i++) {
            if (fms[i].getManagement() != FieldMapping.MANAGE_PERSISTENT)
                continue;

            ValueMapping vm1 = fms[i].getValueMapping();
            OpenJPAStateManager em1 = null;
           
            embed = (Embeddable) fms[i].getStrategy();
            if (vm1.getEmbeddedMapping() != null) {
                if (em instanceof StateManagerImpl) {
                em1 = store.getContext().embed(null, null, em, vm1);
                idx = toObjectValue1(em1, vm1, val, store, fetch, cols, idx);
                } else if (em instanceof ObjectIdStateManager) {
                    em1 = new ObjectIdStateManager(null, null, vm1);
                    idx = toObjectValue1(em1, vm1, val, store, null,
                            getColumns(fms[i]), idx);
                }
                if (em1 != null) {
                    cval = em1.getManagedInstance();
                } else {
                    cval = null;
                }
            } else {
                ecols = embed.getColumns();
                if (ecols.length == 0)
                    cval = null;
                else if (idx == 0 && ecols.length == cols.length)
                    cval = val;
                else if (ecols.length == 1)
                    cval = ((Object[]) val)[idx++];
                else {
                    cval = new Object[ecols.length];
                    System.arraycopy(val, idx, cval, 0, ecols.length);
                    idx += ecols.length;
                }
            }

            if (store != null && em instanceof StateManagerImpl)
                embed.loadEmbedded(em, store, fetch, cval);
            else {
                if (!(em instanceof ObjectIdStateManager))
                    cval = embed.toEmbeddedObjectValue(cval);
                if (fms[i].getHandler() != null)
                    cval = fms[i].getHandler().toObjectValue(fms[i], cval);

                em.store(fms[i].getIndex(), cval);
            }
View Full Code Here

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

        JDBCStore store, Column[] cols, Object rval, int idx) {
        // set rest of columns from fields
        FieldMapping[] fms = vm.getEmbeddedMapping().getFieldMappings();
        Object cval;
        Column[] ecols;
        Embeddable embed;
        for (int i = 0; i < fms.length; i++) {
            if (fms[i].getManagement() != FieldMapping.MANAGE_PERSISTENT)
                continue;
            embed = (Embeddable) fms[i].getStrategy();
            ecols = embed.getColumns();
            if (ecols.length == 0)
                continue;

            cval = (em == null) ? null : em.fetch(i);
            cval = embed.toEmbeddedDataStoreValue(cval, store);
            if (cols.length == 1)
                rval = cval;
            else if (ecols.length == 1)
                ((Object[]) rval)[idx++] = cval;
            else {
View Full Code Here

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

    protected void toObjectValue(OpenJPAStateManager em, ValueMapping vm,
        Object val, JDBCStore store, JDBCFetchConfiguration fetch,
        Column[] cols, int idx)
        throws SQLException {
        FieldMapping[] fms = vm.getEmbeddedMapping().getFieldMappings();
        Embeddable embed;
        Object cval;
        Column[] ecols;
        for (int i = 0; i < fms.length; i++) {
            if (fms[i].getManagement() != FieldMapping.MANAGE_PERSISTENT)
                continue;

            embed = (Embeddable) fms[i].getStrategy();
            ecols = embed.getColumns();
            if (ecols.length == 0)
                cval = null;
            else if (idx == 0 && ecols.length == cols.length)
                cval = val;
            else if (ecols.length == 1)
                cval = ((Object[]) val)[idx++];
            else {
                cval = new Object[ecols.length];
                System.arraycopy(val, idx, cval, 0, ecols.length);
                idx += ecols.length;
            }

            if (store != null)
                embed.loadEmbedded(em, store, fetch, cval);
            else {
                cval = embed.toEmbeddedObjectValue(cval);
                em.store(fms[i].getIndex(), cval);
            }
        }
    }
View Full Code Here

Examples of org.jbehave.core.Embeddable

        StoryRunner runner = mock(StoryRunner.class);
        OutputStream out = new ByteArrayOutputStream();
        EmbedderMonitor monitor = new PrintStreamEmbedderMonitor(new PrintStream(out));
        String myEmbeddableName = MyStoryMaps.class.getName();
        List<String> classNames = asList(myEmbeddableName);
        Embeddable myEmbeddable = new MyStoryMaps();
        List<Embeddable> embeddables = asList(myEmbeddable);
        EmbedderClassLoader classLoader = mock(EmbedderClassLoader.class);
        when(classLoader.newInstance(Embeddable.class, myEmbeddableName)).thenReturn(myEmbeddable);

        // When
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.