use of com.marketo.mktows.ArrayOfLeadRecord in project components by Talend.
the class MarketoSOAPClientTest method getMultipleLeadResult.
public SuccessGetMultipleLeads getMultipleLeadResult() {
SuccessGetMultipleLeads result = new SuccessGetMultipleLeads();
ResultGetMultipleLeads res = new ResultGetMultipleLeads();
res.setReturnCount(1);
res.setRemainingCount(0);
ArrayOfLeadRecord leadrecords = new ArrayOfLeadRecord();
LeadRecord r = new LeadRecord();
r.setId(objectFactory.createLeadRecordId(12345));
r.setEmail(objectFactory.createLeadRecordEmail("t@t.com"));
r.setForeignSysPersonId(objectFactory.createLeadRecordForeignSysPersonId(""));
r.setForeignSysType(objectFactory.createLeadRecordForeignSysType(null));
leadrecords.getLeadRecords().add(r);
QName qname = new QName("http://www.marketo.com/mktows/", "leadAttributeList");
JAXBElement<ArrayOfLeadRecord> attrList = new JAXBElement(qname, LeadRecord.class, leadrecords);
res.setLeadRecordList(attrList);
result.setResult(res);
return result;
}
use of com.marketo.mktows.ArrayOfLeadRecord in project components by Talend.
the class MarketoSOAPClient method syncMultipleLeads.
@Override
public MarketoSyncResult syncMultipleLeads(TMarketoOutputProperties parameters, List<IndexedRecord> leads) {
MarketoSyncResult mkto = new MarketoSyncResult();
try {
ParamsSyncMultipleLeads request = new ParamsSyncMultipleLeads();
ArrayOfLeadRecord leadRecords = new ArrayOfLeadRecord();
for (IndexedRecord r : leads) {
leadRecords.getLeadRecords().add(convertToLeadRecord(r, parameters.mappingInput.getNameMappingsForMarketo()));
}
JAXBElement<Boolean> dedup = objectFactory.createParamsSyncMultipleLeadsDedupEnabled(parameters.deDupeEnabled.getValue());
request.setDedupEnabled(dedup);
request.setLeadRecordList(leadRecords);
SuccessSyncMultipleLeads result = getPort().syncMultipleLeads(request, header);
//
if (LOG.isDebugEnabled()) {
try {
JAXBContext context = JAXBContext.newInstance(SuccessSyncLead.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
m.marshal(result, System.out);
} catch (JAXBException e) {
LOG.error(e.getMessage());
}
}
//
List<SyncStatus> records = new ArrayList<>();
for (com.marketo.mktows.SyncStatus status : result.getResult().getSyncStatusList().getSyncStatuses()) {
SyncStatus s = new SyncStatus(status.getLeadId(), status.getStatus().value());
s.setErrorMessage(status.getError().getValue());
records.add(s);
}
mkto.setSuccess(result.getResult().getSyncStatusList() != null);
mkto.setRecords(records);
} catch (Exception e) {
LOG.error(e.toString());
mkto.setSuccess(false);
mkto.setErrors(Collections.singletonList(new MarketoError(SOAP, e.getMessage())));
}
return mkto;
}
use of com.marketo.mktows.ArrayOfLeadRecord in project components by Talend.
the class MarketoSOAPClientTest method getGetLeadResult.
public SuccessGetLead getGetLeadResult() {
SuccessGetLead result = new SuccessGetLead();
ResultGetLead res = new ResultGetLead();
res.setCount(1);
ArrayOfLeadRecord leadrecords = new ArrayOfLeadRecord();
LeadRecord r = new LeadRecord();
r.setId(objectFactory.createLeadRecordId(12345));
r.setEmail(objectFactory.createLeadRecordEmail("email@email.com"));
r.setForeignSysPersonId(objectFactory.createLeadRecordForeignSysPersonId("foreignSysPersonId"));
r.setForeignSysType(objectFactory.createLeadRecordForeignSysType(ForeignSysType.SFDC));
ArrayOfAttribute aoa = objectFactory.createArrayOfAttribute();
Attribute attr = new Attribute();
attr.setAttrName("attrName");
attr.setAttrValue("attrValue");
aoa.getAttributes().add(attr);
r.setLeadAttributeList(objectFactory.createActivityRecordActivityAttributes(aoa));
leadrecords.getLeadRecords().add(r);
QName qname = new QName("http://www.marketo.com/mktows/", "leadAttributeList");
JAXBElement<ArrayOfLeadRecord> attrList = new JAXBElement(qname, LeadRecord.class, leadrecords);
res.setLeadRecordList(attrList);
result.setResult(res);
return result;
}
Aggregations