Package com.sforce.soap.metadata

Examples of com.sforce.soap.metadata.MetadataConnection


    }    
    zipOS.close();
       
    // Connect to Salesforce Metadata API
        ForceServiceConnector connector = new ForceServiceConnector(ForceServiceConnector.getThreadLocalConnectorConfig());
        MetadataConnection metadataConnection = connector.getMetadataConnection();
       
    // Deploy to Salesforce
    DeployOptions deployOptions = new DeployOptions();
    deployOptions.setSinglePackage(true);
    deployOptions.setPerformRetrieve(false);
    deployOptions.setRollbackOnError(true);
    AsyncResult asyncResult = metadataConnection.deploy(baos.toByteArray(), deployOptions);

    // Given the client the AysncResult to poll for the result of the deploy
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.getSerializationConfig().addMixInAnnotations(AsyncResult.class, AsyncResultMixIn.class);
    return objectMapper.writeValueAsString(asyncResult);
View Full Code Here


    @RequestMapping(method = RequestMethod.GET, value = "/{owner}/{repo}/checkstatus/{asyncId}")
    public String checkStatus(@PathVariable("asyncId") String asyncId) throws Exception
    {
      // Connect to Metadata API, check async status and return to client
        ForceServiceConnector connector = new ForceServiceConnector(ForceServiceConnector.getThreadLocalConnectorConfig());
        MetadataConnection metadataConnection = connector.getMetadataConnection();
        AsyncResult asyncResult =  metadataConnection.checkStatus(new String[] { asyncId })[0];
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.getSerializationConfig().addMixInAnnotations(AsyncResult.class, AsyncResultMixIn.class);     
    return objectMapper.writeValueAsString(asyncResult);
    }
View Full Code Here

    @RequestMapping(method = RequestMethod.GET, value = "/{owner}/{repo}/checkdeploy/{asyncId}")
    public String checkDeploy(@PathVariable("asyncId") String asyncId) throws Exception
    {
      // Connect to Metadata API, check async status and return to client
        ForceServiceConnector connector = new ForceServiceConnector(ForceServiceConnector.getThreadLocalConnectorConfig());
        MetadataConnection metadataConnection = connector.getMetadataConnection();
        DeployResult deployResult = metadataConnection.checkDeployStatus(asyncId);
    ObjectMapper objectMapper = new ObjectMapper();
    return objectMapper.writeValueAsString(printErrors(deployResult));
    }
View Full Code Here

    }
   
    @Mock
    public MetadataConnection getMetadataConnection() throws ConnectionException {
        // Just return a non-null MetadataConnection
        return new MetadataConnection(new ConnectorConfig());
    }
View Full Code Here

        deployOptions.setSinglePackage(true);
        deployOptions.setAutoUpdatePackage(true);
        deployOptions.setAllowMissingFiles(true);
        deployOptions.setPurgeOnDelete(deleteProperty.getPurgeSchemaOnDelete());

        MetadataConnection metadatabinding = mconn.getMetadataConnection();
        createZipFile(schemaFiles.toArray(new File[schemaFiles.size()]), DEPLOY_ZIP);
        AsyncResult asyncResult = metadatabinding.deploy(readZipFile(DEPLOY_ZIP), deployOptions);

        // Wait for the deploy to complete 
        waitForAsyncResult(metadatabinding, new AsyncResult[] {asyncResult}, true, DEPLOY_ZIP);

        DeployResult result = metadatabinding.checkDeployStatus(asyncResult.getId());
       
        // Log any messages 
        StringBuilder buf = new StringBuilder();
        if (result.getMessages() != null) {
            for (DeployMessage rm : result.getMessages()) {
View Full Code Here

        connector.setClientId("testSetClientId");

        PartnerConnection conn = connector.getConnection();
        assertEquals(conn.getCallOptions().getClient(), "testSetClientId");

        MetadataConnection mdConn = connector.getMetadataConnection();
        assertEquals(mdConn.getCallOptions().getClient(), "testSetClientId");
    }
View Full Code Here

        connector.setClientId("testUseLatestClientId2");

        PartnerConnection conn = connector.getConnection();
        assertEquals(conn.getCallOptions().getClient(), "testUseLatestClientId2");

        MetadataConnection mdConn = connector.getMetadataConnection();
        assertEquals(mdConn.getCallOptions().getClient(), "testUseLatestClientId2");
    }
View Full Code Here

       
        ConnectorConfig configNew = new ConnectorConfig();
        configNew.setSessionId(config.getSessionId());
        configNew.setServiceEndpoint(METADATA_URI_PATTERN.matcher(config.getServiceEndpoint()).replaceFirst("$1/m/$2"));

        this.metadataConnection = new MetadataConnection(configNew);

        // Give the metadata connection a client id if we have one
        if (this.clientId != null) {
            this.metadataConnection.setCallOptions(this.clientId);
        } else if (this.externalClientId != null) {
View Full Code Here

            logger.debug("Preparing metadata stub for " + connection.getLogDisplay());
            logger.debug("Using metadata server url: " + connection.getMetadataServerUrl());
        }

        try {
            this.metadataConnection = new MetadataConnection(connection.getMetadataConnectorConfig());
        } catch (ConnectionException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not set metadata connection with connection:  " + connection.getLogDisplay());
            }
            ForceExceptionUtils.handleRemoteException(connection, e);
View Full Code Here

TOP

Related Classes of com.sforce.soap.metadata.MetadataConnection

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.