Package com.force.sdk.jpa

Examples of com.force.sdk.jpa.ForceManagedConnection


        if (conn == null) {
            ObjectManager om = (ObjectManager) em.getDelegate();
           
            // Get the EntityManager's PartnerConnection
            ConnectionFactory connFactory = om.getStoreManager().getConnectionManager().lookupConnectionFactory("force");
            ForceManagedConnection mconn = (ForceManagedConnection) connFactory.createManagedConnection(null, null);
            conn = (PartnerConnection) mconn.getConnection();
        }
    }
View Full Code Here


    protected Object performExecute(Map parameters) {
        if (parameters.size() > 0) {
            throw new NucleusException("Bind parameters not supported on native SOQL query");
        }

        ForceManagedConnection mconn = (ForceManagedConnection) ec.getStoreManager().getConnection(ec);
        try {
            long startTime = System.currentTimeMillis();
            if (NucleusLogger.QUERY.isDebugEnabled()) {
                NucleusLogger.QUERY.debug(LOCALISER.msg("021046", "SOQL", getSingleStringQuery(), null));
            }
            Object results = null;
            if (candidateCollection == null) {
                List<Object> rawResults =
                    new ForceQueryUtils(ec, mconn, this, parameters, null, null).getObjectsOfCandidateType(null);
                if (ForceQueryUtils.getLimitType(this) == LimitType.Java) {
                    JavaQueryEvaluator resultMapper = new JPQLEvaluator(this, rawResults, newDummyQueryCompilation(),
                            parameters, ec.getClassLoaderResolver());
                        results = resultMapper.execute(false, false, false, false, true);
                } else {
                    results = rawResults;
                }
            } else {
                List candidates = new ArrayList(candidateCollection);
                // Apply any result restrictions to the results
                JavaQueryEvaluator resultMapper = new JPQLEvaluator(this, candidates, newDummyQueryCompilation(),
                    parameters, ec.getClassLoaderResolver());
                results = resultMapper.execute(true, true, true, true, true);
            }
   
            if (NucleusLogger.QUERY.isDebugEnabled()) {
                NucleusLogger.QUERY.debug(LOCALISER.msg("021074", "SOQL", "" + (System.currentTimeMillis() - startTime)));
            }
            return results;
        } catch (NucleusException ne) {
            throw ne;
        } catch (Exception e) {
            throw new NucleusException(e.getMessage(), e);
        } finally {
            mconn.release();
        }
    }
View Full Code Here

    @Override
    protected Object performExecute(Map parameters) {
        if (type == BULK_UPDATE) {
            throw new NucleusException("Bulk Update is not yet supported");
        }
        ForceManagedConnection mconn = (ForceManagedConnection) ec.getStoreManager().getConnection(ec);
        try {
            long startTime = System.currentTimeMillis();
            if (NucleusLogger.QUERY.isDebugEnabled()) {
                NucleusLogger.QUERY.debug(LOCALISER.msg("021046", "JPQL", getSingleStringQuery(), null));
            }
            Object results = null;
            if (type == BULK_DELETE) {
                results =
                    new ForceQueryUtils(ec, mconn, this, parameters, listeners, getExtensions())
                            .deleteObjectsOfCandidateType(candidateClass != null ? candidateClass : getFrom());
            } else {
                if (candidateCollection == null) {
                    List<Object> rawResults =
                        new ForceQueryUtils(ec, mconn, this, parameters, listeners, getExtensions())
                                .getObjectsOfCandidateType(compilation.getExprResult());
                    if (ForceQueryUtils.getLimitType(this) == LimitType.Java) {
                        JavaQueryEvaluator resultMapper = new JPQLEvaluator(this, rawResults, compilation,
                                parameters, ec.getClassLoaderResolver());
                            results = resultMapper.execute(false, false, false, false, true);
                    } else {
                        results = rawResults;
                    }
                } else {
                    List candidates = new ArrayList(candidateCollection);
                    // Apply any result restrictions to the results
                    JavaQueryEvaluator resultMapper = new JPQLEvaluator(this, candidates, compilation,
                        parameters, ec.getClassLoaderResolver());
                    results = resultMapper.execute(true, true, true, true, true);
                }
            }
   
            if (NucleusLogger.QUERY.isDebugEnabled()) {
                NucleusLogger.QUERY.debug(LOCALISER.msg("021074", "JPQL", "" + (System.currentTimeMillis() - startTime)));
            }
            return results;
        } catch (NucleusException ne) {
            throw ne;
        } catch (Exception e) {
            throw new NucleusException(e.getMessage(), e);
        } finally {
            mconn.release();
        }
    }
