当前位置: 首页>>代码示例>>Java>>正文


Java AsyncResult类代码示例

本文整理汇总了Java中com.sforce.soap.metadata.AsyncResult的典型用法代码示例。如果您正苦于以下问题:Java AsyncResult类的具体用法?Java AsyncResult怎么用?Java AsyncResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AsyncResult类属于com.sforce.soap.metadata包,在下文中一共展示了AsyncResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deletefields

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
/**
 * Make sure not more than 10 objects are referenced in one call - salesforce limitation.
 * @param objName
 * @param fields
 * @throws com.sforce.ws.ConnectionException
 * @throws InterruptedException
 */
public static void deletefields(String objName, String[] fields) throws ConnectionException, InterruptedException {
    Metadata[] metadata = new Metadata[fields.length];
    int i=0;
    for(String field : fields) {
        CustomField custField = new CustomField();
        custField.setFullName(objName+"."+field.trim().replaceAll(" ", "_")+"__c");
        metadata[i] = custField;
        i++;
    }
    AsyncResult[] ars = metadataConnection.delete(metadata);
    long waitTimeMilliSecs = 1000;
    for(i =0; i < ars.length; i++) {
        while (!ars[i].isDone()) {
            Thread.sleep(waitTimeMilliSecs);
            // double the wait time for the next iteration
            //waitTimeMilliSecs *= 2;
            ars = metadataConnection.checkStatus(new String[] { (ars[i]).getId() });
            App.logInfo("Status of field : "+ars[i].getMessage()+" & Status is: " + ars[i].getState());
        }
    }
    App.logInfo(" Job Done Boss!!!!!!!");
}
 
开发者ID:sunand85,项目名称:DF14_Demo,代码行数:30,代码来源:MetadataUtil.java

示例2: createCustomObject

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public static void createCustomObject(String name) throws ConnectionException, InterruptedException {
    CustomObject co = new CustomObject();
    co.setFullName(name + "__c");
    co.setDeploymentStatus(DeploymentStatus.Deployed);
    co.setDescription("Created by the Metadata API");
    co.setEnableActivities(true);
    co.setLabel(name + " Object");
    co.setPluralLabel(co.getLabel() + "s");
    co.setSharingModel(SharingModel.ReadWrite);
    CustomField nf = new CustomField();
    nf.setType(FieldType.Text);
    nf.setLabel("Name");
    co.setNameField(nf);

    AsyncResult[] ars = metadataConnection.create(new Metadata[]{co});
    AsyncResult asyncResult = ars[0];

    long waitTimeMilliSecs = 1000;
    while (!asyncResult.isDone()) {
        Thread.sleep(waitTimeMilliSecs);
        // double the wait time for the next iteration
        waitTimeMilliSecs *= 2;
        asyncResult = metadataConnection.checkStatus(new String[] {asyncResult.getId()})[0];
        App.logInfo("Status is: " + asyncResult.getState());
    }
}
 
开发者ID:sunand85,项目名称:DF14_Demo,代码行数:27,代码来源:MetadataUtil.java

