@Test public void testParseDescribe() throws Exception { Map<String, Object> testable = ForceAttributeUtilsTest.openTestable("/services/data/v23.0/sobjects/User/describe/GET.json"); SchemaBuilder schemaBuilder = new SchemaBuilder(SalesforceConnector.class); ForceAttributeUtils.parseDescribe(testable, schemaBuilder); Schema schema = schemaBuilder.build(); Assert.assertNotNull(schema.findObjectClassInfo("__ACCOUNT__")); }
public static void parseDescribe(Map describe, SchemaBuilder schemaBuilder) { Object name = describe.get("name"); ObjectClassInfoBuilder ocBuilder = new ObjectClassInfoBuilder(); if (name instanceof String) { if ("User".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.ACCOUNT_NAME); } else if ("Group".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.GROUP_NAME); } else { ocBuilder.setType((String) name); } ocBuilder.addAttributeInfo(Name.INFO); } else { return; } Object fields = describe.get("fields"); if (fields instanceof List) { for (Map<String, Object> field : (List<Map<String, Object>>) fields) { Object fieldName = field.get("name"); if (fieldName instanceof String) { if ("Id".equalsIgnoreCase((String) fieldName)) { continue; } Object idLookup = field.get("idLookup"); if (Boolean.valueOf((Boolean) idLookup)) { continue; } AttributeInfoBuilder attributeInfoBuilder = new AttributeInfoBuilder((String) fieldName); Object updateable = field.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { attributeInfoBuilder.setUpdateable(false); } Object createable = field.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { attributeInfoBuilder.setCreateable(false); } Object nillable = field.get("nillable"); if ((nillable != null) && !Boolean.valueOf((Boolean) nillable)) { attributeInfoBuilder.setRequired(true); } ocBuilder.addAttributeInfo(attributeInfoBuilder.build()); } } } ObjectClassInfo objectClassInfo = ocBuilder.build(); schemaBuilder.defineObjectClass(objectClassInfo); Object updateable = describe.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { schemaBuilder.removeSupportedObjectClass(UpdateOp.class, objectClassInfo); } Object searchable = describe.get("searchable"); if ((searchable != null) && !Boolean.valueOf((Boolean) searchable)) { schemaBuilder.removeSupportedObjectClass(SearchOp.class, objectClassInfo); } Object createable = describe.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { schemaBuilder.removeSupportedObjectClass(CreateOp.class, objectClassInfo); } Object deletable = describe.get("deletable"); if ((deletable != null) && !Boolean.valueOf((Boolean) deletable)) { schemaBuilder.removeSupportedObjectClass(DeleteOp.class, objectClassInfo); } }
ForceAttributeUtils { public static void parseDescribe(Map describe, SchemaBuilder schemaBuilder) { Object name = describe.get("name"); ObjectClassInfoBuilder ocBuilder = new ObjectClassInfoBuilder(); if (name instanceof String) { if ("User".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.ACCOUNT_NAME); } else if ("Group".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.GROUP_NAME); } else { ocBuilder.setType((String) name); } ocBuilder.addAttributeInfo(Name.INFO); } else { return; } Object fields = describe.get("fields"); if (fields instanceof List) { for (Map<String, Object> field : (List<Map<String, Object>>) fields) { Object fieldName = field.get("name"); if (fieldName instanceof String) { if ("Id".equalsIgnoreCase((String) fieldName)) { continue; } Object idLookup = field.get("idLookup"); if (Boolean.valueOf((Boolean) idLookup)) { continue; } AttributeInfoBuilder attributeInfoBuilder = new AttributeInfoBuilder((String) fieldName); Object updateable = field.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { attributeInfoBuilder.setUpdateable(false); } Object createable = field.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { attributeInfoBuilder.setCreateable(false); } Object nillable = field.get("nillable"); if ((nillable != null) && !Boolean.valueOf((Boolean) nillable)) { attributeInfoBuilder.setRequired(true); } ocBuilder.addAttributeInfo(attributeInfoBuilder.build()); } } } ObjectClassInfo objectClassInfo = ocBuilder.build(); schemaBuilder.defineObjectClass(objectClassInfo); Object updateable = describe.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { schemaBuilder.removeSupportedObjectClass(UpdateOp.class, objectClassInfo); } Object searchable = describe.get("searchable"); if ((searchable != null) && !Boolean.valueOf((Boolean) searchable)) { schemaBuilder.removeSupportedObjectClass(SearchOp.class, objectClassInfo); } Object createable = describe.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { schemaBuilder.removeSupportedObjectClass(CreateOp.class, objectClassInfo); } Object deletable = describe.get("deletable"); if ((deletable != null) && !Boolean.valueOf((Boolean) deletable)) { schemaBuilder.removeSupportedObjectClass(DeleteOp.class, objectClassInfo); } } }
ForceAttributeUtils { public static void parseDescribe(Map describe, SchemaBuilder schemaBuilder) { Object name = describe.get("name"); ObjectClassInfoBuilder ocBuilder = new ObjectClassInfoBuilder(); if (name instanceof String) { if ("User".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.ACCOUNT_NAME); } else if ("Group".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.GROUP_NAME); } else { ocBuilder.setType((String) name); } ocBuilder.addAttributeInfo(Name.INFO); } else { return; } Object fields = describe.get("fields"); if (fields instanceof List) { for (Map<String, Object> field : (List<Map<String, Object>>) fields) { Object fieldName = field.get("name"); if (fieldName instanceof String) { if ("Id".equalsIgnoreCase((String) fieldName)) { continue; } Object idLookup = field.get("idLookup"); if (Boolean.valueOf((Boolean) idLookup)) { continue; } AttributeInfoBuilder attributeInfoBuilder = new AttributeInfoBuilder((String) fieldName); Object updateable = field.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { attributeInfoBuilder.setUpdateable(false); } Object createable = field.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { attributeInfoBuilder.setCreateable(false); } Object nillable = field.get("nillable"); if ((nillable != null) && !Boolean.valueOf((Boolean) nillable)) { attributeInfoBuilder.setRequired(true); } ocBuilder.addAttributeInfo(attributeInfoBuilder.build()); } } } ObjectClassInfo objectClassInfo = ocBuilder.build(); schemaBuilder.defineObjectClass(objectClassInfo); Object updateable = describe.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { schemaBuilder.removeSupportedObjectClass(UpdateOp.class, objectClassInfo); } Object searchable = describe.get("searchable"); if ((searchable != null) && !Boolean.valueOf((Boolean) searchable)) { schemaBuilder.removeSupportedObjectClass(SearchOp.class, objectClassInfo); } Object createable = describe.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { schemaBuilder.removeSupportedObjectClass(CreateOp.class, objectClassInfo); } Object deletable = describe.get("deletable"); if ((deletable != null) && !Boolean.valueOf((Boolean) deletable)) { schemaBuilder.removeSupportedObjectClass(DeleteOp.class, objectClassInfo); } } private  ForceAttributeUtils(); }
ForceAttributeUtils { public static void parseDescribe(Map describe, SchemaBuilder schemaBuilder) { Object name = describe.get("name"); ObjectClassInfoBuilder ocBuilder = new ObjectClassInfoBuilder(); if (name instanceof String) { if ("User".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.ACCOUNT_NAME); } else if ("Group".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.GROUP_NAME); } else { ocBuilder.setType((String) name); } ocBuilder.addAttributeInfo(Name.INFO); } else { return; } Object fields = describe.get("fields"); if (fields instanceof List) { for (Map<String, Object> field : (List<Map<String, Object>>) fields) { Object fieldName = field.get("name"); if (fieldName instanceof String) { if ("Id".equalsIgnoreCase((String) fieldName)) { continue; } Object idLookup = field.get("idLookup"); if (Boolean.valueOf((Boolean) idLookup)) { continue; } AttributeInfoBuilder attributeInfoBuilder = new AttributeInfoBuilder((String) fieldName); Object updateable = field.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { attributeInfoBuilder.setUpdateable(false); } Object createable = field.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { attributeInfoBuilder.setCreateable(false); } Object nillable = field.get("nillable"); if ((nillable != null) && !Boolean.valueOf((Boolean) nillable)) { attributeInfoBuilder.setRequired(true); } ocBuilder.addAttributeInfo(attributeInfoBuilder.build()); } } } ObjectClassInfo objectClassInfo = ocBuilder.build(); schemaBuilder.defineObjectClass(objectClassInfo); Object updateable = describe.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { schemaBuilder.removeSupportedObjectClass(UpdateOp.class, objectClassInfo); } Object searchable = describe.get("searchable"); if ((searchable != null) && !Boolean.valueOf((Boolean) searchable)) { schemaBuilder.removeSupportedObjectClass(SearchOp.class, objectClassInfo); } Object createable = describe.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { schemaBuilder.removeSupportedObjectClass(CreateOp.class, objectClassInfo); } Object deletable = describe.get("deletable"); if ((deletable != null) && !Boolean.valueOf((Boolean) deletable)) { schemaBuilder.removeSupportedObjectClass(DeleteOp.class, objectClassInfo); } } private  ForceAttributeUtils(); static void parseDescribe(Map describe, SchemaBuilder schemaBuilder); static Object getAttributeValue(Attribute data, MetaAttribute info); }
ForceAttributeUtils { public static void parseDescribe(Map describe, SchemaBuilder schemaBuilder) { Object name = describe.get("name"); ObjectClassInfoBuilder ocBuilder = new ObjectClassInfoBuilder(); if (name instanceof String) { if ("User".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.ACCOUNT_NAME); } else if ("Group".equalsIgnoreCase((String) name)) { ocBuilder.setType(ObjectClass.GROUP_NAME); } else { ocBuilder.setType((String) name); } ocBuilder.addAttributeInfo(Name.INFO); } else { return; } Object fields = describe.get("fields"); if (fields instanceof List) { for (Map<String, Object> field : (List<Map<String, Object>>) fields) { Object fieldName = field.get("name"); if (fieldName instanceof String) { if ("Id".equalsIgnoreCase((String) fieldName)) { continue; } Object idLookup = field.get("idLookup"); if (Boolean.valueOf((Boolean) idLookup)) { continue; } AttributeInfoBuilder attributeInfoBuilder = new AttributeInfoBuilder((String) fieldName); Object updateable = field.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { attributeInfoBuilder.setUpdateable(false); } Object createable = field.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { attributeInfoBuilder.setCreateable(false); } Object nillable = field.get("nillable"); if ((nillable != null) && !Boolean.valueOf((Boolean) nillable)) { attributeInfoBuilder.setRequired(true); } ocBuilder.addAttributeInfo(attributeInfoBuilder.build()); } } } ObjectClassInfo objectClassInfo = ocBuilder.build(); schemaBuilder.defineObjectClass(objectClassInfo); Object updateable = describe.get("updateable"); if ((updateable != null) && !Boolean.valueOf((Boolean) updateable)) { schemaBuilder.removeSupportedObjectClass(UpdateOp.class, objectClassInfo); } Object searchable = describe.get("searchable"); if ((searchable != null) && !Boolean.valueOf((Boolean) searchable)) { schemaBuilder.removeSupportedObjectClass(SearchOp.class, objectClassInfo); } Object createable = describe.get("createable"); if ((createable != null) && !Boolean.valueOf((Boolean) createable)) { schemaBuilder.removeSupportedObjectClass(CreateOp.class, objectClassInfo); } Object deletable = describe.get("deletable"); if ((deletable != null) && !Boolean.valueOf((Boolean) deletable)) { schemaBuilder.removeSupportedObjectClass(DeleteOp.class, objectClassInfo); } } private  ForceAttributeUtils(); static void parseDescribe(Map describe, SchemaBuilder schemaBuilder); static Object getAttributeValue(Attribute data, MetaAttribute info);  }