View Full Code Here

    /**
     * Executes the JDOQL query against the Force.com database.
     */
    @Override
    protected Object performExecute(Map parameters) {
        ForceManagedConnection mconn = (ForceManagedConnection) ec.getStoreManager().getConnection(ec);
        try {
            long startTime = System.currentTimeMillis();
            if (NucleusLogger.QUERY.isDebugEnabled()) {
                NucleusLogger.QUERY.debug(LOCALISER.msg("021046", "JDOQL", getSingleStringQuery(), null));
            }
            Collection results = null;
            List candidates = null;
            if (candidateCollection != null) {
                candidates = new ArrayList(candidateCollection);
            } else if (candidateExtent != null) {
                candidates = new ArrayList();
                Iterator iter = candidateExtent.iterator();
                while (iter.hasNext()) {
                    candidates.add(iter.next());
                }
            } else {
                List<Object> rawResults =
                    new ForceQueryUtils(ec, mconn, this, parameters, listeners, getExtensions())
                            .getObjectsOfCandidateType(compilation.getExprResult());
                if (ForceQueryUtils.getLimitType(this) == LimitType.Java) {
                    // Apply any result restrictions to the results
                    JavaQueryEvaluator resultMapper = new JDOQLEvaluator(this, rawResults, compilation,
                        parameters, ec.getClassLoaderResolver());
                    results = resultMapper.execute(false, false, false, false, true);
                } else {
                    results = rawResults;
                }
            }

            if (candidates != null) {
                // Apply any result restrictions to the results
                JavaQueryEvaluator resultMapper = new JDOQLEvaluator(this, candidates, compilation,
                    parameters, ec.getClassLoaderResolver());
                results = resultMapper.execute(true, true, true, true, true);
            }

            if (NucleusLogger.QUERY.isDebugEnabled()) {
                NucleusLogger.QUERY.debug(LOCALISER.msg("021074", "JDOQL",
                    "" + (System.currentTimeMillis() - startTime)));
            }

            return results;
        } catch (NucleusException ne) {
            throw ne;
        } catch (Exception e) {
            throw new NucleusException(e.getMessage(), e);
        } finally {
            mconn.release();
        }
    }
View Full Code Here

        if (em == null) createPrimaryEntityManager();
        ObjectManager om = (ObjectManager) em.getDelegate();

        // Get the EntityManager's PartnerConnection
        ConnectionFactory connFactory = om.getStoreManager().getConnectionManager().lookupConnectionFactory("force");
        ForceManagedConnection mconn = (ForceManagedConnection) connFactory.createManagedConnection(null, null);
        SfdcSchemaUtil.cleanSchema(mconn);
    }
View Full Code Here

    protected void cleanSchema() throws Exception {
        ObjectManager om = (ObjectManager) entityManager.getDelegate();
        // Get the EntityManager's PartnerConnection
        ConnectionFactory connFactory = om.getStoreManager().getConnectionManager().lookupConnectionFactory("force");
        ForceManagedConnection mconn = (ForceManagedConnection) connFactory.createManagedConnection(null, null);
        // cleanup schema via destructive changes
        SfdcSchemaUtil.cleanSchema(mconn);
    }
View Full Code Here

TOP

Related Classes of com.force.sdk.jpa.ForceManagedConnection

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.