Java 类org.apache.camel.component.salesforce.api.dto.SObjectField 实例源码

项目:Camel    文件:CamelSalesforceMojo.java   
public String getFieldType(SObjectField field) throws MojoExecutionException {
    // check if this is a picklist
    if (isPicklist(field)) {
        // use a pick list enum, which will be created after generating the SObject class
        return enumTypeName(field.getName());
    } else if (isMultiSelectPicklist(field)) {
        // use a pick list enum array, enum will be created after generating the SObject class
        return enumTypeName(field.getName()) + "[]";
    } else {
        // map field to Java type
        final String soapType = field.getSoapType();
        final String type = LOOKUP_MAP.get(soapType.substring(soapType.indexOf(':') + 1));
        if (type == null) {
            throw new MojoExecutionException(
                    String.format("Unsupported type %s for field %s", soapType, field.getName()));
        }
        return type;
    }
}
项目:Camel    文件:CamelSalesforceMojo.java   
public List<PickListValue> getUniqueValues(SObjectField field) {
    if (field.getPicklistValues().isEmpty()) {
        return field.getPicklistValues();
    }
    final List<PickListValue> result = new ArrayList<PickListValue>();
    final Set<String> literals = new HashSet<String>();
    for (PickListValue listValue : field.getPicklistValues()) {
        final String value = listValue.getValue();
        if (!literals.contains(value)) {
            literals.add(value);
            result.add(listValue);
        }
    }
    literals.clear();
    Collections.sort(result, new Comparator<PickListValue>() {
        @Override
        public int compare(PickListValue o1, PickListValue o2) {
            return o1.getValue().compareTo(o2.getValue());
        }
    });
    return result;
}
项目:Camel    文件:CamelSalesforceMojo.java   
public boolean hasPicklists(SObjectDescription desc) {
    for (SObjectField field : desc.getFields()) {
        if (isPicklist(field)) {
            return true;
        }
    }
    return false;
}
项目:Camel    文件:CamelSalesforceMojo.java   
public boolean hasMultiSelectPicklists(SObjectDescription desc) {
    for (SObjectField field : desc.getFields()) {
        if (isMultiSelectPicklist(field)) {
            return true;
        }
    }
    return false;
}
项目:Camel    文件:CamelSalesforceMojo.java   
public boolean isBlobField(SObjectField field) {
    final String soapType = field.getSoapType();
    return BASE64BINARY.equals(soapType.substring(soapType.indexOf(':') + 1));
}
项目:Camel    文件:CamelSalesforceMojo.java   
public boolean isMultiSelectPicklist(SObjectField field) {
    return MULTIPICKLIST.equals(field.getType());
}
项目:Camel    文件:CamelSalesforceMojo.java   
public boolean isPicklist(SObjectField field) {
//            return field.getPicklistValues() != null && !field.getPicklistValues().isEmpty();
            return PICKLIST.equals(field.getType());
        }