本文整理汇总了Java中org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase类的典型用法代码示例。如果您正苦于以下问题:Java AbstractSObjectBase类的具体用法?Java AbstractSObjectBase怎么用?Java AbstractSObjectBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractSObjectBase类属于org.apache.camel.component.salesforce.api.dto包,在下文中一共展示了AbstractSObjectBase类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processCreateSobject
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private void processCreateSobject(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
String sObjectName;
// determine parameters from input AbstractSObject
AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class);
if (sObjectBase != null) {
sObjectName = sObjectBase.getClass().getSimpleName();
} else {
sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL);
}
restClient.createSObject(sObjectName, getRequestStream(exchange),
new RestClient.ResponseCallback() {
@Override
public void onResponse(InputStream response, SalesforceException exception) {
processResponse(exchange, response, exception, callback);
}
});
}
示例2: processUpdateSobject
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private void processUpdateSobject(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
String sObjectName;
// determine parameters from input AbstractSObject
final AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class);
String sObjectId;
if (sObjectBase != null) {
sObjectName = sObjectBase.getClass().getSimpleName();
// remember the sObject Id
sObjectId = sObjectBase.getId();
// clear base object fields, which cannot be updated
sObjectBase.clearBaseFields();
} else {
sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL);
sObjectId = getParameter(SOBJECT_ID, exchange, IGNORE_BODY, NOT_OPTIONAL);
}
final String finalsObjectId = sObjectId;
restClient.updateSObject(sObjectName, sObjectId, getRequestStream(exchange),
new RestClient.ResponseCallback() {
@Override
public void onResponse(InputStream response, SalesforceException exception) {
processResponse(exchange, response, exception, callback);
restoreFields(exchange, sObjectBase, finalsObjectId, null, null);
}
});
}
示例3: processDeleteSobject
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private void processDeleteSobject(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
String sObjectName;
// determine parameters from input AbstractSObject
final AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class);
String sObjectIdValue;
if (sObjectBase != null) {
sObjectName = sObjectBase.getClass().getSimpleName();
sObjectIdValue = sObjectBase.getId();
} else {
sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL);
sObjectIdValue = getParameter(SOBJECT_ID, exchange, USE_BODY, NOT_OPTIONAL);
}
final String sObjectId = sObjectIdValue;
restClient.deleteSObject(sObjectName, sObjectId, new RestClient.ResponseCallback() {
@Override
public void onResponse(InputStream response, SalesforceException exception) {
processResponse(exchange, response, exception, callback);
restoreFields(exchange, sObjectBase, sObjectId, null, null);
}
});
}
示例4: restoreFields
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private void restoreFields(Exchange exchange, AbstractSObjectBase sObjectBase,
String sObjectId, String sObjectExtIdName, Object oldValue) {
// restore fields
if (sObjectBase != null) {
// restore the Id if it was cleared
if (sObjectId != null) {
sObjectBase.setId(sObjectId);
}
// restore the external id if it was cleared
if (sObjectExtIdName != null && oldValue != null) {
try {
setPropertyValue(sObjectBase, sObjectExtIdName, oldValue);
} catch (SalesforceException e) {
// YES, the exchange may fail if the property cannot be reset!!!
exchange.setException(e);
}
}
}
}
示例5: parsePackages
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private Map<String, Class<?>> parsePackages() {
Map<String, Class<?>> result = new HashMap<String, Class<?>>();
Set<Class<?>> classes = getCamelContext().getPackageScanClassResolver().
findImplementations(AbstractSObjectBase.class, packages);
for (Class<?> aClass : classes) {
// findImplementations also returns AbstractSObjectBase for some reason!!!
if (AbstractSObjectBase.class != aClass) {
result.put(aClass.getSimpleName(), aClass);
}
}
return result;
}
示例6: processGetSobject
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private void processGetSobject(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
String sObjectName;
String sObjectIdValue;
// determine parameters from input AbstractSObject
final AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class);
if (sObjectBase != null) {
sObjectName = sObjectBase.getClass().getSimpleName();
sObjectIdValue = sObjectBase.getId();
} else {
sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL);
sObjectIdValue = getParameter(SOBJECT_ID, exchange, USE_BODY, NOT_OPTIONAL);
}
final String sObjectId = sObjectIdValue;
// use sObject name to load class
setResponseClass(exchange, sObjectName);
// get optional field list
String fieldsValue = getParameter(SOBJECT_FIELDS, exchange, IGNORE_BODY, IS_OPTIONAL);
String[] fields = null;
if (fieldsValue != null) {
fields = fieldsValue.split(",");
}
restClient.getSObject(sObjectName, sObjectId, fields, new RestClient.ResponseCallback() {
@Override
public void onResponse(InputStream response, SalesforceException exception) {
processResponse(exchange, response, exception, callback);
restoreFields(exchange, sObjectBase, sObjectId, null, null);
}
});
}
示例7: processGetSobjectWithId
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private void processGetSobjectWithId(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
String sObjectName;
Object oldValue = null;
String sObjectExtIdValue;
final String sObjectExtIdName = getParameter(SOBJECT_EXT_ID_NAME,
exchange, IGNORE_BODY, NOT_OPTIONAL);
// determine parameters from input AbstractSObject
final AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class);
if (sObjectBase != null) {
sObjectName = sObjectBase.getClass().getSimpleName();
oldValue = getAndClearPropertyValue(sObjectBase, sObjectExtIdName);
sObjectExtIdValue = oldValue.toString();
} else {
sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL);
sObjectExtIdValue = getParameter(SOBJECT_EXT_ID_VALUE, exchange, USE_BODY, NOT_OPTIONAL);
}
// use sObject name to load class
setResponseClass(exchange, sObjectName);
final Object finalOldValue = oldValue;
restClient.getSObjectWithId(sObjectName, sObjectExtIdName, sObjectExtIdValue,
new RestClient.ResponseCallback() {
@Override
public void onResponse(InputStream response, SalesforceException exception) {
processResponse(exchange, response, exception, callback);
restoreFields(exchange, sObjectBase, null, sObjectExtIdName, finalOldValue);
}
});
}
示例8: processUpsertSobject
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private void processUpsertSobject(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
String sObjectName;
String sObjectExtIdValue;
final String sObjectExtIdName = getParameter(SOBJECT_EXT_ID_NAME, exchange,
IGNORE_BODY, NOT_OPTIONAL);
// determine parameters from input AbstractSObject
Object oldValue = null;
final AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class);
if (sObjectBase != null) {
sObjectName = sObjectBase.getClass().getSimpleName();
oldValue = getAndClearPropertyValue(sObjectBase, sObjectExtIdName);
sObjectExtIdValue = oldValue.toString();
// clear base object fields, which cannot be updated
sObjectBase.clearBaseFields();
} else {
sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL);
sObjectExtIdValue = getParameter(SOBJECT_EXT_ID_VALUE, exchange, IGNORE_BODY, NOT_OPTIONAL);
}
final Object finalOldValue = oldValue;
restClient.upsertSObject(sObjectName, sObjectExtIdName, sObjectExtIdValue, getRequestStream(exchange),
new RestClient.ResponseCallback() {
@Override
public void onResponse(InputStream response, SalesforceException exception) {
processResponse(exchange, response, exception, callback);
restoreFields(exchange, sObjectBase, null, sObjectExtIdName, finalOldValue);
}
});
}
示例9: processDeleteSobjectWithId
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private void processDeleteSobjectWithId(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
String sObjectName;
final String sObjectExtIdName = getParameter(SOBJECT_EXT_ID_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL);
// determine parameters from input AbstractSObject
Object oldValue = null;
final AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class);
String sObjectExtIdValue;
if (sObjectBase != null) {
sObjectName = sObjectBase.getClass().getSimpleName();
oldValue = getAndClearPropertyValue(sObjectBase, sObjectExtIdName);
sObjectExtIdValue = oldValue.toString();
} else {
sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL);
sObjectExtIdValue = getParameter(SOBJECT_EXT_ID_VALUE, exchange, USE_BODY, NOT_OPTIONAL);
}
final Object finalOldValue = oldValue;
restClient.deleteSObjectWithId(sObjectName, sObjectExtIdName, sObjectExtIdValue,
new RestClient.ResponseCallback() {
@Override
public void onResponse(InputStream response, SalesforceException exception) {
processResponse(exchange, response, exception, callback);
restoreFields(exchange, sObjectBase, null, sObjectExtIdName, finalOldValue);
}
});
}
示例10: processGetBlobField
import org.apache.camel.component.salesforce.api.dto.AbstractSObjectBase; //导入依赖的package包/类
private void processGetBlobField(final Exchange exchange, final AsyncCallback callback) throws SalesforceException {
String sObjectName;
// get blob field name
final String sObjectBlobFieldName = getParameter(SOBJECT_BLOB_FIELD_NAME,
exchange, IGNORE_BODY, NOT_OPTIONAL);
// determine parameters from input AbstractSObject
final AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class);
String sObjectIdValue;
if (sObjectBase != null) {
sObjectName = sObjectBase.getClass().getSimpleName();
sObjectIdValue = sObjectBase.getId();
} else {
sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL);
sObjectIdValue = getParameter(SOBJECT_ID, exchange, USE_BODY, NOT_OPTIONAL);
}
final String sObjectId = sObjectIdValue;
restClient.getBlobField(sObjectName, sObjectId, sObjectBlobFieldName,
new RestClient.ResponseCallback() {
@Override
public void onResponse(InputStream response, SalesforceException exception) {
processResponse(exchange, response, exception, callback);
restoreFields(exchange, sObjectBase, sObjectId, null, null);
}
});
}