private JobInfo createOrUpdateJob(JobInfo job, String endpoint) throws AsyncApiException { try { Transport transport = config.createTransport(); OutputStream out = transport.connect(endpoint, getHeaders(XML_CONTENT_TYPE), true); XmlOutputStream xout = new AsyncXmlOutputStream(out, true); job.write(JOB_QNAME, xout, typeMapper); xout.close(); InputStream in = transport.getContent(); if (transport.isSuccessful()) { XmlInputStream xin = new XmlInputStream(); xin.setInput(in, "UTF-8"); JobInfo result = new JobInfo(); result.load(xin, typeMapper); return result; } else { parseAndThrowException(in); } } catch (PullParserException e) { throw new AsyncApiException("Failed to create job ", AsyncExceptionCode.ClientInputError, e); } catch (IOException e) { throw new AsyncApiException("Failed to create job ", AsyncExceptionCode.ClientInputError, e); } catch (ConnectionException e) { throw new AsyncApiException("Failed to create job ", AsyncExceptionCode.ClientInputError, e); } return null; }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.isElement(__in, actions__typeInfo)) { setActions( (com.sforce.soap.metadata.WorkflowActionReference[]) __typeMapper.readObject( __in, actions__typeInfo, com.sforce.soap.metadata.WorkflowActionReference[].class)); } __in.peekTag(); if (__typeMapper.isElement(__in, timeLength__typeInfo)) { setTimeLength((int) __typeMapper.readInt(__in, timeLength__typeInfo, int.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, workflowTimeTriggerUnit__typeInfo)) { setWorkflowTimeTriggerUnit( (com.sforce.soap.metadata.MilestoneTimeUnits) __typeMapper.readObject( __in, workflowTimeTriggerUnit__typeInfo, com.sforce.soap.metadata.MilestoneTimeUnits.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, label__typeInfo)) { setLabel( (java.lang.String) __typeMapper.readString(__in, label__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, logoUrl__typeInfo)) { setLogoUrl( (java.lang.String) __typeMapper.readString(__in, logoUrl__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, namespace__typeInfo)) { setNamespace( (java.lang.String) __typeMapper.readString(__in, namespace__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, selected__typeInfo)) { setSelected((boolean) __typeMapper.readBoolean(__in, selected__typeInfo, boolean.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, tabs__typeInfo)) { setTabs( (com.sforce.soap.partner.DescribeTab[]) __typeMapper.readObject( __in, tabs__typeInfo, com.sforce.soap.partner.DescribeTab[].class)); } }
private XMLizable bind(XmlInputStream xin, QName responseElement, Class responseType) throws IOException, ConnectionException { readSoapEnvelopeStart(xin); xin.peekTag(); typeMapper.verifyTag( responseElement.getNamespaceURI(), responseElement.getLocalPart(), xin.getNamespace(), xin.getName()); // todo: change responseElement to typeInfo. TypeInfo info = new TypeInfo( responseElement.getNamespaceURI(), responseElement.getLocalPart(), null, null, 1, 1, true); XMLizable result = (XMLizable) typeMapper.readObject(xin, info, responseType); readSoapEnvelopeEnd(xin); return result; }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, editable__typeInfo)) { setEditable((boolean) __typeMapper.readBoolean(__in, editable__typeInfo, boolean.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, label__typeInfo)) { setLabel( (java.lang.String) __typeMapper.readString(__in, label__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, layoutComponents__typeInfo)) { setLayoutComponents( (com.sforce.soap.enterprise.DescribeLayoutComponent[]) __typeMapper.readObject( __in, layoutComponents__typeInfo, com.sforce.soap.enterprise.DescribeLayoutComponent[].class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, placeholder__typeInfo)) { setPlaceholder( (boolean) __typeMapper.readBoolean(__in, placeholder__typeInfo, boolean.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, required__typeInfo)) { setRequired((boolean) __typeMapper.readBoolean(__in, required__typeInfo, boolean.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) { setCreatedBy( (com.sforce.soap.enterprise.sobject.User) __typeMapper.readObject( __in, CreatedBy__typeInfo, com.sforce.soap.enterprise.sobject.User.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, CreatedById__typeInfo)) { setCreatedById(__typeMapper.readString(__in, CreatedById__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, CreatedDate__typeInfo)) { setCreatedDate( (java.util.Calendar) __typeMapper.readObject(__in, CreatedDate__typeInfo, java.util.Calendar.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, LastModifiedBy__typeInfo)) { setLastModifiedBy( (com.sforce.soap.enterprise.sobject.User) __typeMapper.readObject( __in, LastModifiedBy__typeInfo, com.sforce.soap.enterprise.sobject.User.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, LastModifiedById__typeInfo)) { setLastModifiedById( __typeMapper.readString(__in, LastModifiedById__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, LastModifiedDate__typeInfo)) { setLastModifiedDate( (java.util.Calendar) __typeMapper.readObject(__in, LastModifiedDate__typeInfo, java.util.Calendar.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, MemberId__typeInfo)) { setMemberId(__typeMapper.readString(__in, MemberId__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, SystemModstamp__typeInfo)) { setSystemModstamp( (java.util.Calendar) __typeMapper.readObject(__in, SystemModstamp__typeInfo, java.util.Calendar.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, TeamRoleId__typeInfo)) { setTeamRoleId(__typeMapper.readString(__in, TeamRoleId__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, TeamTemplateId__typeInfo)) { setTeamTemplateId( __typeMapper.readString(__in, TeamTemplateId__typeInfo, java.lang.String.class)); } }
static BatchInfo loadBatchInfo(InputStream in) throws PullParserException, IOException, ConnectionException { BatchInfo info = new BatchInfo(); XmlInputStream xin = new XmlInputStream(); xin.setInput(in, "UTF-8"); info.load(xin, BulkConnection.typeMapper); return info; }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, keyPrefix__typeInfo)) { setKeyPrefix(__typeMapper.readString(__in, keyPrefix__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, name__typeInfo)) { setName(__typeMapper.readString(__in, name__typeInfo, java.lang.String.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, enabled__typeInfo)) { setEnabled((boolean) __typeMapper.readBoolean(__in, enabled__typeInfo, boolean.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, name__typeInfo)) { setName( (java.lang.String) __typeMapper.readString(__in, name__typeInfo, java.lang.String.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) { setCreatedBy( (com.sforce.soap.enterprise.sobject.Name) __typeMapper.readObject( __in, CreatedBy__typeInfo, com.sforce.soap.enterprise.sobject.Name.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, CreatedById__typeInfo)) { setCreatedById(__typeMapper.readString(__in, CreatedById__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, CreatedDate__typeInfo)) { setCreatedDate( (java.util.Calendar) __typeMapper.readObject(__in, CreatedDate__typeInfo, java.util.Calendar.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, Field__typeInfo)) { setField(__typeMapper.readString(__in, Field__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, IsDeleted__typeInfo)) { setIsDeleted( (java.lang.Boolean) __typeMapper.readObject(__in, IsDeleted__typeInfo, java.lang.Boolean.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, NewValue__typeInfo)) { setNewValue( (java.lang.Object) __typeMapper.readObject(__in, NewValue__typeInfo, java.lang.Object.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, OldValue__typeInfo)) { setOldValue( (java.lang.Object) __typeMapper.readObject(__in, OldValue__typeInfo, java.lang.Object.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, Parent__typeInfo)) { setParent( (com.sforce.soap.enterprise.sobject.Servicio__c) __typeMapper.readObject( __in, Parent__typeInfo, com.sforce.soap.enterprise.sobject.Servicio__c.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, ParentId__typeInfo)) { setParentId(__typeMapper.readString(__in, ParentId__typeInfo, java.lang.String.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, masterRecord__typeInfo)) { setMasterRecord( (com.sforce.soap.partner.sobject.SObject) __typeMapper.readObject( __in, masterRecord__typeInfo, com.sforce.soap.partner.sobject.SObject.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, recordToMergeIds__typeInfo)) { setRecordToMergeIds( (java.lang.String[]) __typeMapper.readObject(__in, recordToMergeIds__typeInfo, java.lang.String[].class)); } }
protected void setLabel( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, label__typeInfo)) { setLabel(__typeMapper.readString(__in, label__typeInfo, java.lang.String.class)); } }
public BatchResult getBatchResult(String jobId, String batchId) throws AsyncApiException { try { InputStream stream = doHttpGet(buildBatchResultURL(jobId, batchId)); XmlInputStream xin = new XmlInputStream(); xin.setInput(stream, "UTF-8"); BatchResult result = new BatchResult(); result.load(xin, typeMapper); return result; } catch (PullParserException e) { throw new AsyncApiException( "Failed to parse result ", AsyncExceptionCode.ClientInputError, e); } catch (IOException e) { throw new AsyncApiException("Failed to get result ", AsyncExceptionCode.ClientInputError, e); } catch (ConnectionException e) { throw new AsyncApiException("Failed to get result ", AsyncExceptionCode.ClientInputError, e); } }
static void parseAndThrowException(InputStream in) throws AsyncApiException { try { XmlInputStream xin = new XmlInputStream(); xin.setInput(in, "UTF-8"); AsyncApiException exception = new AsyncApiException(); exception.load(xin, typeMapper); throw exception; } catch (PullParserException e) { throw new AsyncApiException( "Failed to parse exception ", AsyncExceptionCode.ClientInputError, e); } catch (IOException e) { throw new AsyncApiException( "Failed to parse exception", AsyncExceptionCode.ClientInputError, e); } catch (ConnectionException e) { throw new AsyncApiException( "Failed to parse exception ", AsyncExceptionCode.ClientInputError, e); } }
protected void setTriggerOtherEmail( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, triggerOtherEmail__typeInfo)) { setTriggerOtherEmail( __typeMapper.readBoolean(__in, triggerOtherEmail__typeInfo, boolean.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.isElement(__in, result__typeInfo)) { setResult((String[]) __typeMapper.readObject(__in, result__typeInfo, String[].class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, batchSize__typeInfo)) { setBatchSize((int) __typeMapper.readInt(__in, batchSize__typeInfo, int.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, enableIdeaThemes__typeInfo)) { setEnableIdeaThemes( (boolean) __typeMapper.readBoolean(__in, enableIdeaThemes__typeInfo, boolean.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, enableIdeas__typeInfo)) { setEnableIdeas( (boolean) __typeMapper.readBoolean(__in, enableIdeas__typeInfo, boolean.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, halfLife__typeInfo)) { setHalfLife((double) __typeMapper.readDouble(__in, halfLife__typeInfo, double.class)); } }
protected void setSObjectType( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.isElement(__in, sObjectType__typeInfo)) { setSObjectType( (java.lang.String[]) __typeMapper.readObject(__in, sObjectType__typeInfo, java.lang.String[].class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, result__typeInfo)) { setResult( (com.sforce.soap.partner.QueryResult) __typeMapper.readObject( __in, result__typeInfo, com.sforce.soap.partner.QueryResult.class)); } }
protected void setLayoutItems( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, layoutItems__typeInfo)) { setLayoutItems( (com.sforce.soap.partner.DescribeLayoutItem[]) __typeMapper.readObject( __in, layoutItems__typeInfo, com.sforce.soap.partner.DescribeLayoutItem[].class)); } }
protected void setDifference( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, difference__typeInfo)) { setDifference( (com.sforce.soap.partner.DifferenceType) __typeMapper.readObject( __in, difference__typeInfo, com.sforce.soap.partner.DifferenceType.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.verifyElement(__in, objectId__typeInfo)) { setObjectId( (java.lang.String) __typeMapper.readString(__in, objectId__typeInfo, java.lang.String.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.isElement(__in, actions__typeInfo)) { setActions( (com.sforce.soap.partner.ProcessRequest[]) __typeMapper.readObject( __in, actions__typeInfo, com.sforce.soap.partner.ProcessRequest[].class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.isElement(__in, messages__typeInfo)) { setMessages( (com.sforce.soap.enterprise.Email[]) __typeMapper.readObject( __in, messages__typeInfo, com.sforce.soap.enterprise.Email[].class)); } }
public QueryResultList getQueryResultList(String jobId, String batchId) throws AsyncApiException { InputStream stream = getBatchResultStream(jobId, batchId); try { XmlInputStream xin = new XmlInputStream(); xin.setInput(stream, "UTF-8"); QueryResultList result = new QueryResultList(); result.load(xin, typeMapper); return result; } catch (ConnectionException e) { throw new AsyncApiException( "Failed to parse query result list ", AsyncExceptionCode.ClientInputError, e); } catch (PullParserException e) { throw new AsyncApiException( "Failed to parse query result list ", AsyncExceptionCode.ClientInputError, e); } catch (IOException e) { throw new AsyncApiException( "Failed to parse query result list ", AsyncExceptionCode.ClientInputError, e); } }
private void readSoapEnvelopeStart(XmlInputStream xin) throws IOException, ConnectionException { xin.nextTag(); typeMapper.verifyTag(Constants.SOAP_ENVELOPE_NS, "Envelope", xin.getNamespace(), xin.getName()); xin.nextTag(); if (isHeader(xin)) { readSoapHeader(xin); xin.nextTag(); } typeMapper.verifyTag(Constants.SOAP_ENVELOPE_NS, "Body", xin.getNamespace(), xin.getName()); }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.isElement(__in, errors__typeInfo)) { setErrors((Error[]) __typeMapper.readObject(__in, errors__typeInfo, Error[].class)); } __in.peekTag(); if (__typeMapper.isElement(__in, id__typeInfo)) { setId(__typeMapper.readString(__in, id__typeInfo, String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, success__typeInfo)) { setSuccess(__typeMapper.readBoolean(__in, success__typeInfo, boolean.class)); } __in.peekTag(); if (__typeMapper.isElement(__in, created__typeInfo)) { setCreated(__typeMapper.readBoolean(__in, created__typeInfo, boolean.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.verifyElement(__in, debugLevel__typeInfo)) { setDebugLevel( (com.sforce.soap.partner.DebugLevel) __typeMapper.readObject( __in, debugLevel__typeInfo, com.sforce.soap.partner.DebugLevel.class)); } }
protected void loadFields( com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, accountId__typeInfo)) { setAccountId(__typeMapper.readString(__in, accountId__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, contactId__typeInfo)) { setContactId(__typeMapper.readString(__in, contactId__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, convertedStatus__typeInfo)) { setConvertedStatus( __typeMapper.readString(__in, convertedStatus__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, doNotCreateOpportunity__typeInfo)) { setDoNotCreateOpportunity( __typeMapper.readBoolean(__in, doNotCreateOpportunity__typeInfo, boolean.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, leadId__typeInfo)) { setLeadId(__typeMapper.readString(__in, leadId__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, opportunityName__typeInfo)) { setOpportunityName( __typeMapper.readString(__in, opportunityName__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, overwriteLeadSource__typeInfo)) { setOverwriteLeadSource( __typeMapper.readBoolean(__in, overwriteLeadSource__typeInfo, boolean.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, ownerId__typeInfo)) { setOwnerId(__typeMapper.readString(__in, ownerId__typeInfo, java.lang.String.class)); } __in.peekTag(); if (__typeMapper.verifyElement(__in, sendNotificationEmail__typeInfo)) { setSendNotificationEmail( __typeMapper.readBoolean(__in, sendNotificationEmail__typeInfo, boolean.class)); } }