use of org.talend.components.salesforce.tsalesforcegetservertimestamp.TSalesforceGetServerTimestampProperties in project components by Talend.
the class SalesforceServerTimeStampReaderTestIT method getServerTimestamp.
public Calendar getServerTimestamp() throws Throwable {
TSalesforceGetServerTimestampProperties props = (TSalesforceGetServerTimestampProperties) new TSalesforceGetServerTimestampProperties("foo").init();
setupProps(props.connection, !ADD_QUOTES);
BoundedReader<IndexedRecord> bounderReader = createBoundedReader(props);
try {
assertTrue(bounderReader.start());
assertFalse(bounderReader.advance());
IndexedRecord record = bounderReader.getCurrent();
assertNotNull(record);
Long timestamp = (Long) record.get(0);
Calendar ms = Calendar.getInstance();
ms.setTimeInMillis(timestamp);
return ms;
} finally {
bounderReader.close();
}
}
use of org.talend.components.salesforce.tsalesforcegetservertimestamp.TSalesforceGetServerTimestampProperties in project components by Talend.
the class SalesforceSource method createReader.
@Override
public BoundedReader createReader(RuntimeContainer adaptor) {
if (properties instanceof TSalesforceInputProperties) {
TSalesforceInputProperties sfInProperties = (TSalesforceInputProperties) properties;
boolean isBulk = TSalesforceInputProperties.QueryMode.Bulk.equals(sfInProperties.queryMode.getValue());
sfInProperties.connection.bulkConnection.setValue(isBulk);
if (isBulk) {
return new SalesforceBulkQueryInputReader(adaptor, this, sfInProperties);
} else {
return new SalesforceInputReader(adaptor, this, sfInProperties);
}
} else if (properties instanceof TSalesforceGetServerTimestampProperties) {
return new SalesforceServerTimeStampReader(adaptor, this, (TSalesforceGetServerTimestampProperties) properties);
} else if (properties instanceof TSalesforceGetDeletedProperties) {
return new SalesforceGetDeletedReader(adaptor, this, (TSalesforceGetDeletedProperties) properties);
} else if (properties instanceof TSalesforceGetUpdatedProperties) {
return new SalesforceGetUpdatedReader(adaptor, this, (TSalesforceGetUpdatedProperties) properties);
} else if (properties instanceof TSalesforceBulkExecProperties) {
((TSalesforceBulkExecProperties) properties).connection.bulkConnection.setValue(true);
return new SalesforceBulkExecReader(adaptor, this, (TSalesforceBulkExecProperties) properties);
}
return null;
}
Aggregations