Search in sources :

Example 1 with TSalesforceGetServerTimestampProperties

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();
    }
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) Calendar(java.util.Calendar) TSalesforceGetServerTimestampProperties(org.talend.components.salesforce.tsalesforcegetservertimestamp.TSalesforceGetServerTimestampProperties)

Example 2 with TSalesforceGetServerTimestampProperties

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;
}
Also used : TSalesforceGetDeletedProperties(org.talend.components.salesforce.tsalesforcegetdeleted.TSalesforceGetDeletedProperties) TSalesforceGetServerTimestampProperties(org.talend.components.salesforce.tsalesforcegetservertimestamp.TSalesforceGetServerTimestampProperties) TSalesforceInputProperties(org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties) TSalesforceGetUpdatedProperties(org.talend.components.salesforce.tsalesforcegetupdated.TSalesforceGetUpdatedProperties) TSalesforceBulkExecProperties(org.talend.components.salesforce.tsalesforcebulkexec.TSalesforceBulkExecProperties)

Aggregations

TSalesforceGetServerTimestampProperties (org.talend.components.salesforce.tsalesforcegetservertimestamp.TSalesforceGetServerTimestampProperties)2 Calendar (java.util.Calendar)1 IndexedRecord (org.apache.avro.generic.IndexedRecord)1 TSalesforceBulkExecProperties (org.talend.components.salesforce.tsalesforcebulkexec.TSalesforceBulkExecProperties)1 TSalesforceGetDeletedProperties (org.talend.components.salesforce.tsalesforcegetdeleted.TSalesforceGetDeletedProperties)1 TSalesforceGetUpdatedProperties (org.talend.components.salesforce.tsalesforcegetupdated.TSalesforceGetUpdatedProperties)1 TSalesforceInputProperties (org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties)1