public boolean hasPicklists(SObjectDescription desc) { for (SObjectField field : desc.getFields()) { if (isPicklist(field)) { return true; } } return false; }
public boolean hasMultiSelectPicklists(SObjectDescription desc) { for (SObjectField field : desc.getFields()) { if (isMultiSelectPicklist(field)) { return true; } } return false; }
@Override public final SObjectDescription description() { return DESCRIPTION; }
@Override protected void processRequest(Exchange exchange) throws SalesforceException { switch (operationName) { case GET_VERSIONS: // handle in built response types exchange.setProperty(RESPONSE_TYPE, new TypeReference<List<Version>>() { }); break; case GET_RESOURCES: // handle in built response types exchange.setProperty(RESPONSE_CLASS, RestResources.class); break; case GET_GLOBAL_OBJECTS: // handle in built response types exchange.setProperty(RESPONSE_CLASS, GlobalObjects.class); break; case GET_BASIC_INFO: // handle in built response types exchange.setProperty(RESPONSE_CLASS, SObjectBasicInfo.class); break; case GET_DESCRIPTION: // handle in built response types exchange.setProperty(RESPONSE_CLASS, SObjectDescription.class); break; case CREATE_SOBJECT: // handle known response type exchange.setProperty(RESPONSE_CLASS, CreateSObjectResult.class); break; case UPSERT_SOBJECT: // handle known response type exchange.setProperty(RESPONSE_CLASS, CreateSObjectResult.class); break; case SEARCH: // handle known response type exchange.setProperty(RESPONSE_TYPE, new TypeReference<List<SearchResult>>() { }); break; default: // ignore, some operations do not require response class or type } }
@Override protected void processRequest(Exchange exchange) throws SalesforceException { switch (operationName) { case GET_VERSIONS: exchange.setProperty(RESPONSE_CLASS, Versions.class); break; case GET_RESOURCES: exchange.setProperty(RESPONSE_CLASS, RestResources.class); break; case GET_GLOBAL_OBJECTS: // handle in built response types exchange.setProperty(RESPONSE_CLASS, GlobalObjects.class); break; case GET_BASIC_INFO: // handle in built response types exchange.setProperty(RESPONSE_CLASS, SObjectBasicInfo.class); // need to add alias for Salesforce XML that uses SObject name as root element exchange.setProperty(RESPONSE_ALIAS, getParameter(SOBJECT_NAME, exchange, USE_BODY, NOT_OPTIONAL)); break; case GET_DESCRIPTION: // handle in built response types exchange.setProperty(RESPONSE_CLASS, SObjectDescription.class); // need to add alias for Salesforce XML that uses SObject name as root element exchange.setProperty(RESPONSE_ALIAS, getParameter(SOBJECT_NAME, exchange, USE_BODY, NOT_OPTIONAL)); break; case GET_SOBJECT: // need to add alias for Salesforce XML that uses SObject name as root element exchange.setProperty(RESPONSE_ALIAS, getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL)); break; case CREATE_SOBJECT: // handle known response type exchange.setProperty(RESPONSE_CLASS, CreateSObjectResult.class); break; case GET_SOBJECT_WITH_ID: // need to add alias for Salesforce XML that uses SObject name as root element exchange.setProperty(RESPONSE_ALIAS, getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL)); break; case UPSERT_SOBJECT: // handle known response type exchange.setProperty(RESPONSE_CLASS, CreateSObjectResult.class); break; case QUERY: case QUERY_MORE: // need to add alias for Salesforce XML that uses SObject name as root element exchange.setProperty(RESPONSE_ALIAS, "QueryResult"); break; case SEARCH: // handle known response type exchange.setProperty(RESPONSE_CLASS, SearchResults.class); break; case APEX_CALL: // need to add alias for Salesforce XML that uses SObject name as root element exchange.setProperty(RESPONSE_ALIAS, "response"); break; default: // ignore, some operations do not require alias or class exchange properties } }
private void doTestGetDescription(String suffix) throws Exception { SObjectDescription sObjectDescription = template().requestBody("direct:getDescription" + suffix, null, SObjectDescription.class); assertNotNull(sObjectDescription); LOG.debug("SObjectDescription: {}", sObjectDescription); }