Package com.salesforce.dataloader.config

Examples of com.salesforce.dataloader.config.Config


     */

    @Override
    public LoadPage getNextPage() {
        //attempt to login
        Config config = controller.getConfig();
        //get entity
        IStructuredSelection selection = (IStructuredSelection)lv.getSelection();
        DescribeGlobalSObjectResult entity = (DescribeGlobalSObjectResult)selection.getFirstElement();

        config.setValue(Config.ENTITY, entity.getName());
        // set DAO - CSV file name
        config.setValue(Config.DAO_NAME, csvChooser.getStringValue());
        // set DAO type to CSV
        config.setValue(Config.DAO_TYPE, DataAccessObjectFactory.CSV_READ_TYPE);
        controller.saveConfig();

        DataSelectionDialog dlg = new DataSelectionDialog(getShell(), controller);
        if (dlg.open()) {
            return super.getNextPage();
View Full Code Here


        assertTrue(client.getClient().getDisableFeedTrackingHeader().isDisableFeedTracking());
    }

    @Test
    public void testPartnerClientNoUserName() throws ConnectionException {
        Config config = getController().getConfig();
        String origUserName = config.getString(Config.USERNAME);
        try {
            config.setValue(Config.USERNAME, "");
            PartnerClient client = new PartnerClient(getController());
            boolean connect = client.connect();
            assertFalse("Should not connect with empty username", connect);
        } catch (RuntimeException e) {
            //make sure we get the right error message that mentions the username
            assertTrue(e.getMessage().contains(Config.USERNAME));
        } finally {
            config.setValue(Config.USERNAME, origUserName);
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testPartnerClientSfdcInternalSessionIdConnect() throws Exception {
        Config config = getController().getConfig();

        final String origUsername = config.getString(Config.USERNAME);
        final String origPassword = config.getString(Config.PASSWORD);
        final String origEndpoint = config.getString(Config.ENDPOINT);

        //login normally just to get sessionId and endpoint
        PartnerClient setupOnlyClient = new PartnerClient(getController());
        setupOnlyClient.connect();
        final String sessionId = setupOnlyClient.getSessionId();
        final String endpoint = setupOnlyClient.getSession().getServer();
        setupOnlyClient.disconnect();

        try {
            config.setValue(Config.USERNAME, "");
            config.setValue(Config.PASSWORD, "");

            config.setValue(Config.SFDC_INTERNAL, true);
            config.setValue(Config.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true);
            config.setValue(Config.ENDPOINT, endpoint);
            config.setValue(Config.SFDC_INTERNAL_SESSION_ID, sessionId);

            PartnerClient client = new PartnerClient(getController());
            assertTrue(client.connect());
        } finally {
            config.setValue(Config.USERNAME, origUsername);
            config.setValue(Config.PASSWORD, origPassword);
            config.setValue(Config.ENDPOINT, origEndpoint);
            config.setValue(Config.SFDC_INTERNAL, false);
            config.setValue(Config.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false);
            config.setValue(Config.SFDC_INTERNAL_SESSION_ID, "");
        }
    }
View Full Code Here

        }

        this.baseName = baseProcessName;
        Controller theController = runProcess(argMap, 1);

        Config config = theController.getConfig();
        String lastRunFilePath = config.getLastRunFilename();
        File lastRunFile = new File(lastRunFilePath);
        try {
            String defaultFileName = baseProcessName + "_lastRun.properties";
            File expectedFile = useDefault ? new File(config.constructConfigFilePath(defaultFileName)) : new File(
                    outputDir, defaultFileName);
            if (enableOutput) {
                assertTrue("Could not find last run file: " + lastRunFilePath, lastRunFile.exists());
                assertEquals("Did not get expected last run file.", expectedFile, lastRunFile);
            } else {
View Full Code Here

        }
    }

    @Test
    public void testPartnerClientSfdcInternalSessionIdWithoutSfdcInternalConnect() throws Exception {
        Config config = getController().getConfig();

        final String origUsername = config.getString(Config.USERNAME);
        final String origPassword = config.getString(Config.PASSWORD);
        final String origEndpoint = config.getString(Config.ENDPOINT);

        //login normally just to get sessionId and endpoint
        PartnerClient setupOnlyClient = new PartnerClient(getController());
        setupOnlyClient.connect();
        final String sessionId = setupOnlyClient.getSessionId();
        final String endpoint = setupOnlyClient.getSession().getServer();
        setupOnlyClient.disconnect();

        try {
            config.setValue(Config.USERNAME, "");
            config.setValue(Config.PASSWORD, "");

            config.setValue(Config.SFDC_INTERNAL, false);
            config.setValue(Config.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true);
            config.setValue(Config.ENDPOINT, endpoint);
            config.setValue(Config.SFDC_INTERNAL_SESSION_ID, sessionId);

            PartnerClient client = new PartnerClient(getController());
            client.connect();
            Assert.fail("Should not be able to connect with sfdcInternal=false and no username.");
        } catch (IllegalStateException e) {
            assertEquals(
                    "Wrong error messsage",
                    "Empty salesforce.com username specified.  Please make sure that parameter sfdc.username is set to correct username.",
                    e.getMessage());
        } finally {
            config.setValue(Config.USERNAME, origUsername);
            config.setValue(Config.PASSWORD, origPassword);
            config.setValue(Config.ENDPOINT, origEndpoint);
            config.setValue(Config.SFDC_INTERNAL, false);
            config.setValue(Config.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false);
            config.setValue(Config.SFDC_INTERNAL_SESSION_ID, "");
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testIsSessionValidAlwaysTrueForSessionIdLogin() throws Exception {
        Config config = getController().getConfig();

        try {
            config.setValue(Config.SFDC_INTERNAL, true);
            config.setValue(Config.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, true);

            PartnerClient client = new PartnerClient(getController());
            assertTrue(client.isSessionValid());
        } finally {
            config.setValue(Config.SFDC_INTERNAL, false);
            config.setValue(Config.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, false);
        }
    }
View Full Code Here

    @Override
    public void createControl(Composite parent) {
        getShell().setImage(UIUtils.getImageRegistry().get("sfdc_icon")); //$NON-NLS-1$

        Config config = controller.getConfig();

        Composite comp = new Composite(parent, SWT.NONE);

        GridLayout gridLayout = new GridLayout();
        gridLayout.numColumns = 3;
        gridLayout.marginHeight = 30;
        comp.setLayout(gridLayout);

        Label labelUsername = new Label(comp, SWT.RIGHT);
        labelUsername.setText(Labels.getString("SettingsPage.username")); //$NON-NLS-1$

        textUsername = new Text(comp, SWT.BORDER);
        textUsername.setText(config.getString(Config.USERNAME));
        GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
        data.widthHint = 150;
        textUsername.setLayoutData(data);

        Composite composite2 = new Composite(comp, SWT.NONE);
        data = new GridData();
        data.verticalSpan = 2;
        composite2.setLayoutData(data);

        Label labelPassword = new Label(comp, SWT.RIGHT);
        labelPassword.setText(Labels.getString("SettingsPage.password")); //$NON-NLS-1$

        textPassword = new Text(comp, SWT.BORDER | SWT.PASSWORD);
        // don't want to cache the password
        config.setValue(Config.PASSWORD, ""); //$NON-NLS-1$
        textPassword.setText(config.getString(Config.PASSWORD));

        data = new GridData(SWT.FILL, SWT.CENTER, true, false);
        data.widthHint = 150;
        textPassword.setLayoutData(data);

        if(config.getBoolean(Config.SFDC_INTERNAL)) {
            //spacer
            Label spacer = new Label(comp, SWT.NONE);
            data = new GridData();
            data.horizontalSpan = 3;
            data.widthHint = 15;
            spacer.setLayoutData(data);

            //lIsSessionLogin checkbox
            Label labelIsSessionIdLogin = new Label(comp, SWT.RIGHT);
            labelIsSessionIdLogin.setText(Labels.getString("SettingsPage.isSessionIdLogin")); //$NON-NLS-1$

            isSessionIdLogin = new Button(comp, SWT.CHECK);
            isSessionIdLogin.setSelection(config.getBoolean(Config.SFDC_INTERNAL_IS_SESSION_ID_LOGIN));
            data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
            data.horizontalSpan = 2;
            isSessionIdLogin.setLayoutData(data);
            isSessionIdLogin.addSelectionListener(new SelectionAdapter(){
                @Override
                public void widgetSelected(SelectionEvent event) {
                    reconcileLoginCredentialFieldsEnablement();
                }
            });

            //sessionId
            Label labelSessionId = new Label(comp, SWT.RIGHT);
            labelSessionId.setText(Labels.getString("SettingsPage.sessionId")); //$NON-NLS-1$

            textSessionId = new Text(comp, SWT.BORDER);
            textSessionId.setText(config.getString(Config.SFDC_INTERNAL_SESSION_ID));
            data = new GridData(SWT.FILL, SWT.CENTER, true, false);
            data.widthHint = 150;
            textSessionId.setLayoutData(data);

            // consume the 2 cells to the right of textSessionId & textEndpoint
            composite2 = new Composite(comp, SWT.NONE);
            data = new GridData();
            data.verticalSpan = 2;
            composite2.setLayoutData(data);

            //endpoint
            Label labelEndpoint = new Label(comp, SWT.RIGHT);
            labelEndpoint.setText(Labels.getString("SettingsPage.instServerUrl")); //$NON-NLS-1$

            textEndpoint = new Text(comp, SWT.BORDER);
            textEndpoint.setText(config.getString(Config.ENDPOINT));
            data = new GridData(SWT.FILL, SWT.CENTER, true, false);
            data.widthHint = 150;
            textEndpoint.setLayoutData(data);

            reconcileLoginCredentialFieldsEnablement();
View Full Code Here

    // non-static since it needs access to SettingsPage member variables
    private class LoginButtonSelectionListener extends SelectionAdapter {
        @Override
        public void widgetSelected(SelectionEvent event) {
            Config config = controller.getConfig();
            config.setValue(Config.USERNAME, textUsername.getText());
            config.setValue(Config.PASSWORD, textPassword.getText());

            if(config.getBoolean(Config.SFDC_INTERNAL)) {
                config.setValue(Config.SFDC_INTERNAL_IS_SESSION_ID_LOGIN, isSessionIdLogin.getSelection());
                config.setValue(Config.SFDC_INTERNAL_SESSION_ID, textSessionId.getText());
                config.setValue(Config.ENDPOINT, textEndpoint.getText());
            }

            controller.saveConfig();

            loginLabel.setText(Labels.getString("SettingsPage.verifyingLogin")); //$NON-NLS-1$
View Full Code Here

     * @param shell
     *            the dialog window
     */
    private void createContents(final Shell shell) {

        final Config config = controller.getConfig();

        // Create the ScrolledComposite to scroll horizontally and vertically
        ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);

        // Create the parent Composite container for the three child containers
        Composite container = new Composite(sc, SWT.NONE);
        GridLayout containerLayout = new GridLayout(1, false);
        container.setLayout(containerLayout);
        shell.setLayout(new FillLayout());

        GridData data;
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = 50;
        data.widthHint = 400;

        // START TOP COMPONENT

        Composite topComp = new Composite(container, SWT.NONE);
        GridLayout layout = new GridLayout(1, false);
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.verticalSpacing = 0;
        topComp.setLayout(layout);
        topComp.setLayoutData(data);

        Label blank = new Label(topComp, SWT.NONE);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = 10;
        blank.setLayoutData(data);
        blank.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

        // Show the message
        Label label = new Label(topComp, SWT.NONE);
        label.setText(message);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = 30;
        data.widthHint = 370;

        Font f = label.getFont();
        FontData[] farr = f.getFontData();
        FontData fd = farr[0];
        fd.setStyle(SWT.BOLD);
        label.setFont(new Font(Display.getCurrent(), fd));

        label.setLayoutData(data);
        label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

        Label labelSeparator = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
        data = new GridData(GridData.FILL_HORIZONTAL);
        labelSeparator.setLayoutData(data);

        // END TOP COMPONENT

        // START MIDDLE COMPONENT

        Composite restComp = new Composite(container, SWT.NONE);
        data = new GridData(GridData.FILL_BOTH);
        restComp.setLayoutData(data);
        layout = new GridLayout(2, false);
        layout.verticalSpacing = 10;
        restComp.setLayout(layout);

        //batch size
        Label labelBatch = new Label(restComp, SWT.RIGHT);
        labelBatch.setText(Labels.getString("AdvancedSettingsDialog.batchSize")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelBatch.setLayoutData(data);

        textBatch = new Text(restComp, SWT.BORDER);
        textBatch.setText(config.getString(Config.LOAD_BATCH_SIZE));
        textBatch.setTextLimit(8);
        textBatch.addVerifyListener(new VerifyListener() {
            @Override
            public void verifyText(VerifyEvent event) {
                event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character);
            }
        });
        data = new GridData();
        data.widthHint = 50;
        textBatch.setLayoutData(data);

        //insert Nulls
        Label labelNulls = new Label(restComp, SWT.RIGHT);
        labelNulls.setText(Labels.getString("AdvancedSettingsDialog.insertNulls")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelNulls.setLayoutData(data);
        buttonNulls = new Button(restComp, SWT.CHECK);
        buttonNulls.setSelection(config.getBoolean(Config.INSERT_NULLS));

        //assignment rules
        Label labelRule = new Label(restComp, SWT.RIGHT);
        labelRule.setText(Labels.getString("AdvancedSettingsDialog.assignmentRule")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelRule.setLayoutData(data);

        textRule = new Text(restComp, SWT.BORDER);
        textRule.setTextLimit(18);
        data = new GridData();
        data.widthHint = 115;
        textRule.setLayoutData(data);
        textRule.setText(config.getString(Config.ASSIGNMENT_RULE));

        //endpoint
        Label labelEndpoint = new Label(restComp, SWT.RIGHT);
        labelEndpoint.setText(Labels.getString("AdvancedSettingsDialog.serverURL")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelEndpoint.setLayoutData(data);

        textEndpoint = new Text(restComp, SWT.BORDER);
        data = new GridData();
        data.widthHint = 250;
        textEndpoint.setLayoutData(data);
        String endpoint = config.getString(Config.ENDPOINT);
        if ("".equals(endpoint)) { //$NON-NLS-1$
            endpoint = defaultServer;
        }

        textEndpoint.setText(endpoint);

        //reset url on login
        Label labelResetUrl = new Label(restComp, SWT.RIGHT);
        labelResetUrl.setText(Labels.getString("AdvancedSettingsDialog.resetUrlOnLogin")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelResetUrl.setLayoutData(data);
        buttonResetUrl = new Button(restComp, SWT.CHECK);
        buttonResetUrl.setSelection(config.getBoolean(Config.RESET_URL_ON_LOGIN));

        //insert compression
        Label labelCompression = new Label(restComp, SWT.RIGHT);
        labelCompression.setText(Labels.getString("AdvancedSettingsDialog.compression")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelCompression.setLayoutData(data);
        buttonCompression = new Button(restComp, SWT.CHECK);
        buttonCompression.setSelection(config.getBoolean(Config.NO_COMPRESSION));

        //timeout size
        Label labelTimeout = new Label(restComp, SWT.RIGHT);
        labelTimeout.setText(Labels.getString("AdvancedSettingsDialog.timeout")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelTimeout.setLayoutData(data);

        textTimeout = new Text(restComp, SWT.BORDER);
        textTimeout.setTextLimit(4);
        textTimeout.setText(config.getString(Config.TIMEOUT_SECS));
        textTimeout.addVerifyListener(new VerifyListener() {
            @Override
            public void verifyText(VerifyEvent event) {
                event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character);
            }
        });
        data = new GridData();
        data.widthHint = 30;
        textTimeout.setLayoutData(data);

        //extraction batch size
        Label labelQueryBatch = new Label(restComp, SWT.RIGHT);
        labelQueryBatch.setText(Labels.getString("ExtractionInputDialog.querySize")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelQueryBatch.setLayoutData(data);

        textQueryBatch = new Text(restComp, SWT.BORDER);
        textQueryBatch.setText(config.getString(Config.EXTRACT_REQUEST_SIZE));
        textQueryBatch.setTextLimit(4);
        textQueryBatch.addVerifyListener(new VerifyListener() {
            @Override
            public void verifyText(VerifyEvent event) {
                event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character);
            }
        });
        data = new GridData();
        data.widthHint = 30;
        textQueryBatch.setLayoutData(data);

        //enable/disable output of success file for extracts
        Label labelOutputExtractStatus = new Label(restComp, SWT.RIGHT);
        labelOutputExtractStatus.setText(Labels.getString("AdvancedSettingsDialog.outputExtractStatus")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelOutputExtractStatus.setLayoutData(data);

        buttonOutputExtractStatus = new Button(restComp, SWT.CHECK);
        buttonOutputExtractStatus.setSelection(config.getBoolean(Config.ENABLE_EXTRACT_STATUS_OUTPUT));

        //utf-8 for loading
        Label labelReadUTF8 = new Label(restComp, SWT.RIGHT);
        labelReadUTF8.setText(Labels.getString("AdvancedSettingsDialog.readUTF8")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelReadUTF8.setLayoutData(data);

        buttonReadUtf8 = new Button(restComp, SWT.CHECK);
        buttonReadUtf8.setSelection(config.getBoolean(Config.READ_UTF8));

        //utf-8 for extraction
        Label labelWriteUTF8 = new Label(restComp, SWT.RIGHT);
        labelWriteUTF8.setText(Labels.getString("AdvancedSettingsDialog.writeUTF8")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelWriteUTF8.setLayoutData(data);

        buttonWriteUtf8 = new Button(restComp, SWT.CHECK);
        buttonWriteUtf8.setSelection(config.getBoolean(Config.WRITE_UTF8));

        //European Dates
        Label labelEuropeanDates = new Label(restComp, SWT.RIGHT);
        labelEuropeanDates.setText(Labels.getString("AdvancedSettingsDialog.useEuropeanDateFormat")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelEuropeanDates.setLayoutData(data);

        buttonEuroDates = new Button(restComp, SWT.CHECK);
        buttonEuroDates.setSelection(config.getBoolean(Config.EURO_DATES));

        //Field truncation
        Label labelTruncateFields = new Label(restComp, SWT.RIGHT);
        labelTruncateFields.setText(Labels.getString("AdvancedSettingsDialog.allowFieldTruncation"));
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelTruncateFields.setLayoutData(data);

        buttonTruncateFields = new Button(restComp, SWT.CHECK);
        buttonTruncateFields.setSelection(config.getBoolean(Config.TRUNCATE_FIELDS));

        // Enable Bulk API Setting
        Label labelUseBulkApi = new Label(restComp, SWT.RIGHT);
        labelUseBulkApi.setText(Labels.getString("AdvancedSettingsDialog.useBulkApi")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelUseBulkApi.setLayoutData(data);

        boolean useBulkAPI = config.getBoolean(Config.BULK_API_ENABLED);
        buttonUseBulkApi = new Button(restComp, SWT.CHECK);
        buttonUseBulkApi.setSelection(useBulkAPI);
        buttonUseBulkApi.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                super.widgetSelected(e);
                boolean enabled = buttonUseBulkApi.getSelection();
                // update batch size when this setting changes
                int newDefaultBatchSize = controller.getConfig().getDefaultBatchSize(enabled);
                logger.info("Setting batch size to " + newDefaultBatchSize);
                textBatch.setText(String.valueOf(newDefaultBatchSize));
                // make sure the appropriate check boxes are enabled or disabled
                initBulkApiSetting(enabled);
            }
        });

        // Bulk API serial concurrency mode setting
        Label labelBulkApiSerialMode = new Label(restComp, SWT.RIGHT);
        labelBulkApiSerialMode.setText(Labels.getString("AdvancedSettingsDialog.bulkApiSerialMode")); //$NON-NLS-1$
        labelBulkApiSerialMode.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

        buttonBulkApiSerialMode = new Button(restComp, SWT.CHECK);
        buttonBulkApiSerialMode.setSelection(config.getBoolean(Config.BULK_API_SERIAL_MODE));
        buttonBulkApiSerialMode.setEnabled(useBulkAPI);

        // Bulk API serial concurrency mode setting
        Label labelBulkApiZipContent = new Label(restComp, SWT.RIGHT);
        labelBulkApiZipContent.setText(Labels.getString("AdvancedSettingsDialog.bulkApiZipContent")); //$NON-NLS-1$
        labelBulkApiZipContent.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

        buttonBulkApiZipContent = new Button(restComp, SWT.CHECK);
        buttonBulkApiZipContent.setSelection(config.getBoolean(Config.BULK_API_SERIAL_MODE));
        buttonBulkApiZipContent.setEnabled(useBulkAPI);
        // timezone
        textTimezone = createTextInput(restComp, "AdvancedSettingsDialog.timezone", Config.TIMEZONE, TimeZone.getDefault().getID(), 200);

        // proxy Host
        Label labelProxyHost = new Label(restComp, SWT.RIGHT);
        labelProxyHost.setText(Labels.getString("AdvancedSettingsDialog.proxyHost")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelProxyHost.setLayoutData(data);

        textProxyHost = new Text(restComp, SWT.BORDER);
        textProxyHost.setText(config.getString(Config.PROXY_HOST));
        data = new GridData();
        data.widthHint = 250;
        textProxyHost.setLayoutData(data);

        //Proxy Port
        Label labelProxyPort = new Label(restComp, SWT.RIGHT);
        labelProxyPort.setText(Labels.getString("AdvancedSettingsDialog.proxyPort")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelProxyPort.setLayoutData(data);

        textProxyPort = new Text(restComp, SWT.BORDER);
        textProxyPort.setText(config.getString(Config.PROXY_PORT));
        textProxyPort.setTextLimit(4);
        textProxyPort.addVerifyListener(new VerifyListener() {
            @Override
            public void verifyText(VerifyEvent event) {
                event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character);
            }
        });
        data = new GridData();
        data.widthHint = 25;
        textProxyPort.setLayoutData(data);

        //Proxy Username
        Label labelProxyUsername = new Label(restComp, SWT.RIGHT);
        labelProxyUsername.setText(Labels.getString("AdvancedSettingsDialog.proxyUser")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelProxyUsername.setLayoutData(data);

        textProxyUsername = new Text(restComp, SWT.BORDER);
        textProxyUsername.setText(config.getString(Config.PROXY_USERNAME));
        data = new GridData();
        data.widthHint = 120;
        textProxyUsername.setLayoutData(data);

        //Proxy Password
        Label labelProxyPassword = new Label(restComp, SWT.RIGHT);
        labelProxyPassword.setText(Labels.getString("AdvancedSettingsDialog.proxyPassword")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelProxyPassword.setLayoutData(data);

        textProxyPassword = new Text(restComp, SWT.BORDER | SWT.PASSWORD);
        textProxyPassword.setText(config.getString(Config.PROXY_PASSWORD));
        data = new GridData();
        data.widthHint = 120;
        textProxyPassword.setLayoutData(data);


        //proxy NTLM domain
        Label labelProxyNtlmDomain = new Label(restComp, SWT.RIGHT);
        labelProxyNtlmDomain.setText(Labels.getString("AdvancedSettingsDialog.proxyNtlmDomain")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelProxyNtlmDomain.setLayoutData(data);

        textProxyNtlmDomain = new Text(restComp, SWT.BORDER);
        textProxyNtlmDomain.setText(config.getString(Config.PROXY_NTLM_DOMAIN));
        data = new GridData();
        data.widthHint = 250;
        textProxyNtlmDomain.setLayoutData(data);

        //////////////////////////////////////////////////
        //Row to start At

        Label blankAgain = new Label(restComp, SWT.NONE);
        data = new GridData();
        data.horizontalSpan = 2;
        blankAgain.setLayoutData(data);

        //Row to start AT
        Label labelLastRow = new Label(restComp, SWT.NONE);

        String lastBatch = controller.getConfig().getString(LastRun.LAST_LOAD_BATCH_ROW);
        if (lastBatch.equals("")) { //$NON-NLS-1$
            lastBatch = "0"; //$NON-NLS-1$
        }

        labelLastRow.setText(Labels.getFormattedString("AdvancedSettingsDialog.lastBatch", lastBatch)); //$NON-NLS-1$
        data = new GridData();
        data.horizontalSpan = 2;
        labelLastRow.setLayoutData(data);

        Label labelRowToStart = new Label(restComp, SWT.RIGHT);
        labelRowToStart.setText(Labels.getString("AdvancedSettingsDialog.startRow")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelRowToStart.setLayoutData(data);

        textRowToStart = new Text(restComp, SWT.BORDER);
        textRowToStart.setText(config.getString(Config.LOAD_ROW_TO_START_AT));
        data = new GridData();
        data.widthHint = 75;
        textRowToStart.setLayoutData(data);
        textRowToStart.addVerifyListener(new VerifyListener() {
            @Override
            public void verifyText(VerifyEvent event) {
                event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character);
            }
        });

        // now that we've created all the buttons, make sure that buttons dependent on the bulk api
        // setting are enabled or disabled appropriately
        initBulkApiSetting(useBulkAPI);

        //the bottow separator
        Label labelSeparatorBottom = new Label(restComp, SWT.SEPARATOR | SWT.HORIZONTAL);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        labelSeparatorBottom.setLayoutData(data);

        //ok cancel buttons
        new Label(restComp, SWT.NONE);

        // END MIDDLE COMPONENT

        // START BOTTOM COMPONENT

        Composite buttonComp = new Composite(restComp, SWT.NONE);
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        buttonComp.setLayoutData(data);
        buttonComp.setLayout(new GridLayout(2, false));

        // Create the OK button and add a handler
        // so that pressing it will set input
        // to the entered value
        Button ok = new Button(buttonComp, SWT.PUSH);
        ok.setText(Labels.getString("UI.ok")); //$NON-NLS-1$
        ok.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent event) {
                Config config = controller.getConfig();

                //set the configValues
                config.setValue(Config.INSERT_NULLS, buttonNulls.getSelection());
                config.setValue(Config.LOAD_BATCH_SIZE, textBatch.getText());
                config.setValue(Config.EXTRACT_REQUEST_SIZE, textQueryBatch.getText());
                config.setValue(Config.ENDPOINT, textEndpoint.getText());
                config.setValue(Config.ASSIGNMENT_RULE, textRule.getText());
                config.setValue(Config.LOAD_ROW_TO_START_AT, textRowToStart.getText());
                config.setValue(Config.RESET_URL_ON_LOGIN, buttonResetUrl.getSelection());
                config.setValue(Config.NO_COMPRESSION, buttonCompression.getSelection());
                config.setValue(Config.TRUNCATE_FIELDS, buttonTruncateFields.getSelection());
                config.setValue(Config.TIMEOUT_SECS, textTimeout.getText());
                config.setValue(Config.ENABLE_EXTRACT_STATUS_OUTPUT, buttonOutputExtractStatus.getSelection());
                config.setValue(Config.READ_UTF8, buttonReadUtf8.getSelection());
                config.setValue(Config.WRITE_UTF8, buttonWriteUtf8.getSelection());
                config.setValue(Config.EURO_DATES, buttonEuroDates.getSelection());
                config.setValue(Config.TIMEZONE, textTimezone.getText());
                config.setValue(Config.PROXY_HOST, textProxyHost.getText());
                config.setValue(Config.PROXY_PASSWORD, textProxyPassword.getText());
                config.setValue(Config.PROXY_PORT, textProxyPort.getText());
                config.setValue(Config.PROXY_USERNAME, textProxyUsername.getText());
                config.setValue(Config.PROXY_NTLM_DOMAIN, textProxyNtlmDomain.getText());
                config.setValue(Config.BULK_API_ENABLED, buttonUseBulkApi.getSelection());
                config.setValue(Config.BULK_API_SERIAL_MODE, buttonBulkApiSerialMode.getSelection());
                config.setValue(Config.BULK_API_ZIP_CONTENT, buttonBulkApiZipContent.getSelection());

                controller.saveConfig();
                controller.logout();

                input = Labels.getString("UI.ok"); //$NON-NLS-1$
View Full Code Here

     * @param shell
     *            the dialog window
     */
    private void createContents(final Shell shell) {

        Config config = controller.getConfig();

        GridData data;
        GridLayout layout = new GridLayout(1, false);
        layout.verticalSpacing = 10;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        shell.setLayout(layout);

        data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = 50;
        data.widthHint = 400;

        Composite topComp = new Composite(shell, SWT.NONE);
        layout = new GridLayout(1, false);
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.verticalSpacing = 0;
        topComp.setLayout(layout);
        topComp.setLayoutData(data);

        Label blank = new Label(topComp, SWT.NONE);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = 10;
        blank.setLayoutData(data);
        blank.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

        // Show the message
        Label label = new Label(topComp, SWT.NONE);
        label.setText(message);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = 30;
        data.widthHint = 370;

        Font f = label.getFont();
        FontData[] farr = f.getFontData();
        FontData fd = farr[0];
        fd.setStyle(SWT.BOLD);
        label.setFont(new Font(Display.getCurrent(), fd));

        label.setLayoutData(data);
        label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

        Label labelSeparator = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
        data = new GridData(GridData.FILL_HORIZONTAL);
        labelSeparator.setLayoutData(data);

        Composite restComp = new Composite(shell, SWT.NONE);
        data = new GridData(GridData.FILL_BOTH);
        restComp.setLayoutData(data);
        layout = new GridLayout(2, false);
        layout.verticalSpacing = 10;
        restComp.setLayout(layout);

        //extraction batch size
        Label labelBatch = new Label(restComp, SWT.RIGHT);
        labelBatch.setText(Labels.getString("ExtractionInputDialog.querySize")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelBatch.setLayoutData(data);

        textBatch = new Text(restComp, SWT.BORDER);
        textBatch.setText(config.getString(Config.EXTRACT_REQUEST_SIZE));
        textBatch.setTextLimit(4);
        textBatch.addVerifyListener(new VerifyListener() {
            @Override
            public void verifyText(VerifyEvent event) {
                event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character);
            }
        });

        //endpoint
        Label labelEndpoint = new Label(restComp, SWT.RIGHT);
        labelEndpoint.setText(Labels.getString("ExtractionInputDialog.serverURL")); //$NON-NLS-1$

        textEndpoint = new Text(restComp, SWT.BORDER);
        data = new GridData();
        data.widthHint = 250;
        textEndpoint.setLayoutData(data);
        String endpoint = config.getString(Config.ENDPOINT);
        if ("".equals(endpoint)) { //$NON-NLS-1$
            endpoint = Connector.END_POINT;
        }
        textEndpoint.setText(endpoint);

        Label labelCompression = new Label(restComp, SWT.RIGHT);
        labelCompression.setText(Labels.getString("ExtractionInputDialog.compression")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelCompression.setLayoutData(data);
        buttonCompression = new Button(restComp, SWT.CHECK);
        buttonCompression.setSelection(config.getBoolean(Config.NO_COMPRESSION));

        //timeout size
        Label labelTimeout = new Label(restComp, SWT.RIGHT);
        labelTimeout.setText(Labels.getString("ExtractionInputDialog.timeout")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelTimeout.setLayoutData(data);

        textTimeout = new Text(restComp, SWT.BORDER);
        textTimeout.setTextLimit(4);
        textTimeout.setText(config.getString(Config.TIMEOUT_SECS));
        textTimeout.addVerifyListener(new VerifyListener() {
            @Override
            public void verifyText(VerifyEvent event) {
                event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character);
            }
        });

        //proxy Host
        Label labelProxyHost = new Label(restComp, SWT.RIGHT);
        labelProxyHost.setText(Labels.getString("ExtractionInputDialog.proxyHost")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelProxyHost.setLayoutData(data);

        textProxyHost = new Text(restComp, SWT.BORDER);
        textProxyHost.setText(config.getString(Config.PROXY_HOST));
        data = new GridData();
        data.widthHint = 250;
        textProxyHost.setLayoutData(data);

        //Proxy Port
        Label labelProxyPort = new Label(restComp, SWT.RIGHT);
        labelProxyPort.setText(Labels.getString("ExtractionInputDialog.proxyPort")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelProxyPort.setLayoutData(data);

        textProxyPort = new Text(restComp, SWT.BORDER);
        textProxyPort.setText(config.getString(Config.PROXY_PORT));
        textProxyPort.setTextLimit(4);
        textProxyPort.addVerifyListener(new VerifyListener() {
            @Override
            public void verifyText(VerifyEvent event) {
                event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character);
            }
        });
        data = new GridData();
        data.widthHint = 25;
        textProxyPort.setLayoutData(data);

        //Proxy Username
        Label labelProxyUsername = new Label(restComp, SWT.RIGHT);
        labelProxyUsername.setText(Labels.getString("ExtractionInputDialog.proxyUsername")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelProxyUsername.setLayoutData(data);

        textProxyUsername = new Text(restComp, SWT.BORDER);
        textProxyUsername.setText(config.getString(Config.PROXY_USERNAME));
        data = new GridData();
        data.widthHint = 120;
        textProxyUsername.setLayoutData(data);

        //Proxy Password
        Label labelProxyPassword = new Label(restComp, SWT.RIGHT);
        labelProxyPassword.setText(Labels.getString("ExtractionInputDialog.proxyPassword")); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        labelProxyPassword.setLayoutData(data);

        textProxyPassword = new Text(restComp, SWT.BORDER | SWT.PASSWORD);
        textProxyPassword.setText(config.getString(Config.PROXY_PASSWORD));
        data = new GridData();
        data.widthHint = 120;
        textProxyPassword.setLayoutData(data);

        Label blankAgain = new Label(restComp, SWT.NONE);
        data = new GridData();
        data.horizontalSpan = 2;
        blankAgain.setLayoutData(data);

        //the bottow separator
        Label labelSeparatorBottom = new Label(restComp, SWT.SEPARATOR | SWT.HORIZONTAL);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.horizontalSpan = 2;
        labelSeparatorBottom.setLayoutData(data);

        //ok cancel buttons
        new Label(restComp, SWT.NONE);

        Composite buttonComp = new Composite(restComp, SWT.NONE);
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        buttonComp.setLayoutData(data);
        buttonComp.setLayout(new GridLayout(2, false));

        // Create the OK button and add a handler
        // so that pressing it will set input
        // to the entered value
        Button ok = new Button(buttonComp, SWT.PUSH);
        ok.setText(Labels.getString("UI.ok")); //$NON-NLS-1$
        ok.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent event) {
                Config config = controller.getConfig();

                //set the configValues
                config.setValue(Config.EXTRACT_REQUEST_SIZE, textBatch.getText());
                config.setValue(Config.ENDPOINT, textEndpoint.getText());
                config.setValue(Config.TIMEOUT_SECS, textTimeout.getText());
                config.setValue(Config.NO_COMPRESSION, buttonCompression.getSelection());
                config.setValue(Config.PROXY_HOST, textProxyHost.getText());
                config.setValue(Config.PROXY_PASSWORD, textProxyPassword.getText());
                config.setValue(Config.PROXY_PORT, textProxyPort.getText());
                config.setValue(Config.PROXY_USERNAME, textProxyUsername.getText());

                controller.saveConfig();

                input = "OK"; //$NON-NLS-1$
                shell.close();
View Full Code Here

TOP

Related Classes of com.salesforce.dataloader.config.Config

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.