示例3: retrieve

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public AsyncResult retrieve(RetrieveRequest retrieveRequest) throws ForceRemoteException {
    if (metadataConnection == null) {
        throw new IllegalArgumentException("Metadata stub cannot be null");
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Timeout set to " + getReadTimeout() + " milliseconds");
    }

    AsyncResult asyncResult = null;
    try {
        asyncResult = metadataConnection.retrieve(retrieveRequest);
    } catch (ConnectionException e) {
        ForceExceptionUtils.throwTranslatedException(e, connection);
    }

    return asyncResult;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:19,代码来源:MetadataStubExt.java

示例4: deploy

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public AsyncResult deploy(byte[] zipFile, DeployOptions deployOptions) throws ForceRemoteException {
    if (metadataConnection == null) {
        throw new IllegalArgumentException("Metadata stub cannot be null");
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Timeout set to " + getReadTimeout() + " milliseconds");
    }

    AsyncResult asyncResult = null;
    try {
        asyncResult = metadataConnection.deploy(zipFile, deployOptions);
    } catch (ConnectionException e) {
        ForceExceptionUtils.throwTranslatedException(e, connection);
    }
    return asyncResult;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:18,代码来源:MetadataStubExt.java

示例5: testDeployDisplayInformation_whenNotNull

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public void testDeployDisplayInformation_whenNotNull() throws Exception {
    MetadataStubExt mockMetadataStub = mock(MetadataStubExt.class);
    DeployResult mockDeployResult = mock(DeployResult.class);
    AsyncResult mockAsyncResult = mock(AsyncResult.class);

    when(mockAsyncResult.getId()).thenReturn("");
    when(mockDeployResult.getStatus()).thenReturn(DeployStatus.InProgress);
    when(mockDeployResult.getNumberComponentsDeployed()).thenReturn(1);
    when(mockDeployResult.getNumberComponentsTotal()).thenReturn(10);
    when(mockMetadataStub.checkDeployStatus(anyString())).thenReturn(mockDeployResult);

    DeployResultAdapter deployResultAdapter = new DeployResultAdapter(mockAsyncResult, mockMetadataStub);
    deployResultAdapter.checkStatus();

    verify(mockAsyncResult, times(1)).getId();
    assertTrue(deployResultAdapter.retrieveRealTimeStatusUpdatesIfAny()
            .contains("Deploy status: InProgress (1/10)"));
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:19,代码来源:ProjectServiceTest_unit.java

示例6: deleteCustomObject

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public static void deleteCustomObject(String name) throws ConnectionException, InterruptedException {
    CustomObject co = new CustomObject();
    co.setFullName(name + "__c");
    AsyncResult[] ars = metadataConnection.delete(new Metadata[]{co});
    AsyncResult asyncResult = ars[0];

    long waitTimeMilliSecs = 1000;
    while (!asyncResult.isDone()) {
        Thread.sleep(waitTimeMilliSecs);
        // double the wait time for the next iteration
        waitTimeMilliSecs *= 2;
        asyncResult = metadataConnection.checkStatus(new String[] {asyncResult.getId()})[0];
        App.logInfo("Status is: " + asyncResult.getState());
    }
}
 
开发者ID:sunand85,项目名称:DF14_Demo,代码行数:16,代码来源:MetadataUtil.java

示例7: createAndCheckStatus

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public static void createAndCheckStatus(Metadata[] metadata) throws Exception {
    AsyncResult[] ars = metadataConnection.create(metadata);
    String[] id = new String[ars.length];
    int j =0;
    boolean iserror = false;
    for(AsyncResult ar : ars) {
        id[j]=ar.getId();
        ++j;
    }
    long waitTimeMilliSecs = 1000;
    Thread.sleep(waitTimeMilliSecs);
    for(int i =0; i < id.length; i++) {
        do {
            ars = metadataConnection.checkStatus(new String[] { id[i]});
        }
        while (!ars[0].isDone());

        if(ars[0].getMessage() != null ) {
            App.logInfo("Status of field : "+ars[0].getMessage()+" & Status is: " + ars[0].getState());
            iserror = true;
        }
        if(iserror) {
            App.logError("job Done With Error's !!!!!!!");
        } else {
            App.logInfo("job Done !!!!!!!");
        }
    }
}
 
开发者ID:sunand85,项目名称:DF14_Demo,代码行数:29,代码来源:MetadataUtil.java

示例8: getRetrieveResult

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
/**
 * Retrieves asynchronous result from server for a given operation id.
 */
public RetrieveResultExt getRetrieveResult(
    RetrieveResultExt retrieveResultExt,
    AsyncResult asyncResult,
    MetadataStubExt metadataStubExt,
    IProgressMonitor monitor
) throws ForceRemoteException, ServiceException, ForceRemoteException, InterruptedException {
    if (metadataStubExt == null) {
        throw new IllegalArgumentException("MetadataStubExt cannot be null");
    }

    monitorCheckSubTask(monitor, Messages.getString("Retrieve.PreparingResults"));

    RetrieveResult retrieveResult;
    try {
        IFileBasedResultAdapter result = waitForResult(
            new RetrieveResultAdapter(asyncResult, metadataStubExt),
            metadataStubExt,
            operationStats,
            monitor);
        retrieveResult = ((RetrieveResultAdapter) result).getRetrieveResult();

    } catch (ServiceTimeoutException e) {
        e.setMetadataResultExt(retrieveResultExt);
        throw e;
    }

    if (retrieveResultExt == null) {
        retrieveResultExt = new RetrieveResultExt();
    }

    retrieveResultExt.setRetrieveResult(retrieveResult);

    // log result
    logResult(retrieveResultExt);

    monitorWork(monitor);

    return retrieveResultExt;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:43,代码来源:PackageRetrieveService.java

示例9: getDeployResult

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public DeployResultExt getDeployResult(
    DeployResultExt deployResultExt,
    AsyncResult asyncResult,
    MetadataStubExt metadataStubExt,
    IProgressMonitor monitor) throws ServiceTimeoutException, ServiceException, ForceRemoteException,
        ForceRemoteException, InterruptedException {
    if (metadataStubExt == null) {
        throw new IllegalArgumentException("MetadataStubExt cannot be null");
    }

    DeployResult deployResult;
    try {
        IFileBasedResultAdapter result =
                waitForResult(new DeployResultAdapter(asyncResult, metadataStubExt), metadataStubExt,
                    operationStats, monitor);
        deployResult = ((DeployResultAdapter) result).getDeployResult();
    } catch (ServiceTimeoutException ex) {
        ex.setMetadataResultExt(deployResultExt);
        throw ex;
    }

    monitorCheckSubTask(monitor, "Preparing results...");

    // REVIEWME: should we create an empty wrapper?
    if (deployResultExt == null) {
        deployResultExt = new DeployResultExt();
    }

    deployResultExt.setDeployResult(deployResult);
    deployResultExt.setDebugLog(MetadataDebuggingInfoHandler.getDebugLog());

    monitorWork(monitor);

    // log results
    logResult(deployResultExt);

    return deployResultExt;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:39,代码来源:PackageDeployService.java

示例10: checkStatus

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public AsyncResult[] checkStatus(String[] asyncProcessId) throws ForceRemoteException {
    if (metadataConnection == null) {
        throw new IllegalArgumentException("Metadata stub cannot be null");
    }

    AsyncResult[] asyncResult = null;
    try {
        asyncResult = metadataConnection.checkStatus(asyncProcessId);
    } catch (ConnectionException e) {
        ForceExceptionUtils.throwTranslatedException(e, connection);
    }
    return asyncResult;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:14,代码来源:MetadataStubExt.java

示例11: testRetrieveDisplayInformation_whenNull

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public void testRetrieveDisplayInformation_whenNull() throws Exception {
    MetadataStubExt mockMetadataStub = mock(MetadataStubExt.class);
    when(mockMetadataStub.getServerName()).thenReturn("test-end-point-server");

    RetrieveResultAdapter retrieveResult = new RetrieveResultAdapter(mock(AsyncResult.class), mockMetadataStub);
    assertEquals("Polling server test-end-point-server for response",
        retrieveResult.retrieveRealTimeStatusUpdatesIfAny());
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:9,代码来源:ProjectServiceTest_unit.java

示例12: testRetrieveDisplayInformation_whenNotNull

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public void testRetrieveDisplayInformation_whenNotNull() throws Exception {
    MetadataStubExt mockMetadataStub = mock(MetadataStubExt.class);
    RetrieveResult mockRetrieveResult = mock(RetrieveResult.class);
    AsyncResult mockAsyncResult = mock(AsyncResult.class);

    when(mockAsyncResult.getId()).thenReturn("");
    when(mockRetrieveResult.getStatus()).thenReturn(RetrieveStatus.InProgress);
    when(mockMetadataStub.checkRetrieveStatus(anyString())).thenReturn(mockRetrieveResult);

    RetrieveResultAdapter retrieveResultAdapter = new RetrieveResultAdapter(mockAsyncResult, mockMetadataStub);
    retrieveResultAdapter.checkStatus();

    verify(mockAsyncResult, times(1)).getId();
    assertTrue(retrieveResultAdapter.retrieveRealTimeStatusUpdatesIfAny().contains("Request status: InProgress"));
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:16,代码来源:ProjectServiceTest_unit.java

示例13: testDeployDisplayInformation_whenNull

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public void testDeployDisplayInformation_whenNull() throws Exception {
    MetadataStubExt mockMetadataStub = mock(MetadataStubExt.class);
    when(mockMetadataStub.getServerName()).thenReturn("test-end-point-server");

    DeployResultAdapter deployResult = new DeployResultAdapter(mock(AsyncResult.class), mockMetadataStub);
    assertEquals("Polling server test-end-point-server for response",
        deployResult.retrieveRealTimeStatusUpdatesIfAny());
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:9,代码来源:ProjectServiceTest_unit.java

示例14: RetrieveResultAdapter

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
public RetrieveResultAdapter(AsyncResult asyncResult, MetadataStubExt metadataStubExt) {
    this.asyncResult = asyncResult;
    this.metadataStubExt = metadataStubExt;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:5,代码来源:PackageRetrieveService.java

示例15: getAsyncResult

import com.sforce.soap.metadata.AsyncResult; //导入依赖的package包/类
@Override
public AsyncResult getAsyncResult() {
    return asyncResult;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:5,代码来源:PackageRetrieveService.java


注:本文中的com.sforce.soap.metadata.AsyncResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。