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


Java UpsertResult类代码示例

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


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

示例1: handleMetadataResponse

import com.sforce.soap.partner.UpsertResult; //导入依赖的package包/类
private static DeployResponse handleMetadataResponse(DeployResponse dr,
    com.sforce.soap.metadata.UpsertResult[] results) throws DeployException
{
    for (com.sforce.soap.metadata.UpsertResult result : results)
    {
        if (result.isSuccess())
        {
            dr.incrementSuccessCount();
        }
        else
        {
            for (com.sforce.soap.metadata.Error e : result.getErrors())
            {
                dr.addError(String.format("Status Code: [%s]\nMessage: [%s]\nFields: [%s]\n",
                    e.getStatusCode().name(), e.getMessage(), String.join(", ", e.getFields())));
                dr.incrementErrorCount();
            }
        }
    }

    return dr;
}
 
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:23,代码来源:SalesforceService.java

示例2: upsertData

import com.sforce.soap.partner.UpsertResult; //导入依赖的package包/类
public DeployResponse upsertData(String IdField, List<SObject> sobjects)
    throws ConnectionException, DeployException, AsyncApiException
{
    DeployResponse dr = new DeployResponse();

    // ensure the partner connection has been initialized
    createPartnerConnection();

    // check if the SObject queue is empty
    if (sobjects == null || sobjects.isEmpty())
    {
        Utils.log("An empty list of SObject was passed to upsertData()!");
    }
    else
    {
        Utils.log(String.format("Upserting %d records with Id field [%s].", +sobjects.size(), IdField));

        // upsert the records
        com.sforce.soap.partner.UpsertResult[] URs = _pConn.upsert(IdField,
            sobjects.toArray(new SObject[] {}));

        // process the results and log errors
        dr = SalesforceService.handleUpsertResponse(dr, URs);
    }
    return dr;
}
 
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:27,代码来源:SalesforceService.java

示例3: handleUpsertResponse

import com.sforce.soap.partner.UpsertResult; //导入依赖的package包/类
private static DeployResponse handleUpsertResponse(DeployResponse dr, UpsertResult[] results) throws DeployException
{
    boolean foundErrors = false;
    for (UpsertResult ur : results)
    {
        if (ur.getSuccess())
        {
            // Utils.log("'upsert' was successful! [" + ur.getId() + "]");
            dr.incrementSuccessCount();
        }
        else
        {
            for (com.sforce.soap.partner.Error e : ur.getErrors())
            {
                dr.addError(String.format("Status Code: [%s]\nMessage: [%s]\n%s\n", e.getStatusCode().name(),
                    e.getMessage(), (e.getFields() == null || e.getFields().length == 0 ? ""
                        : String.format("Fields: [%s]", String.join(", ", e.getFields())))));
                dr.incrementErrorCount();
            }
            foundErrors = true;
        }
    }

    if (foundErrors)
    {
        Utils.log("'upsert' resulted in errors! See log.");
    }

    return dr;
}
 
开发者ID:forcedotcom,项目名称:scmt-server,代码行数:31,代码来源:SalesforceService.java

示例4: countUpsertResults

import com.sforce.soap.partner.UpsertResult; //导入依赖的package包/类
private void countUpsertResults(UpsertResult[] upsertResults) {
    for (UpsertResult upsertResult : upsertResults) {
        if (upsertResult.isSuccess()) {
            this.numOfSuccess++;
        } else {
            this.numOfError++;
        }
    }
}
 
开发者ID:tzmfreedom,项目名称:embulk-output-salesforce,代码行数:10,代码来源:SalesforceOutputPlugin.java

示例5: upsert

import com.sforce.soap.partner.UpsertResult; //导入依赖的package包/类
private UpsertResult[] upsert(IndexedRecord input) throws IOException {
    upsertItems.add(input);
    if (upsertItems.size() >= commitLevel) {
        return doUpsert();
    }
    return null;
}
 
开发者ID:Talend,项目名称:components,代码行数:8,代码来源:SalesforceWriter.java

示例6: upsert

import com.sforce.soap.partner.UpsertResult; //导入依赖的package包/类
public UpsertResult[] upsert(String upsertField, SObject[] sfBuffer) throws KettleException
{
 try {
  return getBinding().upsert(upsertField, sfBuffer);
 }catch(Exception e) {
  throw new KettleException(BaseMessages.getString(PKG, "SalesforceInput.ErrorUpsert"), e);
 }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:9,代码来源:SalesforceConnection.java

示例7: upsert

import com.sforce.soap.partner.UpsertResult; //导入依赖的package包/类
public UpsertResult[] upsert( String upsertField, SObject[] sfBuffer ) throws KettleException {
  try {
    return getBinding().upsert( upsertField, sfBuffer );
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString( PKG, "SalesforceInput.ErrorUpsert", e ) );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:8,代码来源:SalesforceConnection.java

示例8: ResultWrapper

import com.sforce.soap.partner.UpsertResult; //导入依赖的package包/类
public ResultWrapper(SaveResult[] saveResults, 
        UpsertResult[] upsertResults, DeleteResult[] deleteResults) {
    this.saveResult = saveResults;
    this.upsertResult = upsertResults;
    this.deleteResult = deleteResults;
}
 
开发者ID:tzmfreedom,项目名称:embulk-output-salesforce,代码行数:7,代码来源:SalesforceOutputPlugin.java

示例9: doUpsert

import com.sforce.soap.partner.UpsertResult; //导入依赖的package包/类
private UpsertResult[] doUpsert() throws IOException {
    if (upsertItems.size() > 0) {
        // Clean the feedback records at each batch write.
        cleanWrites();
        SObject[] upds = new SObject[upsertItems.size()];
        for (int i = 0; i < upsertItems.size(); i++) {
            upds[i] = createSObjectForUpsert(upsertItems.get(i));
        }

        String[] changedItemKeys = new String[upds.length];
        for (int ix = 0; ix < upds.length; ++ix) {
            Object value = upds[ix].getField(upsertKeyColumn);
            if (value != null) {
                changedItemKeys[ix] = String.valueOf(value);
            }
        }
        UpsertResult[] upsertResults;
        try {
            upsertResults = connection.upsert(upsertKeyColumn, upds);
            upds = null;
            if (upsertResults != null && upsertResults.length != 0) {
                int batch_idx = -1;
                for (int i = 0; i < upsertResults.length; i++) {
                    ++batch_idx;
                    if (upsertResults[i].getSuccess()) {
                        if (upsertResults[i].getCreated()) {
                            handleSuccess(upsertItems.get(i), upsertResults[i].getId(), "created");
                        } else {
                            handleSuccess(upsertItems.get(i), upsertResults[i].getId(), "updated");
                        }
                    } else {
                        handleReject(upsertItems.get(0), upsertResults[i].getErrors(), changedItemKeys, batch_idx);
                    }
                }
            }
            upsertItems.clear();
            return upsertResults;
        } catch (ConnectionException e) {
            throw new IOException(e);
        }
    }
    return null;

}
 
开发者ID:Talend,项目名称:components,代码行数:45,代码来源:SalesforceWriter.java


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