Package com.sforce.soap.partner

Examples of com.sforce.soap.partner.Field


        DescribeSObjectResult forceFields = client.describeSObject("account");
        Field[] fields = forceFields.getFields();
        assertNotNull(fields);
        boolean hasName = false;
        for (Field field : fields) {
            Field f = field;
            if (f.getName().equals("Name")) {
                hasName = true;
            }
        }
        assertTrue("Account Name not found ", hasName);
    }
View Full Code Here


     */
    private Field[] addRelatedFields(Field[] fields) {
        List<Field> relatedFieldList = new LinkedList<Field>();
        for(Entry<String,Field> relatedFieldInfo : relatedFields.entrySet()) {
            String relationshipName = relatedFieldInfo.getKey();
            Field relatedField = relatedFieldInfo.getValue();
            String mapFieldName = ObjectField.formatAsString(relationshipName, relatedField.getName());
            Field mapField = new Field();
            mapField.setName(mapFieldName);
            mapField.setLabel(relationshipName + " " + relatedField.getLabel());
            mapField.setType(FieldType.reference);
            mapField.setCreateable(relatedField.isCreateable());
            mapField.setUpdateable(relatedField.isUpdateable());
            relatedFieldList.add(mapField);
        }
        relatedFieldList.addAll(Arrays.asList(fields));
        return relatedFieldList.toArray(fields);
    }
View Full Code Here

            if (event.detail == DND.DROP_MOVE) {
                IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
                Field[] fields = (Field[])viewer.getInput();
                ArrayList<Field> fieldList = new ArrayList<Field>(Arrays.asList(fields));
                for (Iterator it = selection.iterator(); it.hasNext();) {
                    Field eventField = (Field)it.next();
                    fieldList.remove(eventField);
                }

                Field[] newFields = fieldList.toArray(new Field[fieldList.size()]);
                dlg.setFields(newFields);
View Full Code Here

     */
    @Override
    public void dragSetData(DragSourceEvent event) {
        try {
            IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
            Field field = (Field)selection.getFirstElement();

            if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
                event.data = field.getName();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

     * @param arg1 the column
     * @return String
     */
    @Override
    public String getColumnText(Object arg0, int arg1) {
        Field field = (Field) arg0;
        String text = "";
        switch (arg1) {
        case MappingDialog.FIELD_NAME:
            text = field.getName();
            break;
        case MappingDialog.FIELD_LABEL:
            text = field.getLabel();
            break;
        case MappingDialog.FIELD_TYPE:
            text = field.getType().toString();
            break;
        }
        return text;
    }
View Full Code Here

     * Compares the object for sorting
     */
    @Override
    public int compare(Viewer viewer, Object e1, Object e2) {
        int rc = 0;
        Field f1 = (Field)e1;
        Field f2 = (Field)e2;

        // Determine which column and do the appropriate sort
        switch (column) {
        case MappingDialog.FIELD_LABEL:
            rc = collator.compare(f1.getLabel(), f2.getLabel());
            break;
        case MappingDialog.FIELD_NAME:
            rc = collator.compare(f1.getName(), f2.getName());
            break;
        case MappingDialog.FIELD_TYPE:
            rc = collator.compare(f1.getType().toString(), f2.getType().toString());
            break;
        }


        // If descending order, flip the direction
View Full Code Here

            } else {
                result = fields;
            }
        } else {
            Field[] idFields = new Field[1];
            Field idField = new Field();
            idField.setName("Id");
            idField.setLabel("Id");
            idField.setType(FieldType.id);
            idFields[0] = idField;
            result = idFields;
        }
        return result;
    }
View Full Code Here

    private void autoMatchFields() {

        LinkedList<Field> fieldList = new LinkedList<Field>(Arrays.asList(fields));
        //first match on name, then label
        ListIterator<Field> iterator = fieldList.listIterator();
        Field field;
        while (iterator.hasNext()) {
            field = iterator.next();
            String fieldName = field.getName();
            String fieldLabel = field.getLabel();
            String mappingSource = null;

            // field is already mapped
            // TODO: check with lexi if this is intended use of automatch
            if(mappedFields.contains(fieldName)) {
View Full Code Here

        }
    }

    public void replenishField(String fieldName) {
        //find the Field object to add to the current list.
        Field field;
        for (int i = 0; i < allFields.length; i++) {
            field = allFields[i];
            if (field.getName().equals(fieldName)) {
                ArrayList<Field> fieldArray = new ArrayList<Field>(Arrays.asList(fields));

                //else add the field
                fieldArray.add(field);
                fields = fieldArray.toArray(new Field[fieldArray.size()]);
View Full Code Here

     */
    private void updateSforce() {

        ArrayList<Field> mappableFieldList = new ArrayList<Field>();
        ArrayList<Field> allFieldList = new ArrayList<Field>();
        Field field;
        OperationInfo operation = controller.getConfig().getOperationInfo();
        for (int i = 0; i < sforceFieldInfo.length; i++) {

            field = sforceFieldInfo[i];
            boolean isMappable = false;
            switch (operation) {
            case insert:
                if (field.isCreateable()) {
                    isMappable = true;
                }
                break;
            case delete:
            case hard_delete:
                if (field.getType().toString().toLowerCase().equals("id")) {
                    isMappable = true;
                }
                break;
            case upsert:
                if (field.isUpdateable() || field.isCreateable()
                        || field.getType().toString().toLowerCase().equals("id")) {
                    isMappable = true;
                }
                break;
            case update:
                if (field.isUpdateable() || field.getType().toString().toLowerCase().equals("id")) {
                    isMappable = true;
                }
                break;
            default:
                throw new UnsupportedOperationException();
            }
            // only add the field to mappings if it's not already used in mapping
            if(isMappable) {
                if(!mappedFields.contains(field.getName())) {
                    mappableFieldList.add(field);
                }
                // this list is for all fields in case map is reset
                allFieldList.add(field);
            }
View Full Code Here

TOP

Related Classes of com.sforce.soap.partner.Field

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.