Package com.salesforce.dataloader.model

Examples of com.salesforce.dataloader.model.Row


                    "Batch failed: InvalidBatch : Failed to process query: FUNCTIONALITY_NOT_ENABLED: Foreign Key Relationships not supported in Bulk Query");
        } else {
            runProcess(argMap, 1);
            final CSVFileReader resultReader = new CSVFileReader(argMap.get(Config.DAO_NAME), getController());
            try {
                final Row resultRow = resultReader.readRow();
                assertEquals("Query returned incorrect Contact ID", contactId, resultRow.get("CONTACT_ID"));
                assertEquals("Query returned incorrect Contact Name", "First 000000 Last 000000",
                        resultRow.get("CONTACT_NAME"));
                assertEquals("Query returned incorrect Account ID", accountId, resultRow.get("ACCOUNT_ID"));
                assertEquals("Query returned incorrect Account Name", "account insert#000000",
                        resultRow.get("ACCOUNT_NAME"));

            } finally {
                resultReader.close();
            }
        }
View Full Code Here


                // run the extract
                runProcess(argmap, 1);
                // open the results of the extraction
                final CSVFileReader rdr = new CSVFileReader(argmap.get(Config.DAO_NAME), getController());
                rdr.open();
                Row row = rdr.readRow();
                assertNotNull(row);
                assertEquals(5,row.size());
                // validate the extract results are correct.
                assertEquals(leadidArr[0], row.get("LID"));
                assertEquals("loader", row.get("LNAME"));
                assertEquals("data loader", row.get("NAME__RESULT"));
                assertEquals(uid, row.get("OID"));
                assertEquals(uid,row.get("OWNID"));
                // validate that we have read the only result. there should be only one.
                assertNull(rdr.readRow());

            }
        } finally {
View Full Code Here

        }
        return daoColumns;
    }

    public Row mapPartnerSObjectSfdcToLocal(SObject sobj) {
        Row map = new Row();
        mapPartnerSObject(map, "", sobj);
        mapConstants(map);
        return map;
    }
View Full Code Here

            throw new InvalidMappingException(e.getMessage(), e);
        }
    }

    public Row mapCsvRowSfdcToLocal(List<String> headers, List<String> values, StringBuilder id) {
        Row resultRow = new Row();
        Iterator<String> headerIter = headers.listIterator();
        for (String val : values) {
            String sfdcName = headerIter.next();
            if ("Id".equalsIgnoreCase(sfdcName)) id.append(val);
            String localName = getMapping(sfdcName);
            if (localName == null) {
                logger.warn("sfdc returned row that cannot be mapped: " + sfdcName);
            } else {
                resultRow.put(localName, val);
            }
        }
        mapConstants(resultRow);
        return resultRow;
    }
View Full Code Here

        }
        return result;
    }

    public Row mapData(Row localRow) {
        Row mappedData = new Row();
        for (Map.Entry<String, Object> entry : localRow.entrySet()) {
            String sfdcName = getMapping(entry.getKey());
            if (StringUtils.hasText(sfdcName)) {
                mappedData.put(sfdcName, entry.getValue());
            } else {
                logger.info("Mapping for field " + entry.getKey() + " will be ignored since destination column is empty");
            }
        }
        mapConstants(mappedData);
View Full Code Here

        }

        // have to do this because although saveResult and deleteResult
        // are a) not the same class yet b) not subclassed
        for (int i = 0; i < results.length; i++) {
            Row dataRow = dataArray.get(i);
            String statusMsg = null;
            if (results instanceof SaveResult[]) {
                SaveResult saveRes = (SaveResult)results[i];
                if (saveRes.getSuccess()) {
                    if (OperationInfo.insert == getConfig().getOperationInfo()) {
                        statusMsg = Messages.getString("DAOLoadVisitor.statusItemCreated");
                    } else {
                        statusMsg = Messages.getString("DAOLoadVisitor.statusItemUpdated");
                    }
                }
                dataRow.put(Config.STATUS_COLUMN_NAME, statusMsg);
                processResult(dataRow, saveRes.getSuccess(), saveRes.getId(), saveRes.getErrors());
            } else if (results instanceof DeleteResult[]) {
                DeleteResult deleteRes = (DeleteResult)results[i];
                if (deleteRes.getSuccess()) {
                    statusMsg = Messages.getString("DAOLoadVisitor.statusItemDeleted");
                }
                dataRow.put(Config.STATUS_COLUMN_NAME, statusMsg);
                processResult(dataRow, deleteRes.getSuccess(), deleteRes.getId(), deleteRes.getErrors());
            } else if (results instanceof UpsertResult[]) {
                UpsertResult upsertRes = (UpsertResult)results[i];
                if (upsertRes.getSuccess()) {
                    statusMsg = upsertRes.getCreated() ? Messages.getString("DAOLoadVisitor.statusItemCreated")
                            : Messages.getString("DAOLoadVisitor.statusItemUpdated");
                }
                dataRow.put(Config.STATUS_COLUMN_NAME, statusMsg);
                processResult(dataRow, upsertRes.getSuccess(), upsertRes.getId(), upsertRes.getErrors());
            }
        }
    }
View Full Code Here

    private static final String CONSTANT_VALUE = "constantValue123";
    private Row sourceRow;

    @Before
    public void setUp() throws Exception {
        sourceRow = new Row();
        // populate all the available values
        for (int i = 0; i < SOURCE_NAMES.length; i++) {
            sourceRow.put(SOURCE_NAMES[i], SOURCE_VALUES[i]);
        }
    }
View Full Code Here

        final String value = wrappedConstantValue;
        mappings.setProperty(value, "Name, field1__c,field2__c,   field3__c,\n\tfield4__c");
        mappings.setProperty("", "Value6");
        LoadMapper mapper = new LoadMapper(null, null, null);
        mapper.putPropertyFileMappings(mappings);
        Row result = mapper.mapData(Row.emptyRow());
        assertEquals(constantValue, result.get("Name"));
        assertEquals(constantValue, result.get("field1__c"));
        assertEquals(constantValue, result.get("field2__c"));
        assertEquals(constantValue, result.get("field3__c"));
        assertEquals(constantValue, result.get("field4__c"));
    }
View Full Code Here

        mappings.setProperty(wrappedConstantValue, sfdcField);
        LoadMapper mapper = new LoadMapper(null, null, null);
        mapper.putPropertyFileMappings(mappings);

        //place a dao column -> sfdc field mapping
        Row input = Row.singleEntryImmutableRow(csvFieldName, sfdcField);

        //(src, dest).
        mapper.putMapping(csvFieldName, sfdcField);
        Map<String, Object> result = mapper.mapData(input);
View Full Code Here

        //place a constant mapping into the LoadMapper.
        mappings.setProperty(wrappedConstantValue, sfdcField);
        mapper.putPropertyFileMappings(mappings);

        Row input = Row.singleEntryImmutableRow(constantValue, sfdcField);

        Map<String, Object> result = mapper.mapData(input);

        //verify that the old value holds
        assertEquals(constantValue, result.get(sfdcField));
View Full Code Here

TOP

Related Classes of com.salesforce.dataloader.model.Row

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.